\$title 'SELKIE test suite' (SELKIE02,SEQ=758) \$ontext A GNEP (generalized Nash equilibrium problem) instance from the Appendix of Penalty methods for the solution of generalized Nash equilibrium problems (with complete test problems), Francisco Facchinei and Christian Kanzow. This is the A13 example in the Appendix of the paper. Contributor: Youngdae Kim (10.26.2016) \$offtext \$if not set TESTTOL \$set TESTTOL 1e-4 scalar tol / %TESTTOL% /; file opt / 'selkie.opt' /; file info / '%emp.info%' /; sets i / 1*3 / m / 1*2 / ; alias(i,j); parameters K(m) / 1 100, 2 100 / d1 / 3 / d2 / 0.01 / e(i) / 1 0.5, 2 0.25, 3 0.75 /; table c(m,i) 1 2 3 1 0.1 0.12 0.15 2 0.01 0.05 0.01; table u(i,m) 1 2 1 6.5 4.583 2 5.0 6.250 3 5.5 3.750; variables obj(i); positive variables x(i); equations objdef(i) cons(m) ; objdef(i).. obj(i) =E= (c('1',i) + c('2',i)*x(i))*x(i) - (d1 - d2*sum(j, x(j)))*x(i); cons(m).. sum(i, u(i,m)*e(i)*x(i)) =L= K(m); model m_shared / objdef, cons /; put info 'equilibrium' /; loop(i, put 'min', obj(i), x(i), objdef(i), 'cons' /; ); putclose; option emp = selkie; solve m_shared using emp; abort\$[ abs(x.l('1') - 30.7692) > tol ] 'bad x.l("1")', x.l; abort\$[ abs(x.l('2')) > tol ] 'bad x.l("2")', x.l; abort\$[ abs(x.l('3')) > tol ] 'bad x.l("3")', x.l; abort\$[ abs(cons.m('1') + 0.6163) > tol ] 'bad cons.m("1")', cons.m; abort\$[ abs(cons.m('2')) > tol ] 'bad cons.m("2")', cons.m; \$onecho > agent1_gms Variables x1,x4,x5,x6; Positive Variables x4,x5,x6; Equations e1,e4,e5; e1.. -((0.1 + 0.01*x4)*x4 - (3 - 0.01*x4 - 0.01*x5 - 0.01*x6)*x4) + x1 =E= 0; e4.. 3.25*x4 + 1.25*x5 + 4.125*x6 =L= 100; e5.. 2.2915*x4 + 1.5625*x5 + 2.8125*x6 =L= 100; * fix levels belonging to other agents x5.fx = 0; x6.fx = 0; Model m / e1,e4,e5 /; Solve m using nlp minimizing x1; \$offecho execute 'cat agent1_gms > agent1.gms.want'; execute 'cat "%gams.scrdir%agent1.gms" > agent1.gms.got'; execute '=diff -bw agent1.gms.want agent1.gms.got'; abort\$errorlevel 'Files agent1.gms.want and agent1.gms.got differ'; \$onecho > agent2_gms Variables x2,x4,x5,x6; Positive Variables x4,x5,x6; Equations e2,e4,e5; e2.. -((0.12 + 0.05*x5)*x5 - (3 - 0.01*x4 - 0.01*x5 - 0.01*x6)*x5) + x2 =E= 0; e4.. 3.25*x4 + 1.25*x5 + 4.125*x6 =L= 100; e5.. 2.2915*x4 + 1.5625*x5 + 2.8125*x6 =L= 100; * fix levels belonging to other agents x4.fx = 0; x6.fx = 0; Model m / e2,e4,e5 /; Solve m using nlp minimizing x2; \$offecho execute 'cat agent2_gms > agent2.gms.want'; execute 'cat "%gams.scrdir%agent2.gms" > agent2.gms.got'; execute '=diff -bw agent2.gms.want agent2.gms.got'; abort\$errorlevel 'Files agent2.gms.want and agent2.gms.got differ'; \$onecho > agent3_gms Variables x3,x4,x5,x6; Positive Variables x4,x5,x6; Equations e3,e4,e5; e3.. -((0.15 + 0.01*x6)*x6 - (3 - 0.01*x4 - 0.01*x5 - 0.01*x6)*x6) + x3 =E= 0; e4.. 3.25*x4 + 1.25*x5 + 4.125*x6 =L= 100; e5.. 2.2915*x4 + 1.5625*x5 + 2.8125*x6 =L= 100; * fix levels belonging to other agents x4.fx = 0; x5.fx = 0; Model m / e3,e4,e5 /; Solve m using nlp minimizing x3; \$offecho execute 'cat agent3_gms > agent3.gms.want'; execute 'cat "%gams.scrdir%agent3.gms" > agent3.gms.got'; execute '=diff -bw agent3.gms.want agent3.gms.got'; abort\$errorlevel 'Files agent3.gms.want and agent3.gms.got differ'; * Test the model without writing agent's problem into a file. putclose opt 'write_agent_model no'; m_shared.optfile = 1; obj.l(i) = 0; x.l(i) = 0; cons.m(m) = 0; solve m_shared using emp; abort\$[ abs(x.l('1') - 30.7692) > tol ] 'bad x.l("1")', x.l; abort\$[ abs(x.l('2')) > tol ] 'bad x.l("2")', x.l; abort\$[ abs(x.l('3')) > tol ] 'bad x.l("3")', x.l; abort\$[ abs(cons.m('1') + 0.6163) > tol ] 'bad cons.m("1")', cons.m; abort\$[ abs(cons.m('2')) > tol ] 'bad cons.m("2")', cons.m;