Hi everyone,
I am working on an MIP optimization problem where X is a positive variable with a lower bound of zero and no upper bound and B is a binary variable.
X{0,inf} and B{0,1}
I'm trying to formulate equations such that if X =E= 0 then B =E= 0, else B=E=1. I've bound B with the following constraint:
X =L= bigM * B */bigM is a value much larger than any expected value the model can choose based on other constraints/*
such that when X is greater than 0, B must equal 1. However, I'm completely lost as to how to formulate the second conditional equation so that when X equals 0, B must equal zero.
I've reviewed viewtopic.php?t=10286, but the equations don't force the binary variable to equal 0 when the lower bound is also equal to 0.
Any advice about how I can code this logical condition into my model would be greatly appreciate. Thank you for your help.
Greg
Conditional binary formulation for variable greater than 0
-
- User
- Posts: 118
- Joined: 7 years ago
- Location: Rosario - Argentina
Re: Conditional binary formulation for variable greater than 0
Hi, try this bigM reformulation
X =L= BbigM*B
if you propose a lower and upper bound you can use the following:
X =L= Xup*B
X =g= Xlo*B
best
X =L= BbigM*B
if you propose a lower and upper bound you can use the following:
X =L= Xup*B
X =g= Xlo*B
best
Re: Conditional binary formulation for variable greater than 0
Hi,
Thank you for your response. What I’m confused about in your proposed formulation is how it ensures that when X=0 that B is all =0. Isn’t it the case that when X=0 that B can equal either 0 or 1? Thanks again for your help!
Thank you for your response. What I’m confused about in your proposed formulation is how it ensures that when X=0 that B is all =0. Isn’t it the case that when X=0 that B can equal either 0 or 1? Thanks again for your help!
Re: Conditional binary formulation for variable greater than 0
Hi,
Thank you for your response. What I’m confused about in your proposed formulation is how it ensures that when X=0 that B is all =0. Isn’t it the case that when X=0 that B can equal either 0 or 1? Thanks again for your help!
Thank you for your response. What I’m confused about in your proposed formulation is how it ensures that when X=0 that B is all =0. Isn’t it the case that when X=0 that B can equal either 0 or 1? Thanks again for your help!
-
- User
- Posts: 118
- Joined: 7 years ago
- Location: Rosario - Argentina
Re: Conditional binary formulation for variable greater than 0
It's hard with a continuous variable. You can try putting a small lower bound
For example:
X =L= Xup*B
X =g= 1e-6*B
Hope this can help you
Best
For example:
X =L= Xup*B
X =g= 1e-6*B
Hope this can help you
Best