-
Notifications
You must be signed in to change notification settings - Fork 0
/
start.py
60 lines (43 loc) · 1.2 KB
/
start.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
from __future__ import division
import abce
from abce import Simulation
simulation_parameters = {'name': 'name',
'rounds': 50,
'firms': 5,
'households': 5}
class Firm(abce.Agent):
def init(self, param, agent_params):
pass
def one(self):
pass
def three(self):
pass
class Household(abce.Agent):
def init(self, param, agent_params):
pass
def two(self):
pass
def three(self):
pass
def main(simulation_parameters, rounds=20):
simulation = Simulation('sim')
firms = simulation.build_agents(Firm, 5)
households = simulation.build_agents(Household, 5)
allagents = firms + households
for r in range(rounds):
# round endowment
# TODO wrap this
for h in households:
h.create('labor', 1)
for f in firms:
f.one()
for h in households:
h.two()
for a in allagents:
a.three()
# perishable
for h in households:
if h.possession('labor') > 0:
h.destroy('labor', 1)
if __name__ == '__main__':
main(simulation_parameters)