Skip to main content

Efficiently model set up binary variables between start and end time variables

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.
  • Simranjit Kaur
    • Gurobi Staff

    Hi Daniel,

    You can possibly use the binary variables start_binary[p, r] and end_binary[p, r] to model the definition of is_available[p,r] variable. Would something like the following work for you?

    is_available[p, r] = is_available[p-1, r] + start_binary[p, r] - end_binary[p, r]

    The is_available[p,r] variable remains 0 for all periods before the period when resource r is acquired. It becomes 1 in the period when start_binary[p, r] equals 1. Subsequently, it takes a value of 1 for all periods until the resource r is removed, which occurs when end_binary[p, r] equals 1. After that, it returns to 0 and remains 0 in subsequent periods.

    Best regards,

    Simran

    0

Post is closed for comments.