Repository navigation
Releases: will-keen/constrainedrandom
Releases · will-keen/constrainedrandom
Release list
1.3.0
Results with the same problem and same seed may differ from 1.2.2. The entries under Changed say for which problems.
Added
- Derived variables:
add_rand_var(..., fn=..., rand_var_args=(...))computes a variable's value from other variables. randomize(with_values=...)validates the given values against domains and constraints. Passcheck_with_values=Falseto skip.RandObj.set_random(_random)sets the random generator after construction, for the object and every variable already added.
Changed
rangedomains use theirstep. Seeded results change for stepped ranges.weighted_choicereturns the chosen value rather than a single-element list.- The naive solver calls the random generator once less per attempt. Seeded results change for problems with multi-variable constraints.
- Variables are randomized in the order they were added. Seeded results change for objects whose variables were added in non-alphabetical order.
python -m testsselects tests by package-relative name, e.g.features.basic.BasicFeatures.
Fixed
- Constraining a random-length list no longer holds its length constant.
randomize(with_values=...)no longer raisesIndexErrorwhen every constrained variable is given a value.- A list given in
with_valuesis no longer overwritten when its length variable is re-randomized. functools.partialobjects and other callables are no longer rejected as constraints.- A failed
add_constraintno longer leaves the object unusable. - Using a random-length list as another variable's
rand_lengthnow raises an error. - Failure messages no longer omit debug information.
- The CSP solve order is rebuilt when a random-length list's length changes, so results no longer depend on earlier randomizations. Seeded results change for problems with random-length lists that reach the CSP solver.
Performance
- Constraints on concrete values are checked directly rather than via the
constraintpackage. 3.5x faster onldInstr, up to 7.6x on multi-variable naive solving. is_puretreats afunctools.partialof a pure function with immutable arguments as pure.
Development
- CI runs the tests on Linux, Windows and macOS and builds the docs with warnings as errors.
ruffformats and lints the code, enforced in CI.
1.2.2
Change project location to https://github.com/will-keen/constrainedrandom
For previous releases, please refer back to https://github.com/imaginationtech/constrainedrandom