jointc1.gms : Educational bilevel model

Description

This is an example that shows that upper level joint constraints
cannot simply be put into lower level model

First model
-----------
The lower level problem essentially requires y = -x which implies -x >= x
for the upper level problem. Since has a lower bound 1 this model is infeasible.

Second model
------------
The lower level problem essentially requires y = |x|. Since x and y are
minimized and x has a lower bound of 1 the solution is x = 1 = y.

Contributor: Michael Ferris, November 2009


Small Model of Type : BP


Category : GAMS EMP library


Main file : jointc1.gms

$title Educational bilevel model (JOINTC1, SEQ=22)

$onText

This is an example that shows that upper level joint constraints
cannot simply be put into lower level model

First model
-----------
The lower level problem essentially requires y = -x which implies -x >= x
for the upper level problem. Since has a lower bound 1 this model is infeasible.

Second model
------------
The lower level problem essentially requires y = |x|. Since x and y are
minimized and x has a lower bound of 1 the solution is x = 1 = y.

Contributor: Michael Ferris, November 2009

$offText

variables x, y;

equations upper, lower;
upper.. y =g= x;
lower.. y =g= -x;
model jc /all/;
x.lo = 1;

file fhandle /"%emp.info%"/;

*First model
putclose fhandle 'bilevel min y lower';
solve jc using emp min x;
* check that it is indeed infeasible
abort$(jc.solvestat <> %solveStat.normalCompletion%
       or ((jc.modelstat <> %modelStat.infeasible%)
           and (jc.modelstat <> %modelStat.locallyInfeasible%)) ) 'Wrong solution: 1st model';

*Reset initial values
x.l = 2;
y.l = 0;

*Second model
putclose fhandle 'bilevel min y upper lower';
solve jc using emp min x;
* check that solution is x = y = 1
abort$(jc.solvestat <> %solveStat.normalCompletion%
      or ((abs(x.l-1) > 1e-6) or (abs(y.l-1) > 1e-6)) )  'Wrong solution: 2nd model';