Skip to content
/ psopt Public

PSOPT Optimal Control Software

License

LGPL-2.1, LGPL-2.1 licenses found

Licenses found

LGPL-2.1
LICENSE.txt
LGPL-2.1
COPYING
Notifications You must be signed in to change notification settings

PSOPT/psopt

Repository files navigation

PSOPT

Copyright (C) 2009-2022 Victor M. Becerra

Introduction

This is the PSOPT library, a software tool for computational optimal control

PSOPT is an open source optimal control package written in C++ that uses direct collocation methods. These methods solve optimal control problems by approximating the time-dependent variables using global or local polynomials. This allows to discretize the differential equations and continuous constraints over a grid of nodes, and to compute any integrals associated with the problem using well known quadrature formulas. Nonlinear programming then is used to find local optimal solutions. PSOPT is able to deal with problems with the following characteristics:

  • Single or multiphase problems
  • Continuous time nonlinear dynamics
  • General endpoint constraints
  • Nonlinear path constraints (equalities or inequalities) on states and/or control variables
  • Integral constraints
  • Interior point constraints
  • Bounds on controls and state variables
  • General cost function with Lagrange and Mayer terms.
  • Free or fixed initial and final conditions
  • Linear or nonlinear linkages between phases
  • Fixed or free initial time
  • Fixed or free final time
  • Optimisation of static parameters
  • Parameter estimation problems with sampled measurements • Differential equations with delayed variables.

The implementation has the following features:

  • Choice between Legendre, Chebyshev, trapezoidal, or Hermite-Simpson based collocation
  • Automatic scaling
  • Automatic first and second derivatives using the ADOL-C library
  • Numerical differentiation by using sparse finite differences
  • Automatic mesh refinement
  • Automatic identification of the Jacobian and Hessian sparsity.
  • DAE formulation, so that differential and algebraic constraints can be implemented in the same C++ function.

The PSOPT interface uses both Eigen3 (a linear algebra template library) and ADOL-C (an automatic differentiation library).

The first release of PSOPT was published in 2009. This is release 5 of PSOPT.

The PSOPT website is http://www.psopt.net.

License

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA, or visit http://www.gnu.org/licenses/

Author: Professor Victor M. Becerra

Address:

       University of Portsmouth

       School of Energy and Electronic Engineering
       
       Portsmouth PO1 3DJ
       
       United Kingdom

e-mail: v.m.becerra@ieee.org

Getting started

Please consult the detailed installation instructions in the PSOPT PDF documentation. In the following, we only summarize some main points.

Dependencies

PSOPT requires the following libraries:

  1. IPOPT
  2. ADOL-C
  3. EIGEN3

Optionally, the user may wish to employ the following software

  1. SNOPT
  2. GNUplot

Moreover, PSOPT is built using CMake. CMake is an open-source, cross-platform family of tools designed to build, test and package software. The build process also requires the pkg-config tool.

Build

Please note that the minimum version of CMake that is required by the build process is 3.12. Earlier versions of CMake are not suitable.

If you use Ubuntu 20.04, all dependencies plus GNUplot can simply be installed as follows:

  1. sudo apt-get install git
  2. sudo apt-get install cmake
  3. sudo apt-get install gfortran
  4. sudo apt-get install g++
  5. sudo apt-get install libboost-dev
  6. sudo apt-get install libboost-system-dev
  7. sudo apt-get install coinor-libipopt-dev
  8. sudo apt-get install libcolpack-dev
  9. sudo apt-get install libadolc-dev
  10. sudo apt-get install gnuplot
  11. sudo apt-get install libeigen3-dev
  12. sudo apt-get install libblas-dev
  13. sudo apt-get install liblapack-dev

Please note that a runtime error related to the adolc library is currently reported when executing PSOPT under Ubuntu 22.04 if the above instructions are followed. To avoid this, you can follow the special instructions given here for Ubuntu 22.04.

If you use Debian 11.4.0, all dependencies plus GNUplot can simply be installed as follows:

  1. su
  2. apt-get install git
  3. apt-get install cmake
  4. apt-get install gfortran
  5. apt-get install g++
  6. apt-get install libboost-dev
  7. apt-get install libboost-system-dev
  8. apt-get install coinor-libipopt-dev
  9. apt-get install libcolpack-dev
  10. apt-get install libadolc-dev
  11. apt-get install gnuplot
  12. apt-get install libeigen3-dev
  13. apt-get install libblas-dev
  14. apt-get install liblapack-dev

If you use OpenSuse Leap 15.4, all dependencies plus GNUplot can be installed as follows:

  1. sudo zypper install git
  2. sudo zypper install gnuplot
  3. sudo zypper install libboost_system1_66_0-devel
  4. sudo zypper install eigen3-devel
  5. sudo zypper install ColPack-devel
  6. sudo zypper install adolc-devel
  7. sudo zypper install blas-devel
  8. sudo zypper install lapack-devel
  9. sudo zypper ar -f https://download.opensuse.org/repositories/science/15.4/ science
  10. sudo zypper install Ipopt-devel
  11. sudo zypper install cmake
  12. sudo zypper install gcc-c++

If you use Arch Linux 2022.08.05 or Manjaro 21.3.7, all dependencies plus GNUplot can be installed as follows:

  1. sudo pacman -Syu
  2. sudo pacman -S git base-devel
  3. sudo pacman -S cmake
  4. sudo pacman -S gnuplot
  5. sudo pacman -S eigen
  6. sudo pacman -S boost
  7. sudo pacman -S blas
  8. sudo pacman -S lapack
  9. sudo pacman -S yay
  10. yay -S coin-or-ipopt
  11. yay -S colpack
  12. yay -S adol-c

After installation of dependencies, a typical PSOPT build and installation on a suitable version of Linux (such as Ubuntu 20.04, Debian 11.4.0 or OpenSUSE Leap 15.4, Arch Linux 2022.08.05 or Manjaro 21.3.7), or other Unix-like operating system, follows the steps given below (please see the PDF documentation for futher details):

  1. git clone https://github.com/PSOPT/psopt.git
  2. cd psopt; mkdir build; cd build
  3. cmake -DBUILD_EXAMPLES=ON ..
  4. make
  5. sudo make install

Note that the executable code for the examples is built inside the folder psopt/build/examples. For example, you can run the 'launch' example, by entering the following commands, after the installation.

  1. cd ./examples/launch
  2. ./launch

Getting help

  • PSOPT Documentation with installation instructions, background theory, examples and much more
  • Issue tracking system: If you believe you found a bug in the code, please use the issue tracking system. Please include as much information as possible, and if possible some example code so that we can reproduce the error.
  • Mailing list: subscribe to receive notifications about updates and to post questions and comments about PSOPT.

Please acknowledge this work

This software is provided for free in the hope that it may be useful to others, and we would very much like to hear about your experience with it. If you find PSOPT helpful for your work or research, please emai the author at v.m.becerra@ieee.org to incorporate a feature on the PSOPT web page.

Given that a great deal of time and effort has gone into PSOPT's development, please cite the following publication if you are using PSOPT for your own research:

BibTex entry:

        @INPROCEEDINGS{5612676,  
        author={V. M. Becerra},  
        booktitle={2010 IEEE International Symposium on Computer-Aided Control System Design},          
        title={Solving complex optimal control problems at no cost with PSOPT},   
        year={2010},    
        pages={1391-1396},  
        doi={10.1109/CACSD.2010.5612676}}