Skip to main content

define a deterministic set of feasible solutions

Answered

Comments

3 comments

  • Official comment
    Simranjit Kaur
    Gurobi Staff Gurobi Staff
    This post is more than three years old. Some information may not be up to date. For current information, please check the Gurobi Documentation or Knowledge Base. If you need more help, please create a new post in the community forum. Or why not try our AI Gurobot?.
  • 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

Post is closed for comments.