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
-
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
Please sign in to leave a comment.
Comments
2 comments