System Constructors

struct ControlSystem <: ModelingToolkit.AbstractControlSystem

A system describing an optimal control problem. This contains a loss function and ordinary differential equations with control variables that describe the dynamics.


  • loss

    The Loss function

  • eqs

    The ODEs defining the system.

  • iv

    Independent variable.

  • states

    Dependent (state) variables.

  • controls

    Control variables.

  • ps

    Parameter variables.

  • observed

  • name

    Name: the name of the system

  • systems

    systems: The internal systems

  • default_u0

    default_u0: The default initial conditions to use when initial conditions are not supplied in ODEProblem.

  • default_p

    default_p: The default parameters to use when parameters are not supplied in ODEProblem.


using ModelingToolkit

@variables t x(t) v(t) u(t)
D = Differential(t)

loss = (4-x)^2 + 2v^2 + u^2
eqs = [
    D(x) ~ v
    D(v) ~ u^3

sys = ControlSystem(loss,eqs,t,[x,v],[u],[])

Composition and Accessor Functions

  • sys.eqs or equations(sys): The equations that define the system.
  • sys.states or states(sys): The set of states in the system.
  • sys.parameters or parameters(sys): The parameters of the system.
  • sys.controls or controls(sys): The control variables of the system


                       tab = ModelingToolkit.constructRadauIIA5())

Transforms a nonlinear optimal control problem into a constrained OptimizationProblem according to a Runge-Kutta tableau that describes a collocation method. Requires a fixed dt over a given timespan. Defaults to using the 5th order RadauIIA tableau, and altnerative tableaus can be specified using the SciML tableau style.