Hello,

I am a graduate student from belgium and I am trying to solve a

bilevel optimization problem using emp.

I get the following error:

**** ERRORS/WARNINGS IN VARIABLE objin1

1 error(s): BILEVEL: follower obj has no entry in follower

equations

I am a beginner in gams and totally new with emp. This is probably a

very simple mistake but I am at a loss.

What could this mean? what should I look out for?

I have included the code here:

$ A leader-followers game with a cournot game for the followers

$ontext

I am trying to solve the following problem:

maximize{q} E q (sum of the cost of the followers) % maximize the

expected value of system cost based on a set of probabilities q

defined with the constraints

s.t sum of q = 1

-q(S)+pbase(S)/(1-alpha) =G= 0

…

$offtext

set player /p1*p2/
S /s1*s4/

;

parameter I(player) /p1 10, p2 15/

parameter A /100/

parameter B/60/

parameter pbase(S) /s1 0.25, s2 0.25, s3 0.25, s4 0.25/

parameter alpha /0.5/

table c(S,player)

p1 p2

s1 2 3

s2 3 2

s3 4 5

s4 1 1

;

variables systcost(S)

ytot(S)

price(S)

objout

objin1

objin2

;

positive variables x(player)

y(player,S)

q(S)

;

equations defout

defsystcost(S)

defytot(S)

defprice(S)

constraintq(S)

sumone

defin1

constraint1(S)

defin2

constraint2(S)

;

defout… objout =E= sum(S,q(S)*systcost(S)) ;

defsystcost(S)… systcost(S) =E=

sum(player,c(S,player)*y(player,S))-price(S)*ytot(S);

defytot(S)… ytot(S)=E=sum(player,y(player,S));

defprice(S)… price(S) =E= A-B*ytot(S);

sumone… sum(S,q(S)) =E= 1;

constraintq(S)… -q(S)+pbase(S)/(1-alpha) =G= 0;

defin1… objin1 =E= I(“p1”)*x(“p1”)+ sum(S,q(S)*(-

price(S)*y(“p1”,S)+c(S,“p1”)*y(“p1”,S)));

constraint1(S)… x(“p1”) =G= y(“p1”,S);

defin2… objin2 =E= I(“p2”)*x(“p2”)+ sum(S,q(S)*(-

price(S)*y(“p2”,S)+c(S,“p2”)*y(“p2”,S)));

constraint2(S)… x(“p2”) =G= y(“p2”,S);

model endorisk / all /;

$onecho > “%emp.info%”

bilevel q

min objin1 x(“p1”) y(“p1”,S) defin1 constraint1(S)

min objin2 x(“p2”) y(“p2”,S) defin2 constraint2(S)

$offecho

solve endorisk us emp min objout;

\