Hello Everyone,

I’m currently working on a bi-level optimization model that seems to behave strangely. Please find my equations below. I have set Bgt=30 and Cf=30. Therefore, per constraint 1 (con1), both et(i,j)=0 and ek(i,j)=0 for all eligible (i,j) pairs. This is what the solver selects. Then, per con8, con9 and con10, y(i,j) is free to be 0 or 1, which is what I expect. But for some strange reason, the solver refuses to select y(i,j)=1, it always sets y(i,j)=0. In fact, when I change the ‘=L=’ to ‘=E=’ in con9, which is a valid constraint, it claims the model is infeasible. I just cannot tell what is going on and would appreciate your help on this. I tried some of the methods here (https://www.gams.com/blog/2017/07/misbehaving-model-infeasible/), but nothing has worked so far. Please note that et(i,j), ek(i,j) and z(Ds) are binary variables that belong to the leader problem, whereas y(i,j) and all other variables belong to the follower. Also, con1 belongs to the leader, and because of its variables, con8 as well.

```
P.up(D,ph)$(Dph(D,ph)) = LoadData(D,ph,'Pmax');
P.lo(D,ph)$(Dph(D,ph)) = 0;
Pline.up(i,j,ph)$(Eph(i,j,ph)$(not Esph(i,j,ph))) = Vbase*F(i,j,ph,'Ampacity');
Pline.lo(i,j,ph)$(Eph(i,j,ph)$(not Esph(i,j,ph))) = -Vbase*F(i,j,ph,'Ampacity');
Pg.lo(src,ph) = 0;
con1.. Cf + sum(Ds, Cd(Ds)*(1-z(Ds))) + sum((i,j)$(Es(i,j)), Ce(i,j)*(et(i,j) + ek(i,j))) =L= Bgt;
con2(src,ph).. Pg(src,ph) =E= sum(j$(E(src,j) ), Pline(src,j,ph));
con3(D,ph)$(Dph(D,ph)).. P(D,ph) =E= sum(i$(Eph(i,D,ph)), Pline(i,D,ph)) - sum(j$(Eph(D,j,ph)), Pline(D,j,ph));
con4(i,j,ph)$(Esph(i,j,ph)).. Pline(i,j,ph) =L= s(i,j)*Vbase*F(i,j,ph,'Ampacity');
con5(i,j,ph)$(Esph(i,j,ph)).. Pline(i,j,ph) =G= -s(i,j)*Vbase*F(i,j,ph,'Ampacity');
con6(Ds,ph)$(Dsph(Ds,ph)).. P(Ds,ph) =L= z(Ds)*LoadData(Ds,ph,'Pmax');
con7(i,j,ph)$(Eph(i,j,ph)).. Pline(i,j,ph) =L= sum(src,Pg(src,ph));
con8(i,j)$(Es(i,j)).. ek(i,j) =L= 1 - et(i,j);
con9(i,j)$(Es(i,j)).. y(i,j) =L= 1 - et(i,j) - ek(i,j);
con10(i,j)$(Es(i,j)).. y(i,j)*(1-y(i,j)) =E= 0;
con11(i,j)$(Es(i,j)).. s(i,j) =E= et(i,j)*(1 - sc(i,j)) + ek(i,j)*sc(i,j) + y(i,j);
objIn.. OFin =E= sum((D,ph)$(Dph(D,ph)),P(D,ph));
objOut.. OFout =E= R * sum((D,ph)$(Dph(D,ph)), LoadData(D,ph,'Criticality')*(LoadData(D,ph,'Pmax') - P(D,ph)))
- (Cf + sum(Ds, Cd(Ds)*(1-z(Ds))) + sum((i,j)$(Es(i,j)), Ce(i,j)*(et(i,j) + ek(i,j))));
Model AttackerProblem /all/;
* For running on NEOS while in GAMS Studio
FILE info / ' ' /;
put_utility info 'ren' / gams.scrDir 'empinfo.' gams.ScrExt
PUTCLOSE info "bilevel et ek z max OFin * objin con2 con3 con4 con5 con6 con7 con9 con10 con11" /;
Solve AttackerProblem using EMP maximizing OFout;
```