MILP: constraints on absolute value of difference
7 views (last 30 days)
Show older comments
Hi everyone,
I am using intlinprog to solve an optimization problem where I have to define 24 real values P1, P2, .... P24 (zero or positive, limited by a real upper bound).
These P values are variables of the intlinprog (with other binary variables and other stack variables used for other purposes) and the optimizer can decide to keep the same value for consecutive instants or change (increase or decrease).
I need to implement constraints which define abs(Pi+1 - Pi) >= 1000, while keeping the possibility that Pi+1 can be also = Pi.
I have tried to implement 4 kind of constraints by binary variables b and big M, but it doesn't work. I copy here the structure.
it is clear that if bi = 1, first and second constraints cannot be respected at the same time.
Please help me to find a way:
I need the constraints to allow to have (Pi+1 = Pi) or (Pi+1~=Pi) with a limit on minimum delta in the second case.
Thanks a lot.
0 Comments
Answers (1)
Subhajyoti
on 17 Jul 2024
Edited: Subhajyoti
on 17 Jul 2024
Hello Chiara,
To efficiently solve the optimization, we can use a formulation that introduces auxiliary variables (say '') to manage the absolute value constraint. The auxiliary variables ‘’ represents the absolute difference ‘’. Also, using a large constant ‘M’ effectively turns off the constraints when ''.
Thus, for each ‘i’ from 1 to : ''.
This can be translated into the following constraints:
These constraints can be further broken down into simple conditions and can be separately handled, since '' are binary variables.
Case 1: ''
(i.e. '')
Case 2: ''
Upper Bound of :
Lower Bound of :
Note: The objective function ‘f’ will be an array of all ones, since we are minimizing the sum. Specifying ‘’ finds a feasible point without trying to minimize an objective function.
Refer to the following MathWorks Documentation to understand more about ‘intlinprog’.
Hope the above information is helpful.
0 Comments
See Also
Categories
Find more on Linear Programming and Mixed-Integer Linear Programming in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!