Page 1 of 1

Bi-level Programming

Posted: Thu May 09, 2019 9:59 am
by paganini
Hi everybody
I am working on a bi_level problem in GAMS and have some few questions.
my problem has one leader and five followers and each follower has a specific constraint and also there are two other constraints which must be shared among all followers.
the equation of all followers and their specific constraints are the same and the only difference between them is a set called "j" which is from j1 to j5 and has a different value for each variable.
Because my follower equations are the same, I'm trying to write just one equation instead of 5 and define it over set "j".
for example, I want to write the below code :

Code: Select all

I know the right way is to define each lower separately like below:

Code: Select all

lower1.. follower1=e= sum((i,j)$(ord(j) eq 1),(a(i)+b(i)*X(i,j)+c(i)*X(i,j)*X(i,j))*z(i,j));
con1(j)$(ord(j) eq 1) .. sum(i,X(i,j)) =e=  E(j) ;
lower2.. follower2=e= sum((i,j)$(ord(j) eq 2),(a(i)+b(i)*X(i,j)+c(i)*X(i,j)*X(i,j))*z(i,j));
con2(j)$(ord(j) eq 2) .. sum(i,X(i,j)) =e=  E(j) ;
lower3.. follower3=e= sum((i,j)$(ord(j) eq 3),(a(i)+b(i)*X(i,j)+c(i)*X(i,j)*X(i,j))*z(i,j));
con3(j)$(ord(j) eq 3) .. sum(i,X(i,j)) =e=  E(j) ;
but why I can't define a variable over a set in bi-level programming?
I can't solve the problem in GAMS's bilevel syntax and don't know how to fix this.
A zip file that contains the GAMS code has been attached.
Thanks for your time and I eagerly look forward to hearing from you.