sweetpea.sampling_strategies.uniform_combinatoric module

class sweetpea.sampling_strategies.uniform_combinatoric.UniformCombinatoricSamplingStrategy

Bases: sweetpea.sampling_strategies.base.SamplingStrategy

This strategy represents the ideal. Valid sequences are uniformly sampled via a bijection from natural numbers to valid trial sequences.

Right now, the intent is that this will only work for designs without complex windows. Once we get that far, we can think about what steps are needed to support complex windows. (Transition, etc.)

This also doesn’t quite work yet for _KInARow constraints, which represent a similar obstacle as the complex windows. However, it will still accept designs with constraints. When such designs are given, it will do rejection sampling to ensure that only valid sequences are returned. The metrics dictionary will include data pertaining to the number of samples rejected for each final sample, as well as an average. (On average, how many samples need to be generated before one is found that is satisfactory?)

static sample(block, sample_count)
Parameters
Return type

sweetpea.sampling_strategies.base.SamplingResult

class sweetpea.sampling_strategies.uniform_combinatoric.UCSolutionEnumerator(block)

Bases: object

Parameters

block (sweetpea.blocks.FullyCrossBlock) –

Return type

None

solution_count()
generate_random_sample(sample_array)
Parameters

sample_array (List[int]) –

Return type

Tuple[int, dict]

generate_sample(sequence_number)
Parameters

sequence_number (int) –

Return type

dict

generate_solution_variables()
Return type

List[int]

generate_trail_values(sequence_number)
Parameters

sequence_number (int) –

Return type

List[dict]