I'm using 'quadprog' in Simulink, but the 'boundary constraint' is invalid

조회 수: 1 (최근 30일)
任飞
任飞 2023년 5월 30일
댓글: 任飞 2023년 7월 4일
I'm using 'quadprog' in Simulink, but the 'boundary constraint' is invalid.
The output does not report error, but the output result exceeds the Ub I set, the maximum value exceeds 200.
This is part of my code, kesai is a 5*1 vector,I'm sure the dimension of the matrix is correct
H = 2*W + 2*yita*M'*Ww*M;
%%
f = -2*yita*M'*Ww*V;
A = [];
b=[];
Aeq = M;
beq = V;
lb = [-100,-100,-100,-100,-0.02];
ub = [200,200,200,200,0.02];
x0 = [0,0,0,0,0];
options = optimoptions('quadprog','Algorithm','active-set');
[kesai] = quadprog(H, f, A, b, Aeq, beq, lb, ub, x0, options);
  댓글 수: 5
Jon
Jon 2023년 5월 30일
Please provide (attach files as needed) a simple, stand alone, runnable example that will reproduce the problem.
Torsten
Torsten 2023년 5월 30일
I was wondering if there could be a conflict with the given constraint, causing the constraint to fail. If there is a conflict between constraints, will MATLAB report an error?
You should look at the exitflag from quadprog:
If exitflag = -2, e.g., the problem is classified as infeasible.

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

채택된 답변

Swaraj
Swaraj 2023년 6월 28일
Hi,
You can try out the following to debug your issue furthur.
You can use “quadprog” function which outputs the “exitflag” as one of its outputs.
Once you have the “exitflag” value, you can use the following table to find the exact issue.
For more details, you can go through the following documentation.
In order to investigate accurately and precisely, can you please give a standalone piece of code that will reproduce the issue.
Hope it helps!!
  댓글 수: 1
任飞
任飞 2023년 7월 4일
The ‘exitflag’ is -2 in nearly 50% of my simulation time.
Does this mean that there is no optimal solution for the quation constraints and boundary constraints?

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Quadratic Programming and Cone Programming에 대해 자세히 알아보기

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by