mpt_init
, why?
Q:
What is Receding Horizon Control (RHC)?
A:
In RHC, an optimal control problem is solved at each time step as a function of the current state to obtain an optimal sequence of inputs.
The length of the input sequence is determined by the prediction horizon. After obtaining the input vector,
only the first element of the sequence (i.e., u(0)) is applied to the system. At the subsequent time step, the state is measured
again and the procedure is repeated. This scheme corresponds to closed-loop control and is a way of approximating the infinite horizon solution by an
infinite sequence of finite time solutions. Note that RHC does not guarantee stability and feasibility without additional measures.
Q:
What is the difference between open-loop and closed-loop trajectories?
A:
The solution of the optimization problems considered here is an input vector of finite size. In open-loop, each of the inputs contained
in the vector are applied in succession, without remeasuring the state. The resulting trajectory contains only as many elements as the chosen prediction horizon
(i.e., length of the input vector). In closed-loop (or Receding Horizon Control), the state is remeasured at each time step, the
optimal input sequence is recomputed and only the first input element is applied.
Q:
I computed the
explicit solution using MPT toolbox, but when I click on some region
(mpt_plotTrajectory), it tells me that the solution does not
exist. What does it mean?
A:
The function mpt_plotTrajectory is used to display closed-loop trajectories
of system/controller combinations. The closed-loop trajectory is plotted by default (check
what is RHC and what is a closed-loop trajectory questions
for more details).
The most important property of RHC is that
feasibility (meaning that the control law exists) and stability (meaning that
the control law stabilizes the system) is not automatically guaranteed.
For instance, solution to a
constrained finite-time optimal control problem with linear cost objective
does not guarantee stability and feasibility for all time. This is most
probably also your case. To insure stability and feasibility for linear
time-invariant systems, use the 2-norm formulation (quadratic cost objective)
with terminal set constraint and calculate either the infinite-time solution by
setting
>> probStruct.N = Inf;
or the time-optimal solution which you will get if you specify
>> probStruct.subopt_lev = 1;
Alternatively, also the low-complexity controller obtained by
>> probStruct.subopt_lev = 2;
also guarantees stability and feasibility and stability for all time
instances.
For the Piece-Wise Affine case, any controller you obtain with MPT toolbox
is a stabilizing one and guarantees also feasibility.
Q:
The solution I get is too complicated (too many regions) and the
computation takes too long. What can I do?
A:
There is no easy answer to this one. There are a number of things you can try:
Q:
I'm trying to obtain a feedback controller for a problem I specified, but
the solution seems to be incorrect. I get several error messages when
exploring the state space.
A:
The algorithms are numerically sensitive. Try decreasing the step size
(e.g. mpt_options('step_size', 1e-6)) in the exploration procedure and try using different
QP/LP solvers. Also try solving the problem with different solvers (e.g.
Infinite-Time, Finite-Time, Minimum-Time, etc.). Some of them might succeed
where others fail. As a last option, you can set
>> mpt_options('debug_level', 2);
This will slow down computations but make the solution more robust. We are constantly working on improving numerical robustness and hope to resolve these issues in the future.
Q:
I specified a problem and I am now computing the Infinite Time /
Minimum-Time / Suboptimal Controller. The computation does not seem to
end... ever.
A:
The three algorithms above are iterative and not "naturally" bounded. If
your problem has very large constraints on certain states and/or the system
dynamics are very slow, it may take a VERY long time for an initial state to
reach a neighborhood of the origin. This in turn will require a lot of
iterations. Try solving a finite horizon problem instead.
Q:
I use your examples, but it takes very long to compute the solution, what
can I do?
A:
This is most probably caused by a slow LP solver. Computing a solution to a
given multi-parametric requires solving of many small linear programs. Thus
having a fast LP solver is the most crucial thing. We have good experience
with the CDD LP solver which comes along with MPT toolbox. For
higher-dimensional systems, NAG is the best option.
Q:
Which solvers does the toolbox support?
A:
Q:
I do have an LP/QP solver which is not among the supported solvers. Can I use it in the MPT
toolbox?
A:
Yes, you can, if the solver can solve LPs/QPs with both inequality and equality
constraints. To add your LP/QP solver to the list of supported solvers, a simple modification
of mpt_solveLP.m or mpt_solveQP.m is necessary. It is however
a good idea to contact us for more details.
Q:
Why should I not use Matlab's linprog LP solver?
A:
We have found linprog very unreliable for the kind of problems the toolbox
is solving. For instance, very often you will get an infeasible solution
from linprog for a given linear program, while the other solvers are able
to return a correct solution. Besides this fact, linprog is also very slow
comparing to other available solvers.
Q:
I don't have any quadratic programming (QP) solver, can I still use the
toolbox?
A:
Yes, you can. The computational geometry features of the MPT toolbox will
still be fully operational, but you will be able to solve only control
problems with linear cost objectives. In order to indicate that you do not
have any QP solver installed on your machine, locate the following line
in mpt_init.m :
mptOptions.qpsolver = 1;
and change it to:
mptOptions.qpsolver = -1;
or, on the Matlab's command prompt, type:
>> mpt_init('qpsolver',-1);
When computing the explicit solution for your system, be sure that you set
probStruct.norm = 1;
to enforce linear cost objective.
Q:
I'd like to change default values for global options, but I don't want to
manually edit mpt_init.m all the time. Is there a way how to change values
of the parameters directly from Matlab?
A:
Yes, there is such a possibility. Call mpt_init with auxiliary parameters,
like follows:
>> mpt_init('lpsolver',yourvalue,'debug_level',yourvalue, ...)
e.g.
>> mpt_init('qpsolver',1,'newfigure',1,'lpsolver',0);
Q:
How do I determine if a polytope is empty?
A:
Use the isfulldim function, as follows:
>> status = isfulldim(P); >> isemptypoly = ~status;
If isfulldim returns 0, the polytope is not full dimensional, i.e. empty.
Q:
I am flooded with textual outputs when using your toolbox, how can I suppress them?
A:
Set the verbose level to 0, for instance by typing
>> mpt_init('verbose', 0);
To make the change permanent, you can save the settings by running
>> mpt_init('verbose', 0, 'save')
Q:
Do I need to download cddlib in order to use the CDD LP solver?
A:
No, cddlib is already linked with the mex interface, so
there is no need to download it separately, unless you plan to
re-compile the interface.
Q:
How do I access internal data of a polytope, i.e. matrices Hx<=K ?
A:
Use the double command, as follows:
>> [H,K] = double(P);
Q:
Can I specify another point than the origin as the final state?
A:
This feature is called tracking and can be enabled by setting
probStruct.tracking = 1; probStruct.Tconstraint = 0;
in your problem definition structure. Now you can use tha standard command
ctrlStruct = mpt_control(sysStruct, probStruct)
to calculate the solution. You can test the resulting controller e.g. with mpt_plotTrajectory. Discuss the manual for more details.
Q:
How do I compute intersection points of two polytopes?
A:
Assume there are two polytope objects defined - P1 and P2. Intersection
of the two polytopes is computed as:
>> I = P1 & P2
and the intersection points are defined as extreme vertices of polytope I:
>> Vint = extreme(I)
Q:
I am running Unix version of Matlab. When I run mpt_demo2, the navigation
buttons disappear. Any help?
A:
This case happens only when a 3D figure is plotted in the slide-show window.
The buttons are still there, they are just not visible. Try to click on their
supposed location, they should appear again.
Q:
I use Matlab R12, some of the functions bother me with annoying
"Warning: Unrecognized OpenGL version, defaulting to 1.0." messages. Can I
switch them off?
A:
This behavior is a
known Matlab bug.
The only way how to suppress the warning messages
is to turn off warnings completely by typing
>> warning off
Q:
Matlab crashes when i run mpt_init
, why?
A:
This usually happens when you try to use a licensed solver (for
instance CPLEX, XPRESS, or MOSEK), but you don't have a valid license.
In such case the solver interface will try to print a warning
using mexErrMsgTxt
. Due to a
change in R14 API,
MEX files compiled with older release of Matlab will crash R14 on Linux if that function
is used.
If you hit this problem, search for occurense of following files and remove
them from your Matlab path if you are not in possession of a valid license:
cplexint.{dll|mexglx|mexsol|mexmac}
lp_cplex.{dll|mexglx|mexsol|mexmac}
qp_cplex.{dll|mexglx|mexsol|mexmac}
milp_cplex.{dll|mexglx|mexsol|mexmac}
miqp_cplex.{dll|mexglx|mexsol|mexmac}
lp_cplex.{dll|mexglx|mexsol|mexmac}
cplexmex.{dll|mexglx|mexsol|mexmac}
mexpress.{dll|mexglx|mexsol|mexmac}