Dadash,

You cannot use the suffix .m in a constraint. You have to use the embedded complementarity system (ECS) I described earlier! Below you’ll find the adjusted example. The construct ‘dualvar price innereq1’ essentially sets price.l = innereq1.m.

Best,

Jan

equations

outerobj

innerobj

innereq1;

outerobj… out =e= price * sum(n,p(n));

innerobj… in =e= sum(n,Power(P(n),2)+p(n));

innereq1… sum(n,p(n)) =e= 40;

model outer / outerobj /

inner / innerobj, innereq1 /

bilevel / outer, inner /;

$onecho > “%emp.info%”

bilevel

min in innerobj innereq1

dualvar price innereq1

$offecho

solve bilevel using emp max out;

On 6/6/2011 10:41 AM, dadash wrote:

Thank you very much for taking the time to reply to me. I forgot to

say that outer level only has objective function but Inner level has

objective function and one constraint that marginal value of this

constraint is used in outer objective function.

A short Part of the code that I have written is:

.

.

.

equations

outerobj

innerobj

innereq1;

outerobj… out =e= innereq1.m * sum(n,p(n));

innerobj… in =e= sum(n,Power(P(n),2)+p(n));

innereq1… sum(n,p(n)) =e= 40;

model outer / outerobj /

inner / innerobj, innereq1 /

bilevel / outer, inner /;

$onecho> C:\Users\q\Documents\gamsdir\projdir\emp.info

bilevel

min in innerobj innereq1

$offecho

solve bilevel using emp max out;

Do you see any mistake in it?

Thank you

Dadash

On Jun 6, 2:44 pm, “Jan-H. Jagla” wrote:

Dadash,

What you are looking for is supported by the so-called

embedded-complementarity-systems (ECS) in EMP

I don’t understand what the marginal of the inner objective function

would tell you but you can make use of it by assigning the marginal to a

variable using the construct dualvar in the emp.info data. E.g.

dualvar xyz innereq

would allow you to use the variable xyz somewhere else in the model.

An example of how to use that can be found in model transeql

(http://www.gams.com/emplib/libhtml/transeql.htm). This example models

an ‘equilibrium’ instead of a ‘bilevel program’, yet the way you would

use dualvar is the same.

Best,

Jan

On 6/5/2011 12:51 PM, dadash wrote:

Dear all,

I am a beginner GMAS user. I have to model a bilevel problem in GAMS.

I have read GAMS emp library (http://www.gams.com/emplib/libhtml/

alfindx.htm), but they are not illustrative and helpful. I mean, It

was great if I had an illustrative example about a bi-level problem

that has been solved with GAMS. I am grateful if you answer and help

me about bilevel modeling in GAMS. I tried to create a model, but it

gives this error:

101 solve bilevel using emp maximizing out;

**** $66,256

**** The following EMP errors were detected in model bilevel:

**** 66 equation outerobj … symbol “innereq” has no values assigned

I should explain that “innereq” is the constraint of the inner

objective function and I have to use it’s marginal value (namely

innereq.m) in outer objective function.

With much hope

Dadash

[sorry for my bad English]

–

Jan-Hendrik Jagla

jhja...@gams.comwww.gams.com

GAMS Development Corporation

1217 Potomac St. NW

Washington DC, 20007, USA

Fon/Fax: +1 202 342-0180/1

GAMS Software GmbH

Eupener Str. 135-137

50933 KÄÅ¼Ëln, Deutschland

Fon/Fax: +49 221 949-9170/1

–

Jan-Hendrik Jagla

jhjagla@gams.com

www.gams.com

GAMS Development Corporation

1217 Potomac St. NW

Washington DC, 20007, USA

Fon/Fax: +1 202 342-0180/1

GAMS Software GmbH

Eupener Str. 135-137

50933 KÃ¶ln, Deutschland

Fon/Fax: +49 221 949-9170/1

–

To post to this group, send email to gamsworld@googlegroups.com.

To unsubscribe from this group, send email to gamsworld+unsubscribe@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.

\