vi_mcp.gms : Identical models specified using MCP and VI syntax

Description

Demonstrate that a RVI (rectangular VI) is equivalent to MCP

Contributor: Steven Dirkse, August 2013


Small Model of Type : VI


Category : GAMS EMP library


Main file : vi_mcp.gms   includes :  qpdata.inc [html]

$title Identical models specified using MCP and VI syntax (VI_MCP,SEQ=98)

$onText

Demonstrate that a RVI (rectangular VI) is equivalent to MCP

Contributor: Steven Dirkse, August 2013

$offText

$include qpdata.inc

* ----------- STEP 0: solve QP as a QP
* solve
*   min   1/2 xQx + cx
*   s.t.  Ax >= b
*           x >=0

option nlp = conopt;
solve mqp using nlp min z;
abort$[mqp.solvestat <> %solveStat.normalCompletion%] 'mqp not solved', mqp.solvestat;
abort$[mqp.modelstat  > %modelStat.locallyOptimal%] 'mqp not solved', mqp.modelstat;


* ----------- STEP 1: formulate KKT conditions of the QP using MCP -----------
positive variable u(i);
equation dLdx(j);
dLdx(j) .. sum{jj, Q(j,jj)*x(jj)} + c(j) - sum{i, u(i)*A(i,j)} =N= 0;

model kkt / dLdx.x, g.u /;

file pathopt / 'path.opt' /;
putclose pathopt 'preprocess no'
               / 'crash_iteration_limit 0'
               / 'major_iteration_limit 0'
               /;
kkt.optfile = 1;
u.l(i) = g.m(i);
solve kkt using mcp;
abort$[kkt.solvestat <> %solveStat.normalCompletion%] 'kkt not solved', kkt.solvestat;
abort$[kkt.modelstat <> %modelStat.optimal%] 'kkt not solved', kkt.modelstat;
abort$[kkt.iterusd <> 0]  'expected to start at a solution', kkt.iterusd;

file copt / 'convert.opt' /;
putclose copt 'gams mcpScalar.gms'
            / 'dict mcpDict.txt'
            /;
option mcp=convert;
solve kkt using mcp;
option mcp=default;


* ----------- STEP 2: formulate the MCP from step 1 using VI -----------
* an MCP(F,B) (where B is the box [L,U]) is identical to VI(F,B)

model vi / dLdx, g /;

file jopt / 'jams.opt' /;
putclose jopt 'fileName viScalar.gms'
            / 'dict viDict.txt'
            /;

file empinfo / '%emp.info%' /;
putclose empinfo 'VI dLdx x  g u' / ;

vi.optfile = 1;
solve vi using emp;
abort$[vi.solvestat <> %solveStat.normalCompletion%] 'VI not solved', vi.solvestat;
abort$[vi.iterusd <> 0]  'expected to start at a solution', vi.iterusd;


execute 'rm -f path.opt convert.opt mcpScalar.??? mcpDict.txt'
execute 'rm -f jams.opt viScalar.??? vi?calarpf.pf viDict.txt empinfo.txt'