-
Notifications
You must be signed in to change notification settings - Fork 2
/
parameters.py
76 lines (53 loc) · 1.78 KB
/
parameters.py
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
import random
from pandas import read_csv
import os
# running time of the model
final_Time = 50
time_to_cut_plots = 2
pop_redutor = 0.0015
# number of agents in the simulation
pop_table = read_csv("pop.csv", sep=";", header=0, decimal=',')
# defining the path to save the output
OUTPUT_PATH = '//storage4/carga/modelo dinamico de simulacao/exits_python/'
# checking the presence of output and creating the folder if there isn't
if os.path.exists(os.path.join(OUTPUT_PATH, 'Results')) is False:
os.mkdir(os.path.join(OUTPUT_PATH, 'Results'))
# formatting the output path
OUTPUT_PATH = os.path.join(OUTPUT_PATH, 'Results')
cod = []
pop_mun = []
for item in range(len(pop_table['cod_mun'])):
cod.append(int(pop_table['cod_mun'][item]))
pop_mun.append(int(pop_table['2010'][item] * pop_redutor))
pop = sum(pop_mun)
if time_to_cut_plots >= final_Time:
vars()['time_to_cut_plots'] = int(final_Time/2)-1
class N:
def __init__(self, pop, cod, pop_mun):
self.total_n = pop
self.old = self.total_n
self.cod = cod
self.pop_mun = pop_mun
def get_n(self):
return self.total_n
def set_n(self, n):
self.total_n = n
def set_old(self):
self.old = self.total_n
def get_old(self):
return self.old
def get_cod(self):
return self.cod
def get_pop_mun(self):
return self.pop_mun
def update_n(self):
self.total_n += 1
def __str__(self):
return str(self.total_n)
my_n = N(pop, cod, pop_mun)
# endowments
omega = 1
# agent activations per period
activation = int(my_n.get_n() * .04)
# time calibration: one model period one month of calendar time
# initial condition all agents in singleton firms