0

I have two binary integer variables, $\alpha_{ts,it}$ and $\alpha_{ts,gshp} \in \{0,1\} $, and two real variables $T_{it}$ and $T_{ts}$ which have known upper and lower bounds. How can I model $\alpha_{ts,it}=1$ if the following constraints are met:

  1. $T_{ts}\geqslant-7$
  2. $T_{it}\leqslant14$
  3. $T_{ts}-T_{it}\geqslant5$
  4. $\alpha_{ts,gshp}=0$
D.W.
  • 167,959
  • 22
  • 232
  • 500
SR89
  • 1
  • 1

2 Answers2

0

That’s the problem with ILP; it is NP-complete so times can explode.

A simple strategy is to solve and optimise a problem as an ordinary linear programming problem, get the solution, and check where your other rules are violated. For example if you find an optimal solution where x = 12.381 but x must be an integer, then you solve two problems, one with x <= 12 added, and one with x >= 13 added. (If you do this by hand you can also handle cases like “x must be the square of a prime”: Either x <= 9 or x >= 25).

In your case, you just solve ignoring your condition. If your condition is fulfilled, great. Otherwise you solve the problem once with a (ts, it) = 1 added, and once with a (ts, it) = 0 and (one of the four conditions is not met) added.

gnasher729
  • 32,238
  • 36
  • 56
0

I might have found a solution to my problem by using four auxiliary binary variables $\alpha_1$, $\alpha_2$, $\alpha_3$ and $\alpha_4$ $\epsilon\ \{0,1\} $. The constraints 1.-4. are rewritten using the big-M method.


Constraint 1

  • $T_{ts}\geqslant -7-M\cdot (1-\alpha_1)$
  • $T_{ts}\leqslant -7+M\cdot \alpha_1$

Constraint 2

  • $T_{it}\leqslant 15+M\cdot (1-\alpha_2)$
  • $T_{it}\geqslant 15-M\cdot \alpha_2$

Constraint 3

  • $T_{ts}-T_{it}+M\cdot (1-\alpha_3)\geqslant 5$
  • $T_{ts}-T_{it}-M\cdot \alpha_3\leqslant 5$

Constraint 4

  • $\alpha_{ts,it}=1-\alpha_{ts,gshp}$

Constraint 5

  • $\alpha_{ts,it}\geqslant \alpha_1+\alpha_2+\alpha_3+\alpha_4-3$
  • $\alpha_{ts,it}\leqslant \alpha_1$
  • $\alpha_{ts,it}\leqslant \alpha_2$
  • $\alpha_{ts,it}\leqslant \alpha_3$
  • $\alpha_{ts,it}\leqslant \alpha_4$

This might be a solution. Unfortunately computational time is exploding. Does someone know a less time-consuming workaround?

Best SR89

SR89
  • 1
  • 1