Working with sets in GAMS

Hi,

I need some help with sets. I have a set with 4 values. I want to select one value from the set inside a loop and perform some operation on all values of the set excluding the one that is selected. Is there any way to exclude a value from set in GAMS?


To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/groups/opt_out.

\

loop(set$(not set.val=num),
operation;
);


On Tue, Aug 6, 2013 at 4:13 PM, Sid Lakhiani wrote:

Hi,

I need some help with sets. I have a set with 4 values. I want to select one value from the set inside a loop and perform some operation on all values of the set excluding the one that is selected. Is there any way to exclude a value from set in GAMS?


To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/groups/opt_out.



\

To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/groups/opt_out.

\

not clear exactly what value you want to select in the loop, but here are a couple of suggestions. first, look at the documentation for dynamic sets. second, some untested code

set j / 1 * 4/, jj(j);
alias(j,j2);

loop(j2,
jj(j) = yes;
jj(j2) = no;
display jj;
);

frank


On Tue, Aug 6, 2013 at 5:13 PM, Sid Lakhiani wrote:

Hi,

I need some help with sets. I have a set with 4 values. I want to select one value from the set inside a loop and perform some operation on all values of the set excluding the one that is selected. Is there any way to exclude a value from set in GAMS?


To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/groups/opt_out.



\

To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/groups/opt_out.

\

Hi Sid

Don’t know if this is what you are Looping for:

Set s /s1*s4/;

Alias(s,as);

Loop(s,
Loop(as$(not sameas(as,s),
Operation using as

);
);

Cheers
Renger

Sent from my iPad

Am 07.08.2013 um 15:35 schrieb “Ryan Cooper” :

loop(set$(not set.val=num),
operation;
);

On Tue, Aug 6, 2013 at 4:13 PM, Sid Lakhiani wrote:

Hi,

I need some help with sets. I have a set with 4 values. I want to select one value from the set inside a loop and perform some operation on all values of the set excluding the one that is selected. Is there any way to exclude a value from set in GAMS?

--
To unsubscribe from this group and stop receiving emails from it, send an email to <gamsworld+unsubscribe@googlegroups.com>.
To post to this group, send email to <gamsworld@googlegroups.com>.
Visit this group at http://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/groups/opt_out.


To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/groups/opt_out.


To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/groups/opt_out.

\