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

two side condition with binary

回答済み

コメント

2件のコメント

  • 正式なコメント
    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 Haung,

    Assuming X can only take non-negative values, you can model the condition "if 0<=X<=5, then x_in_grid==1" with the following constraints:

    X <= 5 + M*(1-x_in_grid)
    X >= 6*(1-x_in_grid)

    If X <= 5, x_in_grid will have to take value 1, as otherwise, the second constraint above will cause an infeasibility.

    Best regards,
    Simran

    0

投稿コメントは受け付けていません。