Syntax error for EMP equilibrium problem

Hi,



I have a emp syntax error for a equilibrium problem. GAMS said “JAMS Pre processing failed” caused by “EMP syntax error: key expected: is I (item 13 on line 3) but instance not in variable rim”.



My code is following:


  • set defined

    set agent /a1a2/,

    time /t0
    t2/,

    node /n0n12/,

    j /j1
    j3/,

    k /k1k4/;



    alias(n, node, parent, child);

    alias(a, agent);



    set sn(n) /n1
    n12/

    leafn(n) /n4n12/

    parentn(n, node) /(n1
    n3).n0,

    (n4n6).n1,

    (n7
    n9).n2,

    (n10n12).n3/;



    Parameter

    y(n) /(n1
    n3) 5,

    (n4n12) 20/

    D(j,n) /j1.n1 150,

    j2.n1 200,

    j3.n1 210,

    j1.n2 105,

    j2.n2 125,

    j3.n2 225,

    j1.n3 210,

    j2.n3 210,

    j3.n3 210,

    j1.(n4,n7,n10) 75,

    j2.(n4,n7,n10) 60,

    j3.(n4,n7,n10) 90,

    j1.(n5,n8,n11) 105,

    j2.(n5,n8,n11) 115,

    j3.(n5,n8,n11) 120,

    j1.(n6,n9,n12) 180,

    j2.(n6,n9,n12) 150,

    j3.(n6,n9,n12) 135

    /

    Gamma(a,n)

    /

    a1.n0 125,

    a2.n0 90,

    a1.(n1
    n3) 30,

    a2.(n1n3) 20

    /

    c(a,j,n)

    /

    a1.j1.(n1
    n3) 10,

    a2.j1.(n1n3) 10,

    a1.j2.(n1
    n3) 12,

    a2.j2.(n1n3) 12,

    a1.j3.(n1
    n3) 15,

    a2.j3.(n1n3) 15,

    a1.j1.(n4
    n12) 20,

    a2.j1.(n4n12) 20,

    a1.j2.(n4
    n12) 25,

    a2.j2.(n4n12) 25,

    a1.j3.(n4
    n12) 30,

    a2.j3.(n4n12) 30

    /

    ;



    set risk(a,n,k)

    /a1.n0.(k1
    k4),

    a2.n0.(k1k3),

    (a1
    a2).n1.(k1k3),

    (a1
    a2).n2.(k1k3),

    (a1
    a2).n3.(k1*k3)

    /

    ;



    Parameter

    c_prob(a,n,k) ‘risk averse conditional probability’

    /a1.n1.k1 0.8,

    a1.n2.k1 0.1,

    a1.n3.k1 0.1,

    a1.n1.k2 0.1,

    a1.n2.k2 0.8,

    a1.n3.k2 0.1,

    a1.n1.k3 0.1,

    a1.n2.k3 0.1,

    a1.n3.k3 0.8,

    a1.n1.k4 0.9,

    a1.n2.k4 0.05,

    a1.n3.k4 0.05,

    a1.(n4,n7,n10).k1 0.8,

    a1.(n5,n8,n11).k1 0.1,

    a1.(n6,n9,n12).k1 0.1,

    a1.(n4,n7,n10).k2 0.1,

    a1.(n5,n8,n11).k2 0.8,

    a1.(n6,n9,n12).k2 0.1,

    a1.(n4,n7,n10).k3 0.1,

    a1.(n5,n8,n11).k3 0.1,

    a1.(n6,n9,n12).k3 0.8,

    a2.n1.k1 0.8,

    a2.n2.k1 0.1,

    a2.n3.k1 0.1,

    a2.n1.k2 0.1,

    a2.n2.k2 0.8,

    a2.n3.k2 0.1,

    a2.n1.k3 0.1,

    a2.n2.k3 0.1,

    a2.n3.k3 0.8,

    a2.(n4,n7,n10).k1 0.9,

    a2.(n5,n8,n11).k1 0.05,

    a2.(n6,n9,n12).k1 0.05,

    a2.(n4,n7,n10).k2 0.05,

    a2.(n5,n8,n11).k2 0.9,

    a2.(n6,n9,n12).k2 0.05,

    a2.(n4,n7,n10).k3 0.05,

    a2.(n5,n8,n11).k3 0.05,

    a2.(n6,n9,n12).k3 0.9

    /

    ;



    **Model

    Positive variable

    R(a,n)

    q(a,j,n)

    I(a,n)

    Ka(a,n)

    P(j,n)

    ;



    variable

    obj(a),

    theta(a,n)

    ;



    Equations

    defobj(a)

    transition(a,n)

    costtogo(a,n,k)

    costtogoleaf(a,n)

    investment(a,n)

    prodcapacity(a,n)

    supplydemand(j,n)

    ;



    defobj(a)…

    obj(a) =e= theta(a,‘n0’) - Gamma(a,‘n0’)I(a,‘n0’);



    transition(a,n)[sn(n)]..<br/> R(a,n) =e= sum(parentn(n, parent), R(a,parent)) - y(n)*sum(j, q(a,j,n));<br/> <br/> investment(a,n)[sn(n)]…

    Ka(a,n) =e= sum(parentn(n, parent), Ka(a,parent) + I(a,parent));



    prodcapacity(a,n)[sn(n)]..<br/> y(n)*sum(j, q(a,j,n)) =l= Ka(a,n);<br/> <br/> costtogo(a,n,k)[not leafn(n) and risk(a,n,k)]…

    theta(a,n) =g= sum(parentn(child, n), c_prob(a,child,k)
    ( sum(j, (c(a,j,child)
  • P(j,child))*q(a,j,child)) - Gamma(a,child)*I(a,child) + theta(a,child) ));



    costtogoleaf(a,n)[leafn(n)]..<br/> theta(a,n) =e= 0; <br/> <br/> supplydemand(j,n)[sn(n)]…

    sum(a, q(a,j,n)) - D(j,n) =g= 0;





    model mp /defobj, transition, costtogo, costtogoleaf, investment, prodcapacity, supplydemand/;



    file empinfo /‘%emp.info%’/;

    put empinfo ‘equilibrium’/;

    loop(a,
  • put variables

    put 'min ';

    put obj(a) theta(a,‘n0’) R(a,‘n0’) Ka(a,‘n0’);

    loop(n$[sn(n)],

    put Ka(a,n) theta(a,n) R(a,n) I(a,n);

    loop(j,

    put q(a,j,n);

    );

    );


  • put constraints

    put defobj(a);

    loop(n$[sn(n)],

    put transition(a,n) investment(a,n) prodcapacity(a,n);

    );

    loop(n$[not leafn(n)],

    loop(risk(a,n,k),

    put costtogo(a,n,k);

    );

    );

    loop(n$leafn(n),

    put costtogoleaf(a,n);

    );

    put /;

    );

    put 'vi '/;

    loop(n$sn(n),

    loop(j,

    put supplydemand(j,n) P(j,n);

    );

    );

    put /;

    putclose empinfo;



    $echo SharedEqu > jams.opt

    mp.optfile = 1;



    R.fx(‘a1’,‘n0’) = 8000;

    R.fx(‘a2’,‘n0’) = 8000;



    Ka.fx(‘a1’,‘n0’) = 1500;

    Ka.fx(‘a2’,‘n0’) = 1500;



    option limrow = 1000;

    option limcol = 1000;



    solve mp using emp;

    display obj.l, theta.l, R.l, q.l, I.l, Ka.l, P.l;

Thanks