$title Compares manual and EMP-VI models (EMPVI02,SEQ=424)
$ontext
This model compares models generated by EMP with the corresponding
manually build models
Contributor: Steven Dirkse and Jan-H. Jagla , January 2009
$offtext
set I / 1 * 2 /;
positive variables x(I);
positive variable u;
equations f(I), g;
equation f2(I) 'MCP version of vi';
f(I).. ord(I) * x(I) =N= 0;
g.. sum {I, x(I)} =G= 1;
f2(I).. ord(I) * x(I) - u =N= 0;
model viMCP / f /;
model vi / f, g /;
file myinfo / "%emp.info%" /;
put myinfo '* complementarity pairs for both viMCP and vi';
putclose / 'vi f x';
model mcp1 'MCP version of viMCP' / f.x /;
model mcp2 'MCP version of vi' / f2.x, g.u /;
solve mcp1 using mcp;
viMCP.iterlim = 0;
solve viMCP using emp;
abort$[viMCP.objval > 1e-6] 'Input for model vi should be optimal, was not';
x.l(I) = 0;
solve mcp2 using mcp;
vi.iterlim = 0;
solve vi using emp;
abort$[vi.objval > 1e-6] 'Input for model vi should be optimal, was not';