How to express this formulation in GAMS?

Dear, all. How to translate this formulation to GAMS?

I want to sum values in the specific subset(c1). Not all c.

Thank you.


\

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/d/optout.

Kafa,

Here is an example for both parameter and variable equations, you can change the sets as you see fit.

As always, McCarl’s guide has a section on subsets:
http://www.gams.com/help/index.jsp?topic=%2Fgams.doc%2Fuserguides%2Fmccarl%2Fsubsets.htm

sets
a /14/
b /5
8/
c /916/
c1(c) /13
16/;

parameter
x1(a,b,c) “first method example parameter”,
k1(c) “first method sum over a and b”,
k2(c) “second method sum over a and b”;

*assign x1 parameter random values
x1(a,b,c) = uniform(0,1);

*first example using condition on LHS:
k1(c)$c1(c) = sum((a,b),x1(a,b,c));

$second example specifying subset indices
k2(c1) = sum((a,b),x1(a,b,c1));

Display k1, k2;

*with variables…
equation sumx1(c),sumx2(c);
variable x(a,b,c);

sumx1(c)$c1(c)… sum((a,b),x(a,b,c))=L=2;
sumx2(c1)… sum((a,b),x(a,b,c1))=L=2;


Best,
Max



On Tuesday, September 29, 2015 at 9:55:53 AM UTC-6, kafa...@gmail.com wrote:

Dear, all. How to translate this formulation to GAMS?

I want to sum values in the specific subset(c1). Not all c.

Thank you.


\

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/d/optout.

I am really grateful for your help. Thank you.

2015년 9월 30일 수요일 오후 3시 12분 13초 UTC+9, Maxwell Brown 님의 말:

Kafa,

Here is an example for both parameter and variable equations, you can change the sets as you see fit.

As always, McCarl’s guide has a section on subsets:
http://www.gams.com/help/index.jsp?topic=%2Fgams.doc%2Fuserguides%2Fmccarl%2Fsubsets.htm

sets
a /14/
b /5
8/
c /916/
c1(c) /13
16/;

parameter
x1(a,b,c) “first method example parameter”,
k1(c) “first method sum over a and b”,
k2(c) “second method sum over a and b”;

*assign x1 parameter random values
x1(a,b,c) = uniform(0,1);

*first example using condition on LHS:
k1(c)$c1(c) = sum((a,b),x1(a,b,c));

$second example specifying subset indices
k2(c1) = sum((a,b),x1(a,b,c1));

Display k1, k2;

*with variables…
equation sumx1(c),sumx2(c);
variable x(a,b,c);

sumx1(c)$c1(c)… sum((a,b),x(a,b,c))=L=2;
sumx2(c1)… sum((a,b),x(a,b,c1))=L=2;


Best,
Max



On Tuesday, September 29, 2015 at 9:55:53 AM UTC-6, kafa...@gmail.com wrote:

Dear, all. How to translate this formulation to GAMS?

I want to sum values in the specific subset(c1). Not all c.

Thank you.


\

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/d/optout.