Public API
This page lists exported symbols of CTModels.Models.
From CTModels.Models
AbstractModel [Abstract Type]
CTModels.Models.AbstractModel — Type
abstract type AbstractModelAbstract base type for optimal control problem models.
Subtypes represent either a fully built immutable model (Model) or a mutable model under construction (PreModel).
Model [Struct]
CTModels.Models.Model — Type
struct Model{TD<:CTModels.Components.TimeDependence, TimesModelType<:CTModels.Components.AbstractTimesModel, StateModelType<:CTModels.Components.AbstractStateModel, ControlModelType<:CTModels.Components.AbstractControlModel, VariableModelType<:CTModels.Components.AbstractVariableModel, DynamicsModelType<:Function, ObjectiveModelType<:CTModels.Components.AbstractObjectiveModel, ConstraintsModelType<:CTModels.Components.AbstractConstraintsModel, DefinitionType<:CTModels.Components.AbstractDefinition, BuildExaModelType<:Union{Nothing, Function}} <: CTModels.Models.AbstractModelImmutable optimal control problem model containing all problem components.
A Model is created from a PreModel once all required fields have been set. It is parameterised by the time dependence type (Autonomous or NonAutonomous) and the types of all its components.
Fields
times::TimesModelType: Initial and final time specification.state::StateModelType: State variable structure (name, components).control::ControlModelType: Control variable structure (name, components).variable::VariableModelType: Optimisation variable structure (may be empty).dynamics::DynamicsModelType: System dynamics function(t, x, u, v) -> ẋ.objective::ObjectiveModelType: Cost functional (Mayer, Lagrange, or Bolza).constraints::ConstraintsModelType: All problem constraints.definition::DefinitionType: Original symbolic definition of the problem.build_examodel::BuildExaModelType: Optional ExaModels builder function.
constraint [Function]
CTModels.Models.constraint — Function
constraint(
model::CTModels.Models.Model,
label::Symbol
) -> Tuple{Symbol, Any, Any, Any}
Get a labelled constraint from the model. Returns a tuple of the form (type, f, lb, ub) where type is the type of the constraint, f is the function, lb is the lower bound and ub is the upper bound.
The function returns an exception if the label is not found in the model.
Arguments
model::Model: The optimal control problem.label::Symbol: The constraint label.
Returns
Tuple: A tuple of the form(type, f, lb, ub).
See also: CTModels.Models.constraints, CTModels.Components.path_constraints_nl.
constraints [Function]
CTModels.Models.constraints — Function
constraints(
ocp::CTModels.Models.Model{<:CTModels.Components.TimeDependence, <:CTModels.Components.AbstractTimesModel, <:CTModels.Components.AbstractStateModel, <:CTModels.Components.AbstractControlModel, <:CTModels.Components.AbstractVariableModel, <:Function, <:CTModels.Components.AbstractObjectiveModel, C<:CTModels.Components.AbstractConstraintsModel}
) -> CTModels.Components.AbstractConstraintsModel
Return the constraints struct.
Arguments
ocp::Model: The optimal control problem.
Returns
C: The constraints model.
See also: CTModels.Models.isempty_constraints, CTModels.Models.constraint.
control_components [Function]
CTModels.Models.control_components — Function
control_components(
ocp::CTModels.Models.Model
) -> Vector{String}
Return the names of the components of the control.
Arguments
ocp::Model: The optimal control problem.
Returns
Vector{String}: The control component names.
See also: CTModels.Models.control, CTModels.Models.control_name, CTModels.Models.control_dimension.
control_components(
sol::CTModels.Solutions.Solution
) -> Vector{String}
Return the names of the components of the control.
Arguments
sol::Solution: The optimal control solution.
Returns
Vector{String}: The control component names.
See also: CTModels.Models.control_dimension, CTModels.Models.control_name.
control_dimension [Function]
CTModels.Models.control_dimension — Function
control_dimension(ocp::CTModels.Models.Model) -> Int64
Return the control dimension.
Arguments
ocp::Model: The optimal control problem.
Returns
Dimension: The control dimension.
See also: CTModels.Models.control, CTModels.Models.control_name, CTModels.Models.control_components.
control_dimension(sol::CTModels.Solutions.Solution) -> Int64
Return the dimension of the control.
Arguments
sol::Solution: The optimal control solution.
Returns
Dimension: The control dimension.
See also: CTModels.Models.control, CTModels.Models.control_components.
control_name [Function]
CTModels.Models.control_name — Function
control_name(ocp::CTModels.Models.Model) -> String
Return the name of the control.
Arguments
ocp::Model: The optimal control problem.
Returns
String: The control name.
See also: CTModels.Models.control, CTModels.Models.control_components, CTModels.Models.control_dimension.
control_name(sol::CTModels.Solutions.Solution) -> String
Return the name of the control.
Arguments
sol::Solution: The optimal control solution.
Returns
String: The control name.
See also: CTModels.Models.control_components, CTModels.Models.control_dimension.
definition [Function]
CTModels.Models.definition — Function
definition(
ocp::CTModels.Models.Model{<:CTModels.Components.TimeDependence, <:CTModels.Components.TimesModel, <:CTModels.Components.AbstractStateModel, <:CTModels.Components.AbstractControlModel, <:CTModels.Components.AbstractVariableModel, <:Function, <:CTModels.Components.AbstractObjectiveModel, <:CTModels.Components.AbstractConstraintsModel, D<:CTModels.Components.AbstractDefinition}
) -> CTModels.Components.AbstractDefinition
Return the model definition.
Arguments
ocp::Model: The optimal control problem.
Returns
D: The model definition.
See also: CTModels.Components.expression.
dynamics [Function]
CTModels.Models.dynamics — Function
dynamics(
ocp::CTModels.Models.Model{<:CTModels.Components.TimeDependence, <:CTModels.Components.AbstractTimesModel, <:CTModels.Components.AbstractStateModel, <:CTModels.Components.AbstractControlModel, <:CTModels.Components.AbstractVariableModel, D<:Function}
) -> Function
Return the dynamics.
Arguments
ocp::Model: The optimal control problem.
Returns
D: The dynamics function.
See also: CTModels.Models.state, CTModels.Models.control.
get_build_examodel [Function]
CTModels.Models.get_build_examodel — Function
get_build_examodel(
ocp::CTModels.Models.Model{<:CTModels.Components.TimeDependence, <:CTModels.Components.AbstractTimesModel, <:CTModels.Components.AbstractStateModel, <:CTModels.Components.AbstractControlModel, <:CTModels.Components.AbstractVariableModel, <:Function, <:CTModels.Components.AbstractObjectiveModel, <:CTModels.Components.AbstractConstraintsModel, <:CTModels.Components.AbstractDefinition, BE<:Function}
) -> Function
Return the build_examodel.
Arguments
ocp::Model: The optimal control problem with ExaModels builder.
Returns
BE: The ExaModels builder function.
See also: CTModels.Models.dynamics.
get_build_examodel(
_::CTModels.Models.Model{<:CTModels.Components.TimeDependence, <:CTModels.Components.AbstractTimesModel, <:CTModels.Components.AbstractStateModel, <:CTModels.Components.AbstractControlModel, <:CTModels.Components.AbstractVariableModel, <:Function, <:CTModels.Components.AbstractObjectiveModel, <:CTModels.Components.AbstractConstraintsModel, <:CTModels.Components.AbstractDefinition, <:Nothing}
)
Fallback: throw when no Exa builder is present.
has_abstract_definition [Function]
CTModels.Models.has_abstract_definition — Function
has_abstract_definition(ocp::CTModels.Models.Model) -> Bool
Check whether the problem has an abstract definition.
Arguments
ocp::Model: The optimal control problem.
Returns
Bool:trueif the problem has an abstract definition,falseotherwise.
See also: CTModels.Models.is_abstractly_defined, CTModels.Models.definition.
has_control [Function]
CTModels.Models.has_control — Function
has_control(ocp::CTModels.Models.Model) -> Bool
Check whether the problem has control input.
Arguments
ocp::Model: The optimal control problem.
Returns
Bool:trueif the problem has control input,falseotherwise.
See also: CTModels.Models.is_control_free.
has_variable [Function]
CTModels.Models.has_variable — Function
has_variable(ocp::CTModels.Models.Model) -> Bool
Check whether the problem has optimisation variables.
Arguments
ocp::Model: The optimal control problem.
Returns
Bool:trueif the problem has optimisation variables,falseotherwise.
See also: CTModels.Models.is_variable.
is_abstractly_defined [Function]
CTModels.Models.is_abstractly_defined — Function
is_abstractly_defined(ocp::CTModels.Models.Model) -> Bool
Check whether the problem is abstractly defined.
Arguments
ocp::Model: The optimal control problem.
Returns
Bool:trueif the problem is abstractly defined,falseotherwise.
See also: CTModels.Models.has_abstract_definition.
is_autonomous [Function]
CTModels.Models.is_autonomous — Function
is_autonomous(
_::CTModels.Models.Model{CTModels.Components.Autonomous, <:CTModels.Components.TimesModel}
) -> Bool
Return true for an autonomous model.
Arguments
::Model{Autonomous,...}: An autonomous model.
Returns
Bool:true.
See also: CTModels.Models.is_nonautonomous.
is_autonomous(
_::CTModels.Models.Model{CTModels.Components.NonAutonomous, <:CTModels.Components.TimesModel}
) -> Bool
Return false for a non-autonomous model.
Arguments
::Model{NonAutonomous,...}: A non-autonomous model.
Returns
Bool:false.
See also: CTModels.Models.is_autonomous.
is_control_free [Function]
CTModels.Models.is_control_free — Function
is_control_free(ocp::CTModels.Models.Model) -> Bool
Check whether the problem is control-free (no control input).
Arguments
ocp::Model: The optimal control problem.
Returns
Bool:trueif the problem has no control input,falseotherwise.
See also: CTModels.Models.has_control, CTModels.Models.control_dimension.
is_nonautonomous [Function]
CTModels.Models.is_nonautonomous — Function
is_nonautonomous(ocp::CTModels.Models.Model) -> Bool
Check whether the problem is non-autonomous (time-dependent).
Arguments
ocp::Model: The optimal control problem.
Returns
Bool:trueif the problem is non-autonomous,falseotherwise.
See also: CTModels.Models.is_autonomous.
is_nonvariable [Function]
CTModels.Models.is_nonvariable — Function
is_nonvariable(ocp::CTModels.Models.Model) -> Bool
Check whether the problem has no optimisation variables.
Arguments
ocp::Model: The optimal control problem.
Returns
Bool:trueif the problem has no optimisation variables,falseotherwise.
See also: CTModels.Models.is_variable.
is_variable [Function]
CTModels.Models.is_variable — Function
is_variable(ocp::CTModels.Models.Model) -> Bool
Check whether the problem has optimisation variables.
Arguments
ocp::Model: The optimal control problem.
Returns
Bool:trueif the problem has optimisation variables,falseotherwise.
See also: CTModels.Models.is_nonvariable, CTModels.Models.variable_dimension.
isempty_constraints [Function]
CTModels.Models.isempty_constraints — Function
isempty_constraints(ocp::CTModels.Models.Model) -> Bool
Return true if the model has no constraints.
Arguments
ocp::Model: The optimal control problem.
Returns
Bool:trueif the model has no constraints,falseotherwise.
See also: CTModels.Models.constraints, CTModels.Models.constraint.
state_components [Function]
CTModels.Models.state_components — Function
state_components(
ocp::CTModels.Models.Model
) -> Vector{String}
Return the names of the components of the state.
Arguments
ocp::Model: The optimal control problem.
Returns
Vector{String}: The state component names.
See also: CTModels.Models.state, CTModels.Models.state_name, CTModels.Models.state_dimension.
state_components(
sol::CTModels.Solutions.Solution
) -> Vector{String}
Return the names of the components of the state.
Arguments
sol::Solution: The optimal control solution.
Returns
Vector{String}: The state component names.
See also: CTModels.Models.state_dimension, CTModels.Models.state_name.
state_dimension [Function]
CTModels.Models.state_dimension — Function
state_dimension(ocp::CTModels.Models.Model) -> Int64
Return the state dimension.
Arguments
ocp::Model: The optimal control problem.
Returns
Dimension: The state dimension.
See also: CTModels.Models.state, CTModels.Models.state_name, CTModels.Models.state_components.
state_dimension(ocp::CTModels.Building.PreModel) -> Int64
Return the state dimension of the PreModel.
Arguments
ocp::PreModel: The pre-model to query.
Throws
Exceptions.PreconditionError: if the state has not been set yet.
state_dimension(sol::CTModels.Solutions.Solution) -> Int64
Return the dimension of the state.
Arguments
sol::Solution: The optimal control solution.
Returns
Dimension: The state dimension.
See also: CTModels.Models.state, CTModels.Models.state_components.
state_name [Function]
CTModels.Models.state_name — Function
state_name(ocp::CTModels.Models.Model) -> String
Return the name of the state.
Arguments
ocp::Model: The optimal control problem.
Returns
String: The state name.
See also: CTModels.Models.state, CTModels.Models.state_components, CTModels.Models.state_dimension.
state_name(sol::CTModels.Solutions.Solution) -> String
Return the name of the state.
Arguments
sol::Solution: The optimal control solution.
Returns
String: The state name.
See also: CTModels.Models.state_components, CTModels.Models.state_dimension.
variable_components [Function]
CTModels.Models.variable_components — Function
variable_components(
ocp::CTModels.Models.Model
) -> Vector{String}
Return the names of the components of the variable.
Arguments
ocp::Model: The optimal control problem.
Returns
Vector{String}: The variable component names.
See also: CTModels.Models.variable, CTModels.Models.variable_name, CTModels.Models.variable_dimension.
variable_components(
sol::CTModels.Solutions.Solution
) -> Vector{String}
Return the names of the components of the variable.
Arguments
sol::Solution: The optimal control solution.
Returns
Vector{String}: The variable component names.
See also: CTModels.Models.variable_dimension, CTModels.Models.variable_name.
variable_dimension [Function]
CTModels.Models.variable_dimension — Function
variable_dimension(ocp::CTModels.Models.Model) -> Int64
Return the variable dimension.
Arguments
ocp::Model: The optimal control problem.
Returns
Dimension: The variable dimension.
See also: CTModels.Models.variable, CTModels.Models.variable_name, CTModels.Models.variable_components.
variable_dimension(
sol::CTModels.Solutions.Solution
) -> Int64
Return the dimension of the variable.
Arguments
sol::Solution: The optimal control solution.
Returns
Dimension: The variable dimension.
See also: CTModels.Models.variable, CTModels.Models.variable_components.
variable_name [Function]
CTModels.Models.variable_name — Function
variable_name(ocp::CTModels.Models.Model) -> String
Return the name of the variable.
Arguments
ocp::Model: The optimal control problem.
Returns
String: The variable name.
See also: CTModels.Models.variable, CTModels.Models.variable_components, CTModels.Models.variable_dimension.
variable_name(sol::CTModels.Solutions.Solution) -> String
Return the name of the variable.
Arguments
sol::Solution: The optimal control solution.
Returns
String: The variable name.
See also: CTModels.Models.variable_components, CTModels.Models.variable_dimension.