Transient solution of the CME
FSP variant specification
NumCME.AdaptiveFspSparse
โ Typemutable struct AdaptiveFspSparse <: TransientCmeAlgorithm
Struct to store adaptive Finite State Projection algorithmic options. This type is intended to work with solve()
methods that output CME solutions as sparse vectors of type FspVectorSparse
.
Fields
ode_method
Instance of an ODE algorithm from the DifferentialEquations.jl
package.
space_adapter
Method to adapt the FSP state space when truncation error exceeds user-specified tolerance.
See also
State space adaptation policies
NumCME.RStepAdapter
โ Typestruct RStepAdapter <: AbstractSpaceAdapterSparse
Simple adapter based on reachability. Whenever the current FSP solution error is found to exceed the acceptable tolerance, the adapter will expand the state space by exploring all states that could be reached from the current state space within a set number of reaction events.
This adapter only works with StateSpaceSparse
.
NumCME.SelectiveRStepAdapter
โ Typestruct SelectiveRStepAdapter <: AbstractSpaceAdapterSparse
Adapter based on reachability. This adapter only explore new states through reaction channels with positive derivatives.
This adapter only works with StateSpaceSparse
.
NumCME.adapt!
โ Methodadapt!(
statespace::StateSpaceSparse,
adapter::SelectiveRStepAdapter,
p::Vector{var"#s68"} where var"#s68"<:AbstractFloat,
sinks::Vector{var"#s67"} where var"#s67"<:AbstractFloat,
t::AbstractFloat,
tend::AbstractFloat,
fsptol::AbstractFloat;
integrator
)
Adapt the state space and probability vector based on current error recorded in the sinks
vector.
NumCME.adapt!
โ Methodadapt!(
statespace::StateSpaceSparse,
adapter::RStepAdapter,
p::Array{RealT<:AbstractFloat, 1},
sinks::Array{RealT<:AbstractFloat, 1},
t::AbstractFloat,
tend::AbstractFloat,
fsptol::AbstractFloat;
integrator
)
Adapt the state space and probability vector based on current error recorded in the sinks
vector.
NumCME.init!
โ Methodinit!(
statespace::StateSpaceSparse,
adapter::RStepAdapter,
p::Vector{var"#s74"} where var"#s74"<:AbstractFloat,
t::AbstractFloat,
fsptol::AbstractFloat
)
Make the state space and solution vector ready for FSP integration.
NumCME.init!
โ Methodinit!(
statespace::StateSpaceSparse,
adapter::SelectiveRStepAdapter,
p::Array{RealT<:AbstractFloat, 1},
t::AbstractFloat,
fsptol::AbstractFloat
)
init!(statespace::StateSpaceSparse, adapter::SelectiveRStepAdapter, p::Vector{RealT}, t::RealT, fsptol::RealT) where {RealT <: AbstractFloat}
Make the state space and solution vector ready for FSP integration.
FSP output format
NumCME.FspOutputSliceSparse
โ Typestruct FspOutputSliceSparse
Struct to store the FSP solution at a single time. Fields: t
, p
, sinks
.
NumCME.FspOutputSparse
โ Typestruct FspOutputSparse{NS, IntT<:Integer, RealT<:AbstractFloat}
Struct to store Finite State Projection outputs based on the sparse representation of the FSP solution.
Fields
t
: Array of solution output times.p
: Array ofFspVectorSparse
instances.p[i]
is the solution at timet[i]
.sinks
: Probability mass accumulated at the sink states over time.
Usage
If sol
is of type FspOutputSparse
, sol[i]
will return a slice, of type FspOutputSliceSparse
of the solution set at the i
-th index.
See also
Base.length
โ Methodlength(fspoutput::FspOutputSparse) -> Int64
Return number of FSP solutions in the solution set.
solve()
method
CommonSolve.solve
โ Methodsolve(
model::CmeModel,
initial_distribution::FspVectorSparse{NS, IntT<:Integer, RealT<:AbstractFloat},
tspan::Tuple{AbstractFloat, AbstractFloat},
fspalgorithm::AdaptiveFspSparse;
saveat,
fsptol,
odeatol,
odertol,
verbose
) -> Any
Numerical integration for the chemical master equation using an adaptive Finite State Projection (FSP) algorithm. This method is adaptive, meaning that states will be added during the course of integration to ensure the approximation error is below the user-specified tolerance. In addition, depending on the input fspalgorithm
, the space adapter may delete states with low probabilities before expanding the state space. This ensures not only accuracy but also efficiency of the CME integration.
Arguments
model::CmeModel
Chemical Master Equation model.
initial_distribution::FspVectorSparse
Initial distribution.
tspan::Tuple{AbstractFloat, AbstractFloat}
Timespan for the integration. The first element is the starting time, the second element is the end time of the integration.
fspalgorithm::AdaptiveFspSparse
An instance of AdaptiveFspSparse
, storing information about the specific adaptive FSP method.
saveat::Vector{AbstractFloat} (optional)
Time points to store the FSP solutions at. Default is []
, which means all solutions at every timestep will be stored.
fsptol (optional)
FSP truncation error tolerance. The FSP state space is adapted so that the output solution vectors sum to greater than or equal to 1-fsptol
. Default: 1.0E-6.
odertol (optional)
Relative error tolerance for the ODE solver of the ODEs resulting from FSP truncation. Default: 1.0E-4.
odeatol (optional)
Relative error tolerance for the ODE solver of the ODEs resulting from FSP truncation. Default: 1.0E-10.
verbose (optional)
Whether to output status when updating the state space. Default: false.
Returns
An instance of FspOutputSparse
.
See also