Skip to content

nosnoc/nosnoc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

280 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

nosnoc

Tests Documentation License MATLAB Python package

nosnoc is an open-source MATLAB software package for NOnSmooth Numerical Optimal Control and Model Predictive Control of hybrid and nonsmooth dynamical systems.

For a quick start, we recommend browsing the examples.

For Python users we have nosnoc_py.

TL;DR

nosnoc is about:

  • optimal control and MPC for hybrid and nonsmooth systems
  • FESD discretization with accurate event handling and sensitivities
  • time-freezing reformulations for systems with state jumps
  • real-time MPC algorithms for hybrid systems, and fast MPC via CCOpt
  • extensive MATLAB example library

General

nosnoc is a software framework for numerical optimal control and model predictive control (MPC) of hybrid and nonsmooth dynamical systems, including systems with switching, state jumps, impacts, hysteresis, and complementarity structure.

Its main capabilities include:

  1. Real-time MPC algorithms for hybrid systems

    • hybrid real-time iterations (HyRTI)
    • hybrid advanced-step controller (HyASC)
    • hybrid advanced-step real-time iteration (HyAS-RTI)

    Fast MPC in nosnoc uses CCOpt, which is currently our fastest and most robust solver, especially suited for MPC applications. For getting started, see: MPC examples.

  2. Automatic discretization via FESD (Finite Elements with Switch Detection)

    • high accuracy and correct sensitivities
    • superior treatment of switching events compared to classical time-stepping methods
  3. Automatic reformulations of systems with state jumps

    • for example, contact problems via time-freezing
    • reformulation into Filippov / piecewise smooth / complementarity-based models
    • accurate treatment of jumps and mode transitions
  4. Homotopy-based and active-set solutions of mathematical programs with complementarity constraints

    • multiple relaxation-based algorithms for MPCCs (mpccsol, CCOpt)
    • active-set-based methods (mpecopt)
    • compatibility with off-the-shelf NLP solvers such as IPOPT, and SNOPT

With nosnoc, users can formulate and solve problems involving:

  • switched systems
  • rigid body models with impacts and friction (also with time-freezing)
  • piecewise affine and piecewise smooth systems
  • Filippov systems
  • systems with logical Heaviside step functions
  • relay systems
  • projected dynamical systems
  • first-order sweeping processes
  • hybrid systems with hysteresis

See our example library for a range of optimal control and MPC examples.

Users may either provide a dynamic complementarity system (DCS) directly, or formulate the problem in a standard form that is automatically reformulated into a DCS. nosnoc then discretizes the resulting model with FESD and solves the resulting MPCC/NLP.

Installation

nosnoc requires:

Installation for MATLAB

  1. Install CasADi and make sure it is on your MATLAB path.

  2. Clone this repository:

git clone --recursive https://github.com/nosnoc/nosnoc.git
  1. Open the nosnoc folder in MATLAB and run:
install_nosnoc

Installation for Python

For Python support, see the nosnoc_py repository.

Dependencies

Core dependency

  • CasADi for symbolic modeling and derivative generation
  • IPOPT is shipped with CasADi. More information is available on the IPOPT homepage.

Recommended dependency for fast MPC and Simulation πŸš€

For high-performance MPC and fastest simulation performance, nosnoc supports CCOpt:

CCOpt is used by the fast MPC functionality in nosnoc and is currently our fastest and most robust option.

We are currently in the process of upstreaming CCOpt support into the next release of CasADi, however this is not yet complete. As such please use the ap/ccopt branch of CasADi found in this fork. This requires building CasADi from source with the CMake flags -DWITH_CCOPT=ON -DWITH_BUILD_CCOPT=ON, as well as running MATLAB with some additional environment variables. For details please visit the README for libMad, the ahead-of-time compiled library containing both MadNLP and CCOpt.

Using nosnoc

The interface of nosnoc is based on the symbolic modeling framework CasADi.
User inputs should therefore be provided as CasADi expressions.

To get started, browse the example library.

Citing nosnoc πŸ“„

If you use nosnoc in research, please cite the software paper:

@article{Nurkanovic2022,
  title={nosnoc: A software package for numerical optimal control of nonsmooth systems},
  author={Nurkanovi{\'c}, Armin and Diehl, Moritz},
  journal={IEEE Control Systems Letters},
  volume={6},
  pages={3110--3115},
  year={2022},
  publisher={IEEE}
}

Further reading and citations πŸ“„πŸ’»

Depending on which features of nosnoc you use, please also cite the corresponding algorithmic or software papers.

Real-time MPC algorithms

Related software

Finite Elements with Switch Detection

Matheamtical programs with complementarity constraints

Projected dynamical systems

Time-freezing

Contact

Questions, remarks, bug reports, and feature requests are best submitted via a new issue in this repository.

Main developers:

Success stories and source code contributions are very welcome.

Packages

 
 
 

Contributors

Languages