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

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

int

getLastOrder()

Accessor order

getLinearMultistepMethod()

returns the linear system multistep method

getLinearSolver()

rtype

int

getMaxSteps()

returns the maximum number of solver steps for the forward problem

getMaxStepsBackwardProblem()

returns the maximum number of solver steps for the backward problem

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

getNewtonMaxLinearSteps()

Get maximum number of allowed linear steps per Newton step for steady state computation

getNewtonMaxSteps()

Get maximum number of allowed Newton steps for steady state computation

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

getPreequilibration()

Get if model preequilibration is enabled

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

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

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

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

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

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

setNonlinearSolverIteration(iter)

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

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

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

switchForwardSensisOff()

Disable forward sensitivity integration (used in steady state sim)

Attributes

app

AMICI context

Methods

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

Initialize self. See help(type(self)) for accurate signature.

clone() → Iterable[amici.amici.Solver][source]

Clone this instance

Return type

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

int

Returns

internal sensitivity method

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

int

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

int

Returns

linear system multistep method

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

int

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

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

int

Returns

getNewtonMaxLinearSteps()int[source]

Get maximum number of allowed linear steps per Newton step for steady state computation

Return type

int

Returns

getNewtonMaxSteps()int[source]

Get maximum number of allowed Newton steps for steady state computation

Return type

int

Returns

getNonlinearSolverIteration()amici.amici.NonlinearSolverIteration[source]

returns the nonlinear system solution method

Return type

int

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

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

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

int

Returns

ReturnData reporting mode

getSensitivityMethod()amici.amici.SensitivityMethod[source]

Return current sensitivity method

Return type

int

Returns

method enum

getSensitivityMethodPreequilibration()amici.amici.SensitivityMethod[source]

Return current sensitivity method during preequilibration

Return type

int

Returns

method enum

getSensitivityOrder()amici.amici.SensitivityOrder[source]

Get sensitivity order

Return type

int

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).

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

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

setNewtonMaxLinearSteps(newton_maxlinsteps: int)None[source]

Set maximum number of allowed linear steps per Newton step for steady state computation

Parameters

newton_maxlinsteps (int) –

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

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

setPreequilibration(require_preequilibration: bool)None[source]

Enable/disable model preequilibration

Parameters

require_preequilibration (bool) –

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

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

switchForwardSensisOff()None[source]

Disable forward sensitivity integration (used in steady state sim)

Return type

None