EMP error

Solver related questions
Post Reply
nozarian
User
User
Posts: 3
Joined: 9 months ago

EMP error

Post by nozarian » 9 months ago

Hello everyone,
I am trying to write a gams model of a bilevel problem. However, GAMS said I have a EMP syntax error:

EMP syntax error: key expected: has dimension 0 but should be 2: emp error (item 2 on line 2)

--- EMP Summary (errors=1)
Adjusted Equations = 0
Dual Variable Maps = 0
Dual Equation Maps = 0
VI Functions = 0
Equilibrium Agent = 0
Bilevel Followers = 0
Disjunctions = 0
*
* JAMS Pre processing failed - please report to support@gams.com
* JAMS Please capture the GAMS input file


I don't know how to deal with this error.
I don't know where my problem is, please help me to solve it.
Thank you,
Best wishes.

abhosekar
Moderator
Moderator
Posts: 209
Joined: 1 year ago

Re: EMP error

Post by abhosekar » 9 months ago

Hi, the error suggests that you have included some element in your empinfo file that without its indices (for example, x instead of x('i1', 'j1')).

To figure this out, you can use GAMS command line option keep=1 so that the process directory 225.. is not deleted. After running your model, you can check the file named empinfo.dat in this directory. The error refers to item 2 on line 2 in this file.

Hope this helps.

- Atharv

nozarian
User
User
Posts: 3
Joined: 9 months ago

Re: EMP error

Post by nozarian » 9 months ago

Hi Dear Atharv,
Thanks for the answer.
The error is related to this section of the original code:


Model bilevel /all/;
******************************************************
$onecho > "%emp.info%"
bilevel P_lem P_wem P_wgm
OBJ_UL
C1_UL
C2_UL
C3_UL
C4_UL
C5_UL
C6_UL
C1_LI
C2_LI
C3_LI
C4_LI
C5_LI
C6_LI
C7_LI
C8_LI
C9_LI
C10_LI
C11_LI
C12_LI
C13_LI
C14_LI
C15_LI
C16_LI
min objin Ipvinv Iwinv Ichpinv Isttvinv E LSIh LSIe Pcpv Pcw Pdch Pch
OBJ_LL
C1_LL
C2_LL
C3_LL
C4_LL
C5_LL
C6_LL
C7_LL
C8_LL
C9_LL
C10_LL
C11_LL
C12_LL
C13_LL
C14_LL
C15_LL
C16_LL
C17_LL
C18_LL
C19_LL
C20_LL
$offecho
**********************************************************
solve bilevel using EMP minimizing objout ;

Which C symbols are constraints and the rest are the variables, which are two or more dimensional for example C1_LL (h, t) and Pch (h, t).
However, I don't know what's wrong in writing this section.

Thank you again for your help.
Best Regards.
--

abhosekar
Moderator
Moderator
Posts: 209
Joined: 1 year ago

Re: EMP error

Post by abhosekar » 9 months ago

This is what I explained in my previous response and also the error message mentions the exact same thing that you have included a symbol that is 2 dimensional without any index.

You should explicitly add C1_LL('h1','t1'), C1_LL('h2','t2') and so on. Simply writing C1_LL is not enough.

You can do this using put writing facility and using loop.
https://www.gams.com/33/docs/UG_Put.htm ... %20writing
https://www.gams.com/33/docs/UG_FlowCon ... trol_Loop


Further, you have to use command line option keep=1 and check empinfo.dat file inside 225? directory in order to see which element is being referred in the error message.

- Atharv

nozarian
User
User
Posts: 3
Joined: 9 months ago

Re: EMP error

Post by nozarian » 4 months ago

Hi Dear Atharv,
Thanks for the answer.
Unfortunately, despite much effort over the past few months, I have not been able to implement your tips. If possible, for the following code, please specify exactly how the loops for constraints and variables in the upper and lower levels should be.

Thank you again for your help.
Best Regards.
Untitled_1.gms

abhosekar
Moderator
Moderator
Posts: 209
Joined: 1 year ago

Re: EMP error

Post by abhosekar » 4 months ago

Hi,

Not sure what you couldn't follow but here is an example of how to write emp file using put facility

Code: Select all

File empfile /%emp.info%/ ;
file empfile; put empfile;
$onPut
bilevel P_lem P_wem P_wgm
OBJ_UL
$offPut

put empfile;
loop(t,
put empfile C1_UL(t)
);
loop(t,
put empfile C2_UL(t)
);

* You do this for everything that is indexed
* for example for C1_LL
loop((h,t),
C1_LL(h,t)
);
* for all elements that you have listed.


Once you do this, please follow my instructions on how to check if the file is being written correctly. (i.e. using gamskeep and checking empinfo.dat file)

Please understand that the whole point here is that you are trying to tell GAMS something about C1_LL but GAMS only knows C1_LL(h,t). This is true for all indexed elements in your empfile.
Hope it is clear now.
- Atharv

Post Reply