Problem with summation

Dear Gamsworld members

Sorry for cross posting.
I am facing a problem in summing up two parameters.
I want to calculate F0 as in the code bellow.
However, it seems difficult to sum up activities and commodities, even if they have the same dimension.
Thanks in advance
Gomez


Set a activities /a1, a2, a3 /
c commodities /c1,c2,c3/
f factors /f1,f2/
;
alias
(a,aa), (c,cc), (f,ff);

table xa(f,a) factor endowment
a1 a2 a3
f1 4 5 3
f2 6 1 4
;
parameter rt0(c) /c1 10
c2 16
c3 11/
;
parameter
F0(f,a) the h-th factor input by the j-th firm
FK(f)
;
F0(f,aa) =xa(f,aa)-xa(f,aa)/sum(ff, xa(ff,aa))*rt0(c);
FK(f) =sum(a, F0(f,a));
display f0, fk;



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 Alino



The error message is quite clear: Gams tells you “uncontrolled set entered as constant” and stops right behind the term rt0(c). The key is “uncontrolled”: The set c doesn’t appear anywhere else in the expression.

Either sum over the set c additionally or define your sum F0(f,aa) also over c (e.g. F0(f,aa,c)).

Cheers

Renger



Von: gamsworld@googlegroups.com [mailto:gamsworld@googlegroups.com] Im Auftrag von Alino Gómez
Gesendet: Donnerstag, 7. Februar 2013 06:24
An: gamsworld@googlegroups.com
Betreff: Problem with summation



Dear Gamsworld members



Sorry for cross posting.

I am facing a problem in summing up two parameters.

I want to calculate F0 as in the code bellow.

However, it seems difficult to sum up activities and commodities, even if they have the same dimension.

Thanks in advance

Gomez


Set a activities /a1, a2, a3 /

c commodities /c1,c2,c3/

f factors /f1,f2/

;

alias

(a,aa), (c,cc), (f,ff);


table xa(f,a) factor endowment
a1 a2 a3
f1 4 5 3
f2 6 1 4
;
parameter rt0(c) /c1 10
c2 16
c3 11/
;

parameter
F0(f,a) the h-th factor input by the j-th firm
FK(f)
;

F0(f,aa) =xa(f,aa)-xa(f,aa)/sum(ff, xa(ff,aa))*rt0(c);
FK(f) =sum(a, F0(f,a));

display f0, fk;



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.

\