Skip to main content

Module random

Module random 

Source
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.
SamplesParameters
Validated parameters for random sample generation.
StateParameters

Enums§

SamplesParametersError
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 Arbitrary trait with its Arbitrary::Parameters.
random_deterministic
Get random object based on Arbitrary trait with its Arbitrary::Parameters in a deterministic way.
sample
sample_deterministic
unique_integer_pairs
Generate unique pairs of integers (i, j) where i <= 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