Skip to main content

how to use value of a continuous variable as another variable's index?

Answered

Comments

2 comments

  • Official comment
    Simranjit Kaur
    • Gurobi Staff
    This post is more than two 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 try Gurobot, our chatbot interface offering instant, expert-level support.
  • Mario Ruthmair
    • Gurobi Staff

    Hi,

    Yes, variables as indices of other variables are not possible. Maybe you can reformulate your problem in a way to avoid this situation. But without knowing your problem, you might work with binary variables Y[i,k,t] for i in V, k in K, t in the domain of variable a_int[i,k]. Then,

    a_int[i,k] == sum_{t} t * Y[i,k,t]
    sum_{t} Y[i,k,t] == 1

    The continuous coordinate variables might also have another index, i.e., Z[i,k,t]. Together with the Y[i,k,t], you can ensure that only one Z[i,k,t] is non-zero:

    LB * Y[i,k,t] <= Z[i,k,t] <= UB * Y[i,k,t]
    X[t,k] = sum_{i} Z[i,k,t]

    Not sure if that works for your problem. Maybe you need more constraints to limit the number of non-zero 3-index variables.

    Best regards,
    Mario

    0

Post is closed for comments.