Main /

- New geometric library, which supports unbounded and lower-dimensional polyhedra, among other things.
- Novel parametric optimization solver with improved numerical reliability.
- Reworked user interface which gives greater control over specifying MPC problems.

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

mptopt('lpsolver', 'LCP', 'qpsolver', 'LCP')

In this example we set CDD as default LP solver and QUADPROG as default QP solver

mptopt('lpsolver', 'CDD', 'qpsolver', 'QUADPROG')

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:

options = mptopt;

options.solvers_list

options.solvers_list

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?- The syntax is
`P = Polyhedron(A, b)`

to construct a polyhedron using a H-representation, and`P = Polyhedron(V)`

to construct it from vertices. - Redundant constraints are not removed by default. Use
`P.minHRep()`

to perform redundancy elimination. - The
`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.

expctrl.partition.plot()

expctrl.feedback.fplot()

expctrl.cost.fplot()

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:

F = {}; g = {};

A = {}; b = {};

for i = 1:optimizer.Num

F{i} = optimizer.Set(i).Functions('primal').F;

g{i} = optimizer.Set(i).Functions('primal').g;

A{i} = optimizer.Set(i).A;

b{i} = optimizer.Set(i).b;

end

A = {}; b = {};

for i = 1:optimizer.Num

F{i} = optimizer.Set(i).Functions('primal').F;

g{i} = optimizer.Set(i).Functions('primal').g;

A{i} = optimizer.Set(i).A;

b{i} = optimizer.Set(i).b;

end

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:

H = {}; F = {}; g = {};

A = {}; b = {};

for i = 1:optimizer.Num

if isa(optimizer.Set(i).Functions('obj'), 'QuadFunction')

H{i} = optimizer.Set(i).Functions('obj').H;

end

F{i} = optimizer.Set(i).Functions('obj').F;

g{i} = optimizer.Set(i).Functions('obj').g;

A{i} = optimizer.Set(i).A;

b{i} = optimizer.Set(i).b;

end

A = {}; b = {};

for i = 1:optimizer.Num

if isa(optimizer.Set(i).Functions('obj'), 'QuadFunction')

H{i} = optimizer.Set(i).Functions('obj').H;

end

F{i} = optimizer.Set(i).Functions('obj').F;

g{i} = optimizer.Set(i).Functions('obj').g;

A{i} = optimizer.Set(i).A;

b{i} = optimizer.Set(i).b;

end

First, make sure you have a working mex compiler. Then run the following commands:

cwd = pwd;

cd(fileparts(which('lcp')))

lcp_compile;

cd(cwd)

cd(fileparts(which('lcp')))

lcp_compile;

cd(cwd)

Afterwards, re-initialize MPT by running `mpt_init`

and all should work fine.