amici.amici.Solver¶
-
class
amici.amici.
Solver
(*args, **kwargs)[source]¶ The Solver class provides a generic interface to CVODES and IDAS solvers, individual realizations are realized in the CVodeSolver and the IDASolver class. All transient private/protected members (CVODES/IDAS memory, interface variables and status flags) are specified as mutable and not included in serialization or equality checks. No solver setting parameter should be marked mutable.
NOTE: Any changes in data members here must be propagated to copy ctor, equality operator, serialization functions in serialization.h, and amici::hdf5::readSolverSettingsFromHDF5 in hdf5.cpp.
-
__init__
(*args, **kwargs)[source] Initialize self. See help(type(self)) for accurate signature.
Methods Summary
__init__
(*args, **kwargs)Initialize self.
clone
()Clone this instance
check if ASA is being computed
check if FSA is being computed
Get the absolute tolerances for the forward problem
Returns the absolute tolerances for the backward problem for adjoint sensitivity analysis
Returns the absolute tolerances for the forward sensitivity problem
returns the absolute tolerance for the quadrature problem
returns the absolute tolerance for the steady state problem
returns the absolute tolerance for the sensitivities of the steady state problem
Reads out the CPU time needed for forward solve
Reads out the CPU time needed for backward solve
returns the internal sensitivity method
- rtype
int
Accessor order
returns the linear system multistep method
- rtype
int
returns the maximum number of solver steps for the forward problem
returns the maximum number of solver steps for the backward problem
Get a lower bound of the damping factor used in the Newton solver
Get a state of the damping factor used in the Newton solver
Get maximum number of allowed linear steps per Newton step for steady state computation
Get maximum number of allowed Newton steps for steady state computation
returns the nonlinear system solution method
Accessor netf
Accessor netfB
Accessor nnlscf
Accessor nnlscfB
Accessor nrhs
Accessor nrhsB
Accessor ns
Accessor nsB
Get if model preequilibration is enabled
Get the relative tolerances for the forward problem
Returns the relative tolerances for the adjoint sensitivity problem
Returns the relative tolerances for the forward sensitivity problem
Returns the relative tolerance for the quadrature problem
returns the relative tolerance for the steady state problem
returns the relative tolerance for the sensitivities of the steady state problem
returns the ReturnData reporting mode
Return current sensitivity method
Return current sensitivity method during preequilibration
Get sensitivity order
returns stability limit detection mode
Gets KLU / SuperLUMT state ordering mode
gett
()current solver timepoint
nplist
()number of parameters with which the solver was initialized
nquad
()number of quadratures with which the solver was initialized
nx
()number of states with which the solver was initialized
setAbsoluteTolerance
(atol)Sets the absolute tolerances for the forward problem
setAbsoluteToleranceB
(atol)Sets the absolute tolerances for the backward problem for adjoint sensitivity analysis
setAbsoluteToleranceFSA
(atol)Sets the absolute tolerances for the forward sensitivity problem
sets the absolute tolerance for the quadrature problem
sets the absolute tolerance for the steady state problem
sets the absolute tolerance for the sensitivities of the steady state problem
sets the internal sensitivity method
setInterpolationType
(interpType)sets the interpolation of the forward solution that is used for the backwards problem
sets the linear system multistep method
setLinearSolver
(linsol)- type linsol
int
setMaxSteps
(maxsteps)sets the maximum number of solver steps for the forward problem
setMaxStepsBackwardProblem
(maxsteps)sets the maximum number of solver steps for the backward problem
Set a lower bound of the damping factor in the Newton solver
setNewtonDampingFactorMode
(dampingFactorMode)Turn on/off a damping factor in the Newton method
setNewtonMaxLinearSteps
(newton_maxlinsteps)Set maximum number of allowed linear steps per Newton step for steady state computation
setNewtonMaxSteps
(newton_maxsteps)Set maximum number of allowed Newton steps for steady state computation
sets the nonlinear system solution method
setPreequilibration
(require_preequilibration)Enable/disable model preequilibration
setRelativeTolerance
(rtol)Sets the relative tolerances for the forward problem
setRelativeToleranceB
(rtol)Sets the relative tolerances for the adjoint sensitivity problem
setRelativeToleranceFSA
(rtol)Sets the relative tolerances for the forward sensitivity problem
sets the relative tolerance for the quadrature problem
sets the relative tolerance for the steady state problem
sets the relative tolerance for the sensitivities of the steady state problem
sets the ReturnData reporting mode
setSensitivityMethod
(sensi_meth)Set sensitivity method
Set sensitivity method for preequilibration
setSensitivityOrder
(sensi)Set the sensitivity order
setStabilityLimitFlag
(stldet)set stability limit detection mode
setStateOrdering
(ordering)Sets KLU / SuperLUMT state ordering mode
Disable forward sensitivity integration (used in steady state sim)
Attributes
app
AMICI context
Methods
-
clone
() → Iterable[amici.amici.Solver][source]¶ Clone this instance
- Return type
- Returns
The clone
-
getAbsoluteTolerance
() → float[source]¶ Get the absolute tolerances for the forward problem
Same tolerance is used for the backward problem if not specified differently via setAbsoluteToleranceASA.
- Return type
- Returns
absolute tolerances
-
getAbsoluteToleranceB
() → float[source]¶ Returns the absolute tolerances for the backward problem for adjoint sensitivity analysis
- Return type
- Returns
absolute tolerances
-
getAbsoluteToleranceFSA
() → float[source]¶ Returns the absolute tolerances for the forward sensitivity problem
- Return type
- Returns
absolute tolerances
-
getAbsoluteToleranceQuadratures
() → float[source]¶ returns the absolute tolerance for the quadrature problem
- Return type
- Returns
absolute tolerance
-
getAbsoluteToleranceSteadyState
() → float[source]¶ returns the absolute tolerance for the steady state problem
- Return type
- Returns
absolute tolerance
-
getAbsoluteToleranceSteadyStateSensi
() → float[source]¶ returns the absolute tolerance for the sensitivities of the steady state problem
- Return type
- Returns
absolute tolerance
-
getCpuTime
() → float[source]¶ Reads out the CPU time needed for forward solve
- Return type
- Returns
cpu_time
-
getCpuTimeB
() → float[source]¶ Reads out the CPU time needed for backward solve
- Return type
- Returns
cpu_timeB
-
getInternalSensitivityMethod
() → amici.amici.InternalSensitivityMethod[source]¶ returns the internal sensitivity method
- Return type
- Returns
internal sensitivity method
-
getInterpolationType
() → amici.amici.InterpolationType[source]¶ - Return type
- Returns
-
getLastOrder
() → amici.amici.IntVector[source]¶ Accessor order
- Return type
- Returns
order
-
getLinearMultistepMethod
() → amici.amici.LinearMultistepMethod[source]¶ returns the linear system multistep method
- Return type
- Returns
linear system multistep method
-
getLinearSolver
() → amici.amici.LinearSolver[source]¶ - Return type
- Returns
-
getMaxSteps
() → int[source]¶ returns the maximum number of solver steps for the forward problem
- Return type
- Returns
maximum number of solver steps
-
getMaxStepsBackwardProblem
() → int[source]¶ returns the maximum number of solver steps for the backward problem
- Return type
- Returns
maximum number of solver steps
-
getNewtonDampingFactorLowerBound
() → float[source]¶ Get a lower bound of the damping factor used in the Newton solver
- Return type
- Returns
-
getNewtonDampingFactorMode
() → amici.amici.NewtonDampingFactorMode[source]¶ Get a state of the damping factor used in the Newton solver
- Return type
- Returns
-
getNewtonMaxLinearSteps
() → int[source]¶ Get maximum number of allowed linear steps per Newton step for steady state computation
- Return type
- Returns
-
getNewtonMaxSteps
() → int[source]¶ Get maximum number of allowed Newton steps for steady state computation
- Return type
- Returns
-
getNonlinearSolverIteration
() → amici.amici.NonlinearSolverIteration[source]¶ returns the nonlinear system solution method
- Return type
- Returns
-
getNumErrTestFails
() → amici.amici.IntVector[source]¶ Accessor netf
- Return type
- Returns
netf
-
getNumErrTestFailsB
() → amici.amici.IntVector[source]¶ Accessor netfB
- Return type
- Returns
netfB
-
getNumNonlinSolvConvFails
() → amici.amici.IntVector[source]¶ Accessor nnlscf
- Return type
- Returns
nnlscf
-
getNumNonlinSolvConvFailsB
() → amici.amici.IntVector[source]¶ Accessor nnlscfB
- Return type
- Returns
nnlscfB
-
getNumRhsEvals
() → amici.amici.IntVector[source]¶ Accessor nrhs
- Return type
- Returns
nrhs
-
getNumRhsEvalsB
() → amici.amici.IntVector[source]¶ Accessor nrhsB
- Return type
- Returns
nrhsB
-
getNumSteps
() → amici.amici.IntVector[source]¶ Accessor ns
- Return type
- Returns
ns
-
getNumStepsB
() → amici.amici.IntVector[source]¶ Accessor nsB
- Return type
- Returns
nsB
-
getPreequilibration
() → bool[source]¶ Get if model preequilibration is enabled
- Return type
boolean
- Returns
-
getRelativeTolerance
() → float[source]¶ Get the relative tolerances for the forward problem
Same tolerance is used for the backward problem if not specified differently via setRelativeToleranceASA.
- Return type
- Returns
relative tolerances
-
getRelativeToleranceB
() → float[source]¶ Returns the relative tolerances for the adjoint sensitivity problem
- Return type
- Returns
relative tolerances
-
getRelativeToleranceFSA
() → float[source]¶ Returns the relative tolerances for the forward sensitivity problem
- Return type
- Returns
relative tolerances
-
getRelativeToleranceQuadratures
() → float[source]¶ Returns the relative tolerance for the quadrature problem
- Return type
- Returns
relative tolerance
-
getRelativeToleranceSteadyState
() → float[source]¶ returns the relative tolerance for the steady state problem
- Return type
- Returns
relative tolerance
-
getRelativeToleranceSteadyStateSensi
() → float[source]¶ returns the relative tolerance for the sensitivities of the steady state problem
- Return type
- Returns
relative tolerance
-
getReturnDataReportingMode
() → amici.amici.RDataReporting[source]¶ returns the ReturnData reporting mode
- Return type
- Returns
ReturnData reporting mode
-
getSensitivityMethod
() → amici.amici.SensitivityMethod[source]¶ Return current sensitivity method
- Return type
- Returns
method enum
-
getSensitivityMethodPreequilibration
() → amici.amici.SensitivityMethod[source]¶ Return current sensitivity method during preequilibration
- Return type
- Returns
method enum
-
getSensitivityOrder
() → amici.amici.SensitivityOrder[source]¶ Get sensitivity order
- Return type
- Returns
sensitivity order
-
getStabilityLimitFlag
() → bool[source]¶ returns stability limit detection mode
- Return type
boolean
- Returns
stldet can be false (deactivated) or true (activated)
-
getStateOrdering
() → int[source]¶ Gets KLU / SuperLUMT state ordering mode
- Return type
- Returns
State-ordering as integer according to SUNLinSolKLU::StateOrdering or SUNLinSolSuperLUMT::StateOrdering (which differ).
-
nplist
() → int[source]¶ number of parameters with which the solver was initialized
- Return type
- Returns
sx.getLength()
-
nquad
() → int[source]¶ number of quadratures with which the solver was initialized
- Return type
- Returns
xQB.getLength()
-
nx
() → int[source]¶ number of states with which the solver was initialized
- Return type
- Returns
x.getLength()
-
setAbsoluteTolerance
(atol: float) → None[source]¶ Sets the absolute tolerances for the forward problem
Same tolerance is used for the backward problem if not specified differently via setAbsoluteToleranceASA.
-
setAbsoluteToleranceB
(atol: float) → None[source]¶ Sets the absolute tolerances for the backward problem for adjoint sensitivity analysis
-
setAbsoluteToleranceFSA
(atol: float) → None[source]¶ Sets the absolute tolerances for the forward sensitivity problem
-
setAbsoluteToleranceQuadratures
(atol: float) → None[source]¶ sets the absolute tolerance for the quadrature problem
-
setAbsoluteToleranceSteadyState
(atol: float) → None[source]¶ sets the absolute tolerance for the steady state problem
-
setAbsoluteToleranceSteadyStateSensi
(atol: float) → None[source]¶ sets the absolute tolerance for the sensitivities of the steady state problem
-
setInternalSensitivityMethod
(ism: amici.amici.InternalSensitivityMethod) → None[source]¶ sets the internal sensitivity method
- Parameters
ism (
amici.amici.InternalSensitivityMethod
) – internal sensitivity method- Return type
-
setInterpolationType
(interpType: amici.amici.InterpolationType) → None[source]¶ sets the interpolation of the forward solution that is used for the backwards problem
- Parameters
interpType (
amici.amici.InterpolationType
) – interpolation type- Return type
-
setLinearMultistepMethod
(lmm: amici.amici.LinearMultistepMethod) → None[source]¶ sets the linear system multistep method
- Parameters
lmm (
amici.amici.LinearMultistepMethod
) – linear system multistep method- Return type
-
setLinearSolver
(linsol: amici.amici.LinearSolver) → None[source]¶ - Parameters
linsol (
amici.amici.LinearSolver
) –- Return type
-
setMaxSteps
(maxsteps: int) → None[source]¶ sets the maximum number of solver steps for the forward problem
-
setMaxStepsBackwardProblem
(maxsteps: int) → None[source]¶ sets the maximum number of solver steps for the backward problem
- Parameters
maxsteps (
int
) – maximum number of solver steps (non-negative number)
Notes: default behaviour (100 times the value for the forward problem) can be restored by passing maxsteps=0
- Return type
-
setNewtonDampingFactorLowerBound
(dampingFactorLowerBound: float) → None[source]¶ Set a lower bound of the damping factor in the Newton solver
-
setNewtonDampingFactorMode
(dampingFactorMode: amici.amici.NewtonDampingFactorMode) → None[source]¶ Turn on/off a damping factor in the Newton method
- Parameters
dampingFactorMode (
amici.amici.NewtonDampingFactorMode
) –- Return type
-
setNewtonMaxLinearSteps
(newton_maxlinsteps: int) → None[source]¶ Set maximum number of allowed linear steps per Newton step for steady state computation
-
setNewtonMaxSteps
(newton_maxsteps: int) → None[source]¶ Set maximum number of allowed Newton steps for steady state computation
-
setNonlinearSolverIteration
(iter: amici.amici.NonlinearSolverIteration) → None[source]¶ sets the nonlinear system solution method
- Parameters
iter (
amici.amici.NonlinearSolverIteration
) – nonlinear system solution method- Return type
-
setPreequilibration
(require_preequilibration: bool) → None[source]¶ Enable/disable model preequilibration
-
setRelativeTolerance
(rtol: float) → None[source]¶ Sets the relative tolerances for the forward problem
Same tolerance is used for the backward problem if not specified differently via setRelativeToleranceASA.
-
setRelativeToleranceB
(rtol: float) → None[source]¶ Sets the relative tolerances for the adjoint sensitivity problem
-
setRelativeToleranceFSA
(rtol: float) → None[source]¶ Sets the relative tolerances for the forward sensitivity problem
-
setRelativeToleranceQuadratures
(rtol: float) → None[source]¶ sets the relative tolerance for the quadrature problem
-
setRelativeToleranceSteadyState
(rtol: float) → None[source]¶ sets the relative tolerance for the steady state problem
-
setRelativeToleranceSteadyStateSensi
(rtol: float) → None[source]¶ sets the relative tolerance for the sensitivities of the steady state problem
-
setReturnDataReportingMode
(rdrm: amici.amici.RDataReporting) → None[source]¶ sets the ReturnData reporting mode
- Parameters
rdrm (
amici.amici.RDataReporting
) – ReturnData reporting mode- Return type
-
setSensitivityMethod
(sensi_meth: amici.amici.SensitivityMethod) → None[source]¶ Set sensitivity method
- Parameters
sensi_meth (
amici.amici.SensitivityMethod
) –- Return type
-
setSensitivityMethodPreequilibration
(sensi_meth_preeq: amici.amici.SensitivityMethod) → None[source]¶ Set sensitivity method for preequilibration
- Parameters
sensi_meth_preeq (
amici.amici.SensitivityMethod
) –- Return type
-
setSensitivityOrder
(sensi: amici.amici.SensitivityOrder) → None[source]¶ Set the sensitivity order
- Parameters
sensi (
amici.amici.SensitivityOrder
) – sensitivity order- Return type
-