nosnoc is an open source Python software package for NOnSmooth Numerical Optimal Control.
A detailed overview of the theory and methods behind NOSNOC can be found in the course material of the Summer School on Direct Methods for Optimal Control of Nonsmooth Systems.
It is a structured reimplementation of the Matlab package NOSNOC (https://github.com/nurkanovic/nosnoc), but does not support all features in there (yet). Most importantly, time freezing is not implemented yet.
It implements the FESD (Finite elements with switch detection) method, which allows one to handle nonsmooth ODE systems accurately in simulation and optimal control problems.
More information can be found in the NOSNOC package (https://github.com/nurkanovic/nosnoc).
nosnoc is now available on PyPI! As such you can pip install it as you would any other package.
- Setup virtual environment:
virtualenv env --python=python3
- Source environment:
source env/bin/activate
- Install
pip install nosnoc
In case you are developing the nosnoc package you can install the following optional dependency-groups:
docs, for building the docs:
pip install --group docs -e .
- In order to run tests you should install the testing requirements:
pip install --group test -e .
Note that for this you will need a sufficiently modern version of your python package manager (normally pip).
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}
}Depending on which features of nosnoc you use, please also cite the corresponding methodological papers.
@Article{Nurkanovic2026a,
Title = {Real-Time Algorithms for Model Predictive Control of Hybrid Dynamical Systems},
Author = {Nurkanovi{\'c}, Armin and Pozharskiy, Anton and Diehl, Moritz},
Journal = {arXiv preprint},
Year = {2026},
Url = {https://www.syscop.de/files/users/armin.nurkanovic/Nurkanovic2026a.pdf}
}@article{Nurkanovic2024,
title={Finite elements with switch detection for direct optimal control of nonsmooth systems},
author={Nurkanovi{\'c}, Armin and Sperl, Mario and Albrecht, Sebastian and Diehl, Moritz},
journal={Numerische Mathematik},
pages={1--48},
year={2024},
publisher={Springer}
}@article{Nurkanovic2024a,
title={Finite Elements with Switch Detection for numerical optimal control of nonsmooth dynamical systems with set-valued heaviside step functions},
author={Nurkanovi{\'c}, Armin and Pozharskiy, Anton and Frey, Jonathan and Diehl, Moritz},
journal={Nonlinear Analysis: Hybrid Systems},
volume={54},
pages={101518},
year={2024},
publisher={Elsevier}
}@article{Nurkanovic2021,
title={A Time-Freezing Approach for Numerical Optimal Control of Nonsmooth Differential Equations with State Jumps},
author={Nurkanovi{\'c}, Armin and Sartor, Thomas and Albrecht, Sebastian and Diehl, Moritz},
journal={IEEE Control Systems Letters},
year={2021}
}@article{Nurkanovic2023,
title={The Time-Freezing Reformulation for Numerical Optimal Control of Complementarity Lagrangian Systems with State Jumps},
author={Nurkanovi{\'c}, Armin and Albrecht, Sebastian and Brogliato, Bernard and Diehl, Moritz},
journal={Automatica},
volume={158},
pages={111295},
year={2023}
}@article{Nurkanovic2022a,
title={Continuous Optimization for Control of Hybrid Systems with Hysteresis via Time-Freezing},
author={Nurkanovi{\'c}, Armin and Diehl, Moritz},
journal={IEEE Control Systems Letters},
year={2022}
}@Article{Pozharskiy2026,
Title = {{CCO}pt: an Open-Source Solver for Large-Scale Mathematical Programs with Complementarity Constraints},
Author = {Pozharskiy, Anton and Pacaud, Fran{\c{c}}ois and Diehl, Moritz and Nurkanovi{\'c}, Armin},
Journal = {arXiv preprint},
Year = {2026},
Url = {https://www.syscop.de/files/users/armin.nurkanovic/Pozharskiy2026.pdf}
}- Finite Elements with Switch Detection for Direct Optimal Control of Nonsmooth Systems
- Finite Elements with Switch Detection for numerical optimal control of nonsmooth dynamical systems with set-valued heaviside step functions
- First-Order Sweeping Processes and Extended Projected Dynamical Systems: Equivalence, Time-Discretization and Numerical Optimal Control
- Finite Elements with Switch Detection for Numerical Optimal Control of Projected Dynamical Systems
- A Time-Freezing Approach for Numerical Optimal Control of Nonsmooth Differential Equations with State Jumps
- The Time-Freezing Reformulation for Numerical Optimal Control of Complementarity Lagrangian Systems with State Jumps
- Continuous Optimization for Control of Hybrid Systems with Hysteresis via Time-Freezing
Questions, remarks, bug reports, and feature requests are best submitted via a new issue in this repository.
Main developers:
- Anton Pozharskiy — anton.pozharskiy@imtek.uni-freiburg.de
- Armin Nurkanović — armin.nurkanovic@imtek.uni-freiburg.de
- Jonathan Frey — jonathan.frey@imtek.uni-freiburg.de
Success stories and source code contributions are very welcome.