Error 125! Your help is higly appreciated!

Dears, I have an error 125. The problem with the EQBOP, if I eliminate it, savings are equal investments, due to NX (net export) is 0. When I use EQBOP I have this error. What is wrong?


1 set
2 T time periods /20142064/
3 J producers (A=oil sector and B=non-oil sector) /A,B/
4 ;
5
6 PARAMETERS
7 A(J,T) technology level parameter for production function
8 alpha(J) expenditure shares of capital for production function
9 r discount rate
10 gl rate of labour force
11 delta depreciation rate
12 L0 labour force at t = 0 /96379/
13 K0 captial stock at t = 0 /676144/
14 gamma share of good A and B in utility function
15 p(J) price of goods
16
17 ;
18
19 Parameter values
20 A(J,T) = 1;
21 r=0.02;
22 gl = 0.01;
23 delta = 0.10;
24 alpha(“A”) = 0.20;
25 alpha(“B”) = 0.15;
26 gamma = 0.5;
27 p(J) = 1;
28
29
30 VARIABLES
31
32 C(J,T) consumption
33 L(J,T) labour force
34 LT(T) total labour
35 K(J,T) capital
36 I(J,T) investment
37 Y(J,T) economic activity or output
38 Y1(J,T) economic activity or output Y1
39 U(T) utility
40 TOTU objective function
41 EX(J,T) export
42 IM(J,T) import
43 NX(J,T) net export
44 S(J,T) savings
45 BOP
46 ;
47
48
49 POSITIVE VARIABLES C(J,T), L(J,T), K(J,T), I(J,T), Y1(J,T), LB(J,T);
50
51
52 EQUATIONS
53
54 EQL(J,T) labour force for A and B
55 EQLT(T) total labour
56 EQLB(J,T) labour force distributed
57 EQK(J,T) capital
58 EQY(J,T) economic activity
59 EQY1(J,T) economic activity Y1
60 EQU(T) utility
61 EQTOTU objectie fuction
62 EQEX(J,T) export
63 EQIM(J,T) import
64 EQNX(J,T) net export
65 EQS(J,T) savings
66 EQBOP(J,T)
67
68 ;
69
70 EQL(J,T)… L(J,T) =E= L0
(1+gl)**(ORD(T));
71 EQLT(T)… LT(T) =E= sum(J,L(J,T));
72 EQLB(J,T)… LT(T) =E= LB(“A”,T)+LB(“B”,T);
73 EQK(J,T)… K(J,T) =E= (K0$(ord(T)=1)+K(J,T-1))
(1-delta)+I(J,T);
74 EQY(J,T)… Y(J,T) =E= A(J,T)K(J,T)alpha(J)*L(J,T)(1-ALPHA(J));
75 EQY1(J,T)… Y(J,T) =E= C(J,T)+I(J,T)+NX(J,T);
76 EQU(T)… U(T) =E= (C(“A”,T)**gamma)
(C(“B”,T)(1-gamma))/((1+r)(O
RD(T)-1));
77 EQTOTU… TOTU =E= sum(T,U(T));
78 EQNX(J,T)… NX(J,T) =E= EX(J,T)-IM(J,T);
79 EQIM(J,T)… IM(J,T) =E= 0.5C(J,T);
80 EQEX(J,T)… EX(J,T) =E= IM(J,T);
81 EQS(J,T)… S(J,T) =E= Y(J,T)-C(J,T);
82 EQBOP(J,T)… SUM(J,p(J)
(EX(J,T)-IM(J,T)))=E=0;
**** $125
83
84
85
86 L.L(J,T)=L0;
87 K.L(J,T)=K0;
88
89
90
91 MODEL INVEST /ALL/;
92 SOLVE INVEST USING DNLP MAXIMIZING TOTU;
**** $257
93
94
95 DISPLAY Y.L, C.L, L.L, K.L, I.L, S.L, U.L, TOTU.L, EX.L, IM.L, NX.L;
**** $141 $141 $141 $141 $141 $141 $141 $141 $141
GAMS Rev 148 x86/MS Windows 09/11/14 15:15:30 Page 2
G e n e r a l A l g e b r a i c M o d e l i n g S y s t e m
Error Messages

125 Set is under control already
141 Symbol neither initialized nor assigned
A wild shot: You may have spurious commas in the explanatory
text of a declaration. Check symbol reference list.
257 Solve statement not checked because of previous errors


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.

Tanya: Your question is a fairly common one that has been answered many times. Please remember you can search this group at https://groups.google.com/forum/#!forum/gamsworld, and some relevant links are given there to documents where your question is answered (p 21 of GAMS Tutorial and User Guide, and this page of the McCarl’s extended User Guide http://www.gams.com/mccarl/mccarlhtml/summing_over_ses_already_indexed_error_f.htm?zoom_highlightsub=125).

I understand that you can read from any of these three sources what your mistake is.

Basically, you’re trying to sum over set J, and at the same time you’re declaring EQBOP to be written for each member of sets J and T.

This is conflictive because when you invoke it inside the summatory (on symbols p(J), EX(J,T), IM(J,T)) you loose the possibility of specifying wether you’re reffering to the particular instances of EQBOP (there are card(T) instances for each J) or to the summing-over index.

Solution for this conflict comes through the Alias() statement, with which you create a “mirror” set that you can use to replace one of the two “controlling” appearences (as the domain of an equation / as the index of a summatory) of set J, and then univocally specify what set is “controlling” each of the symbols p(J), EX(J,T) and IM(J,T).

Really hard for me to explain this by mail, but if you work it in “paper” terms you will notice where the conflict is.

Best Regards and Good Luck!
Claudio

On Thu, Sep 11, 2014 at 10:18 AM, Tanya B. wrote:

Dears, I have an error 125. The problem with the EQBOP, if I eliminate it, savings are equal investments, due to NX (net export) is 0. When I use EQBOP I have this error. What is wrong?


1 set
2 T time periods /20142064/
3 J producers (A=oil sector and B=non-oil sector) /A,B/
4 ;
5
6 PARAMETERS
7 A(J,T) technology level parameter for production function
8 alpha(J) expenditure shares of capital for production function
9 r discount rate
10 gl rate of labour force
11 delta depreciation rate
12 L0 labour force at t = 0 /96379/
13 K0 captial stock at t = 0 /676144/
14 gamma share of good A and B in utility function
15 p(J) price of goods
16
17 ;
18
19 Parameter values
20 A(J,T) = 1;
21 r=0.02;
22 gl = 0.01;
23 delta = 0.10;
24 alpha(“A”) = 0.20;
25 alpha(“B”) = 0.15;
26 gamma = 0.5;
27 p(J) = 1;
28
29
30 VARIABLES
31
32 C(J,T) consumption
33 L(J,T) labour force
34 LT(T) total labour
35 K(J,T) capital
36 I(J,T) investment
37 Y(J,T) economic activity or output
38 Y1(J,T) economic activity or output Y1
39 U(T) utility
40 TOTU objective function
41 EX(J,T) export
42 IM(J,T) import
43 NX(J,T) net export
44 S(J,T) savings
45 BOP
46 ;
47
48
49 POSITIVE VARIABLES C(J,T), L(J,T), K(J,T), I(J,T), Y1(J,T), LB(J,T);
50
51
52 EQUATIONS
53
54 EQL(J,T) labour force for A and B
55 EQLT(T) total labour
56 EQLB(J,T) labour force distributed
57 EQK(J,T) capital
58 EQY(J,T) economic activity
59 EQY1(J,T) economic activity Y1
60 EQU(T) utility
61 EQTOTU objectie fuction
62 EQEX(J,T) export
63 EQIM(J,T) import
64 EQNX(J,T) net export
65 EQS(J,T) savings
66 EQBOP(J,T)
67
68 ;
69
70 EQL(J,T)… L(J,T) =E= L0
(1+gl)**(ORD(T));
71 EQLT(T)… LT(T) =E= sum(J,L(J,T));
72 EQLB(J,T)… LT(T) =E= LB(“A”,T)+LB(“B”,T);
73 EQK(J,T)… K(J,T) =E= (K0$(ord(T)=1)+K(J,T-1))
(1-delta)+I(J,T);
74 EQY(J,T)… Y(J,T) =E= A(J,T)K(J,T)alpha(J)*L(J,T)(1-ALPHA(J));
75 EQY1(J,T)… Y(J,T) =E= C(J,T)+I(J,T)+NX(J,T);
76 EQU(T)… U(T) =E= (C(“A”,T)**gamma)
(C(“B”,T)(1-gamma))/((1+r)(O
RD(T)-1));
77 EQTOTU… TOTU =E= sum(T,U(T));
78 EQNX(J,T)… NX(J,T) =E= EX(J,T)-IM(J,T);
79 EQIM(J,T)… IM(J,T) =E= 0.5C(J,T);
80 EQEX(J,T)… EX(J,T) =E= IM(J,T);
81 EQS(J,T)… S(J,T) =E= Y(J,T)-C(J,T);
82 EQBOP(J,T)… SUM(J,p(J)
(EX(J,T)-IM(J,T)))=E=0;
**** $125
83
84
85
86 L.L(J,T)=L0;
87 K.L(J,T)=K0;
88
89
90
91 MODEL INVEST /ALL/;
92 SOLVE INVEST USING DNLP MAXIMIZING TOTU;
**** $257
93
94
95 DISPLAY Y.L, C.L, L.L, K.L, I.L, S.L, U.L, TOTU.L, EX.L, IM.L, NX.L;
**** $141 $141 $141 $141 $141 $141 $141 $141 $141
GAMS Rev 148 x86/MS Windows 09/11/14 15:15:30 Page 2
G e n e r a l A l g e b r a i c M o d e l i n g S y s t e m
Error Messages

125 Set is under control already
141 Symbol neither initialized nor assigned
A wild shot: You may have spurious commas in the explanatory
text of a declaration. Check symbol reference list.
257 Solve statement not checked because of previous errors


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.

\

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.

Reply-to: gamsworld@googlegroups.com

Dear Andre!

Thanks again for the help. I understand that smth. wrong with the J index. For example, if I use only T: EQBOP(T)… SUM(J,p(J)*(EX(J,T)-IM(J,T)))=E=0; the model works, but I’m confused by the outcome, since S(J,T) - savings have to be equal I (J,T) - investment, because NX (J,T) =0. But it’s not the case…

Tanya

On Friday, 12 September 2014 09:28:24 UTC+2, Savitsky Andre wrote:

Dear Tania!

You used SUM(j

But in Equation definition You have (J,T)

After usage SUM(j
J will dissapear

How it can be in equation definition?

Correct this and all will be fine


All the best

Dears, I have an error 125. The problem with the EQBOP, if I eliminate it, savings are equal investments, due to NX (net export) is 0. When I use EQBOP I have this error. What is wrong?

1 set
2 T time periods /20142064/
3 J producers (A=oil sector and B=non-oil sector) /A,B/
4 ;
5
6 PARAMETERS
7 A(J,T) technology level parameter for production function
8 alpha(J) expenditure shares of capital for production function
9 r discount rate
10 gl rate of labour force
11 delta depreciation rate
12 L0 labour force at t = 0 /96379/
13 K0 captial stock at t = 0 /676144/
14 gamma share of good A and B in utility function
15 p(J) price of goods
16
17 ;
18
19 Parameter values
20 A(J,T) = 1;
21 r=0.02;
22 gl = 0.01;
23 delta = 0.10;
24 alpha(“A”) = 0.20;
25 alpha(“B”) = 0.15;
26 gamma = 0.5;
27 p(J) = 1;
28
29
30 VARIABLES
31
32 C(J,T) consumption
33 L(J,T) labour force
34 LT(T) total labour
35 K(J,T) capital
36 I(J,T) investment
37 Y(J,T) economic activity or output
38 Y1(J,T) economic activity or output Y1
39 U(T) utility
40 TOTU objective function
41 EX(J,T) export
42 IM(J,T) import
43 NX(J,T) net export
44 S(J,T) savings
45 BOP
46 ;
47
48
49 POSITIVE VARIABLES C(J,T), L(J,T), K(J,T), I(J,T), Y1(J,T), LB(J,T);
50
51
52 EQUATIONS
53
54 EQL(J,T) labour force for A and B
55 EQLT(T) total labour
56 EQLB(J,T) labour force distributed
57 EQK(J,T) capital
58 EQY(J,T) economic activity
59 EQY1(J,T) economic activity Y1
60 EQU(T) utility
61 EQTOTU objectie fuction
62 EQEX(J,T) export
63 EQIM(J,T) import
64 EQNX(J,T) net export
65 EQS(J,T) savings
66 EQBOP(J,T)
67
68 ;
69
70 EQL(J,T)… L(J,T) =E= L0
(1+gl)**(ORD(T));
71 EQLT(T)… LT(T) =E= sum(J,L(J,T));
72 EQLB(J,T)… LT(T) =E= LB(“A”,T)+LB(“B”,T);
73 EQK(J,T)… K(J,T) =E= (K0$(ord(T)=1)+K(J,T-1))
(1-delta)+I(J,T);
74 EQY(J,T)… Y(J,T) =E= A(J,T)K(J,T)alpha(J)*L(J,T)(1-ALPHA(J));
75 EQY1(J,T)… Y(J,T) =E= C(J,T)+I(J,T)+NX(J,T);
76 EQU(T)… U(T) =E= (C(“A”,T)**gamma)
(C(“B”,T)(1-gamma))/((1+r)(O
RD(T)-1));
77 EQTOTU… TOTU =E= sum(T,U(T));
78 EQNX(J,T)… NX(J,T) =E= EX(J,T)-IM(J,T);
79 EQIM(J,T)… IM(J,T) =E= 0.5C(J,T);
80 EQEX(J,T)… EX(J,T) =E= IM(J,T);
81 EQS(J,T)… S(J,T) =E= Y(J,T)-C(J,T);
82 EQBOP(J,T)… SUM(J,p(J)
(EX(J,T)-IM(J,T)))=E=0;
**** $125
83
84
85
86 L.L(J,T)=L0;
87 K.L(J,T)=K0;
88
89
90
91 MODEL INVEST /ALL/;
92 SOLVE INVEST USING DNLP MAXIMIZING TOTU;
**** $257
93
94
95 DISPLAY Y.L, C.L, L.L, K.L, I.L, S.L, U.L, TOTU.L, EX.L, IM.L, NX.L;
**** $141 $141 $141 $141 $141 $141 $141 $141 $141
GAMS Rev 148 x86/MS Windows 09/11/14 15:15:30 Page 2
G e n e r a l A l g e b r a i c M o d e l i n g S y s t e m
Error Messages

125 Set is under control already
141 Symbol neither initialized nor assigned
A wild shot: You may have spurious commas in the explanatory
text of a declaration. Check symbol reference list.
257 Solve statement not checked because of previous errors

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.

For more options, visit https://groups.google.com/d/optout.

With kindly regards!
Andre Savitsky
E-mail:a...@yandex.ru
andre...@yahoo.com


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.

Dear Claudio,


Many thanks for the message! I realised that the problem with the J index. I red smth from the google forum and also the McCarl’s Gams User Guid, but it’s still not clear for me how to fix, since the Gams Guid doesn’t explain it.

Regarding, alias, I thought about it… mmm… I got it, have a look:


Alias (J,J1)

EQBOP(J,T)… SUM(J1,p(J)*(EX(J,T)-IM(J,T)))=E=0;

Claudio, the model WORKS! Yahoo!!!

Tanya





On Thursday, 11 September 2014 16:55:07 UTC+2, Claudio Delpino wrote:

Tanya: Your question is a fairly common one that has been answered many times. Please remember you can search this group at https://groups.google.com/forum/#!forum/gamsworld, and some relevant links are given there to documents where your question is answered (p 21 of GAMS Tutorial and User Guide, and this page of the McCarl’s extended User Guide http://www.gams.com/mccarl/mccarlhtml/summing_over_ses_already_indexed_error_f.htm?zoom_highlightsub=125).

I understand that you can read from any of these three sources what your mistake is.

Basically, you’re trying to sum over set J, and at the same time you’re declaring EQBOP to be written for each member of sets J and T.

This is conflictive because when you invoke it inside the summatory (on symbols p(J), EX(J,T), IM(J,T)) you loose the possibility of specifying wether you’re reffering to the particular instances of EQBOP (there are card(T) instances for each J) or to the summing-over index.

Solution for this conflict comes through the Alias() statement, with which you create a “mirror” set that you can use to replace one of the two “controlling” appearences (as the domain of an equation / as the index of a summatory) of set J, and then univocally specify what set is “controlling” each of the symbols p(J), EX(J,T) and IM(J,T).

Really hard for me to explain this by mail, but if you work it in “paper” terms you will notice where the conflict is.

Best Regards and Good Luck!
Claudio

On Thu, Sep 11, 2014 at 10:18 AM, Tanya B. wrote:

Dears, I have an error 125. The problem with the EQBOP, if I eliminate it, savings are equal investments, due to NX (net export) is 0. When I use EQBOP I have this error. What is wrong?


1 set
2 T time periods /20142064/
3 J producers (A=oil sector and B=non-oil sector) /A,B/
4 ;
5
6 PARAMETERS
7 A(J,T) technology level parameter for production function
8 alpha(J) expenditure shares of capital for production function
9 r discount rate
10 gl rate of labour force
11 delta depreciation rate
12 L0 labour force at t = 0 /96379/
13 K0 captial stock at t = 0 /676144/
14 gamma share of good A and B in utility function
15 p(J) price of goods
16
17 ;
18
19 Parameter values
20 A(J,T) = 1;
21 r=0.02;
22 gl = 0.01;
23 delta = 0.10;
24 alpha(“A”) = 0.20;
25 alpha(“B”) = 0.15;
26 gamma = 0.5;
27 p(J) = 1;
28
29
30 VARIABLES
31
32 C(J,T) consumption
33 L(J,T) labour force
34 LT(T) total labour
35 K(J,T) capital
36 I(J,T) investment
37 Y(J,T) economic activity or output
38 Y1(J,T) economic activity or output Y1
39 U(T) utility
40 TOTU objective function
41 EX(J,T) export
42 IM(J,T) import
43 NX(J,T) net export
44 S(J,T) savings
45 BOP
46 ;
47
48
49 POSITIVE VARIABLES C(J,T), L(J,T), K(J,T), I(J,T), Y1(J,T), LB(J,T);
50
51
52 EQUATIONS
53
54 EQL(J,T) labour force for A and B
55 EQLT(T) total labour
56 EQLB(J,T) labour force distributed
57 EQK(J,T) capital
58 EQY(J,T) economic activity
59 EQY1(J,T) economic activity Y1
60 EQU(T) utility
61 EQTOTU objectie fuction
62 EQEX(J,T) export
63 EQIM(J,T) import
64 EQNX(J,T) net export
65 EQS(J,T) savings
66 EQBOP(J,T)
67
68 ;
69
70 EQL(J,T)… L(J,T) =E= L0
(1+gl)**(ORD(T));
71 EQLT(T)… LT(T) =E= sum(J,L(J,T));
72 EQLB(J,T)… LT(T) =E= LB(“A”,T)+LB(“B”,T);
73 EQK(J,T)… K(J,T) =E= (K0$(ord(T)=1)+K(J,T-1))
(1-delta)+I(J,T);
74 EQY(J,T)… Y(J,T) =E= A(J,T)K(J,T)alpha(J)*L(J,T)(1-ALPHA(J));
75 EQY1(J,T)… Y(J,T) =E= C(J,T)+I(J,T)+NX(J,T);
76 EQU(T)… U(T) =E= (C(“A”,T)**gamma)
(C(“B”,T)(1-gamma))/((1+r)(O
RD(T)-1));
77 EQTOTU… TOTU =E= sum(T,U(T));
78 EQNX(J,T)… NX(J,T) =E= EX(J,T)-IM(J,T);
79 EQIM(J,T)… IM(J,T) =E= 0.5C(J,T);
80 EQEX(J,T)… EX(J,T) =E= IM(J,T);
81 EQS(J,T)… S(J,T) =E= Y(J,T)-C(J,T);
82 EQBOP(J,T)… SUM(J,p(J)
(EX(J,T)-IM(J,T)))=E=0;
**** $125
83
84
85
86 L.L(J,T)=L0;
87 K.L(J,T)=K0;
88
89
90
91 MODEL INVEST /ALL/;
92 SOLVE INVEST USING DNLP MAXIMIZING TOTU;
**** $257
93
94
95 DISPLAY Y.L, C.L, L.L, K.L, I.L, S.L, U.L, TOTU.L, EX.L, IM.L, NX.L;
**** $141 $141 $141 $141 $141 $141 $141 $141 $141
GAMS Rev 148 x86/MS Windows 09/11/14 15:15:30 Page 2
G e n e r a l A l g e b r a i c M o d e l i n g S y s t e m
Error Messages

125 Set is under control already
141 Symbol neither initialized nor assigned
A wild shot: You may have spurious commas in the explanatory
text of a declaration. Check symbol reference list.
257 Solve statement not checked because of previous errors


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.
For more options, visit https://groups.google.com/d/optout.

\

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.

Reply-to: gamsworld@googlegroups.com

Andre, many-many thanks. I fixed it!

Alias (J,J1)

EQBOP(J,T)… SUM(J1,p(J)*(EX(J,T)-IM(J,T)))=E=0;


Tanya

On Friday, 12 September 2014 09:28:24 UTC+2, Savitsky Andre wrote:

Dear Tania!

You used SUM(j

But in Equation definition You have (J,T)

After usage SUM(j
J will dissapear

How it can be in equation definition?

Correct this and all will be fine


All the best

Dears, I have an error 125. The problem with the EQBOP, if I eliminate it, savings are equal investments, due to NX (net export) is 0. When I use EQBOP I have this error. What is wrong?

1 set
2 T time periods /20142064/
3 J producers (A=oil sector and B=non-oil sector) /A,B/
4 ;
5
6 PARAMETERS
7 A(J,T) technology level parameter for production function
8 alpha(J) expenditure shares of capital for production function
9 r discount rate
10 gl rate of labour force
11 delta depreciation rate
12 L0 labour force at t = 0 /96379/
13 K0 captial stock at t = 0 /676144/
14 gamma share of good A and B in utility function
15 p(J) price of goods
16
17 ;
18
19 Parameter values
20 A(J,T) = 1;
21 r=0.02;
22 gl = 0.01;
23 delta = 0.10;
24 alpha(“A”) = 0.20;
25 alpha(“B”) = 0.15;
26 gamma = 0.5;
27 p(J) = 1;
28
29
30 VARIABLES
31
32 C(J,T) consumption
33 L(J,T) labour force
34 LT(T) total labour
35 K(J,T) capital
36 I(J,T) investment
37 Y(J,T) economic activity or output
38 Y1(J,T) economic activity or output Y1
39 U(T) utility
40 TOTU objective function
41 EX(J,T) export
42 IM(J,T) import
43 NX(J,T) net export
44 S(J,T) savings
45 BOP
46 ;
47
48
49 POSITIVE VARIABLES C(J,T), L(J,T), K(J,T), I(J,T), Y1(J,T), LB(J,T);
50
51
52 EQUATIONS
53
54 EQL(J,T) labour force for A and B
55 EQLT(T) total labour
56 EQLB(J,T) labour force distributed
57 EQK(J,T) capital
58 EQY(J,T) economic activity
59 EQY1(J,T) economic activity Y1
60 EQU(T) utility
61 EQTOTU objectie fuction
62 EQEX(J,T) export
63 EQIM(J,T) import
64 EQNX(J,T) net export
65 EQS(J,T) savings
66 EQBOP(J,T)
67
68 ;
69
70 EQL(J,T)… L(J,T) =E= L0
(1+gl)**(ORD(T));
71 EQLT(T)… LT(T) =E= sum(J,L(J,T));
72 EQLB(J,T)… LT(T) =E= LB(“A”,T)+LB(“B”,T);
73 EQK(J,T)… K(J,T) =E= (K0$(ord(T)=1)+K(J,T-1))
(1-delta)+I(J,T);
74 EQY(J,T)… Y(J,T) =E= A(J,T)K(J,T)alpha(J)*L(J,T)(1-ALPHA(J));
75 EQY1(J,T)… Y(J,T) =E= C(J,T)+I(J,T)+NX(J,T);
76 EQU(T)… U(T) =E= (C(“A”,T)**gamma)
(C(“B”,T)(1-gamma))/((1+r)(O
RD(T)-1));
77 EQTOTU… TOTU =E= sum(T,U(T));
78 EQNX(J,T)… NX(J,T) =E= EX(J,T)-IM(J,T);
79 EQIM(J,T)… IM(J,T) =E= 0.5C(J,T);
80 EQEX(J,T)… EX(J,T) =E= IM(J,T);
81 EQS(J,T)… S(J,T) =E= Y(J,T)-C(J,T);
82 EQBOP(J,T)… SUM(J,p(J)
(EX(J,T)-IM(J,T)))=E=0;
**** $125
83
84
85
86 L.L(J,T)=L0;
87 K.L(J,T)=K0;
88
89
90
91 MODEL INVEST /ALL/;
92 SOLVE INVEST USING DNLP MAXIMIZING TOTU;
**** $257
93
94
95 DISPLAY Y.L, C.L, L.L, K.L, I.L, S.L, U.L, TOTU.L, EX.L, IM.L, NX.L;
**** $141 $141 $141 $141 $141 $141 $141 $141 $141
GAMS Rev 148 x86/MS Windows 09/11/14 15:15:30 Page 2
G e n e r a l A l g e b r a i c M o d e l i n g S y s t e m
Error Messages

125 Set is under control already
141 Symbol neither initialized nor assigned
A wild shot: You may have spurious commas in the explanatory
text of a declaration. Check symbol reference list.
257 Solve statement not checked because of previous errors

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.

For more options, visit https://groups.google.com/d/optout.

With kindly regards!
Andre Savitsky
E-mail:a...@yandex.ru
andre...@yahoo.com


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.

Reply-to: gamsworld@googlegroups.com

Dear Andre!


I checked it! It seems to be equal for both equations. Thanks!!! But I’m confused by the next model that I’ve posted “Dears, the model works, but the result is confusing! Your help is highly appreciated!”. I dont’understand what is wrong there. If you have time and willingness to help, I would be glad to hear your feedback about it.


Tanya


On Monday, 15 September 2014 11:14:55 UTC+2, Savitsky Andre wrote:

Dear Tanya!

Check please again model and how code correspond to model

if this work
EQBOP(J,T)… SUM(J1,p(J)*(EX(J,T)-IM(J,T)))=E=0;
this have work too

EQBOP(J,T)… p(J)*(EX(J,T)-IM(J,T))=E=0;
without any difference

\

Dear Claudio,

Many thanks for the message! I realised that the problem with the J index. I red smth from the google forum and also the McCarl’s Gams User Guid, but it’s still not clear for me how to fix, since the Gams Guid doesn’t explain it.

Regarding, alias, I thought about it… mmm… I got it, have a look:

Alias (J,J1)

EQBOP(J,T)… SUM(J1,p(J)*(EX(J,T)-IM(J,T)))=E=0;

Claudio, the model WORKS! Yahoo!!!

Tanya

On Thursday, 11 September 2014 16:55:07 UTC+2, Claudio Delpino wrote:

Tanya: Your question is a fairly common one that has been answered many times. Please remember you can search this group at https://groups.google.com/forum/#!forum/gamsworld, and some relevant links are given there to documents where your question is answered (p 21 of GAMS Tutorial and User Guide, and this page of the McCarl’s extended User Guide http://www.gams.com/mccarl/mccarlhtml/summing_over_ses_already_indexed_error_f.htm?zoom_highlightsub=125).

I understand that you can read from any of these three sources what your mistake is.

Basically, you’re trying to sum over set J, and at the same time you’re declaring EQBOP to be written for each member of sets J and T.

This is conflictive because when you invoke it inside the summatory (on symbols p(J), EX(J,T), IM(J,T)) you loose the possibility of specifying wether you’re reffering to the particular instances of EQBOP (there are card(T) instances for each J) or to the summing-over index.

Solution for this conflict comes through the Alias() statement, with which you create a “mirror” set that you can use to replace one of the two “controlling” appearences (as the domain of an equation / as the index of a summatory) of set J, and then univocally specify what set is “controlling” each of the symbols p(J), EX(J,T) and IM(J,T).

Really hard for me to explain this by mail, but if you work it in “paper” terms you will notice where the conflict is.

Best Regards and Good Luck!
Claudio

On Thu, Sep 11, 2014 at 10:18 AM, Tanya B. wrote:

Dears, I have an error 125. The problem with the EQBOP, if I eliminate it, savings are equal investments, due to NX (net export) is 0. When I use EQBOP I have this error. What is wrong?

1 set
2 T time periods /20142064/
3 J producers (A=oil sector and B=non-oil sector) /A,B/
4 ;
5
6 PARAMETERS
7 A(J,T) technology level parameter for production function
8 alpha(J) expenditure shares of capital for production function
9 r discount rate
10 gl rate of labour force
11 delta depreciation rate
12 L0 labour force at t = 0 /96379/
13 K0 captial stock at t = 0 /676144/
14 gamma share of good A and B in utility function
15 p(J) price of goods
16
17 ;
18
19 Parameter values
20 A(J,T) = 1;
21 r=0.02;
22 gl = 0.01;
23 delta = 0.10;
24 alpha(“A”) = 0.20;
25 alpha(“B”) = 0.15;
26 gamma = 0.5;
27 p(J) = 1;
28
29
30 VARIABLES
31
32 C(J,T) consumption
33 L(J,T) labour force
34 LT(T) total labour
35 K(J,T) capital
36 I(J,T) investment
37 Y(J,T) economic activity or output
38 Y1(J,T) economic activity or output Y1
39 U(T) utility
40 TOTU objective function
41 EX(J,T) export
42 IM(J,T) import
43 NX(J,T) net export
44 S(J,T) savings
45 BOP
46 ;
47
48
49 POSITIVE VARIABLES C(J,T), L(J,T), K(J,T), I(J,T), Y1(J,T), LB(J,T);
50
51
52 EQUATIONS
53
54 EQL(J,T) labour force for A and B
55 EQLT(T) total labour
56 EQLB(J,T) labour force distributed
57 EQK(J,T) capital
58 EQY(J,T) economic activity
59 EQY1(J,T) economic activity Y1
60 EQU(T) utility
61 EQTOTU objectie fuction
62 EQEX(J,T) export
63 EQIM(J,T) import
64 EQNX(J,T) net export
65 EQS(J,T) savings
66 EQBOP(J,T)
67
68 ;
69
70 EQL(J,T)… L(J,T) =E= L0
(1+gl)**(ORD(T));
71 EQLT(T)… LT(T) =E= sum(J,L(J,T));
72 EQLB(J,T)… LT(T) =E= LB(“A”,T)+LB(“B”,T);
73 EQK(J,T)… K(J,T) =E= (K0$(ord(T)=1)+K(J,T-1))
(1-delta)+I(J,T);
74 EQY(J,T)… Y(J,T) =E= A(J,T)K(J,T)alpha(J)*L(J,T)(1-ALPHA(J));
75 EQY1(J,T)… Y(J,T) =E= C(J,T)+I(J,T)+NX(J,T);
76 EQU(T)… U(T) =E= (C(“A”,T)**gamma)
(C(“B”,T)(1-gamma))/((1+r)(O
RD(T)-1));
77 EQTOTU… TOTU =E= sum(T,U(T));
78 EQNX(J,T)… NX(J,T) =E= EX(J,T)-IM(J,T);
79 EQIM(J,T)… IM(J,T) =E= 0.5C(J,T);
80 EQEX(J,T)… EX(J,T) =E= IM(J,T);
81 EQS(J,T)… S(J,T) =E= Y(J,T)-C(J,T);
82 EQBOP(J,T)… SUM(J,p(J)
(EX(J,T)-IM(J,T)))=E=0;
**** $125
83
84
85
86 L.L(J,T)=L0;
87 K.L(J,T)=K0;
88
89
90
91 MODEL INVEST /ALL/;
92 SOLVE INVEST USING DNLP MAXIMIZING TOTU;
**** $257
93
94
95 DISPLAY Y.L, C.L, L.L, K.L, I.L, S.L, U.L, TOTU.L, EX.L, IM.L, NX.L;
**** $141 $141 $141 $141 $141 $141 $141 $141 $141
GAMS Rev 148 x86/MS Windows 09/11/14 15:15:30 Page 2
G e n e r a l A l g e b r a i c M o d e l i n g S y s t e m
Error Messages

125 Set is under control already
141 Symbol neither initialized nor assigned
A wild shot: You may have spurious commas in the explanatory
text of a declaration. Check symbol reference list.
257 Solve statement not checked because of previous errors

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.

For more options, visit https://groups.google.com/d/optout.

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.

For more options, visit https://groups.google.com/d/optout.

With kindly regards!
Andre Savitsky
E-mail:a...@yandex.ru
andre...@yahoo.com


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.