Thank you so much, it helped me a lot.

Best regards,

BrÃgida

2011/10/4 Arne Stolbjerg Drud

Brigida:

It seems that the last index is driving the equation (excluding the first element) and that the first index that you sum over always should be less than the second. This gives the following suggestion:

set j / 8 * 12 / ;

alias( j,t ) ;

equation c(t);

## c(t)(ord(t) gt 1) .. sum(j(ord(j) lt ord(t)), v(j,t) ) =E= 1;

Good luck

Arne

\

Arne Stolbjerg Drud

ARKI Consulting & Development A/S

Bagsvaerdvej 246A, DK-2880 Bagsvaerd, Denmark

Phone: (+45) 44 49 03 23, Fax: (+45) 44 49 03 33, email: adrud@arki.dk

Fra: gamsworld@googlegroups.com [mailto:gamsworld@googlegroups.com] PÃ¥ vegne af BrÃgida Sartini

Sendt: 3. oktober 2011 02:36

Til: gamsworld@googlegroups.com

Emne: indexes and restrictions

Hi,

I have a model which has a variable v(j,t) where j e t is in

{ 8,9,10,11,12}

and I want to write the following restrictions in GAMS

v(8,9) = 1;

v(8,10) + v(9,10) = 1;

v(8,11) + v(9,11) + v(10,11) = 1;

v(8,12) + v(9,12) + v(10,12) + v(11,12) = 1;

I put this following form, but is there any way more concise? I’m asking because this set j it will be larger in other instances…

j set / 8 * 12 / ;

alias( j,t ) ;

C2(t)… sum(j$(ord(j) eq 1), v(j,‘9’)) =e= 1;

C3(t)… sum(j$(ord(j) le 2), v(j,‘10’)) =e= 1;

C4(t)… sum(j$(ord(j) le 3), v(j,‘11’)) =e= 1;

C5(t)… sum(j$(ord(j) le 4), v(j,‘12’)) =e= 1;

Best regards,

BrÃgida

–

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.