A Multi-phase nonlinear Optimal control problem solver using Pseudo-spectral collocation
Project description
MPOPT
MPOPT is a collection of modules to solve multi-stage optimal control problems(OCPs) using pseudo-spectral collocation method. This module creates Nonlinear programming problem (NLP) from the given OCP description, which is then solved by CasADi nlpsolver using various available plugins such as ipopt, snopt etc.
Main features of the solver are :
- Customizable collocation approximation, compatable with Legendre-Gauss-Radau, Legendre-Gauss-Lobatto, Chebyshev-Gauss-Lobatto roots.
- Intuitive definition of OCP/multi-phase OCP
- Single-phase as well as multi-phase OCP solving capability using user defined collocation approximation
- Adaptive grid refinement schemes for robust solutions
- NLP solution using algorithmic differentiation capability offered by CasADi, multiple NLP solver compatibility 'ipopt', 'snopt', 'sqpmethod' etc.
- Sophisticated post-processing module for interactive data visualization
Getting started
A brief overview of the package and capabilities are demonstrated with simple moon-lander OCP example in Jupyter notebook.
- Get started with MPOPT
Installation
Install and try the package using
$ pip install mpopt
$ wget https://raw.githubusercontent.com/mpopt/mpopt/master/examples/moon_lander.py
$ python3 moon_lander.py
If you want to downloaded it from source, you may do so either by:
-
Downloading it from GitHub page
- Unzip the folder and you are ready to go
-
Or cloning it to a desired directory using git:
$ git clone https://github.com/mpopt/mpopt.git --branch master
-
Move to the cloned directory
$ cd mpopt
-
Install package using
$ make install
-
Test installation using
$ make test
-
Try moon-lander example using
$ make run
Documentation
- Refer Documentation
A sample code to solve moon-lander OCP (2D)
# Moon lander OCP direct collocation/multi-segment collocation
from mpopt import mp
# Define OCP
ocp = mp.OCP(n_states=2, n_controls=1)
ocp.dynamics[0] = lambda x, u, t: [x[1], u[0] - 1.5]
ocp.running_costs[0] = lambda x, u, t: u[0]
ocp.terminal_constraints[0] = lambda xf, tf, x0, t0: [xf[0], xf[1]]
ocp.x00[0] = [10.0, -2.0]
ocp.lbu[0], ocp.ubu[0] = 0, 3
# Create optimizer(mpo), solve and post process(post) the solution
mpo, post = mp.solve(ocp, n_segments=20, poly_orders=3, scheme="LGR", plot=True)
Authors
- Devakumar THAMMISETTY
- Prof. Colin Jones (Co-author)
License
This project is licensed under the GNU LGPL v3 - see the LICENSE file for details
Acknowledgements
- Petr Listov
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file mpopt-0.1.6.tar.gz
.
File metadata
- Download URL: mpopt-0.1.6.tar.gz
- Upload date:
- Size: 63.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.7.0 requests/2.25.1 setuptools/56.0.0 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 17a017e4e276091a080845de8d246233541cb3f78b4ef1f53fbb5fa72ee60613 |
|
MD5 | 9b8d664f1717ea8d5e21defb326b14b3 |
|
BLAKE2b-256 | 972df5f4a890fa2e3973cbe996c0701cc448bcd175ec04437943154bcef71e50 |
Provenance
File details
Details for the file mpopt-0.1.6-py3-none-any.whl
.
File metadata
- Download URL: mpopt-0.1.6-py3-none-any.whl
- Upload date:
- Size: 105.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.7.0 requests/2.25.1 setuptools/56.0.0 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1ccfcf30171eddf71b2d3bfd91546909243933ff69d01a1eb27eaffdbc2145e9 |
|
MD5 | bf9f17bf928134d93235559098df3fc7 |
|
BLAKE2b-256 | ff8b3ce6bbb20773be5349536c86a6150e146a9e11a64be840892785a8dacc49 |