I'm trying to model an integer program whose integer variables may have multipe domains? For example, an integer variable x with range [10,30], [62,70]. How to build this constraint? Any ideas are welcomed and appreciated.
Asked
Active
Viewed 30 times
1
-
A crude solution would be to do it twice, one with $x\in[10,30]$ and one with $x\in[62,70]$. – durianice Apr 04 '23 at 16:37
2 Answers
3
You can try with this constraint
$10z + 62(1-z) \le x \le 30z + 70(1-z)$ where $z$ is a binary.
You may need other constraints that will determine which domain to use, there you need to use $z$.
Sutanu Majumdar
- 458
0
One possibility is to use a set of binary variables to enumerate the options. So you could write $$x=10z_1 + 11z_2 + \dots + 30z_{21} + 62z_{22} + \dots + 70z_{30}$$ together with $$z_1 + \dots + z_{30} = 1,$$ the $z_i$ being binary.
Another option is to use two integer variables and one binary variable. So $$x=x_1 + x_2,$$ $$10z \le x_1 \le 30z$$ and $$62(1-z) \le x_2 \le 70(1-z),$$ with $x_1$ and $x_2$ integer and $z$ binary
prubin
- 4,923