Absolute value as a linear programming constraint?
12 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponses (1)
Matt J
le 22 Juin 2013
Modifié(e) : Matt J
le 22 Juin 2013
abs(x1+x2)<=1
is equivalent to the constraints
x1+x2<=1
-(x1+x2)<=1
5 commentaires
James Tursa
le 8 Avr 2020
Modifié(e) : James Tursa
le 8 Avr 2020
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
le 8 Avr 2020
Modifié(e) : Matt J
le 8 Avr 2020
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]
Voir également
Catégories
En savoir plus sur Solver Outputs and Iterative Display dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!