Skip to main content

How to include an exponent function in an indicator constraint

Answered

Comments

3 comments

  • Official comment
    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.
  • 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

    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

Post is closed for comments.