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::(read/write)SolverSettings(From/To)HDF5 in hdf5.cpp.

__init__(*args, **kwargs)[source]

Methods Summary

__init__(*args, **kwargs)

clone()

Clone this instance

computingASA()

check if ASA is being computed

computingFSA()

check if FSA is being computed

getAbsoluteTolerance()

Get the absolute tolerances for the forward problem

getAbsoluteToleranceB()

Returns the absolute tolerances for the backward problem for adjoint sensitivity analysis

getAbsoluteToleranceFSA()

Returns the absolute tolerances for the forward sensitivity problem

getAbsoluteToleranceQuadratures()

returns the absolute tolerance for the quadrature problem

getAbsoluteToleranceSteadyState()

returns the absolute tolerance for the steady state problem

getAbsoluteToleranceSteadyStateSensi()

returns the absolute tolerance for the sensitivities of the steady state problem

getCpuTime()

Reads out the CPU time needed for forward solve

getCpuTimeB()

Reads out the CPU time needed for backward solve

getInternalSensitivityMethod()

returns the internal sensitivity method

getInterpolationType()

rtype

amici.InterpolationType

getLastOrder()

Accessor order

getLinearMultistepMethod()

returns the linear system multistep method

getLinearSolver()

rtype

amici.LinearSolver

getMaxSteps()

returns the maximum number of solver steps for the forward problem

getMaxStepsBackwardProblem()

returns the maximum number of solver steps for the backward problem

getMaxTime()

Returns the maximum time allowed for integration

getNewtonDampingFactorLowerBound()

Get a lower bound of the damping factor used in the Newton solver

getNewtonDampingFactorMode()

Get a state of the damping factor used in the Newton solver

getNewtonMaxSteps()

Get maximum number of allowed Newton steps for steady state computation

getNewtonStepSteadyStateCheck()

Returns how convergence checks for steadystate computation are performed.

getNonlinearSolverIteration()

returns the nonlinear system solution method

getNumErrTestFails()

Accessor netf

getNumErrTestFailsB()

Accessor netfB

getNumNonlinSolvConvFails()

Accessor nnlscf

getNumNonlinSolvConvFailsB()

Accessor nnlscfB

getNumRhsEvals()

Accessor nrhs

getNumRhsEvalsB()

Accessor nrhsB

getNumSteps()

Accessor ns

getNumStepsB()

Accessor nsB

getRelativeTolerance()

Get the relative tolerances for the forward problem

getRelativeToleranceB()

Returns the relative tolerances for the adjoint sensitivity problem

getRelativeToleranceFSA()

Returns the relative tolerances for the forward sensitivity problem

getRelativeToleranceQuadratures()

Returns the relative tolerance for the quadrature problem

getRelativeToleranceSteadyState()

returns the relative tolerance for the steady state problem

getRelativeToleranceSteadyStateSensi()

returns the relative tolerance for the sensitivities of the steady state problem

getReturnDataReportingMode()

returns the ReturnData reporting mode

getSensiSteadyStateCheck()

Returns how convergence checks for steadystate computation are performed.

getSensitivityMethod()

Return current sensitivity method

getSensitivityMethodPreequilibration()

Return current sensitivity method during preequilibration

getSensitivityOrder()

Get sensitivity order

getStabilityLimitFlag()

returns stability limit detection mode

getStateOrdering()

Gets KLU / SuperLUMT state ordering mode

getSteadyStateSensiToleranceFactor()

returns the steady state sensitivity simulation tolerance factor.

getSteadyStateToleranceFactor()

returns the steady state simulation tolerance factor.

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

setAbsoluteToleranceQuadratures(atol)

sets the absolute tolerance for the quadrature problem

setAbsoluteToleranceSteadyState(atol)

sets the absolute tolerance for the steady state problem

setAbsoluteToleranceSteadyStateSensi(atol)

sets the absolute tolerance for the sensitivities of the steady state problem

setInternalSensitivityMethod(ism)

sets the internal sensitivity method

setInterpolationType(interpType)

sets the interpolation of the forward solution that is used for the backwards problem

setLinearMultistepMethod(lmm)

sets the linear system multistep method

setLinearSolver(linsol)

type linsol

amici.LinearSolver

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

setMaxTime(maxtime)

Set the maximum time allowed for integration

setNewtonDampingFactorLowerBound(...)

Set a lower bound of the damping factor in the Newton solver

setNewtonDampingFactorMode(dampingFactorMode)

Turn on/off a damping factor in the Newton method

setNewtonMaxSteps(newton_maxsteps)

Set maximum number of allowed Newton steps for steady state computation

setNewtonStepSteadyStateCheck(flag)

Sets how convergence checks for steadystate computation are performed.

setNonlinearSolverIteration(iter)

sets the nonlinear system solution method

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

setRelativeToleranceQuadratures(rtol)

sets the relative tolerance for the quadrature problem

setRelativeToleranceSteadyState(rtol)

sets the relative tolerance for the steady state problem

setRelativeToleranceSteadyStateSensi(rtol)

sets the relative tolerance for the sensitivities of the steady state problem

setReturnDataReportingMode(rdrm)

sets the ReturnData reporting mode

setSensiSteadyStateCheck(flag)

Sets for which variables convergence checks for steadystate computation are performed.

setSensitivityMethod(sensi_meth)

Set sensitivity method

setSensitivityMethodPreequilibration(...)

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

setSteadyStateSensiToleranceFactor(factor)

set the steady state sensitivity simulation tolerance factor.

setSteadyStateToleranceFactor(factor)

set the steady state simulation tolerance factor.

startTimer()

Start timer for tracking integration time

switchForwardSensisOff()

Disable forward sensitivity integration (used in steady state sim)

timeExceeded()

Check whether maximum integration time was exceeded

Attributes

app

AMICI context

Methods

__init__(*args, **kwargs)[source]
clone() Iterable[amici.amici.Solver][source]

Clone this instance

Return type

amici.Solver

Returns

The clone

computingASA() bool[source]

check if ASA is being computed

Return type

boolean

Returns

flag

computingFSA() bool[source]

check if FSA is being computed

Return type

boolean

Returns

flag

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

float

Returns

absolute tolerances

getAbsoluteToleranceB() float[source]

Returns the absolute tolerances for the backward problem for adjoint sensitivity analysis

Return type

float

Returns

absolute tolerances

getAbsoluteToleranceFSA() float[source]

Returns the absolute tolerances for the forward sensitivity problem

Return type

float

Returns

absolute tolerances

getAbsoluteToleranceQuadratures() float[source]

returns the absolute tolerance for the quadrature problem

Return type

float

Returns

absolute tolerance

getAbsoluteToleranceSteadyState() float[source]

returns the absolute tolerance for the steady state problem

Return type

float

Returns

absolute tolerance

getAbsoluteToleranceSteadyStateSensi() float[source]

returns the absolute tolerance for the sensitivities of the steady state problem

Return type

float

Returns

absolute tolerance

getCpuTime() float[source]

Reads out the CPU time needed for forward solve

Return type

float

Returns

cpu_time

getCpuTimeB() float[source]

Reads out the CPU time needed for backward solve

Return type

float

Returns

cpu_timeB

getInternalSensitivityMethod() amici.amici.InternalSensitivityMethod[source]

returns the internal sensitivity method

Return type

amici.InternalSensitivityMethod

Returns

internal sensitivity method

getInterpolationType() amici.amici.InterpolationType[source]
Return type

amici.InterpolationType

Returns

getLastOrder() amici.amici.IntVector[source]

Accessor order

Return type

IntVector

Returns

order

getLinearMultistepMethod() amici.amici.LinearMultistepMethod[source]

returns the linear system multistep method

Return type

amici.LinearMultistepMethod

Returns

linear system multistep method

getLinearSolver() amici.amici.LinearSolver[source]
Return type

amici.LinearSolver

Returns

getMaxSteps() int[source]

returns the maximum number of solver steps for the forward problem

Return type

int

Returns

maximum number of solver steps

getMaxStepsBackwardProblem() int[source]

returns the maximum number of solver steps for the backward problem

Return type

int

Returns

maximum number of solver steps

getMaxTime() float[source]

Returns the maximum time allowed for integration

Return type

float

Returns

Time in seconds

getNewtonDampingFactorLowerBound() float[source]

Get a lower bound of the damping factor used in the Newton solver

Return type

float

Returns

getNewtonDampingFactorMode() amici.amici.NewtonDampingFactorMode[source]

Get a state of the damping factor used in the Newton solver

Return type

amici.NewtonDampingFactorMode

Returns

getNewtonMaxSteps() int[source]

Get maximum number of allowed Newton steps for steady state computation

Return type

int

Returns

getNewtonStepSteadyStateCheck() bool[source]

Returns how convergence checks for steadystate computation are performed. If activated, convergence checks are limited to every 25 steps in the simulation solver to limit performance impact.

Return type

boolean

Returns

boolean flag indicating newton step (true) or the right hand side (false)

getNonlinearSolverIteration() amici.amici.NonlinearSolverIteration[source]

returns the nonlinear system solution method

Return type

amici.NonlinearSolverIteration

Returns

getNumErrTestFails() amici.amici.IntVector[source]

Accessor netf

Return type

IntVector

Returns

netf

getNumErrTestFailsB() amici.amici.IntVector[source]

Accessor netfB

Return type

IntVector

Returns

netfB

getNumNonlinSolvConvFails() amici.amici.IntVector[source]

Accessor nnlscf

Return type

IntVector

Returns

nnlscf

getNumNonlinSolvConvFailsB() amici.amici.IntVector[source]

Accessor nnlscfB

Return type

IntVector

Returns

nnlscfB

getNumRhsEvals() amici.amici.IntVector[source]

Accessor nrhs

Return type

IntVector

Returns

nrhs

getNumRhsEvalsB() amici.amici.IntVector[source]

Accessor nrhsB

Return type

IntVector

Returns

nrhsB

getNumSteps() amici.amici.IntVector[source]

Accessor ns

Return type

IntVector

Returns

ns

getNumStepsB() amici.amici.IntVector[source]

Accessor nsB

Return type

IntVector

Returns

nsB

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

float

Returns

relative tolerances

getRelativeToleranceB() float[source]

Returns the relative tolerances for the adjoint sensitivity problem

Return type

float

Returns

relative tolerances

getRelativeToleranceFSA() float[source]

Returns the relative tolerances for the forward sensitivity problem

Return type

float

Returns

relative tolerances

getRelativeToleranceQuadratures() float[source]

Returns the relative tolerance for the quadrature problem

Return type

float

Returns

relative tolerance

getRelativeToleranceSteadyState() float[source]

returns the relative tolerance for the steady state problem

Return type

float

Returns

relative tolerance

getRelativeToleranceSteadyStateSensi() float[source]

returns the relative tolerance for the sensitivities of the steady state problem

Return type

float

Returns

relative tolerance

getReturnDataReportingMode() amici.amici.RDataReporting[source]

returns the ReturnData reporting mode

Return type

amici.RDataReporting

Returns

ReturnData reporting mode

getSensiSteadyStateCheck() bool[source]

Returns how convergence checks for steadystate computation are performed.

Return type

boolean

Returns

boolean flag indicating state and sensitivity equations (true) or only state variables (false).

getSensitivityMethod() amici.amici.SensitivityMethod[source]

Return current sensitivity method

Return type

amici.SensitivityMethod

Returns

method enum

getSensitivityMethodPreequilibration() amici.amici.SensitivityMethod[source]

Return current sensitivity method during preequilibration

Return type

amici.SensitivityMethod

Returns

method enum

getSensitivityOrder() amici.amici.SensitivityOrder[source]

Get sensitivity order

Return type

amici.SensitivityOrder

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

int

Returns

State-ordering as integer according to SUNLinSolKLU::StateOrdering or SUNLinSolSuperLUMT::StateOrdering (which differ).

getSteadyStateSensiToleranceFactor() float[source]

returns the steady state sensitivity simulation tolerance factor.

Steady state sensitivity simulation tolerances are the product of the sensitivity simulation tolerances and this factor, unless manually set with set(Absolute/Relative)ToleranceSteadyStateSensi().

Return type

float

Returns

steady state simulation tolerance factor

getSteadyStateToleranceFactor() float[source]

returns the steady state simulation tolerance factor.

Steady state simulation tolerances are the product of the simulation tolerances and this factor, unless manually set with set(Absolute/Relative)ToleranceSteadyState().

Return type

float

Returns

steady state simulation tolerance factor

gett() float[source]

current solver timepoint

Return type

float

Returns

t

nplist() int[source]

number of parameters with which the solver was initialized

Return type

int

Returns

sx.getLength()

nquad() int[source]

number of quadratures with which the solver was initialized

Return type

int

Returns

xQB.getLength()

nx() int[source]

number of states with which the solver was initialized

Return type

int

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.

Parameters

atol (float) – absolute tolerance (non-negative number)

Return type

None

setAbsoluteToleranceB(atol: float) None[source]

Sets the absolute tolerances for the backward problem for adjoint sensitivity analysis

Parameters

atol (float) – absolute tolerance (non-negative number)

Return type

None

setAbsoluteToleranceFSA(atol: float) None[source]

Sets the absolute tolerances for the forward sensitivity problem

Parameters

atol (float) – absolute tolerance (non-negative number)

Return type

None

setAbsoluteToleranceQuadratures(atol: float) None[source]

sets the absolute tolerance for the quadrature problem

Parameters

atol (float) – absolute tolerance (non-negative number)

Return type

None

setAbsoluteToleranceSteadyState(atol: float) None[source]

sets the absolute tolerance for the steady state problem

Parameters

atol (float) – absolute tolerance (non-negative number)

Return type

None

setAbsoluteToleranceSteadyStateSensi(atol: float) None[source]

sets the absolute tolerance for the sensitivities of the steady state problem

Parameters

atol (float) – absolute tolerance (non-negative number)

Return type

None

setInternalSensitivityMethod(ism: amici.amici.InternalSensitivityMethod) None[source]

sets the internal sensitivity method

Parameters

ism (amici.amici.InternalSensitivityMethod) – internal sensitivity method

Return type

None

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

None

setLinearMultistepMethod(lmm: amici.amici.LinearMultistepMethod) None[source]

sets the linear system multistep method

Parameters

lmm (amici.amici.LinearMultistepMethod) – linear system multistep method

Return type

None

setLinearSolver(linsol: amici.amici.LinearSolver) None[source]
Parameters

linsol (amici.amici.LinearSolver) –

Return type

None

setMaxSteps(maxsteps: int) None[source]

sets the maximum number of solver steps for the forward problem

Parameters

maxsteps (int) – maximum number of solver steps (positive number)

Return type

None

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

None

setMaxTime(maxtime: float) None[source]

Set the maximum time allowed for integration

Parameters

maxtime (float) – Time in seconds

Return type

None

setNewtonDampingFactorLowerBound(dampingFactorLowerBound: float) None[source]

Set a lower bound of the damping factor in the Newton solver

Parameters

dampingFactorLowerBound (float) –

Return type

None

setNewtonDampingFactorMode(dampingFactorMode: amici.amici.NewtonDampingFactorMode) None[source]

Turn on/off a damping factor in the Newton method

Parameters

dampingFactorMode (amici.amici.NewtonDampingFactorMode) –

Return type

None

setNewtonMaxSteps(newton_maxsteps: int) None[source]

Set maximum number of allowed Newton steps for steady state computation

Parameters

newton_maxsteps (int) –

Return type

None

setNewtonStepSteadyStateCheck(flag: bool) None[source]

Sets how convergence checks for steadystate computation are performed.

Parameters

flag (bool) – boolean flag to pick newton step (true) or the right hand side (false, default)

Return type

None

setNonlinearSolverIteration(iter: amici.amici.NonlinearSolverIteration) None[source]

sets the nonlinear system solution method

Parameters

iter (amici.amici.NonlinearSolverIteration) – nonlinear system solution method

Return type

None

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.

Parameters

rtol (float) – relative tolerance (non-negative number)

Return type

None

setRelativeToleranceB(rtol: float) None[source]

Sets the relative tolerances for the adjoint sensitivity problem

Parameters

rtol (float) – relative tolerance (non-negative number)

Return type

None

setRelativeToleranceFSA(rtol: float) None[source]

Sets the relative tolerances for the forward sensitivity problem

Parameters

rtol (float) – relative tolerance (non-negative number)

Return type

None

setRelativeToleranceQuadratures(rtol: float) None[source]

sets the relative tolerance for the quadrature problem

Parameters

rtol (float) – relative tolerance (non-negative number)

Return type

None

setRelativeToleranceSteadyState(rtol: float) None[source]

sets the relative tolerance for the steady state problem

Parameters

rtol (float) – relative tolerance (non-negative number)

Return type

None

setRelativeToleranceSteadyStateSensi(rtol: float) None[source]

sets the relative tolerance for the sensitivities of the steady state problem

Parameters

rtol (float) – relative tolerance (non-negative number)

Return type

None

setReturnDataReportingMode(rdrm: amici.amici.RDataReporting) None[source]

sets the ReturnData reporting mode

Parameters

rdrm (amici.amici.RDataReporting) – ReturnData reporting mode

Return type

None

setSensiSteadyStateCheck(flag: bool) None[source]

Sets for which variables convergence checks for steadystate computation are performed.

Parameters

flag (bool) – boolean flag to pick state and sensitivity equations (true, default) or only state variables (false).

Return type

None

setSensitivityMethod(sensi_meth: amici.amici.SensitivityMethod) None[source]

Set sensitivity method

Parameters

sensi_meth (amici.amici.SensitivityMethod) –

Return type

None

setSensitivityMethodPreequilibration(sensi_meth_preeq: amici.amici.SensitivityMethod) None[source]

Set sensitivity method for preequilibration

Parameters

sensi_meth_preeq (amici.amici.SensitivityMethod) –

Return type

None

setSensitivityOrder(sensi: amici.amici.SensitivityOrder) None[source]

Set the sensitivity order

Parameters

sensi (amici.amici.SensitivityOrder) – sensitivity order

Return type

None

setStabilityLimitFlag(stldet: bool) None[source]

set stability limit detection mode

Parameters

stldet (bool) – can be false (deactivated) or true (activated)

Return type

None

setStateOrdering(ordering: int) None[source]

Sets KLU / SuperLUMT state ordering mode

This only applies when linsol is set to LinearSolver::KLU or LinearSolver::SuperLUMT. Mind the difference between SUNLinSolKLU::StateOrdering and SUNLinSolSuperLUMT::StateOrdering.

Parameters

ordering (int) – state ordering

Return type

None

setSteadyStateSensiToleranceFactor(factor: float) None[source]

set the steady state sensitivity simulation tolerance factor.

Steady state sensitivity simulation tolerances are the product of the sensitivity simulation tolerances and this factor, unless manually set with set(Absolute/Relative)ToleranceSteadyStateSensi().

Parameters

factor (float) – tolerance factor (non-negative number)

Return type

None

setSteadyStateToleranceFactor(factor: float) None[source]

set the steady state simulation tolerance factor.

Steady state simulation tolerances are the product of the simulation tolerances and this factor, unless manually set with set(Absolute/Relative)ToleranceSteadyState().

Parameters

factor (float) – tolerance factor (non-negative number)

Return type

None

startTimer() None[source]

Start timer for tracking integration time

Return type

None

switchForwardSensisOff() None[source]

Disable forward sensitivity integration (used in steady state sim)

Return type

None

timeExceeded() bool[source]

Check whether maximum integration time was exceeded

Return type

boolean

Returns

True if the maximum integration time was exceeded, false otherwise.