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 differation capability offered by CasADi, multiple NLP solver compatibility 'ipopt', 'snopt', 'sqpmethod' etc.
- Sophisticated post-processing module for interactive data visualization
Installation
Install the package using
$ pip install mpopt
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
$ make init
$ make test
$ python examples/moon_lander.py
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
Documentation
Work under progress.
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
License
This project is licensed under the GNU LGPL v3 - see the LICENSE file for details
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.0.tar.gz
.
File metadata
- Download URL: mpopt-0.1.0.tar.gz
- Upload date:
- Size: 35.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.6.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 144646bac69580ec8b64bf5cd6d1a1e5af18c97478b9b5fb6de2eea9a834e931 |
|
MD5 | c93d3efdf42aa6c1bd93ee0bfea94427 |
|
BLAKE2b-256 | 6f4ab619e96dacf8542f68d9e17d04f3784ac3d08f27196737b0ebdee8bb71a4 |
Provenance
File details
Details for the file mpopt-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: mpopt-0.1.0-py3-none-any.whl
- Upload date:
- Size: 44.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.6.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a0c5bf039dbbbb752bc3c2bf1b0864b94e7f15b755f057b53a4dadfdb0d6e76d |
|
MD5 | fd2cf4c5a883998d54094d4c848133ba |
|
BLAKE2b-256 | 24c2a39260c042933eb8c20c60e58b0dff6dc6740fbedc42d0bc095f37a3e032 |