Solution

Index

Warning

In the examples in the documentation below, the methods are not prefixed by the module name even if they are private.

julia> using CTModels
julia> x = 1
julia> private_fun(x) # throw an error

must be replaced by

julia> using CTModels
julia> x = 1
julia> CTModels.private_fun(x)

However, if the method is reexported by another package, then, there is no need of prefixing.

julia> module OptimalControl
           import CTModels: private_fun
           export private_fun
       end
julia> using OptimalControl
julia> x = 1
julia> private_fun(x)

Documentation

Base.showMethod
show(
    io::IO,
    _::MIME{Symbol("text/plain")},
    sol::CTModels.Solution
)

Prints the solution.

CTModels.boundary_constraints_dualMethod
boundary_constraints_dual(
    sol::CTModels.Solution
) -> Union{Nothing, AbstractVector{<:Real}}

Return the dual of the boundary constraints.

CTModels.build_solutionMethod
build_solution(
    ocp::CTModels.Model,
    T::Vector{Float64},
    X::Union{Function, Matrix{Float64}},
    U::Union{Function, Matrix{Float64}},
    v::Vector{Float64},
    P::Union{Function, Matrix{Float64}};
    objective,
    iterations,
    constraints_violation,
    message,
    status,
    successful,
    path_constraints_dual,
    boundary_constraints_dual,
    state_constraints_lb_dual,
    state_constraints_ub_dual,
    control_constraints_lb_dual,
    control_constraints_ub_dual,
    variable_constraints_lb_dual,
    variable_constraints_ub_dual
)

Build a solution from the optimal control problem, the time grid, the state, control, variable, and dual variables.

Arguments

  • ocp::Model: the optimal control problem.
  • T::Vector{Float64}: the time grid.
  • X::Matrix{Float64}: the state trajectory.
  • U::Matrix{Float64}: the control trajectory.
  • v::Vector{Float64}: the variable trajectory.
  • P::Matrix{Float64}: the costate trajectory.
  • objective::Float64: the objective value.
  • iterations::Int: the number of iterations.
  • constraints_violation::Float64: the constraints violation.
  • message::String: the message associated to the status criterion.
  • status::Symbol: the status criterion.
  • successful::Bool: the successful status.
  • path_constraints_dual::Matrix{Float64}: the dual of the path constraints.
  • boundary_constraints_dual::Vector{Float64}: the dual of the boundary constraints.
  • state_constraints_lb_dual::Matrix{Float64}: the lower bound dual of the state constraints.
  • state_constraints_ub_dual::Matrix{Float64}: the upper bound dual of the state constraints.
  • control_constraints_lb_dual::Matrix{Float64}: the lower bound dual of the control constraints.
  • control_constraints_ub_dual::Matrix{Float64}: the upper bound dual of the control constraints.
  • variable_constraints_lb_dual::Vector{Float64}: the lower bound dual of the variable constraints.
  • variable_constraints_ub_dual::Vector{Float64}: the upper bound dual of the variable constraints.

Returns

  • sol::Solution: the optimal control solution.
CTModels.controlMethod
control(
    sol::CTModels.Solution{<:CTModels.AbstractTimeGridModel, <:CTModels.AbstractTimesModel, <:CTModels.AbstractStateModel, <:CTModels.ControlModelSolution{TS<:Function}}
) -> Function

Return the control as a function of time.

julia> u  = control(sol)
julia> t0 = time_grid(sol)[1]
julia> u0 = u(t0) # control at the initial time
CTModels.control_componentsMethod
control_components(sol::CTModels.Solution) -> Vector{String}

Return the names of the components of the control.

CTModels.control_constraints_lb_dualMethod
control_constraints_lb_dual(
    sol::CTModels.Solution
) -> Union{Nothing, Function}

Return the lower bound dual of the control constraints.

CTModels.control_constraints_ub_dualMethod
control_constraints_ub_dual(
    sol::CTModels.Solution
) -> Union{Nothing, Function}

Return the upper bound dual of the control constraints.

CTModels.control_nameMethod
control_name(sol::CTModels.Solution) -> String

Return the name of the control.

CTModels.costateMethod
costate(
    sol::CTModels.Solution{<:CTModels.AbstractTimeGridModel, <:CTModels.AbstractTimesModel, <:CTModels.AbstractStateModel, <:CTModels.AbstractControlModel, <:CTModels.AbstractVariableModel, Co<:Function}
) -> Function

Return the costate as a function of time.

julia> p  = costate(sol)
julia> t0 = time_grid(sol)[1]
julia> p0 = p(t0) # costate at the initial time
CTModels.dual_modelMethod
dual_model(
    sol::CTModels.Solution{<:CTModels.AbstractTimeGridModel, <:CTModels.AbstractTimesModel, <:CTModels.AbstractStateModel, <:CTModels.AbstractControlModel, <:CTModels.AbstractVariableModel, <:Function, <:Real, DM<:CTModels.AbstractDualModel}
) -> CTModels.AbstractDualModel
CTModels.infosMethod
infos(sol::CTModels.Solution) -> Dict{Symbol, Any}

Return a dictionary of additional infos depending on the solver or nothing.

CTModels.iterationsMethod
iterations(sol::CTModels.Solution) -> Int64

Return the number of iterations (if solved by an iterative method).

CTModels.messageMethod
message(sol::CTModels.Solution) -> String

Return the message associated to the status criterion.

CTModels.modelMethod
model(
    sol::CTModels.Solution{<:CTModels.AbstractTimeGridModel, <:CTModels.AbstractTimesModel, <:CTModels.AbstractStateModel, <:CTModels.AbstractControlModel, <:CTModels.AbstractVariableModel, <:Function, <:Real, <:CTModels.AbstractDualModel, <:CTModels.AbstractSolverInfos, TM<:CTModels.AbstractModel}
) -> CTModels.AbstractModel
CTModels.objectiveMethod
objective(
    sol::CTModels.Solution{<:CTModels.AbstractTimeGridModel, <:CTModels.AbstractTimesModel, <:CTModels.AbstractStateModel, <:CTModels.AbstractControlModel, <:CTModels.AbstractVariableModel, <:Function, O<:Real}
) -> Real

Return the objective value.

CTModels.path_constraints_dualMethod
path_constraints_dual(
    sol::CTModels.Solution
) -> Union{Nothing, Function}

Return the dual of the path constraints.

CTModels.stateMethod
state(
    sol::CTModels.Solution{<:CTModels.AbstractTimeGridModel, <:CTModels.AbstractTimesModel, <:CTModels.StateModelSolution{TS<:Function}}
) -> Function

Return the state as a function of time.

julia> x  = state(sol)
julia> t0 = time_grid(sol)[1]
julia> x0 = x(t0) # state at the initial time
CTModels.state_componentsMethod
state_components(sol::CTModels.Solution) -> Vector{String}

Return the names of the components of the state.

CTModels.state_constraints_lb_dualMethod
state_constraints_lb_dual(
    sol::CTModels.Solution
) -> Union{Nothing, Function}

Return the lower bound dual of the state constraints.

CTModels.state_constraints_ub_dualMethod
state_constraints_ub_dual(
    sol::CTModels.Solution
) -> Union{Nothing, Function}

Return the upper bound dual of the state constraints.

CTModels.state_nameMethod
state_name(sol::CTModels.Solution) -> String

Return the name of the state.

CTModels.statusMethod
status(sol::CTModels.Solution) -> Symbol

Return the status criterion (a Symbol).

CTModels.successfulMethod
successful(sol::CTModels.Solution) -> Bool

Return the successful status.

CTModels.time_gridMethod
time_grid(
    sol::CTModels.Solution{<:CTModels.TimeGridModel{T<:Union{StepRangeLen, AbstractVector{<:Real}}}}
) -> Union{StepRangeLen, AbstractVector{<:Real}}

Return the time grid.

CTModels.time_nameMethod
time_name(sol::CTModels.Solution) -> String

Return the name of the time component.

CTModels.variableMethod
variable(
    sol::CTModels.Solution{<:CTModels.AbstractTimeGridModel, <:CTModels.AbstractTimesModel, <:CTModels.AbstractStateModel, <:CTModels.AbstractControlModel, <:CTModels.VariableModelSolution{TS<:Union{Real, AbstractVector{<:Real}}}}
) -> Union{Real, AbstractVector{<:Real}}

Return the variable or nothing.

julia> v  = variable(sol)
CTModels.variable_componentsMethod
variable_components(
    sol::CTModels.Solution
) -> Vector{String}

Return the names of the components of the variable.

CTModels.variable_constraints_lb_dualMethod
variable_constraints_lb_dual(
    sol::CTModels.Solution
) -> Union{Nothing, AbstractVector{<:Real}}

Return the lower bound dual of the variable constraints.

CTModels.variable_constraints_ub_dualMethod
variable_constraints_ub_dual(
    sol::CTModels.Solution
) -> Union{Nothing, AbstractVector{<:Real}}

Return the upper bound dual of the variable constraints.

CTModels.variable_nameMethod
variable_name(sol::CTModels.Solution) -> String

Return the name of the variable.