linear inequality constrains based on absolute values

Please help me to define the inequality constrains for quadprog in the below scenario
x+y <= 0.1*abs(x)
x+y >= -0.1*abs(x)

 採用された回答

Matt J
Matt J 2022 年 10 月 6 日
編集済み: Matt J 2022 年 10 月 6 日

0 投票

The constraints correspond to a non-convex region in (as Walter's second plot shows). You would have to break it into two regions and optimize over each one separately:
Region 1:
x<=0
x+y <= 0.1*(-x)
x+y >= -0.1*(-x)
Region 2:
x>=0
x+y <= 0.1*(x)
x+y >= -0.1*(x)

3 件のコメント

D D
D D 2022 年 10 月 7 日
編集済み: D D 2022 年 10 月 7 日
Thank You.. I am thinking of solving for 2 regions seperately and took the best solution from that.. Could you please suggest, if there is any good method to find the best solution out of two.
Torsten
Torsten 2022 年 10 月 7 日
The one that gives the lowest value of the objective, I guess.
help min
Walter Roberson
Walter Roberson 2022 年 10 月 7 日
There is no point which is not in one of the regions or the other, so solving separately and looking for the best between the two is going to get you the same result as if you had no constraint.
It would make more sense if the conditions were "and" and you processed the intersection of the constraints in two pieces, one for negative x and the other for non-negative x, and took the best between the two of those.

サインインしてコメントする。

その他の回答 (1 件)

Walter Roberson
Walter Roberson 2022 年 10 月 6 日

0 投票

x = linspace(-0.005, 0.005, 100);
y = linspace(-0.005, 0.005, 101).';
M1 = x + y <= 0.1*abs(x);
M2 = x + y >= -0.1*abs(x);
[r1, c1] = find(M1);
[r2, c2] = find(M2);
plot(x(c1), y(r1), 'k.', x(c2), y(r2), 'ro');
As you can see from the plot, there is nowhere which is not part of one of the regions or the other, so nothing is constrained out.
Matters would be different if the constraints were "and".
x = linspace(-0.0003, 0.0003, 1000);
y = linspace(-0.0003, 0.0003, 1001).';
M1 = x + y <= 0.1*abs(x);
M2 = x + y >= -0.1*abs(x);
[r1, c1] = find(M1 & M2);
plot(x(c1), y(r1), 'k.');
I think the small gap is a matter of resolution.

カテゴリ

質問済み:

D D
2022 年 10 月 6 日

コメント済み:

2022 年 10 月 7 日

Community Treasure Hunt

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

Start Hunting!

Translated by