Soften hard constraints in MPC formulated as a QP-problem

7 Ansichten (letzte 30 Tage)
Ahmed Hatem
Ahmed Hatem am 12 Jun. 2018
Kommentiert: Ahmed Hatem am 12 Jun. 2018
I have problems introducing a slack variable to soften some constraints I have on the states. I use QUADPROG to solve the problem which is written in the form
min 0.5x'Hx
S.t Aeq*x = beq
lb <= x <=ub
The vector x contains 3 states z1, z2 and z3 as well as the the calculated control input u. For instance, for prediction horizon 1 the vector will have 4 rows, for prediction horizon 2 it will grow to 8 etc. Now I have constraints on the input varible which I put in the vectors lb and ub. Everything works fine until I introduce constraints on the states. These are hard inequality constraints. As expected the problem becomes infeasible so I would need to relax them. Therein lies the issue, I do not know how to modify the setup in order to incorporate a slack variable.
I understand that the state vector has to be expanded by adding an extra variable s => 0 preferably in the end. Consequently I have to increase the size of H by 1, so the last diagonal element will be the weight on the slack varible which of course should be heavily penalized. Now if I would like to soften the constraint on the first state z1 I need to modify the first entry in ub and lb by adding the slack variable s.
So far I have only modified H as mentioned above but I do not know how to continue with the vectors ub and lb, which I assume also have to be modified in some way.
Thank you in advance for any advice!

Antworten (2)

Anton Semechko
Anton Semechko am 12 Jun. 2018
You could try using 'fmincon' instead of 'quadprog', which would allow you to incorporate non-linear constraints on your state variables in terms of barrier functions.

Ahmed Hatem
Ahmed Hatem am 12 Jun. 2018
Anton,
thanks for your answer. Is it really necessary to use fmincon and nonlinear constraints? It seems like it will just complicate matters. I have experience with nonlinear models and solvers and usually the solver is slow and if it is able to find a solution it is often not global optimal. Furthermore, I want to keep the time to solve the problem down since I aim to implement this controller. This is the reason why I want to use linear models only.
  2 Kommentare
Anton Semechko
Anton Semechko am 12 Jun. 2018
You make a good point. Using 'fmincon' was a bad suggestion on my part. There is pretty good tutorial on YouTube explaining how to convert the inequality constraints into equality constraints with slack variables. I am not sure if that will help, as it is a something that may already be done internally when calling 'quadprog'.
Ahmed Hatem
Ahmed Hatem am 12 Jun. 2018
Well I already have a set of equality constraints defined by the matrix Aeq and the vector beq. I cannot really see how to combine those with the ones that arise once I convert the inequalities into equalities. I will basically end up with two different matrices Aeq and vectors beq. I hope there is a way I can solve this problem using the vectors ub and lb which I pass to QUADPROG.

Melden Sie sich an, um zu kommentieren.

Produkte


Version

R2018a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by