MATLAB Answers

Linear programming with conditional constraints

37 views (last 30 days)
Blenda Moreira
Blenda Moreira on 14 Dec 2020
Answered: Blenda Moreira on 16 Dec 2020
Hello,
I'm trying to figure out a way to formulate a linear program to solve an optimization problem with the following constraints:
x1 = 10*e1 if e1>=0
x1 = 0,1*e1 if e1<0
x1 and e1 are variables of the problem.
All the other constraints are regular linear expressions.
Is it possible to model with a linear programming solution?
Is it possible to solve using linprog or intlinprog? If so, how can I do this?
Thanks

  0 Comments

Sign in to comment.

Answers (2)

Alan Weiss
Alan Weiss on 15 Dec 2020
I think that you can do this with mixed-integer linear programming. Create auxiliary binary variables y1 and y2. These variables track whether e1 is positive or not. Assume that M is an upper bound on abs(e1). Include the constraints
e1 <= M*y1; % This enforces y1 = 1 whenever e1 > 0
e1 + M*y2 >= 0; % This enforces y2 = 1 whenever e1 < 0
y1 + y2 = 1;
So now you have y1 as the indicator that e1 > 0 and y2 as the indicator that e1 < 0.
I am not sure at this point how to include y1 and y2 into your problem formulation, but maybe you can figure it out from here.
Good luck,
Alan Weiss
MATLAB mathematical toolbox documentation

  0 Comments

Sign in to comment.


Blenda Moreira
Blenda Moreira on 16 Dec 2020
It looks like a good way out!
I'll try to formulate from there and I'll let you know if it works.
Thanks a lot

  0 Comments

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!