rsr.rsr.sample_new_comp_st_to_test

rsr.rsr.sample_new_comp_st_to_test(probs, refs_mat, B=1024, max_iters=1000)[source]

Search for a component-state vector not yet covered by refs_mat.

Repeatedly draws batches of candidate events from the intersection of the complementary events of the existing references, until a boundary branch is found that is not a subset of any existing reference. This is used to obtain a new sample whose system state is unknown and should therefore be evaluated by the system function.

Parameters:
  • probs – Categorical component probabilities (n_var, n_state).

  • refs_mat – Existing reference tensor (n_refs, n_var, n_state). If empty, a single all-ones sample is returned.

  • B – Batch size per iteration.

  • max_iters – Maximum number of iterations before giving up.

Returns:

A tuple (new_sample, all_samples) where new_sample is a boundary branch not covered by the existing references, and all_samples is the full batch tensor accumulated during the search. new_sample is None if no uncovered branch was found within max_iters.