sweetpea.core.generate.sample_non_uniform module¶
This module provides non-uniform CNF sampling functionality through the
sample_non_uniform()
function.
Note
For compatibility with older testing mechanisms, there is also the
sample_non_uniform_from_specification()
function, which takes a
ProblemSpecification
as input. The ProblemSpecification
can be generated with an appropriately formatted JSON file, which is how
inputs were given in the original Haskell version of SweetPea Core. This
function (and the associated classes) will likely be removed from SweetPea
at some point.
- sweetpea.core.generate.sample_non_uniform.sample_non_uniform(count, initial_cnf, fresh, support, generation_requests)¶
Samples solutions to a CNF problem non-uniformly. Produces
count
solutions, each with a support set of lengthsupport
.- Parameters
count (int) –
initial_cnf (sweetpea.core.cnf.CNF) –
fresh (int) –
support (int) –
generation_requests (List[sweetpea.core.generate.utility.GenerationRequest]) –
- Return type
- sweetpea.core.generate.sample_non_uniform.sample_non_uniform_from_specification(spec)¶
Samples solutions to a CNF problem non-uniformly, using a
ProblemSpecification
.Note
This function exists for easier legacy compatibility from when SweetPea’s input was given as JSON files. This should no longer be necessary.
- Parameters
spec (sweetpea.core.generate.utility.ProblemSpecification) –
- Return type