Quadprog solver not following constraints
Ältere Kommentare anzeigen
Hello!
I am working on a project where I use quadprog to solve an optimization problem for a model predictive controller (MPC). I am trying to apply very simple bounds to the optimization problem but it does not seem to be working.
Here is a snippet of my code:
for i =1:2*iC
lb(i,:)=-50000;
ub(i,:)=50000;
end
duf = quadprog(H,F,[],[],[],[],lb,ub);
The for loop ensures that lb and ub are the same size as duf. However, when I run the program, quadprog seems to simply ignore the constraints. Am I missing something simple? Thank you!
2 Kommentare
Nathan Batta
am 14 Sep. 2020
We need a description of what you actually see. What indications do you see that the bounds are not obeyed? How much larger is the violation than the ConstraintTolerance parameter? Also, please attach a .mat file containing H, F, lb, and ub so that we can run the optimization ourselves and try to reproduce your output.
Antworten (1)
Abdolkarim Mohammadi
am 2 Sep. 2020
Bearbeitet: Abdolkarim Mohammadi
am 2 Sep. 2020
Your bounds are the same for all of the variables, so they can be defined easier:
lb = -5e4 * ones(1,2*iC);
ub = 5e4 * ones(1,2*iC);
3 Kommentare
Nathan Batta
am 2 Sep. 2020
Abdolkarim Mohammadi
am 3 Sep. 2020
Have you tried increasing the MaxIterations option?
Nathan Batta
am 3 Sep. 2020
Kategorien
Mehr zu Controller Creation finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!