Absolute value as a linear programming constraint?

조회 수: 12 (최근 30일)
Mike Vukovich
Mike Vukovich 2013년 6월 21일
편집: Matt J 2020년 4월 8일
Suppose I want to use absolute values in a constraint equation for linear or mixed integer programming - i.e. suppose I need one of the form abs(x1) + abs(x2) <= 1.
How would I incorporate this in the constraint matrix in MATLAB?
  댓글 수: 2
Matt J
Matt J 2013년 6월 22일
There are no absolute value expressions in the example you've given.
Mike Vukovich
Mike Vukovich 2013년 6월 22일
Sorry, it was a typo... corrected.

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

답변 (1개)

Matt J
Matt J 2013년 6월 22일
편집: Matt J 2013년 6월 22일
abs(x1+x2)<=1
is equivalent to the constraints
x1+x2<=1
-(x1+x2)<=1
  댓글 수: 5
James Tursa
James Tursa 2020년 4월 8일
편집: James Tursa 2020년 4월 8일
Correct. This constraint abs(x1) + abs(x2) <= 1 is actually inside a diamond with vertices at (1,0), (0,1), (-1,0), and (0,-1). So there would be four inequality constraints involved for the four line segments, not just two.
Matt J
Matt J 2020년 4월 8일
편집: Matt J 2020년 4월 8일
The original question was how to code abs(x1)+abs(x2)<=1 as a constraint.
I suspect the original question was abs(x1+x2) and was later edited....
However, abs(x1) + abs(x2) <= 1 can be represented by 4 inequality constraints, as James says:
[1 1 * [x1;x2] <=[1;1;1;1]
1 -1
-1 1
-1 -1]

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

카테고리

Help CenterFile Exchange에서 Solver Outputs and Iterative Display에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by