EMP syntax error: key expected: is the key min

Problems with syntax of GAMS
Post Reply
maxtu
User
User
Posts: 2
Joined: 2 years ago

EMP syntax error: key expected: is the key min

Post by maxtu »

Hi,

I am currently trying to build an equilibrium model that consists of several players, which try to minimize their costs respectively. Unfortunately when running the model, I get the following error message: " EMP syntax error: key expected: is the key min (item 1 on line 4)". The first lines of the empinfo file look like this:

equilibrium
dualequ cons P_bm

min obj('1') R('1','336') X('1','336') F('1','336') G('1','336') I('1','336') S_c('1','336') S_d('1','336') S('1','336') RH('1','336') S_h('1','336') S_hd('1','336') S_hc('1','336') W_i('1','336') W_g('1','336') W_res('1','336') W_sd('1','336')...

So apparently "min obj('1') " is problematic? My guess is there is something wrong with how I implemented the emp-info, but since this is my first time working with GAMS EMP I don't know what went wrong. Any advice would be appreciated!

Code: Select all

file empinfo / '%emp.info%' /; 
put empinfo 'equilibrium' /;
put 'dualequ cons P_bm' /;
    
loop(n, put / 'min', obj(n);
    loop(t, put R(n,t) X(n,t) F(n,t) G(n,t) I(n,t) S_c(n,t)
    S_d(n,t) S(n,t) RH(n,t) S_h(n,t) S_hd(n,t) S_hc(n,t) W_i(n,t)
    W_g(n,t) W_res(n,t) W_sd(n,t) H_chp(n,t) A(n,t) FC(n,t)
    f20(n,t) f21(n,t) f22(n,t) f23(n,t) f24(n,t)
    f44(n,t) f50(n,t) f51(n,t));
    put objdef(n);
    );
    
putclose empinfo;

$onEcho > jams.opt
FileName equ_opt_reform.gms
Dict dict.txt
$offEcho
*SharedEqu

equ_opt.optfile = 1;
solve equ_opt using emp;
display R.l;
equ_opt.zip
All files needed for running the model and log-file
(1.33 MiB) Downloaded 164 times
User avatar
dirkse
Moderator
Moderator
Posts: 215
Joined: 7 years ago
Location: Fairfax, VA

Re: EMP syntax error: key expected: is the key min

Post by dirkse »

Hi,

The dualEqu keyword is something I would use to modify a single-agent optimization model whose objective is specified in the GAMS model statement. By default all equations in such a model are constraints on the agent (i.e. normal constraints) but dualEqu says that some equations move away from the agent and into the embedded complementarity system.

You can formulate exactly the same model by using the equilibrium keyword, but in such a case I would not use the dualEqu keyword. Instead I would formulate the embedded complementarity system directly using the VI keyword.

There is an example showing exactly these two different pathways to exactly the same result in the GAMS EMP Library:

https://www.gams.com/37/emplib_ml/libht ... monop.html

Also the GAMS docs explain these keywords and their use better than I can here:

https://www.gams.com/37/docs/UG_EMP_EMP ... ch=dualequ

HTH,

-Steve
maxtu
User
User
Posts: 2
Joined: 2 years ago

Re: EMP syntax error: key expected: is the key min

Post by maxtu »

Hi Steve,

thank you for you advice! With help from the GAMS support I've been able to implement a small version of the model using the VI keywort that seems to work. So I am pretty sure that this is the right way to go but I'll need some time to familiarize myself with the EMP tool and VIs before I can scale up this formulation.
Post Reply