vidualvar.gms : VI with dualvar specified for VI constraint

Description

Usually when we use the empinfo syntax

dualvar x e

it is for the case where e is a constraint in an optimization model,
and we want to use the dual multiplier e.m (aka x) in our algebra.
It is also possible to do this when e is a constraint in a VI, as we
show here.
This wasn't working in GAMS Distribution 24.1.1 and previous.

Contributor: Dirkse & Ferris, June 2013


Small Model of Type : VI


Category : GAMS EMP library


Main file : vidualvar.gms

$title VI with dualvar specified for VI constraint (VIDUALVAR,SEQ=96)

$onText

Usually when we use the empinfo syntax

dualvar x e

it is for the case where e is a constraint in an optimization model,
and we want to use the dual multiplier e.m (aka x) in our algebra.
It is also possible to do this when e is a constraint in a VI, as we
show here.
This wasn't working in GAMS Distribution 24.1.1 and previous.

Contributor: Dirkse & Ferris, June 2013

$offText


$onText
We'll specify a simple two-agent problem and then model it in EMP in
several different ways.

    min   v + w =: z
    s.t.  sqr(v) + 2*w >= 1  perp-to u >= 0
          v, w >= 0

    VI: F_y() := y - 4*u - 1 perp-to y free

To get a model with dualVar involving a constraint in a VI,
we will rewrite the min agent as a VI.
$offText

positive variables
  v  'belongs to min agent'
  w  'belongs to min agent'
  u  'equivalenced to g.m'
  ;
free variables
  y  'belongs to VI agent'
  z  'objective var'
  ;
equations
  defz  'objective def'
  g     'constraint for min agent'
  Fy    'VI function'
  Dv    'Lagrangian deriv wrt v'
  Dw    'Lagrangian deriv wrt w'
  Fv    'VI function in opt-as-VI'
  Fw    'VI function in opt-as-VI'
  ;

defz.. v+w =e= z;
g   .. sqrt(v+1) + 2*w =g= 2;
Fy  .. y =e= 4*u - 1;
Dv  .. 1  - (1/(v+1))*u =N= 0;
Dw  .. 1  - 2        *u =N= 0;
Fv  .. 1 =N= 0;
Fw  .. 1 =N= 0;

model opt 'min agent and VI agent' / defz, g, Fy /;
model vi  'VI agent and VI agent'  / Fv, Fw, g, Fy /;
model m   'explicit MCP'           / Dv.v, Dw.w, g.u, Fy.y /;

file jamsopt / 'jams.opt'/;
file empinfo / '%emp.info%' /;

putclose jamsopt
  'FileName mcpOpt.gms' /
  'Dict dictOpt.txt' /
*  'debug 2' /
  ;

putclose empinfo
'equilibrium' /
'  min z v w defz g' /
'  vi Fy y' /
'  dualvar u g' /
;

opt.optfile = 1;
opt.iterlim = 0;
defz.m = -1;
g.m = 0.5;
Fy.m = 1;
v.l = 0;
w.l = 0.5;
y.l = 1;
u.l = 0.5;
solve opt using emp;
abort$[opt.modelStat <> %modelStat.locallyOptimal%] 'Opt should solve OK in zero iters';
abort$[opt.solveStat <> %solveStat.normalCompletion%] 'Opt should solve OK in zero iters';


m.iterlim = 0;
solve m using mcp;
abort$[m.modelStat  > %modelStat.locallyOptimal%] 'm should solve OK in zero iters';
abort$[m.solveStat <> %solveStat.normalCompletion%] 'm should solve OK in zero iters';


putclose jamsopt
  'FileName mcpVI.gms' /
  'Dict dictVI.txt' /
*  'debug 2' /
  ;
putclose empinfo
'equilibrium' /
'  vi Fv v  Fw w  g' /
'  vi Fy y' /
'  dualvar u g' /
;
vi.optfile = 1;
vi.iterlim = 0;
solve vi using emp;
abort$[vi.modelStat <> %modelStat.locallyOptimal%] 'VI should solve OK in zero iters';
abort$[vi.solveStat <> %solveStat.normalCompletion%] 'VI should solve OK in zero iters';