Hello Everyone,

I am trying to solve a bi-level optimisation problem using GAMS but I keep getting the following error,

*** EMP syntax error: key expected: is Wind_Output (item 1 on line 1)

— EMP Summary

Logical Constraints = 0

Disjunctions = 0

Adjusted Constraint = 0

Flipped Constraints = 0

Dual Variable Maps = 0

Dual Equation Maps = 0

VI Functions = 0

QVI Parameters = 0

Equilibrium Agent = 0

Bilevel Followers = 0

I have checked the file of 225a directory (empinfo.dat) and could not figure out the issue.

I need your kind help to solve this error as it is very urgent, thanks in advance!

I will upload the file 225 and my code, so please any help to identify the error.

empinfo.zip (346 KB)

Fifth Draft.gms (9.53 KB)

Hello,

Your EMP info file is not proper. It must start with a keyword, not a variable or equation name.

In the docs for bilevel models there are two examples (bard511 and ccmg71).

https://gams.com/latest/docs/S_JAMS.html#EMP_BILEVEL_PROGRAMS

Each example includes a link to the complete model in the EMP model library and also some code fragments illustrating how the EMP info file looks. You’ll also find more details there about what the keywords are and how to use them.

-Steve

Hello,

Thank you for your response! I just want to let you know that I have followed the documentation published prepared by GAMS in this regard [https://www.gams.com/latest/docs/UG_EMP_Bilevel.html#UG_EMP_Bilevel_EMPSyntax] (https://gams.com/latest/docs/S_JAMS.html#EMP_BILEVEL_PROGRAMS), but it still does not work.

I have a Bi-level Problem of the following specifications and I have defined the solve statement as in the attached picture according to the guidelines:

Upper-Level Problem: ObjOut1, ObjOut2

Upper-Level Problem - Decision Variables: P_RTP(i,k), P_ToU(j,k), PV_Out(k), Wind_Out(k), Con_Out(k)

Upper-Level Problem: ObjIn

Upper-Level Problem - Decision Variables: D_RTP(i,k), D_ToU(j,k)

Constraints: Balance_Constraint(k), PV_Constraint(k), Wind_Constraint(k), Conv_Constraint(k)

As you can see in the above photo, I have added the keyword Bi-level and then the decision variables. However, I still receive the same error, so could you please advise?

Attached the code to help you re-produce the error.

Looking forward to your reply,

Kind regards,

Omar

Fifth Draft.gms (10.9 KB)

Hello,

You are getting closer. Have a look at the transbp model in EMPLIB: it demonstrates the use of indexed equation and variable symbols in the EMP info file.

The EMP info file in that example looks like this:

bilevel

min z x cost supply demand

vi extdem g

with no index sets with the equation and variable symbols.

-Steve

Hi Steve,

Thank you very much! the problem has been solved, much appreciated!

I just have one question, does the solve statement have to include all the equations defined in the model or just the equations that represent the constraints of the model? This is because I have equations to calculate some variables.

Kind regards,

Omar

Omar,

This seems like a trick question. The solve statement does not include any equations. For example:

```
solve myMod using emp min z;
```

contains no equations and only one variable.

-Steve