$title Bilevel model with MIN follower vs. VI follower (EMPBP05,SEQ=466) $onText This is a version of the model bard871 from the GAMS EMP Library Example from Chapter 8, example 8.7.1, page 358 John F. Bard, Practical Bilevel Optimization: Algorithms and Applications, Kluwer Academic Publishers, Dordrecht, 1998. Contributor: Jan-H. Jagla, December 2009 $offText *The reported solution is scalar x_l /11.25/ y_l / 5/ tol / 1e-3/; positive variables x,y; variables objout,objin; equations defout,defin,e1,e2; defout.. objout =e= 16*sqr(x) + 9*sqr(y); defin.. objin =e= power(x+y-20,4); e1.. -4*x + y =l= 0; e2.. 4*x + y =l= 50; model bard / all /; $echo bilevel x min objin * defin e2 > "%emp.info%" *Start from reported solution x.l = x_l ; y.l = y_l; solve bard us emp min objout; abort$( (abs(x.l - x_l ) > tol) or (abs(y.l - y_l ) > tol) ) 'Bard: Global solution not found'; abort$((bard.solvestat <> %solveStat.normalCompletion%) or (bard.modelstat <> %modelStat.locallyOptimal% )) 'Bard: Wrong status codes'; *Now solve with follower formulated as VI equations viin; viin.. 4*power(x+y-20,3) =N= 0; model bard_vi / defout,e1,e2,viin /; execute 'echo bilevel x vi viin y e2 > "%emp.info%"'; * Verify we get the same solution, but we cannot assume we get it * in zero iterations: reformulations do not always work that way solve bard_vi us emp min objout; abort$( (abs(x.l - x_l ) > tol) or (abs(y.l - y_l ) > tol) ) 'Bard_VI: Global solution not found'; abort$((bard.solvestat <> %solveStat.normalCompletion%) or (bard.modelstat <> %modelStat.locallyOptimal% )) 'Bard_VI: Wrong status codes';