メインコンテンツへスキップ

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

回答済み

コメント

1件のコメント

  • 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

サインインしてコメントを残してください。