define a deterministic set of feasible solutions
AnsweredHi,
How can I define a deterministic set of feasible solutions for a variable? For example the solver can only find a solution in the following set of solutions for the variable x: x ∈ {0.1,0.2,0.3,0.4,....}
Thanks

Hi David,
You can define a binary variable for each possible value of \( x \), then ensure exactly one binary variable is selected. For example:
$$\begin{align*} 0.1 z_1 + 0.2 z_2 + 0.3 z_3 + 0.4 z_4 &= x \\ \sum_{i=1}^4 z_i &= 1 \\ z &\in \{0,1\}^4.\end{align*}$$
In this specific case, since the feasible values of \( x \) form a linear sequence, you could set \( x \) based on the value of a general integer variable. E.g.:
$$\begin{align*} x &= 0.1 y \\ 1 \leq y &\leq 4 \\ y &\in \mathbb{Z}.\end{align*}$$
Eli
1 
Thank you so much for the advice, it worked out perfectly.
David
0
Please sign in to leave a comment.
Comments
2 comments