Solution
Index
CTModels.boundary_constraints_dual
CTModels.build_solution
CTModels.constraints_violation
CTModels.control
CTModels.control_components
CTModels.control_constraints_lb_dual
CTModels.control_constraints_ub_dual
CTModels.control_dimension
CTModels.control_name
CTModels.costate
CTModels.dual_model
CTModels.final_time_name
CTModels.infos
CTModels.initial_time_name
CTModels.iterations
CTModels.message
CTModels.model
CTModels.objective
CTModels.path_constraints_dual
CTModels.state
CTModels.state_components
CTModels.state_constraints_lb_dual
CTModels.state_constraints_ub_dual
CTModels.state_dimension
CTModels.state_name
CTModels.status
CTModels.successful
CTModels.time_grid
CTModels.time_name
CTModels.variable
CTModels.variable_components
CTModels.variable_constraints_lb_dual
CTModels.variable_constraints_ub_dual
CTModels.variable_dimension
CTModels.variable_name
Base.show
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.show
— Methodshow(
io::IO,
_::MIME{Symbol("text/plain")},
sol::CTModels.Solution
)
Prints the solution.
CTModels.boundary_constraints_dual
— Methodboundary_constraints_dual(
sol::CTModels.Solution
) -> Union{Nothing, AbstractVector{<:Real}}
Return the dual of the boundary constraints.
CTModels.build_solution
— Methodbuild_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.constraints_violation
— Methodconstraints_violation(sol::CTModels.Solution) -> Float64
Return the constraints violation.
CTModels.control
— Methodcontrol(
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_components
— Methodcontrol_components(sol::CTModels.Solution) -> Vector{String}
Return the names of the components of the control.
CTModels.control_constraints_lb_dual
— Methodcontrol_constraints_lb_dual(
sol::CTModels.Solution
) -> Union{Nothing, Function}
Return the lower bound dual of the control constraints.
CTModels.control_constraints_ub_dual
— Methodcontrol_constraints_ub_dual(
sol::CTModels.Solution
) -> Union{Nothing, Function}
Return the upper bound dual of the control constraints.
CTModels.control_dimension
— Methodcontrol_dimension(sol::CTModels.Solution) -> Int64
Return the dimension of the control.
CTModels.control_name
— Methodcontrol_name(sol::CTModels.Solution) -> String
Return the name of the control.
CTModels.costate
— Methodcostate(
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_model
— Methoddual_model(
sol::CTModels.Solution{<:CTModels.AbstractTimeGridModel, <:CTModels.AbstractTimesModel, <:CTModels.AbstractStateModel, <:CTModels.AbstractControlModel, <:CTModels.AbstractVariableModel, <:Function, <:Real, DM<:CTModels.AbstractDualModel}
) -> CTModels.AbstractDualModel
CTModels.final_time_name
— Methodfinal_time_name(sol::CTModels.Solution) -> String
Return the name of the final time.
CTModels.infos
— Methodinfos(sol::CTModels.Solution) -> Dict{Symbol, Any}
Return a dictionary of additional infos depending on the solver or nothing
.
CTModels.initial_time_name
— Methodinitial_time_name(sol::CTModels.Solution) -> String
Return the name of the initial time.
CTModels.iterations
— Methoditerations(sol::CTModels.Solution) -> Int64
Return the number of iterations (if solved by an iterative method).
CTModels.message
— Methodmessage(sol::CTModels.Solution) -> String
Return the message associated to the status criterion.
CTModels.model
— Methodmodel(
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.objective
— Methodobjective(
sol::CTModels.Solution{<:CTModels.AbstractTimeGridModel, <:CTModels.AbstractTimesModel, <:CTModels.AbstractStateModel, <:CTModels.AbstractControlModel, <:CTModels.AbstractVariableModel, <:Function, O<:Real}
) -> Real
Return the objective value.
CTModels.path_constraints_dual
— Methodpath_constraints_dual(
sol::CTModels.Solution
) -> Union{Nothing, Function}
Return the dual of the path constraints.
CTModels.state
— Methodstate(
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_components
— Methodstate_components(sol::CTModels.Solution) -> Vector{String}
Return the names of the components of the state.
CTModels.state_constraints_lb_dual
— Methodstate_constraints_lb_dual(
sol::CTModels.Solution
) -> Union{Nothing, Function}
Return the lower bound dual of the state constraints.
CTModels.state_constraints_ub_dual
— Methodstate_constraints_ub_dual(
sol::CTModels.Solution
) -> Union{Nothing, Function}
Return the upper bound dual of the state constraints.
CTModels.state_dimension
— Methodstate_dimension(sol::CTModels.Solution) -> Int64
Return the dimension of the state.
CTModels.state_name
— Methodstate_name(sol::CTModels.Solution) -> String
Return the name of the state.
CTModels.status
— Methodstatus(sol::CTModels.Solution) -> Symbol
Return the status criterion (a Symbol).
CTModels.successful
— Methodsuccessful(sol::CTModels.Solution) -> Bool
Return the successful status.
CTModels.time_grid
— Methodtime_grid(
sol::CTModels.Solution{<:CTModels.TimeGridModel{T<:Union{StepRangeLen, AbstractVector{<:Real}}}}
) -> Union{StepRangeLen, AbstractVector{<:Real}}
Return the time grid.
CTModels.time_name
— Methodtime_name(sol::CTModels.Solution) -> String
Return the name of the time component.
CTModels.variable
— Methodvariable(
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_components
— Methodvariable_components(
sol::CTModels.Solution
) -> Vector{String}
Return the names of the components of the variable.
CTModels.variable_constraints_lb_dual
— Methodvariable_constraints_lb_dual(
sol::CTModels.Solution
) -> Union{Nothing, AbstractVector{<:Real}}
Return the lower bound dual of the variable constraints.
CTModels.variable_constraints_ub_dual
— Methodvariable_constraints_ub_dual(
sol::CTModels.Solution
) -> Union{Nothing, AbstractVector{<:Real}}
Return the upper bound dual of the variable constraints.
CTModels.variable_dimension
— Methodvariable_dimension(sol::CTModels.Solution) -> Int64
Return the dimension of the variable.
CTModels.variable_name
— Methodvariable_name(sol::CTModels.Solution) -> String
Return the name of the variable.