Hi Maria

You canâ€™t directly use a set element as a number. Ceil(av/5) is not working, because Gams sees av as a set element (like a,b,c) and not as an integer.

One way around is using ord(av), the order of the set element.

But you still will run into problems, as you now have an equation defined over the set av and you are using the set l within the equation.

Either the equation should be defined over av AND l, or you do it this way, summing over all l where the condition after the sign is met:
\
\
\
dem(av).. z(av)- sum(l,beta(l)(ord(l) eq ceil(ord(av)/5))) =g=0

Cheers

Renger

From: gamsworld@googlegroups.com [mailto:gamsworld@googlegroups.com] On Behalf Of Maria a. Rad

Sent: Monday, June 25, 2012 10:38 AM

To: gamsworld@googlegroups.com

Subject: equations on suffix

Dear Friends!

I want to do some algebraic operations on a suffix of a variable but I run into an error,

For example:

set l /1*5/*

av /120/;

positive variables beta(l), z(av);

free variable w;

parameter

c(l) /1 1

2 3

3 3

4 5

5 4/;

equations

cost

dem(av);

cost… w =e= sum{l, c(l)*beta(l)};

dem(av)… z(av)-beta(ceil(av/5))=g=0;

model D /all/;

solve D using lp minimization w;

Can anyone help me?

–

To view this discussion on the web visit https://groups.google.com/d/msg/gamsworld/-/P8EOkSOcbtsJ.

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.

–

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.