Skip to main content

define a deterministic set of feasible solutions

Answered

Comments

2 comments

  • Eli Towle
    Gurobi Staff Gurobi Staff

    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
  • David Mejía
    Gurobi-versary
    Conversationalist
    Curious

    Thank you so much for the advice, it worked out perfectly.

    David

    0

Please sign in to leave a comment.