Thanks for the good advice, Claudio! It’s a better to find an answer myself! It’s not that easy to ask a tutor. Learning by doing - a motto of the university!
Tanya
On Wednesday, 27 August 2014 09:26:35 UTC+2, Claudio Delpino wrote:
Tanya:
GAMS fix: You declared LB to be a PARAMETER but then you didn’t initialize (assign values) into it. I get the feeling that it should be a Variable, but no one better than you to understand what you are trying to model, which takes me to…
Philosophycal rant on modelling:
Do you understand the difference between a parameter and a variable ? You should not be in the coding stage if you don’t.
As I wrote you before: “As a general advice on modelling, the higher the ratio of [thinking time]/[writing code] the better results you will get.”
I go into this because you are asking a lot of things which stem not from difficult GAMS syntax, but not a proper understanding of modelling in general terms and your model specifically.
Write it on paper, even better, try to solve it. Know how your variables should behave. Then learn the syntax of the language -GAMS- in order to achieve what you already at least feel your model should achieve.
Sets, summing over sets, equalities and inequalities, appear to be on top of your learning list.
I will agree if you say this is a lengthy and a process that’s not easy to do alone (don’t you have a tutor ???), but I’m sure that it will payoff to you in the long run. I’d think most of the people here using the language -GAMS- efficiently have gone through it in the past. I’m sure I have, and it has paid off for me. Syntax is easy once you know your theory.
Please don’t take this the wrong way, just trying to help you.
Regards
Claudio
On Tue, Aug 26, 2014 at 11:30 AM, Tanya B. wrote:
I did not put the list file. The error 66 stated that I need to put a value for LB. Why I have to do it, if I want the model to distribute the amount of labour between two sectors LB(J,T) to be equal total labour LT(T)?
1 set
2 T time periods /2014*2064/
3 J producers /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 /5201/
13 K0 captial stock at t = 0 /194239/
14 CC(T) per capita consumption
15 LB(J,T)
16 ;
17
18 *Parameter values
19 A(J,T) = 1;
20 r=0.02;
21 gl = 0.01;
22 delta = 0.10;
23 alpha(“A”) = 0.2;
24 alpha(“B”) = 0.3;
25
26
27 VARIABLES
28
29 C(T) consumption
30 L(J,T) labour force
31
32 K(J,T) capital
33 I(J,T) investment
34 S(J,T) savings
35 Y(J,T) economic activity or output
36 Y1(J,T) economic activity or output Y1
37 TOTY(T) total ptoduction of 2 sectors
38 U(T) utility
39 TOTU objective function
40 LT(T)
41
42 ;
43
44
45 POSITIVE VARIABLES C(T), L(J,T), K(J,T), I(J,T), Y1(J,T);
46
47
48 EQUATIONS
49
50 EQL(J,T) labour force
51 EQLT(T) total labour
52 EQLB(J,T) labour force A and K
53 EQK(J,T) capital
54 EQY(J,T) economic activity
55 EQY1(J,T) economic activity Y1
56 EQS(J,T) savings
57 EQTOTY(T) total ptoduction of 2 sectors
58 EQU(T) utility
59 EQTOTU objectie fuction
60
61
62 ;
63
64 EQL(J,T)… L(J,T) =E= L0*(1+gl)(ORD(T));
65
66 EQLT(T)… LT(T) =E= sum(J,L(J,T));
67 EQLB(J,T)… LT(T) =G= LB(“A”,T)+LB(“B”,T);
68 EQK(J,T)… K(J,T) =E= (K0$(ord(T)=1)+K(J,T-1))*(1-delta)+I(J,T);
69
70 EQY(J,T)… Y(J,T) =E= A(J,T)*K(J,T)alpha(J)*L(J,T)(1-ALPHA(J));
71 EQY1(J,T)… Y(J,T) =E= C(T)+I(J,T);
72 EQTOTY(T)… TOTY(T) =E= sum(J,Y(J,T));
73 EQS(J,T)… S(J,T) =E= I(J,T);
74 EQU(T)… U(T) =E= C(T)/((1+r)(ORD(T)));
75 EQTOTU… TOTU =E= sum(T,U(T));
76
77
78
79 L.L(J,T)=L0;
80 K.L(J,T)=K0;
81
82
83
84 MODEL INVEST /ALL/;
85 SOLVE INVEST USING DNLP MAXIMIZING TOTU;
**** $66,256
**** The following DNLP errors were detected in model INVEST:
**** 66 equation EQLB … symbol “LB” has no values assigned
86
87
88 DISPLAY Y.L, C.L, L.L, K.L, I.L, S.L, U.L, TOTU.L, TOTY.L;
GAMS Rev 148 x86/MS Windows 08/26/14 16:21:56 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
66 The symbol shown has not been defined or assigned
A wild shot: You may have spurious commas in the explanatory
text of a declaration. Check symbol reference list.
256 Error(s) in analyzing solve statement. More detail appears
Below the solve statement above
On Monday, 25 August 2014 11:54:39 UTC+2, Arne Stolbjerg Drud wrote:
Hi Tania
I usually do not respond to questions with “Urgent†in the subject list. In my view, the GAMS lists are friendly offers for help to users that themselves make an effort, think about what they do, try to learn, and put in time. So do not push with Urgent, Quick or something like that. At least it kept me away from your problem for a long time.
Anyway, you really have to think about your variables. What does L and K mean? Sure, it is labor and capital. But you should have something with total labor and capital in a particular year and then you should have something with the amount of labor and capital in each sector. This means you need variables like LT(T) and KT(T) for total labor and capital and LS(J,T) and KS(J.T) for the amounts used in each sector. Go through your model and think which of these variable you need in each case. The equations that have been the subject of this thread for the last week are quite simple: they are just the relationship between the two different labor variables, LT and LS, and between the two different capital variables, KT and KS.
Once you have these concepts right and understand what a set and an index is, then you should be all right.
Good luck.
Arne
\
Arne Stolbjerg Drud
ARKI Consulting & Development A/S
Bagsvaerdvej 246A, DK-2880 Bagsvaerd, Denmark
Phone: (+45) 44 49 03 23, Fax: (+45) 44 49 03 33, email: ad…@arki.dk
From: gams...@googlegroups.com [mailto:gams...@googlegroups.com] On Behalf Of Tanya B.
Sent: Monday, August 25, 2014 11:23 AM
To: gams...@googlegroups.com
Cc: for_t...@mail.ru; andre...@yandex.ru
Subject: Re: Error 125 in GAMS. I Urgently need help!
I also tried to fix the 148 error without “Alias”:
EQKS(J,T)… K(“A”,T)+K(“B”,T) =L= K(J,T);
EQLS(J,T)… L(“A”,T)+L(“B”,T) =L= L(J,T);
the model works, but the result is the same as yours.
On Monday, 25 August 2014 09:57:58 UTC+2, Savitsky Andre wrote:
Dear Tania!
I am not good specialist in economic and this reason why I not understood and possible never can understand what this model is and what about
But error in GAMS code - this i not dificult
Please read this file.
set
T time periods /2014*2064/
J producers /A,B/ ;
Alias(j,j1)
;
PARAMETERS
A(J,T) technology level parameter for production function
alpha(J) Expenditure shares of capital for production function
r discount rate
gl rate of labour force
delta depreciation rate
L0 labour force at t = 0 /4324/
K0 captial stock at t = 0 /194239/
CC(T) per capita consumption
;
*Parameter values
A(J,T) = 1;
r=0.02;
gl = 0.01;
delta = 0.10;
alpha(“A”) = 0.2;
alpha(“B”) = 0.3;
VARIABLES
C(T) consumption
L(J,T) labour force
K(J,T) capital
I(J,T) investment
S(J,T) savings
Y(J,T) economic activity or output
Y1(J,T) economic activity or output Y1
TOTY(T) total ptoduction of 2 sectors
U(T) utility
TOTU objective function
;
POSITIVE VARIABLES C(T), L(J,T), K(J,T), I(J,T), Y1(J,T);
EQUATIONS
EQL(J,T) labour force
EQK(J,T) capital
EQY(J,T) economic activity
EQY1(J,T) economic activity Y1
EQS(J,T) savings
EQTOTY(T) total ptoduction of 2 sectors
EQU(T) utility
EQTOTU objectie fuction
EQKS(J,T)
EQLS(J,T)
;
EQL(J,T)… L(J,T) =E= L0*(1+gl)(ORD(T));
EQK(J,T)… K(J,T) =E= (K0$(ord(T)=1)+K(J,T-1))*(1-delta)+I(J,T);
EQY(J,T)… Y(J,T) =E= A(J,T)*K(J,T)alpha(J)*L(J,T)(1-ALPHA(J));
EQY1(J,T)… Y(J,T) =E= C(T)+I(J,T);
EQTOTY(T)… TOTY(T) =E= sum(J,Y(J,T));
EQS(J,T)… S(J,T) =E= I(J,T);
EQU(T)… U(T) =E= C(T)/((1+r)(ORD(T)-1));
EQTOTU… TOTU =E= sum(T,U(T));
***************************************************** WAS
- EQKS(J,T)… SUM(J1,K(J1)) =L= K(J,T);
*** $148
- EQLS(J,T)… SUM(J1,L(J1)) =L= L(J,T);
*** $148
***************************************************** May be this is more correct
EQKS(J,T)… SUM(J1,K(J1,T)) =L= K(J,T);
EQLS(J,T)… SUM(J1,L(J1,T)) =L= L(J,T);
L.L(J,T)=L0;
K.L(J,T)=K0;
MODEL INVEST /ALL/;
SOLVE INVEST USING DNLP MAXIMIZING TOTU;
CC(T)=C.L(T)/sum(J,L.L(J,T));
DISPLAY Y.L, C.L, L.L, K.L, I.L, S.L, U.L, TOTU.L, TOTY.L, CC;
I receive answer that something not good in mathematical description of model. But only You can to find where economic problems in model. Some interfighing between equations.
All the best! Andre
\
Hi Andre! Thanks again. But the model still doesn’t work. I’m confused by Alias(j,j1) . When I put it in the set, the word “Alias” is blue… My intention is to limit the labour and capital of the two sectors A and B (LS, KS) every year by the L(J,T) and K(J,T) calculated within the model every year.
1 set
2 T time periods /20142064/
3 J producers /A,B/
4 Alias(j,j1)
5 ;
6
7 PARAMETERS
8 A(J,T) technology level parameter for production function
9 alpha(J) Expenditure shares of capital for production function
10 r discount rate
11 gl rate of labour force
12 delta depreciation rate
13 L0 labour force at t = 0 /4324/
14 K0 captial stock at t = 0 /194239/
15 CC(T) per capita consumption
16 ;
17
18 Parameter values
19 A(J,T) = 1;
20 r=0.02;
21 gl = 0.01;
22 delta = 0.10;
23 alpha(“A”) = 0.2;
24 alpha(“B”) = 0.3;
25
26
27
28 VARIABLES
29
30 C(T) consumption
31 L(J,T) labour force
32 K(J,T) capital
33 I(J,T) investment
34 S(J,T) savings
35 Y(J,T) economic activity or output
36 Y1(J,T) economic activity or output Y1
37 TOTY(T) total ptoduction of 2 sectors
38 U(T) utility
39 TOTU objective function
40
41 ;
42
43
44 POSITIVE VARIABLES C(T), L(J,T), K(J,T), I(J,T), Y1(J,T);
45
46 EQUATIONS
47
48 EQL(J,T) labour force
49 EQK(J,T) capital
50 EQY(J,T) economic activity
51 EQY1(J,T) economic activity Y1
52 EQS(J,T) savings
53 EQTOTY(T) total ptoduction of 2 sectors
54 EQU(T) utility
55 EQTOTU objectie fuction
56 EQKS(J,T)
57 EQLS(J,T)
58
59
60 ;
61
62 EQL(J,T)… L(J,T) =E= L0(1+gl)**(ORD(T));
63 EQK(J,T)… K(J,T) =E= (K0$(ord(T)=1)+K(J,T-1))(1-delta)+I(J,T);
64 EQY(J,T)… Y(J,T) =E= A(J,T)*K(J,T)alpha(J)*L(J,T)(1-ALPHA(J));
65 EQY1(J,T)… Y(J,T) =E= C(T)+I(J,T);
66 EQTOTY(T)… TOTY(T) =E= sum(J,Y(J,T));
67 EQS(J,T)… S(J,T) =E= I(J,T);
68 EQU(T)… U(T) =E= C(T)/((1+r)**(ORD(T)-1));
69 EQTOTU… TOTU =E= sum(T,U(T));
70 EQKS(J,T)… SUM(J1,K(J1)) =L= K(J,T);
**** $148
71
72 EQLS(J,T)… SUM(J1,L(J1)) =L= L(J,T);
**** $148
73
74
75 L.L(J,T)=L0;
76 K.L(J,T)=K0;
77
78
79
80
81
82 MODEL INVEST /ALL/;
83 SOLVE INVEST USING DNLP MAXIMIZING TOTU;
**** $257
84
85 CC(T)=C.L(T)/sum(J,L.L(J,T));
**** $141
86
87 DISPLAY Y.L, C.L, L.L, K.L, I.L, S.L, U.L, TOTU.L, TOTY.L, CC;
**** $141 $141 $141 $141 $141 $141
GAMS Rev 148 x86/MS Windows 08/22/14 15:23:16 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
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.
148 Dimension different - The symbol is referenced with more/less
indices as declared
257 Solve statement not checked because of previous errors
**** 10 ERROR(S) 0 WARNING(S)
–
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+...@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.