Optgra
This repository provides pyoptgra, a python package wrapping (and including) OPTGRA. OPTGRA is an optimization algorithm developed and implemented by Johannes Schoenmaekers, it is specifically designed for near-linear constrained problems, which commonly occur in trajectory optimization.
The full documentation can be found here or on the ESA-internal page.
Installation
With Pip
Pyoptgra is available on PyPi and can be installed with pip:
pip install pyoptgra
Compile from Source
First install a C++ compiler, a fortran compiler, cmake, python and python build, then clone the repository and build with python -m build
Usage
Pyoptgra is designed as a pygmo user-defined algorithm: First create an instance of the optgra class with all relevant parameters, then pass a pygmo.population containing your problem to the instance’s evolve method:
>>> import pygmo
>>> import pyoptgra
>>> prob = pygmo.problem(pygmo.schwefel(30)) # using the schwefel test problem from pygmo, with 30 dimensions
>>> pop = pygmo.population(prob, 1)
>>> algo = pygmo.algorithm(pyoptgra.optgra())
>>> pop = algo.evolve(pop) # the actual call to OPTGRA
License
Copyright 2008, 2021 European Space Agency
Pyoptgra/Optgra is available under two different licenses. You may choose to license and use it under version 3 of the GNU General Public License or under the ESA Software Community Licence (ESCL) 2.4 Weak Copyleft. We explicitly reserve the right to release future versions of Pyoptgra and Optgra under different licenses.
Copies of GPL3 and ESCL 2.4 can be found in the root directory of this package, you can also obtain them at https://www.gnu.org/licenses/gpl-3.0.txt and https://essr.esa.int/license/european-space-agency-community-license-v2-4-weak-copyleft
Further reading
You can set scaling factors for variables and constraints, see Variable Scaling Factors.
Constraint tolerances can be set with the c_tol attribute of the passed problem, see Constraint Tolerances.
Optgra offers several functions for Sensitivity Analysis of a problem with respect to constraints and parameters, as well as functions for local updates. This feature is still under development.
If you have previously used the fortran interface of Optgra, you might be interested in the internals of how pyoptgra calls the underlying fortran code: Internal Workings of the Python to Fortran Interface
An example of how to optimise a Godot problem can be found here: GODOT Example.