Do-mpc

Latest version: v4.6.4

Safety actively analyzes 630217 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 2 of 5

4.5.0

Major changes

Linear control
- Newly implemented class ``LinearModel``. The linear model can be created by:
- linearizing a regular (nonlinear) ``Model`` instance
- passing system matrices ``(A,B,C,D)``
- creating (linear) equations in ``LinearModel`` with the well known syntax used in ``Model``.
- Discretize a (continuous-time) ``LinearModel``.
- Setup the new discrete-time linear quadratic regulator (``LQR``) controller class

Data-based system identification with neural networks
- Use neural networks as system models in do-mpc
- ``ONNXConversion`` can convert a previously trained and stored neural network to a CasADi graph
- ONNX files can be exported from most major neural network frameworks (e.g. tensorflow, pytorch, matlab, ...)
- Some limitations to the neural network operations apply.

Minor changes

Compile NLP
- The ``MHE``, ``MPC`` classes can now export and compile the NLP.
- Compiled NLPs can be loaded and solved. This may result in faster optimization times.

Improved sampling tools for data generation
- Optional parameters in ``__init__`` of ``Sampler``, ``SamplingPlanner``, ``DataHandler`` that are passed to ``set_param``. This allows for a more concise setup.
- ``SamplingPlanner`` method ``product`` to create cartesian product (grid) of input variables to create test cases.

Simulator
- ``Simulator.make_step()`` can now be called without control input for autonomous systems.

Bug fixes
- Example files now import do-mpc relative path with ``os.path.join`` to yield a OS agnostic implementation.
- ``MHE`` class can now be created without estimating parameters.
- Solves visualization bug described in 340

Backend
- Significant code refactoring
- Many modules (e.g. ``controller.py``) were getting to large
- Individual files (e.g. ``_mpc.py``) in subfolder ``do_mpc/controller/`` for large classes
- User-facing classes (e.g. ``MPC``) imported in ``do_mpc/controller/__init__.py``.
- Imported such that ``do_mpc.controller.MPC`` still yields the ``MPC`` class
- No changes in front-end for users
- Recursive documentation with Sphinx / Readthedocs is fully automated now. Important considerations:
- Private files (marked as e.g. ``_mpc.py``) are not documented
- Imported modules are documented (e.g. the imported ``MPC`` class.
- Importing with ``from casadi import *`` could result in documentation of CasADi package in **do-mpc**. This is avoided by:
- Explicitly excluding certain packages (e.g. ``casadi``) to be documented.
- Marking functions or classes as private with ``_Name``.
- Using the ``__all__ = [...]`` variable to mark in certain files the list of elements that should be documented.

4.4.0

Major changes
- MHE/MPC bounds on optimiziation variables can now be changed after calling ``mhe.setup()`` and ``mpc.setup()`` respectively (fixes 289). The simplest way to set bounds is the ``mhe.bounds`` and ``mpc.bounds`` property ([docs](https://www.do-mpc.com/en/latest/api/do_mpc.controller.MPC.bounds.html))
- More granular control over the bounds is now possible, e.g. choosing different values for each time-step of the horizon or for different collocation points (if that makes sense). For this purpose two now properties ``lb_opt_x`` and ``ub_opt_x`` are now documented and accessible to the user. These properties are indexed similarly to the property [opt_x](https://www.do-mpc.com/en/latest/api/do_mpc.controller.MPC.opt_x.html). Importantly, setting new values on these structure automatically considers the scaling factors.
- The do-mpc model can now be pickled. Pickling is restricted, however and requires (error messages are thrown otherwise):
- the model class must be setup
- the model must use ``SX`` symbolic variables
- Enhanced warmstarting: The solver is now supplied with a guess for the dual variables

Minor changes
- Bug fix: [MPCData.prediction](https://www.do-mpc.com/en/latest/api/do_mpc.data.MPCData.prediction.html) was previously unable to query algebraic states ``_z``.
- Fixed 283: Algebraic states can now be plotted with the graphics package

4.3.5

Minor fixes
- Setup for release in v4.3.4 was incomplete.

4.3.4

Minor fixes

- ``model.aux`` can now be queried before calling ``model.setup()``
- Some typos in documentation

4.3.3

Major changes

- ``DataHandler`` class can now create ``post_processing_function`` considering inputs from the case-definition as created in the ``SamplingPlanner``.

Minor changes

- All cost terms that are continuously appended to are now initialised with value ``DM(0)``. If nothing is appended (i.e. the term is not active), this avoids unclear error messages. This should fix 214 and 86

Documentation

Minor fixes.

4.3.2

Major fixes

- Solved 215
- Hoping to solve 233

Page 2 of 5

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.