Quadprog solver not following constraints

조회 수: 7 (최근 30일)
Nathan Batta
Nathan Batta 2020년 9월 2일
편집: Matt J 2020년 9월 14일
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
Nathan Batta
Nathan Batta 2020년 9월 14일
It does follow bounds that are equal to zero though. So if either the upper or lower bound is zero, it will follow that constraint but nothing else
Matt J
Matt J 2020년 9월 14일
편집: Matt J 2020년 9월 14일
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.

댓글을 달려면 로그인하십시오.

답변 (1개)

Abdolkarim Mohammadi
Abdolkarim Mohammadi 2020년 9월 2일
편집: Abdolkarim Mohammadi 2020년 9월 2일
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
Abdolkarim Mohammadi
Abdolkarim Mohammadi 2020년 9월 3일
Have you tried increasing the MaxIterations option?
Nathan Batta
Nathan Batta 2020년 9월 3일
Yes. It didn't have any effect on the optimization

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Refinement에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by