Use MPT3 and report bugs. We will be grateful for your feedback and will do our best to address your concerns and/or answer questions.
MPT2 was tuned for speed, which resulted in an incredibly messy code that was difficult to maintain and extend. Our goal for MPT3 was to have a code base which is sustainable in the long term, and hence contains a minimum of speed-hacks. We definitely plan to make MPT3 faster in the future.
One option to improve the speed of MPT3 is to employ external commercial solvers to solve the low-level optimization problems. In MPT3 we provide interfaces and support the following external optimization solvers:
If the external solver is available on the Matlab path, MPT3 will detect it automatically using the initialization script mpt_init
. The new solver will be assigned a higher priority and can be then used for computations.
When calling the initialization script mpt_init
, MPT3 searches for available solvers on the Matlab path and assigns them priorities according to our performance results on various tests cases. If you want to give preference to a different solver, one can use mptopt
class to handle the global MPT3 options. For instance, selecting LCP solver as default LP and QP solver is achieved by
In this example we set CDD as default LP solver and QUADPROG as default QP solver
When selecting the solver, one has to choose from the list of solvers that are available on the Matlab path. The list of available solvers is stored in mptopt
class:
Resetting to default values is achieved by calling mpt_init
script.
Yes. MPT3 contains a thin compatibility layer which will convert polytope
and mptctrl
objects of MPT2 to the new format.
polytope
object. Will my code work?It should thanks to the thin compatibility layer. If you experience problems, just let us know. However, you should start rewriting your algorithms in terms of the more powerful Polyhedron
object.
Polyhedron
class, which replaces polytope
from MPT2?P = Polyhedron(A, b)
to construct a polyhedron using a H-representation, and P = Polyhedron(V)
to construct it from vertices.
P.minHRep()
to perform redundancy elimination.
Polyhedron
object can also represent lower-dimensional polyhedra. To determine whether a polyhedron is empty (i.e., there is no point x \in P
), use the P.isEmptySet()
method. To determine whether a polyhedron is fully dimensional, use P.isFullDim()
.
mpt_control(sysStruct, probStruct)
in MPT3?Use the MPCController
class, see MigrationFromMPT2 and UI.Control.
mpt_import
complains that minimum-time setups cannot be automatically imported. How do I construct an explicit minimum-time controller in MPT3?Use ctrl = EMinTimeController(model)
to construct explicit minimum-time controllers.
p. (Notice that the correct method is fplot
, not plot
!)
We will assume that your explicit optimizer is stored in the optimizer
variable, which is an instance of the PolyUnion
class. Then:
Note that you can access the optimizer of an explicit MPC controller via explicit_controller.optimizer
.
We will assume that your explicit optimizer is stored in the optimizer
variable, which is an instance of the PolyUnion
class (for explicit MPC controllers the optimizer is available in controller.optimizer
). Then:
First, make sure you have a working mex compiler. Then run the following commands:
Afterwards, re-initialize MPT by running mpt_init
and all should work fine.