This repository provides a standalone illustrative example of OptimalControl.jl, serving as a companion annex to the submitted JOSS paper:
OptimalControl.jl: A Julia package for modeling and solving optimal control problems with ODEs J.-B. Caillau, O. Cots, J. Gergaud, P. Martinon, S. Sed.
The script example.jl solves a constrained energy
minimization problem, combining a direct method (transcription to an NLP
solved with IPOPT on a coarse grid) with an indirect method (shooting
based on Pontryagin's Maximum Principle) to compute a high-accuracy
solution. The direct solution is used to detect the three-arc structure
(unconstrained–constrained–unconstrained) and to initialize the shooting.
The generated figure comparison.pdf compares both
solutions.
- Julia ≥ 1.10.
The Julia dependencies and their compatible versions are specified in
Project.toml (via the [compat] section) and are
installed automatically when running the script.
From this directory:
julia example.jlThe script activates the local environment, instantiates the dependencies,
solves the problem with both the direct and indirect methods, and writes
comparison.pdf with the comparison plot.
MIT — see the OptimalControl.jl repository for the license of the underlying package.