How to set the sum of the absolute value of variables as inequality matrix and vector in linear programming?

I am trying to solve a linear program with command "linprog". The inequality constrains has a sum of varaibles. e.g. I have 3 variable. x1,x2,x3.
The constrain should be like "abs(x1)+abs(x2)+abs(x3)<=2";
How to set this constrains in matlab?
I had read the link of two variables problem. But I can't figure out the rule of it. I can't derive the 3 case from it, either. Could anyone give me some suggestions? That will be very appreciated.

 채택된 답변

You can intruduce slack variables y1, y2, y3
x1 <= y1 and x1 >= -y1
x2 <= y2 and x2 >= -y2
x3 <= y3 and x3 >= -y3
y1+y2+y3 <= 2
Formulate your LP with
X:=[x1,x2,x3,y1,y2,y3]'
and the above constraints

추가 답변 (0개)

카테고리

도움말 센터 및 File Exchange에서 Linear Programming and Mixed-Integer Linear Programming에 대해 자세히 알아보기

제품

릴리스

R2019a

질문:

2020년 8월 18일

답변:

2020년 8월 18일

Community Treasure Hunt

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

Start Hunting!

Translated by