Public API

This page lists exported symbols of CTModels.OCP.


From CTModels.OCP

is_autonomous

CTModels.OCP.is_autonomousFunction
is_autonomous(
    ocp::CTModels.OCP.PreModel
) -> Union{Nothing, Bool}

Check whether the system is autonomous.

Arguments

  • ocp::PreModel: The optimal control problem.

Returns

  • Bool: true if the system is autonomous (i.e., does not explicitly depend on time), false otherwise.

Example

julia> is_autonomous(ocp)  # returns true or false
is_autonomous(
    _::CTModels.OCP.Model{CTModels.OCP.Autonomous, <:CTModels.OCP.TimesModel}
) -> Bool

Return true for an autonomous model.

is_autonomous(
    _::CTModels.OCP.Model{CTModels.OCP.NonAutonomous, <:CTModels.OCP.TimesModel}
) -> Bool

Return false for a non-autonomous model.

time_dependence!

CTModels.OCP.time_dependence!Function
time_dependence!(ocp::CTModels.OCP.PreModel; autonomous)

Set the time dependence of the optimal control problem ocp.

Arguments

  • ocp::PreModel: The optimal control problem being defined.
  • autonomous::Bool: Indicates whether the system is autonomous (true) or time-dependent (false).

Preconditions

  • The time dependence must not have been set previously.

Behavior

This function sets the autonomous field of the model to indicate whether the system's dynamics explicitly depend on time. It can only be called once.

Errors

Throws Exceptions.PreconditionError if the time dependence has already been set.

Example

julia> ocp = PreModel(...)
julia> time_dependence!(ocp; autonomous=true)