0
$\begingroup$

I found this related question, but that's not quite it

Is it possible to model this with integer programming:

$$A = \begin{cases} 1 & \text{if } B \geq C \geq D \\ 0 & \text{otherwise}\end{cases}$$

where $A \in \{0,1\}$, $B, D \in \mathbb R$ and $C \in \mathbb N$. We have upper and lower bounds on $B$, $C$ and $D$.

$\endgroup$
  • $\begingroup$ Since you have upper bounds on B,C, and D, can you not use the technique you have linked twice? $A_1 = 1$ iff $B \geq C$, and $A_2 = 1$ iff $C \geq D$. Then $A = A_1\cdot A_2$. $\endgroup$ – MrHug Aug 16 '19 at 11:53
  • $\begingroup$ I can only have linear constraints, therefore it is not possible to calculate $A = A_1 * A_2$ $\endgroup$ – Dav Aug 16 '19 at 12:53
  • $\begingroup$ Then how about $A_1 + A_2 \geq 2$? $\endgroup$ – MrHug Aug 16 '19 at 13:15
  • $\begingroup$ You can implement any comparisons you like with big M trick. blog.adamfurmanek.pl/2015/09/12/ilp-part-4 $\endgroup$ – user1543037 Aug 16 '19 at 15:40
0
$\begingroup$

Thanks MrHug, I should have thought of this myself after your first hint.

after using the solution from here twice with the resulting binaries $A_1$ and $A_2$ we can form another problem: $$A = \begin{cases} 1 & \text{if } A_1+A_2 \geq 2 \\ 0 & \text{otherwise}\end{cases}$$

This one can be solved with a little hint from there:

$$A_1 + A_2 \geq 2 - M * (1-A) \\ 2 - \epsilon \geq A_1 + A_2 - M * A$$

where $M$ is a big value and $\epsilon$ is a very small value (above 0, below 1).

It's a bit unfortunate that so many variables are needed as $A$, $A_1$ and $A_2$ are cubic in my case. But I'm glad about this solution.

| cite | improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.