Time discretization

class rtctools.optimization.collocated_integrated_optimization_problem.CollocatedIntegratedOptimizationProblem(**kwargs)

Bases: rtctools.optimization.optimization_problem.OptimizationProblem

Discretizes your model using a mixed collocation/integration scheme.

Collocation means that the discretized model equations are included as constraints between state variables in the optimization problem.

Note

To ensure that your optimization problem only has globally optimal solutions, any model equations that are collocated must be linear. By default, all model equations are collocated, and linearity of the model equations is verified. Working with non-linear models is possible, but discouraged.

Variables:check_collocation_linearity – If True, check whether collocation constraints are linear. Default is True.
integrated_states

A list of states that are integrated rather than collocated.

Warning

This is an experimental feature.

integrator_options()

Configures the implicit function used for time step integration.

Returns:A dictionary of CasADi rootfinder options. See the CasADi documentation for details.
interpolation_method(variable=None)

Interpolation method for variable.

Parameters:variable – Variable name.
Returns:Interpolation method for the given variable.
theta

RTC-Tools discretizes differential equations of the form

\[\dot{x} = f(x, u)\]

using the \(\theta\)-method

\[x_{i+1} = x_i + \Delta t \left[\theta f(x_{i+1}, u_{i+1}) + (1 - \theta) f(x_i, u_i)\right]\]

The default is \(\theta = 1\), resulting in the implicit or backward Euler method. Note that in this case, the control input at the initial time step is not used.

Set \(\theta = 0\) to use the explicit or forward Euler method. Note that in this case, the control input at the final time step is not used.

Warning

This is an experimental feature for \(0 < \theta < 1\).

times(variable=None)

List of time stamps for variable.

Parameters:variable – Variable name.
Returns:A list of time stamps for the given variable.