Reference
Artificially centered hit-and-run sampling
CuFluxSampler.ACHR.sample — Methodsample(
m::COBREXA.MetabolicModel,
start::AbstractMatrix;
iters,
bound_stoichiometry,
check_stoichiometry,
direction_noise_max,
epsilon,
seed
)
A traditional artificially-centered hit-and-run algorithm that starts with start points.
Refer to the documentation in module AffineHR for the meaning of arguments.
Affine hit-and-run sampling
CuFluxSampler.AffineHR.sample — Methodsample(
m::COBREXA.MetabolicModel,
start::AbstractMatrix;
iters,
bound_stoichiometry,
check_stoichiometry,
direction_noise_max,
epsilon,
seed,
mix_points,
mix_mtx
)
Use the affine-combination hit-and-run algorithm to generate a sample of the feasible area of m from the set of start points supplied as columns in a matrix.
The run directions are generated from random affine combination of mix_points points (by default 3); matrices mix_mtx and permute_mtx give fine control about the mixing in the process. Preferably, this matrix is very sparse.
check_stoichiometry allows to turn on/off the filtering of generated points based on whether they are close to the steady state (with tolerance epsilon). bound_stoichiometry additionally computes run bounds based on the steady-state region, and uses it to generate better runs. This is useful in combination with direction_noise_max which may add a small noise to the generated run directions, allowing the sampler to discover new directions (potentially not obvious from warmup in start), but easily explodes without limiting the directions.
Additional bounds on run ranges are taken from model coupling constraints, if present.
If you are generating a sample of the optimal model solution, it is expected that the optimum bound is already present in m.
Returns a matrix of the same size as start.
Full-linear-combination affine hit-and-run sampling (internal)
CuFluxSampler.FullAffineHR.sample — Methodsample(
m::COBREXA.MetabolicModel,
warmup::AbstractMatrix;
npts,
iters,
bound_stoichiometry,
check_stoichiometry,
direction_noise_max,
epsilon,
seed
)
Use the full-affine-combination hit-and-run algorithm to generate a sample of the feasible area of m from the warmup points supplied as columns in a matrix. If you are generating a sample of the optimal solution, it is expected that the optimum bound is already present in m.
Returns a matrix of npts samples organized in columns.
This algorithm is mostly a toy for comparing the performance. It works, but do not use it in production.
Internal functions
TEA-based RNG
CuFluxSampler.TeaRNG — ModuleFast stateless random number generator for GPUs based on TEA cipher.
CuFluxSampler.TeaRNG.device_fill_rand! — Methoddevice_fill_rand!(arr, seed::UInt32)
CUDA.jl grid-stride kernel that fills the array with random numbers generated by tea_random. seed is used as the stream ID, global thread index in grid is used as the sequence number.
CuFluxSampler.TeaRNG.tea_random — Methodtea_random(stream::UInt32, seq::UInt32) -> UInt32
Use TEA cipher algorithm to reproducibly generate a seq-th random number from the stream-th random stream.