Forward sensitivity analysis
Forward Sensitivity FSP variant specification
NumCME.AdaptiveForwardSensFspSparse
โ Typestruct AdaptiveForwardSensFspSparse <: ForwardSensCmeAlgorithm
Type to store algorithmic options for solving a Foward Sensitivity CME problem.
Fields
space_adapter
: Method to adapt state space when the current solution error exceeds tolerance.
ode_method
: An ODE solver fromDifferentialEquations.jl
to integrate the FSP-truncated problem.
See also
State space adaptation policy
NumCME.ForwardSensRStepAdapter
โ TypeSimple 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.adapt!
โ Methodadapt!(statespace::StateSpaceSparse, adapter::RStepAdapter, p::Vector{RealT}, sinks::Vector{RealT}, t::RealT, fsptol::RealT; integrator::Union{DEIntegrator, Nothing}=nothing) where {RealT <: AbstractFloat}
Adapt the state space, probability vector and sensitivity vectors based on current error recorded in the sinks
vector.
NumCME.init!
โ Methodinit!(statespace::StateSpaceSparse, adapter::RStepAdapter, p::Vector{RealT}, S::Vector{Vector{RealT}}, t::RealT, fsptol::RealT) where {RealT <: AbstractFloat}
Initialize the state space, solution vector and sensitivity indices for FSP integration.
Forward sensitivity FSP output format
NumCME.ForwardSensFspOutputSliceSparse
โ TypeForwardSensFspOutputSliceSparse
Struct to store the Forward Sensitivity FSP solution at a single time. Fields: t
, p
, S
, sinks
, dsinks
.
NumCME.ForwardSensFspOutputSparse
โ TypeForwardSensFspOutputSparse{NS,IntT<:Integer,RealT<:AbstractFloat}
Struct to store Forward Sensitivity 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 CME solution at timet[i]
.- 'S': Array of arrays of
FspVectorSparse
instances.S[j][i]
is thej
-th partial derivative ofp[i]
. sinks
: Probability mass accumulated at the sink states over time.sinks[i]
is the vector of sink state probabilities at timet[i]
.dsinks
: Partial derivatives of sink probabilties.dsinks[j][i]
is thej
-th partial derivative ofsinks[i]
.
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
solve()
method
NumCME.ForwardSensFspInitialConditionSparse
โ Typestruct ForwardSensFspInitialConditionSparse{NS, IntT<:Integer, RealT<:AbstractFloat}
Initial condition for Foward Sensitivity FSP in sparse format.
Fields
states
: List of states with nonzero initial probabilities.
p
: List of nonzero probabilities, withp[i]
being the probability of statestates[i]
.
S
: List of partial derivatives, withS[j][i]
being thej
-th partial derivative ofp[i]
.
CommonSolve.solve
โ Methodsolve(
model::CmeModelWithSensitivity,
initial_condition::ForwardSensFspInitialConditionSparse{NS, IntT<:Integer, RealT<:AbstractFloat},
tspan::Tuple{AbstractFloat, AbstractFloat},
sensfspalgorithm::AdaptiveForwardSensFspSparse;
saveat,
fsptol,
odeatol,
odertol,
verbose
) -> Any
Foward sensitivity Finite State Projection to compute the time-dependent probability distributions of a stochastic reaction network along with their partial derivatives with respect to model parameters.
Arguments
model
: Stochastic reaction network model with propensity sensitivities.initial_condition
: Initial condition.tspan
: Time span.sensfspalgorithm
: Forward Sesitivity FSP method, a combination of space adaptation strategy and the ODE method to integrate the FSP-truncated problem.saveat
: timepoints to save the intermediate solutions. If left empty, all timesteps computed by the ODE solver is saved.fsptol
: FSP error tolerance. The solver dynamically adapts the projection space so that the sum of probability mass in the truncated solution is above1.0 - fsptol
. Default: 1.0E-6.odeatol
: Absolute tolerance for the ODE solver. Default: 1.0E-10.odertol
: Relative tolerance for the ODE solver. Default: 1.0E-4.verbose
: Whether to print status when adapting state space. Default: false.
Returns
A ForwardSensFspOutputSparse
instance.
See also
FspVectorSparse
, ForwardSensFspOutputSparse
, AdaptiveForwardSensFspSparse
.
NumCME.forwardsens_initial_condition
โ Methodforwardsens_initial_condition(
states::Array{var"#s73", 1} where var"#s73"<:AbstractArray{IntT<:Integer, 1},
probabilities::Array{RealT<:AbstractFloat, 1},
sensitivity::Array{Array{RealT<:AbstractFloat, 1}, 1}
) -> ForwardSensFspInitialConditionSparse
Return a ForwardSensFspInitialConditionSparse
instance from a list of initial states states
, initial probabilities probabilities
and initial sensitivities sensitivity
.