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

How to model this kind of indicator constraint in Gurobipy?

回答済み

コメント

4件のコメント

  • 正式なコメント
    Simranjit Kaur
    • 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?.
  • Daniel Espinoza

    Hi,

     

    You would need into basic parts the logic, for example:

    let b1 b2 b3 be binary variables

    m.addConstr((b1 == 1) >> (x>= 5))

    m.addConstr((b1 == 0) >> (x <= 5))

    m.addConstr((b2 == 1) >> (y <= 2))

    m.addConstr((b3 == 1) >> (z <= 3))

    m.addConstr(b1 = or_(b2,b3))

    1
  • Daniel Espinoza

    Small typo: m.addConstr( b1 == or_(b2,b3))

    1
  • jiangyuan NTXPPA
    • Gurobi-versary
    • First Comment
    • First Question

    Thank you. This way is available. I am wondering if there are other efficient ways so that I don't need to creat so many variables.

    0

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