Skip to main content

How to include an exponent function in an indicator constraint

Answered

Comments

2 comments

  • Yizhi ZHEN
    Gurobi-versary
    First Question
    First Comment

    Sorry I make a spelling mistake, the corrected should be

    if x!=0: y=x^-0.5; if x==0: y=0

    where x is a non-negative integer.

    Thanks.

    Best regards

    0
  • Riley Clement
    Gurobi Staff Gurobi Staff

    Hi Yizhi,

    You can do this with an auxiliary variable.

    Create a constraint for 

    aux=x^-0.5

    which always holds, then your indicator constraint becomes

    if x==1: y=aux; if x==0: y=0

    - Riley

    0

Please sign in to leave a comment.