-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.py
More file actions
76 lines (70 loc) · 2.7 KB
/
Main.py
File metadata and controls
76 lines (70 loc) · 2.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
__author__ = "Andre Barbe"
__created__ = "2021-09-06"
# This file is the main one, it automates the running of the GTAP files
import subprocess
# Create cmf_file for each simulation
# Instructions on how to write a cmf file are available here:
# https://www.kite.com/python/answers/how-to-write-to-a-file-in-python
lines_common=[
"!Define AI and non-AI Sectors\n",
"XSET AI_COMM # AI related comms # (OthServices, CMN, OBS, Transport) ;\n",
"XSUBSET AI_COMM is subset of TRAD_COMM ;\n",
"XSET NONAI_COMM = TRAD_COMM - AI_COMM ;\n",
"\n",
"!Define Labor, High, and Low\n",
"!Off_Mgr_Pros is ILO category 1\n",
"!Tech_AsPros is ILO 2 and 3\n",
"!Clerks is ILO 4\n",
"!Service_Shop is ILO 5\n",
"!Ag_OthLowSk is ILO 6-9\n",
"XSET HI_LAB # High Skilled Labor # (Off_Mgr_Pros, Tech_AsPros) ;\n",
"XSUBSET HI_LAB is subset of ENDW_COMM ;\n",
"XSET LO_LAB # Low Skilled Labor # (Clerks, Service_Shop, Ag_OthLowSk) ;\n",
"XSUBSET LO_LAB is subset of ENDW_COMM ;\n",
"XSET ALL_LAB = HI_LAB + LO_LAB ;\n",
"XSUBSET ALL_LAB is subset of ENDW_COMM ;\n",
"!@ end of CMFSTART part\n",
"\n",
"aux files = GTAP_Model_Files/GTAPU;\n",
"file gtapSETS = GTAP_Data_Files/sets.har;\n",
"file gtapDATA = GTAP_Data_Files/basedata.har;\n",
"\n",
"Method = Gragg;\n",
"Steps = 2 4 6;\n",
"automatic accuracy = yes;\n",
"accuracy figures = 4;\n",
"accuracy percent = 99;\n",
"minimum subinterval length = 1.0E-0003;\n",
"minimum subinterval fails = stop;\n",
"accuracy criterion = Data;\n",
"subintervals = 2;\n",
"exogenous\n",
" pop\n",
" psaveslack pfactwld\n",
" profitslack incomeslack endwslack\n",
" cgdslack tradslack\n",
" ams atm atf ats atd\n",
" aosec aoreg avasec avareg\n",
" afcom afsec afreg afecom afesec afereg\n",
" aoall afall afeall\n",
" au dppriv dpgov dpsave\n",
" to tp tm tms tx txs\n",
" qo(ENDW_COMM,REG)\n",
" atall avaall tf tfd tfm tgd tpd tgm tpm;\n",
"Rest Endogenous ;\n",
"\n",
]
lines_sim_specific=[
"Updated file gtapDATA = Results/01Ref.upd;\n",
"Solution file = Results/01Ref;\n",
"file gtapPARM = GTAP_Data_Files\default.prm;\n",
"Verbal Description =\n",
"1 Reference case. Increase supply of all 5 types of labor in USA;\n",
"\n",
"swap qo(\"capital\",REG) = Expand(\"capital\",REG);\n",
"shock qo(all_lab , \"usa\") = uniform 50;\n"
]
cmf_file = open("Control_Files/01Ref.cmf", "w")
cmf_file.writelines(lines_common + lines_sim_specific)
cmf_file.close()
subprocess.call("Control_Files\Run_GTAP_SLTOHT.cmd")