Skip to content

API levels ​

OptimalControl builds on several packages (see Ecosystem) and gives access to what a user needs from them at two levels. A third level holds what it uses internally. The lists below are generated from the package itself, and each name links to its documentation.

LevelReached asWhat
1. Exportedusing OptimalControl, then namethe vocabulary of the package: problems, solve, solutions, flows, geometry
2. QualifiedOptimalControl.Namestrategies (modelers, solvers, discretizer, AD backend), types, exceptions
3. Internalnot for usersthe modules of the packages OptimalControl builds on

Why these choices.

  • Exported: the names a user writes in every script, so that using OptimalControl is enough.

  • Qualified: the strategies have the names of the packages they rely on (Ipopt, MadNLP, DifferentiationInterface): exporting them would clash with these packages in the user's session. The exceptions are rarely written, only to check what a call raised, and the types mostly appear in signatures. Writing OptimalControl.Ipopt() says where the name comes from.

  • Internal: no module name is exported. @def, @init and @Lie work after import OptimalControl alone, so a user never needs CTModels or CTBase in scope.

Level 1: exported (199 names) ​

Modelling (12)

Documented on the page Modelling.

@def, @init, time!, state!, control!, variable!, dynamics!, objective!, constraint!, time_dependence!, build, build_initial_guess

Problem (58)

Documented on the page Problem.

state_dimension, state_name, state_components, control_dimension, control_name, control_components, variable_dimension, variable_name, variable_components, components, dimension, name, index, expression, criterion, initial_time, final_time, times, time_name, initial_time_name, final_time_name, has_fixed_initial_time, has_free_initial_time, has_fixed_final_time, has_free_final_time, is_initial_time_fixed, is_initial_time_free, is_final_time_fixed, is_final_time_free, dynamics, mayer, lagrange, has_mayer_cost, has_lagrange_cost, is_mayer_cost_defined, is_lagrange_cost_defined, constraint, constraints, path_constraints_nl, boundary_constraints_nl, state_constraints_box, control_constraints_box, variable_constraints_box, dim_path_constraints_nl, dim_boundary_constraints_nl, dim_state_constraints_box, dim_control_constraints_box, dim_variable_constraints_box, definition, has_abstract_definition, is_abstractly_defined, is_autonomous, is_nonautonomous, is_variable, is_nonvariable, has_variable, has_control, is_control_free

Solving (7)

Documented on the page Solving.

solve, methods, discretize, ocp_model, nlp_model, ocp_solution, get_build_examodel

Options and strategies (26)

Documented on the page Options and strategies.

route_to, bypass, force, options, option_names, option_type, option_default, option_defaults, option_description, option_value, option_source, has_option, is_user, is_default, is_computed, id, metadata, create_registry, strategy_ids, type_from_id, parameter, default_parameter, available_parameters, CPU, GPU, describe

Solution (27)

Documented on the page Solution.

state, control, costate, variable, time_grid, objective, status, message, successful, iterations, constraints_violation, infos, model, is_empty, is_empty_time_grid, dual, 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, dim_dual_state_constraints_box, dim_dual_control_constraints_box, dim_dual_variable_constraints_box

Flows (28)

Documented on the page Flows.

Flow, control_law, pseudo_hamiltonian, hamiltonian, hamiltonian_vector_field, vector_field, get_hamiltonian_gradient, get_variable_gradient, get_pseudo_hamiltonian_gradient, get_pseudo_variable_gradient, MultiPhaseFlow, MultiPhaseStateFlow, MultiPhaseHamiltonianFlow, AnyMultiPhaseFlow, n_phases, get_flow, get_flows, get_switching_time, get_switching_times, get_jump, get_jumps, system, integrator, SciML, AbstractIntegrator, AbstractIntegrationResult, final_state, evaluate_at

Geometry (7)

Documented on the page Geometry.

ad, Lift, Poisson, ∂ₜ, dg_ad_backend, dg_ad_backend!, @Lie

Types (27)

Documented on the page Types.

AbstractVectorField, VectorField, AbstractControlledVectorField, ControlledVectorField, ComposedVectorField, controlled_vector_field, AbstractHamiltonian, Hamiltonian, ComposedHamiltonian, AbstractHamiltonianVectorField, HamiltonianVectorField, AbstractPseudoHamiltonian, PseudoHamiltonian, AbstractPseudoHamiltonianVectorField, PseudoHamiltonianVectorField, AbstractControlLaw, ControlLaw, OpenLoop, ClosedLoop, DynClosedLoop, AbstractPathConstraint, PathConstraint, StateConstraint, ControlConstraint, MixedConstraint, AbstractMultiplier, Multiplier

Plotting and I/O (4)

Documented on the page Plotting and I/O.

plot, plot!, export_ocp_solution, import_ocp_solution

Deprecated (3)

Documented on the page Deprecated.

Lie, ⋅, HamiltonianLift

Level 2: qualified (40 names) ​

Documented on the page Qualified access.

Names

OptimalControl.PreModel, OptimalControl.AbstractModel, OptimalControl.Model, OptimalControl.Solution, OptimalControl.AbstractSolution, OptimalControl.AbstractInitialGuess, OptimalControl.InitialGuess, OptimalControl.ADNLP, OptimalControl.Exa, OptimalControl.Ipopt, OptimalControl.MadNLP, OptimalControl.MadNCL, OptimalControl.Knitro, OptimalControl.Uno, OptimalControl.AbstractDiscretizer, OptimalControl.DiscretizedModel, OptimalControl.AbstractNLPModeler, OptimalControl.AbstractNLPSolver, OptimalControl.LiftedHamiltonianFunction, OptimalControl.CTException, OptimalControl.IncorrectArgument, OptimalControl.PreconditionError, OptimalControl.NotImplemented, OptimalControl.ParsingError, OptimalControl.AmbiguousDescription, OptimalControl.ExtensionError, OptimalControl.NotProvided, OptimalControl.NotProvidedType, OptimalControl.ctNumber, OptimalControl.DifferentiationInterface, OptimalControl.AbstractADBackend, OptimalControl.AbstractStrategy, OptimalControl.StrategyRegistry, OptimalControl.StrategyMetadata, OptimalControl.StrategyOptions, OptimalControl.RoutedOption, OptimalControl.BypassValue, OptimalControl.AbstractStrategyParameter, OptimalControl.OptionDefinition, OptimalControl.OptionValue

Without a documentation entry: OptimalControl.Collocation.

Level 3: internal ​

The modules OptimalControl binds, for its own use. They are reachable as OptimalControl.Module, but a user should not need them.

ModuleWhy OptimalControl binds it
ADNLPModelsloaded to arm the :adnlp modeler (extension CTSolversADNLPModels)
CTBasestrategies, options, exceptions, the Data types of flows
CTDirectthe direct method: the Collocation discretizer
CTFlowsflows and their accessors
CTLiedifferential geometry: ad, Lift, Poisson, @Lie
CTModelsproblems, solutions, initial guesses, plots and I/O
CTSolversmodelers, NLP solvers, integrators
CommonSolvethe generic function solve
DifferentiationInterfacePkgthe package DifferentiationInterface, loaded to arm the AD of the geometry (extension CTBaseDifferentiationInterface)
DocStringExtensionsdocstrings
ExaModelsloaded for the :exa modeler
ForwardDiffloaded to arm the AD of solve (extension CTSolversForwardDiff)
LinearAlgebraloaded to arm the linear algebra of ExaModels
Reexportbuilds the exported names