Conditional Sum

Hi,

i would like to make a sum statement that includes all items from from a set, but not the one at the current iteration.

Let me demonstrate:

10
9
8

equations should be:
muBB(1) = 9 + 8;
muBB(2) = 10 + 8;
muBB(3) = 9 + 8;


i am trying to implement this in the following equation: (x(ii) is my objective variable… it is unknown, so i cant predefine any sets)
muBB(i)… OS(i) =e= sum(ii , (OA(ii) * alpha * (1-C(ii))) * x(ii));
My ideas:

alias (i, ii)
muBB(i)… OS(i) =e= sum(ii $ not i, (OA(ii) * alpha * (1-C(ii))) * x(ii));

Maybe with if then statements… i dont know how to do it, please help.


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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.

\

Hi, this is done in gams with the following:

muBB(i)… OS(i) =e= sum(ii $(ord(i) ne ord(ii)), (OA(ii) * alpha * (1-C(ii))) * x(ii));

regards
Claudio


On Mon, May 6, 2013 at 7:46 PM, wrote:

Hi,

i would like to make a sum statement that includes all items from from a set, but not the one at the current iteration.

Let me demonstrate:

10
9
8

equations should be:
muBB(1) = 9 + 8;
muBB(2) = 10 + 8;
muBB(3) = 9 + 8;


i am trying to implement this in the following equation: (x(ii) is my objective variable… it is unknown, so i cant predefine any sets)
muBB(i)… OS(i) =e= sum(ii , (OA(ii) * alpha * (1-C(ii))) * x(ii));
My ideas:

alias (i, ii)
muBB(i)… OS(i) =e= sum(ii $ not i, (OA(ii) * alpha * (1-C(ii))) * x(ii));

Maybe with if then statements… i dont know how to do it, please help.


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?hl=en.
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.

\

Thank you so much,
worked perfectly.

On Tuesday, May 7, 2013 6:15:19 PM UTC+2, Claudio Delpino wrote:

Hi, this is done in gams with the following:

muBB(i)… OS(i) =e= sum(ii $(ord(i) ne ord(ii)), (OA(ii) * alpha * (1-C(ii))) * x(ii));

regards
Claudio


On Mon, May 6, 2013 at 7:46 PM, wrote:

Hi,

i would like to make a sum statement that includes all items from from a set, but not the one at the current iteration.

Let me demonstrate:

10
9
8

equations should be:
muBB(1) = 9 + 8;
muBB(2) = 10 + 8;
muBB(3) = 9 + 8;


i am trying to implement this in the following equation: (x(ii) is my objective variable… it is unknown, so i cant predefine any sets)
muBB(i)… OS(i) =e= sum(ii , (OA(ii) * alpha * (1-C(ii))) * x(ii));
My ideas:

alias (i, ii)
muBB(i)… OS(i) =e= sum(ii $ not i, (OA(ii) * alpha * (1-C(ii))) * x(ii));

Maybe with if then statements… i dont know how to do it, please help.


To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+...@googlegroups.com.
To post to this group, send email to gams...@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld?hl=en.
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.

\