Bilevel program with 100 followers

Problems with modeling
Post Reply
skampezidou3
User
User
Posts: 1
Joined: 9 months ago

Bilevel program with 100 followers

Post by skampezidou3 »

Dear forum, how can I write the model and the emf info file if I have 100 followers? See code below.

The followers are identical and defined with the objective and constraints/variable limits indexed by i, where i is from 1 to 100. That part is ok. What I need help with is:
1. how to write "model master / defobj, a / submodel / defh, e /;" without having to repeat submodel1, submodel2, ... submodel100,
2. how to write the part "model my_emp_model / master, submodel /;" without having to repeat submodel1, submodel2, ... submodel100,
3. how to write the emp file part "$onecho > "%emp.info%" bilevel p max h x defh e $offecho" without having to repeat again the submodels multiple times.

This is the error tha GAMS gives me:
JAMS - Solver for Extended Mathematical Programs (EMP)
------------------------------------------------------
*** EMP syntax error: BILEVEL: obj has to be scalar is h (item 2 on line 2)
*** EMP syntax error: key expected: is h (item 2 on line 2)
--- 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

Code: Select all

set t /1*24/
    i /1*100/;

variables p(t), x(i,t), z, h(i);
equations defobj,defh(i),a(i),e(i);

scalar h_0 / 0 /
       u / 0.01 /
       W / 5 /;

defobj.. z =e= sum(t, -p(t)*sum(i, x(i,t)));
a(i).. h(i) =e= h_0;
p.lo(t) = 0;
p.up(t) = 10;

defh(i).. h(i) =e= sum(t, p(t)*x(i,t)-u*x(i,t)**2);
e(i).. sum(t, x(i,t)) =e= W;
x.lo(i,t) = 0;
x.up(i,t) = 20;


model master    / defobj, a /
      submodel  / defh, e /;

*Now we use EMP to solve the model
model my_emp_model / master, submodel /;
$onecho > "%emp.info%"
bilevel p
max h x defh e
$offecho

option solvelink=%SOLVELINK.CallScript%,solprint=on;

solve my_emp_model using emp max z;
Stella Kampezidou, Ph.D.
Georgia Institute of Technology
Post Reply