Expand description
Random generation and proptest support for OMMX domain types
§Random Generation
Domain types like crate::Instance and crate::Linear can be generated randomly via
the Arbitrary trait using random and random_deterministic functions.
use ommx::{Instance, InstanceParameters, Linear, LinearParameters, random::random_deterministic};
// Linear function with random coefficients
let linear: Linear = random_deterministic(LinearParameters::new(5, 10.into()).unwrap());
// LP instance
let instance: Instance = random_deterministic(InstanceParameters::default_lp());§Proptest Support
The domain types implement the Arbitrary trait so proptest! macros can drive them
directly. This module provides the accompanying helpers (e.g. arbitrary_coefficient,
arbitrary_state) for hand-rolled property tests. See the
proptest book for details.
Structs§
- Rng
- State used when running a proptest test.
- Samples
Parameters - Validated parameters for random sample generation.
- State
Parameters
Enums§
- Samples
Parameters Error - Invalid parameter combinations for random sample generation.
Functions§
- arbitrary_
bounds - arbitrary_
coefficient - Strategy for generating arbitrary coefficients.
- arbitrary_
coefficient_ nonzero - arbitrary_
integer_ partition - Generate random partitions of a sum into n parts at least 1 each.
- arbitrary_
samples - arbitrary_
split_ ids - arbitrary_
split_ state - arbitrary_
state - arbitrary_
state_ within_ bounds - multi_
choose - nHr
- random
- Get random object based on
Arbitrarytrait with itsArbitrary::Parameters. - random_
deterministic - Get random object based on
Arbitrarytrait with itsArbitrary::Parametersin a deterministic way. - sample
- sample_
deterministic - unique_
integer_ pairs - Generate unique pairs of integers
(i, j)wherei <= j <= max_id - unique_
integers - Generate a strategy for producing a vector of unique integers within a given range
min_id..=max_id - unique_
sorted_ ids