Public API
This page lists exported symbols of CTSolvers.DOCP.
From CTSolvers.DOCP
CTSolvers.DOCP [Module]
CTSolvers.DOCP Module
DOCP (Discretized Optimal Control Problem) module.
This module defines the DiscretizedModel type and the associated API to build NLP models and reconstruct OCP solutions via the Optimization and Modelers contracts.
The DOCP layer is the bridge between continuous-time models (from CTModels) and the solver/modeler infrastructure provided by CTSolvers.
AbstractDiscretizer [Abstract Type]
CTSolvers.DOCP.AbstractDiscretizer Type
abstract type AbstractDiscretizer <: CTBase.Strategies.AbstractStrategyAbstract base type for all discretization strategies.
Concrete subtypes implement specific transcription methods (collocation, direct shooting, etc.) and are defined in the package providing the method. A discretizer is a Strategies.AbstractStrategy: it carries validated options and drives discretize to turn an optimal control problem into a DiscretizedModel.
See also: DiscretizedModel, discretize.
DiscretizedModel [Struct]
CTSolvers.DOCP.DiscretizedModel Type
struct DiscretizedModel{TO<:CTModels.Models.AbstractModel, TD<:CTSolvers.DOCP.AbstractDiscretizer, TC<:CTBase.Core.AbstractCache} <: CTSolvers.Optimization.AbstractOptimizationProblemDiscretized optimal control problem ready for NLP solving.
A thin pairing of an optimal control problem with the discretizer that produced it, plus a backend cache. The actual NLP model and OCP solution are produced by multiple dispatch on (DiscretizedModel, modeler) through the build_model / build_solution contract, implemented in the package providing the discretizer (e.g. CTDirect). This mirrors Flow{system, integrator} on the ODE side.
Fields
ocp::TO: The original optimal control problem.discretizer::TD: The discretization strategy used.cache::TC: Backend cache (<: CTBase.Core.AbstractCache), opaque to CTSolvers, populated by the implementing package (e.g. CTDirect'sDOCPCache).
Type parameters
TO <: CTModels.AbstractModelTD <: AbstractDiscretizerTC <: CTBase.Core.AbstractCache
See also: ocp_model, discretize, build_model, build_solution.
discretize [Function]
CTSolvers.DOCP.discretize Function
discretize(
ocp::CTModels.Models.AbstractModel,
discretizer::CTSolvers.DOCP.AbstractDiscretizer
)Discretize an optimal control problem into a DiscretizedModel.
Contract
Must be implemented in the package providing discretizer, dispatching on its concrete type, e.g. CTSolvers.discretize(ocp, ::Collocation) in CTDirect.
Arguments
ocp::CTModels.AbstractModel: The optimal control problem.discretizer::AbstractDiscretizer: The discretization strategy.
Returns
- A
DiscretizedModelwith a populated cache.
See also: build_model, build_solution.
nlp_model [Function]
CTSolvers.DOCP.nlp_model Function
nlp_model(
prob::CTSolvers.DOCP.DiscretizedModel,
initial_guess,
modeler::CTSolvers.Modelers.AbstractNLPModeler
)Build an NLP model from a discretized optimal control problem.
This is a convenience wrapper around build_model that returns only the backend NLP model (the nlp field of the BuiltModel). Use build_model directly when the build-time cache is needed (e.g. before build_solution).
Arguments
prob::DiscretizedModel: The discretized OCPinitial_guess: Initial guess for the NLP solvermodeler: The modeler to use (e.g., Modelers.ADNLP, Modelers.Exa)
Returns
NLPModels.AbstractNLPModel: The NLP model
Example
nlp = nlp_model(docp, initial_guess, modeler)See also: ocp_solution, Optimization.build_model, Optimization.BuiltModel
ocp_model [Function]
CTSolvers.DOCP.ocp_model Function
ocp_model(
docp::CTSolvers.DOCP.DiscretizedModel
) -> CTModels.Models.AbstractModelExtract the original optimal control problem from a discretized problem.
Arguments
docp::DiscretizedModel: The discretized optimal control problem
Returns
- The original optimal control problem
Example
ocp = ocp_model(docp)See also: DiscretizedModel
ocp_solution [Function]
CTSolvers.DOCP.ocp_solution Function
ocp_solution(
built::CTSolvers.Optimization.BuiltModel,
model_solution::SolverCore.AbstractExecutionStats,
modeler::CTSolvers.Modelers.AbstractNLPModeler
)Build an optimal control solution from NLP execution statistics.
This is a convenience wrapper around build_solution that dispatches on the BuiltModel returned by build_model and ensures the return type is an optimal control solution.
Arguments
built::BuiltModel: The built model bundle returned bybuild_modelmodel_solution::SolverCore.AbstractExecutionStats: NLP solver outputmodeler: The modeler used for building
Returns
AbstractSolution: The OCP solution
Example
built = build_model(docp, initial_guess, modeler)
sol = ocp_solution(built, nlp_stats, modeler)See also: nlp_model, Optimization.build_solution, Optimization.BuiltModel