How to include an exponent function in an indicator constraint
AnsweredHi,
Now I want to model the relationship as followed:
if x==1: y=x^-0.5; if x==0: y=0
I have used addGenConstrPow(x,y,-0.5) to model function y=x^-0.5, and used addGenConstrIndicator() function to model whether x equals 1. If someone have ideas on how to combine addGenConstrPow() into addGenConstrIndicator()?
Thanks in advanced.
Best regards
0
-
Official comment
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. -
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 -
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.
Comments
3 comments