Skip to main content

How to model this kind of indicator constraint in Gurobipy?

Answered

Comments

3 comments

  • 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

Please sign in to leave a comment.