Add ControlSystem for Nonlinear Optimal Control #562
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request adds a
ControlSystem
construct for specifying nonlinear optimal control problems. The format is as follows:Over time it will get full standardization with the rest of ModelingToolkit's abstract system interface, which means that things like pins and observables should get supported. Through component-based modeling should already work.
This is an abstract specification, so it is symbolic in nature and does not do the computation itself. Instead, all computation on a ControlSystem occurs through the transformation into another system type. In order to demonstrate this, I created the first transformation function,
runge_kutta_discretize
, which takes in a ControlSystem and outputs an OptimizationSystem that is defined by the collocation of some Runge-Kutta method (defaulting to a 5th order RadauIIA). That means that all of the machinery for OptimizationSystem can then be used to transform this into a OptimizationProblem to be numerically handled, and sparse symbolic Hessians should already work, etc.As a demonstration of this:
creates an OptimizationSystem, which one can then transform to a numerical problem to solve. Note that for this transformation to work, I did the long-overdue thing of expanding OptimizationSystem to have constraints. We will need to update OptimizationProblem to have an interface for this, and then setup GalacticOptim to appropriately handle constraints, and then this will be a "direct to numerics" thing, but for now it's purely symbolic.