I posted a couple of weeks back asking how to force a variable to take a non-zero value. I have since managed to achieve this using additional constraints, however I am now wondering how to solve the following problem I'm having with my MILP model. Below, I would essentially like to include "if f2 = 0, qin = 0, qout = 0". I have included the relevant code and a short description below.
Code: Select all
Variable f2,qin,qout;
Positive variable pr,avgpi;
Equation avgflow,avgpconst,lpconst1,lpconst2;
AvgFlow(aij(a,gn,gm),t) ..
f2(a,gn,gm,t) =e= (qin(a,gn,gm,t)+qout(a,gn,gm,t))/2
;
AvgPConst(aij(a,gn,gm),t) ..
Avgpi(a,gn,gm,t) =e= (pr(gn,t)+Pr(gm,t))/2
;
LPConst1(aij(a,gn,gm),t) ..
m(a,gn,gm,t) =e= CLP(a,gn,gm)*AvgPi(a,gn,gm,t)
;
LPConst2(aij(a,gn,gm),t) ..
m(a,gn,gm,t) =e= m(a,gn,gm,t-1)$(ord(t)>1) + qin(a,gn,gm,t)-qout(a,gn,gm,t)
;
So, I'm looking to see if there is a way to constrain the variables qin, qout to only take values when f2 is nonzero. Or, in other words, constrain qin and qout to equal 0 when f2 equals 0. Any help would be greatly appreciated. Cheers!