Note: this repository is no longer maintained. The benchmark_ocp repository contains a regularly updated implementation of this code's functionality.
pylgr is a basic Python implementation of a Legendre-Gauss-Radau (LGR) pseudospectral
(PS) method for infinite horizon computational optimal control. The optimal
control problem (OCP) is collocated in time at LGR points, turning it into a
constrained nonlinear programming problem which we solve with sequential least
squares quadratic programming (SLSQP). Rough estimates for the costates are
extracted based on the covector mapping theorem.
The code has been tested with the following dependencies:
python>=3.6
numpy>=1.19.5
scipy>=1.5.4
pytest>=7.0.1
matplotlib>=3.3.4
The code can be installed using the following command:
pip install -e .
You can then import pylgr in any python script. The main function is
pylgr.solve_ocp. Documentation can be accessed by the python command
help(pylgr.solve_ocp).
The test suite can be run from the main directory with the command
pytest unit_tests -s -v
Plotting can be enabled in test_solve.py inside each individual test function.
See the following references for details on the LGR PS approach: