Skip to main content

A Multi-phase nonlinear Optimal control problem solver using Pseudo-spectral collocation

Project description

pypi pacakge Build Status Coverage Status Documentation Status

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.

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 --branch master
  • Install package using

    • $ make install
  • Test installation using

    • $ make test
  • Try moon-lander example using

    • $ make run

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mpopt-0.1.3.tar.gz (36.3 kB view details)

Uploaded Source

Built Distribution

mpopt-0.1.3-py3-none-any.whl (45.4 kB view details)

Uploaded Python 3

File details

Details for the file mpopt-0.1.3.tar.gz.

File metadata

  • Download URL: mpopt-0.1.3.tar.gz
  • Upload date:
  • Size: 36.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.24.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.38.0 CPython/3.6.9

File hashes

Hashes for mpopt-0.1.3.tar.gz
Algorithm Hash digest
SHA256 93804bdb9c6d702c20d00bbe5dc8065d97d182eedb4e119db4fb51ec32158fcb
MD5 22978784d3aec48499b1e01ce7fc3d03
BLAKE2b-256 7126085e5469bc177fc65ed61adf227d01fda5b18e6ce9734489589b32659316

See more details on using hashes here.

Provenance

File details

Details for the file mpopt-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: mpopt-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 45.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.24.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.38.0 CPython/3.6.9

File hashes

Hashes for mpopt-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 41f7b686105c259aeecc891db2211988ed413095235851cfcbdc7237b507191e
MD5 7d3d51eda7a4d3f75eef716edef87b9e
BLAKE2b-256 a308da92acfdb5c00c82524edcd83fb2b4774089408db2d0eb0fe30d591cd55b

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page