Skip to content

Commit 86f8592

Browse files
committed
rebase and some additional fixes
1 parent 40399c7 commit 86f8592

File tree

6 files changed

+334
-140
lines changed

6 files changed

+334
-140
lines changed
Lines changed: 251 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,251 @@
1+
,RunId,iteration,Step,init_people,rich_threshold,reserve_percent,Rich,Poor,Middle Class,Savings,Wallets,Money,Loans,AgentID,Wealth
2+
0,0,0,1000,25,5,5,11,5,7,251,0,251,173,1,2
3+
1,0,0,1000,25,5,5,11,5,7,251,0,251,173,2,44
4+
2,0,0,1000,25,5,5,11,5,7,251,0,251,173,3,-22
5+
3,0,0,1000,25,5,5,11,5,7,251,0,251,173,4,-10
6+
4,0,0,1000,25,5,5,11,5,7,251,0,251,173,5,8
7+
5,0,0,1000,25,5,5,11,5,7,251,0,251,173,6,17
8+
6,0,0,1000,25,5,5,11,5,7,251,0,251,173,7,5
9+
7,0,0,1000,25,5,5,11,5,7,251,0,251,173,8,1
10+
8,0,0,1000,25,5,5,11,5,7,251,0,251,173,9,2
11+
9,0,0,1000,25,5,5,11,5,7,251,0,251,173,10,51
12+
10,0,0,1000,25,5,5,11,5,7,251,0,251,173,11,14
13+
11,0,0,1000,25,5,5,11,5,7,251,0,251,173,12,-22
14+
12,0,0,1000,25,5,5,11,5,7,251,0,251,173,13,10
15+
13,0,0,1000,25,5,5,11,5,7,251,0,251,173,14,57
16+
14,0,0,1000,25,5,5,11,5,7,251,0,251,173,15,7
17+
15,0,0,1000,25,5,5,11,5,7,251,0,251,173,16,3
18+
16,0,0,1000,25,5,5,11,5,7,251,0,251,173,17,12
19+
17,0,0,1000,25,5,5,11,5,7,251,0,251,173,18,-64
20+
18,0,0,1000,25,5,5,11,5,7,251,0,251,173,19,-2
21+
19,0,0,1000,25,5,5,11,5,7,251,0,251,173,20,9
22+
20,0,0,1000,25,5,5,11,5,7,251,0,251,173,21,7
23+
21,0,0,1000,25,5,5,11,5,7,251,0,251,173,22,-1
24+
22,0,0,1000,25,5,5,11,5,7,251,0,251,173,23,-23
25+
23,0,0,1000,25,5,5,11,5,7,251,0,251,173,24,2
26+
24,0,0,1000,25,5,5,11,5,7,251,0,251,173,25,-29
27+
25,1,0,1000,25,10,5,12,8,3,422,5,427,251,1,38
28+
26,1,0,1000,25,10,5,12,8,3,422,5,427,251,2,30
29+
27,1,0,1000,25,10,5,12,8,3,422,5,427,251,3,-21
30+
28,1,0,1000,25,10,5,12,8,3,422,5,427,251,4,65
31+
29,1,0,1000,25,10,5,12,8,3,422,5,427,251,5,40
32+
30,1,0,1000,25,10,5,12,8,3,422,5,427,251,6,10
33+
31,1,0,1000,25,10,5,12,8,3,422,5,427,251,7,-12
34+
32,1,0,1000,25,10,5,12,8,3,422,5,427,251,8,8
35+
33,1,0,1000,25,10,5,12,8,3,422,5,427,251,9,30
36+
34,1,0,1000,25,10,5,12,8,3,422,5,427,251,10,20
37+
35,1,0,1000,25,10,5,12,8,3,422,5,427,251,11,-5
38+
36,1,0,1000,25,10,5,12,8,3,422,5,427,251,12,-38
39+
37,1,0,1000,25,10,5,12,8,3,422,5,427,251,13,-12
40+
38,1,0,1000,25,10,5,12,8,3,422,5,427,251,14,27
41+
39,1,0,1000,25,10,5,12,8,3,422,5,427,251,15,-29
42+
40,1,0,1000,25,10,5,12,8,3,422,5,427,251,16,6
43+
41,1,0,1000,25,10,5,12,8,3,422,5,427,251,17,-37
44+
42,1,0,1000,25,10,5,12,8,3,422,5,427,251,18,27
45+
43,1,0,1000,25,10,5,12,8,3,422,5,427,251,19,-38
46+
44,1,0,1000,25,10,5,12,8,3,422,5,427,251,20,-10
47+
45,1,0,1000,25,10,5,12,8,3,422,5,427,251,21,-49
48+
46,1,0,1000,25,10,5,12,8,3,422,5,427,251,22,37
49+
47,1,0,1000,25,10,5,12,8,3,422,5,427,251,23,35
50+
48,1,0,1000,25,10,5,12,8,3,422,5,427,251,24,37
51+
49,1,0,1000,25,10,5,12,8,3,422,5,427,251,25,12
52+
50,2,0,1000,100,5,5,50,42,8,2563,7,2570,2219,1,-81
53+
51,2,0,1000,100,5,5,50,42,8,2563,7,2570,2219,2,27
54+
52,2,0,1000,100,5,5,50,42,8,2563,7,2570,2219,3,-56
55+
53,2,0,1000,100,5,5,50,42,8,2563,7,2570,2219,4,53
56+
54,2,0,1000,100,5,5,50,42,8,2563,7,2570,2219,5,86
57+
55,2,0,1000,100,5,5,50,42,8,2563,7,2570,2219,6,77
58+
56,2,0,1000,100,5,5,50,42,8,2563,7,2570,2219,7,20
59+
57,2,0,1000,100,5,5,50,42,8,2563,7,2570,2219,8,-28
60+
58,2,0,1000,100,5,5,50,42,8,2563,7,2570,2219,9,51
61+
59,2,0,1000,100,5,5,50,42,8,2563,7,2570,2219,10,-72
62+
60,2,0,1000,100,5,5,50,42,8,2563,7,2570,2219,11,-96
63+
61,2,0,1000,100,5,5,50,42,8,2563,7,2570,2219,12,81
64+
62,2,0,1000,100,5,5,50,42,8,2563,7,2570,2219,13,-43
65+
63,2,0,1000,100,5,5,50,42,8,2563,7,2570,2219,14,66
66+
64,2,0,1000,100,5,5,50,42,8,2563,7,2570,2219,15,70
67+
65,2,0,1000,100,5,5,50,42,8,2563,7,2570,2219,16,7
68+
66,2,0,1000,100,5,5,50,42,8,2563,7,2570,2219,17,32
69+
67,2,0,1000,100,5,5,50,42,8,2563,7,2570,2219,18,21
70+
68,2,0,1000,100,5,5,50,42,8,2563,7,2570,2219,19,64
71+
69,2,0,1000,100,5,5,50,42,8,2563,7,2570,2219,20,-54
72+
70,2,0,1000,100,5,5,50,42,8,2563,7,2570,2219,21,11
73+
71,2,0,1000,100,5,5,50,42,8,2563,7,2570,2219,22,-30
74+
72,2,0,1000,100,5,5,50,42,8,2563,7,2570,2219,23,-21
75+
73,2,0,1000,100,5,5,50,42,8,2563,7,2570,2219,24,24
76+
74,2,0,1000,100,5,5,50,42,8,2563,7,2570,2219,25,-4
77+
75,2,0,1000,100,5,5,50,42,8,2563,7,2570,2219,26,-12
78+
76,2,0,1000,100,5,5,50,42,8,2563,7,2570,2219,27,-67
79+
77,2,0,1000,100,5,5,50,42,8,2563,7,2570,2219,28,53
80+
78,2,0,1000,100,5,5,50,42,8,2563,7,2570,2219,29,79
81+
79,2,0,1000,100,5,5,50,42,8,2563,7,2570,2219,30,-9
82+
80,2,0,1000,100,5,5,50,42,8,2563,7,2570,2219,31,-6
83+
81,2,0,1000,100,5,5,50,42,8,2563,7,2570,2219,32,-2
84+
82,2,0,1000,100,5,5,50,42,8,2563,7,2570,2219,33,45
85+
83,2,0,1000,100,5,5,50,42,8,2563,7,2570,2219,34,85
86+
84,2,0,1000,100,5,5,50,42,8,2563,7,2570,2219,35,23
87+
85,2,0,1000,100,5,5,50,42,8,2563,7,2570,2219,36,-32
88+
86,2,0,1000,100,5,5,50,42,8,2563,7,2570,2219,37,-36
89+
87,2,0,1000,100,5,5,50,42,8,2563,7,2570,2219,38,-75
90+
88,2,0,1000,100,5,5,50,42,8,2563,7,2570,2219,39,-67
91+
89,2,0,1000,100,5,5,50,42,8,2563,7,2570,2219,40,-44
92+
90,2,0,1000,100,5,5,50,42,8,2563,7,2570,2219,41,-13
93+
91,2,0,1000,100,5,5,50,42,8,2563,7,2570,2219,42,-53
94+
92,2,0,1000,100,5,5,50,42,8,2563,7,2570,2219,43,105
95+
93,2,0,1000,100,5,5,50,42,8,2563,7,2570,2219,44,20
96+
94,2,0,1000,100,5,5,50,42,8,2563,7,2570,2219,45,-77
97+
95,2,0,1000,100,5,5,50,42,8,2563,7,2570,2219,46,36
98+
96,2,0,1000,100,5,5,50,42,8,2563,7,2570,2219,47,-35
99+
97,2,0,1000,100,5,5,50,42,8,2563,7,2570,2219,48,-87
100+
98,2,0,1000,100,5,5,50,42,8,2563,7,2570,2219,49,-70
101+
99,2,0,1000,100,5,5,50,42,8,2563,7,2570,2219,50,98
102+
100,2,0,1000,100,5,5,50,42,8,2563,7,2570,2219,51,109
103+
101,2,0,1000,100,5,5,50,42,8,2563,7,2570,2219,52,-93
104+
102,2,0,1000,100,5,5,50,42,8,2563,7,2570,2219,53,-18
105+
103,2,0,1000,100,5,5,50,42,8,2563,7,2570,2219,54,72
106+
104,2,0,1000,100,5,5,50,42,8,2563,7,2570,2219,55,38
107+
105,2,0,1000,100,5,5,50,42,8,2563,7,2570,2219,56,-33
108+
106,2,0,1000,100,5,5,50,42,8,2563,7,2570,2219,57,43
109+
107,2,0,1000,100,5,5,50,42,8,2563,7,2570,2219,58,87
110+
108,2,0,1000,100,5,5,50,42,8,2563,7,2570,2219,59,-2
111+
109,2,0,1000,100,5,5,50,42,8,2563,7,2570,2219,60,29
112+
110,2,0,1000,100,5,5,50,42,8,2563,7,2570,2219,61,123
113+
111,2,0,1000,100,5,5,50,42,8,2563,7,2570,2219,62,-22
114+
112,2,0,1000,100,5,5,50,42,8,2563,7,2570,2219,63,47
115+
113,2,0,1000,100,5,5,50,42,8,2563,7,2570,2219,64,108
116+
114,2,0,1000,100,5,5,50,42,8,2563,7,2570,2219,65,-53
117+
115,2,0,1000,100,5,5,50,42,8,2563,7,2570,2219,66,-3
118+
116,2,0,1000,100,5,5,50,42,8,2563,7,2570,2219,67,-58
119+
117,2,0,1000,100,5,5,50,42,8,2563,7,2570,2219,68,-16
120+
118,2,0,1000,100,5,5,50,42,8,2563,7,2570,2219,69,-28
121+
119,2,0,1000,100,5,5,50,42,8,2563,7,2570,2219,70,41
122+
120,2,0,1000,100,5,5,50,42,8,2563,7,2570,2219,71,-60
123+
121,2,0,1000,100,5,5,50,42,8,2563,7,2570,2219,72,-69
124+
122,2,0,1000,100,5,5,50,42,8,2563,7,2570,2219,73,93
125+
123,2,0,1000,100,5,5,50,42,8,2563,7,2570,2219,74,9
126+
124,2,0,1000,100,5,5,50,42,8,2563,7,2570,2219,75,37
127+
125,2,0,1000,100,5,5,50,42,8,2563,7,2570,2219,76,-108
128+
126,2,0,1000,100,5,5,50,42,8,2563,7,2570,2219,77,-69
129+
127,2,0,1000,100,5,5,50,42,8,2563,7,2570,2219,78,75
130+
128,2,0,1000,100,5,5,50,42,8,2563,7,2570,2219,79,-11
131+
129,2,0,1000,100,5,5,50,42,8,2563,7,2570,2219,80,-18
132+
130,2,0,1000,100,5,5,50,42,8,2563,7,2570,2219,81,16
133+
131,2,0,1000,100,5,5,50,42,8,2563,7,2570,2219,82,-32
134+
132,2,0,1000,100,5,5,50,42,8,2563,7,2570,2219,83,12
135+
133,2,0,1000,100,5,5,50,42,8,2563,7,2570,2219,84,8
136+
134,2,0,1000,100,5,5,50,42,8,2563,7,2570,2219,85,25
137+
135,2,0,1000,100,5,5,50,42,8,2563,7,2570,2219,86,16
138+
136,2,0,1000,100,5,5,50,42,8,2563,7,2570,2219,87,-99
139+
137,2,0,1000,100,5,5,50,42,8,2563,7,2570,2219,88,-15
140+
138,2,0,1000,100,5,5,50,42,8,2563,7,2570,2219,89,33
141+
139,2,0,1000,100,5,5,50,42,8,2563,7,2570,2219,90,12
142+
140,2,0,1000,100,5,5,50,42,8,2563,7,2570,2219,91,43
143+
141,2,0,1000,100,5,5,50,42,8,2563,7,2570,2219,92,2
144+
142,2,0,1000,100,5,5,50,42,8,2563,7,2570,2219,93,-139
145+
143,2,0,1000,100,5,5,50,42,8,2563,7,2570,2219,94,25
146+
144,2,0,1000,100,5,5,50,42,8,2563,7,2570,2219,95,101
147+
145,2,0,1000,100,5,5,50,42,8,2563,7,2570,2219,96,78
148+
146,2,0,1000,100,5,5,50,42,8,2563,7,2570,2219,97,44
149+
147,2,0,1000,100,5,5,50,42,8,2563,7,2570,2219,98,3
150+
148,2,0,1000,100,5,5,50,42,8,2563,7,2570,2219,99,-44
151+
149,2,0,1000,100,5,5,50,42,8,2563,7,2570,2219,100,-59
152+
150,3,0,1000,100,10,5,49,42,9,2598,33,2631,2046,1,-22
153+
151,3,0,1000,100,10,5,49,42,9,2598,33,2631,2046,2,27
154+
152,3,0,1000,100,10,5,49,42,9,2598,33,2631,2046,3,60
155+
153,3,0,1000,100,10,5,49,42,9,2598,33,2631,2046,4,89
156+
154,3,0,1000,100,10,5,49,42,9,2598,33,2631,2046,5,11
157+
155,3,0,1000,100,10,5,49,42,9,2598,33,2631,2046,6,12
158+
156,3,0,1000,100,10,5,49,42,9,2598,33,2631,2046,7,-47
159+
157,3,0,1000,100,10,5,49,42,9,2598,33,2631,2046,8,60
160+
158,3,0,1000,100,10,5,49,42,9,2598,33,2631,2046,9,34
161+
159,3,0,1000,100,10,5,49,42,9,2598,33,2631,2046,10,2
162+
160,3,0,1000,100,10,5,49,42,9,2598,33,2631,2046,11,5
163+
161,3,0,1000,100,10,5,49,42,9,2598,33,2631,2046,12,-27
164+
162,3,0,1000,100,10,5,49,42,9,2598,33,2631,2046,13,-13
165+
163,3,0,1000,100,10,5,49,42,9,2598,33,2631,2046,14,105
166+
164,3,0,1000,100,10,5,49,42,9,2598,33,2631,2046,15,-63
167+
165,3,0,1000,100,10,5,49,42,9,2598,33,2631,2046,16,138
168+
166,3,0,1000,100,10,5,49,42,9,2598,33,2631,2046,17,65
169+
167,3,0,1000,100,10,5,49,42,9,2598,33,2631,2046,18,40
170+
168,3,0,1000,100,10,5,49,42,9,2598,33,2631,2046,19,-68
171+
169,3,0,1000,100,10,5,49,42,9,2598,33,2631,2046,20,39
172+
170,3,0,1000,100,10,5,49,42,9,2598,33,2631,2046,21,-27
173+
171,3,0,1000,100,10,5,49,42,9,2598,33,2631,2046,22,64
174+
172,3,0,1000,100,10,5,49,42,9,2598,33,2631,2046,23,50
175+
173,3,0,1000,100,10,5,49,42,9,2598,33,2631,2046,24,-86
176+
174,3,0,1000,100,10,5,49,42,9,2598,33,2631,2046,25,21
177+
175,3,0,1000,100,10,5,49,42,9,2598,33,2631,2046,26,42
178+
176,3,0,1000,100,10,5,49,42,9,2598,33,2631,2046,27,-2
179+
177,3,0,1000,100,10,5,49,42,9,2598,33,2631,2046,28,-124
180+
178,3,0,1000,100,10,5,49,42,9,2598,33,2631,2046,29,90
181+
179,3,0,1000,100,10,5,49,42,9,2598,33,2631,2046,30,-39
182+
180,3,0,1000,100,10,5,49,42,9,2598,33,2631,2046,31,-40
183+
181,3,0,1000,100,10,5,49,42,9,2598,33,2631,2046,32,21
184+
182,3,0,1000,100,10,5,49,42,9,2598,33,2631,2046,33,55
185+
183,3,0,1000,100,10,5,49,42,9,2598,33,2631,2046,34,60
186+
184,3,0,1000,100,10,5,49,42,9,2598,33,2631,2046,35,71
187+
185,3,0,1000,100,10,5,49,42,9,2598,33,2631,2046,36,-27
188+
186,3,0,1000,100,10,5,49,42,9,2598,33,2631,2046,37,66
189+
187,3,0,1000,100,10,5,49,42,9,2598,33,2631,2046,38,48
190+
188,3,0,1000,100,10,5,49,42,9,2598,33,2631,2046,39,-63
191+
189,3,0,1000,100,10,5,49,42,9,2598,33,2631,2046,40,74
192+
190,3,0,1000,100,10,5,49,42,9,2598,33,2631,2046,41,3
193+
191,3,0,1000,100,10,5,49,42,9,2598,33,2631,2046,42,13
194+
192,3,0,1000,100,10,5,49,42,9,2598,33,2631,2046,43,-20
195+
193,3,0,1000,100,10,5,49,42,9,2598,33,2631,2046,44,0
196+
194,3,0,1000,100,10,5,49,42,9,2598,33,2631,2046,45,-51
197+
195,3,0,1000,100,10,5,49,42,9,2598,33,2631,2046,46,45
198+
196,3,0,1000,100,10,5,49,42,9,2598,33,2631,2046,47,44
199+
197,3,0,1000,100,10,5,49,42,9,2598,33,2631,2046,48,-110
200+
198,3,0,1000,100,10,5,49,42,9,2598,33,2631,2046,49,-95
201+
199,3,0,1000,100,10,5,49,42,9,2598,33,2631,2046,50,-21
202+
200,3,0,1000,100,10,5,49,42,9,2598,33,2631,2046,51,-46
203+
201,3,0,1000,100,10,5,49,42,9,2598,33,2631,2046,52,-34
204+
202,3,0,1000,100,10,5,49,42,9,2598,33,2631,2046,53,31
205+
203,3,0,1000,100,10,5,49,42,9,2598,33,2631,2046,54,-42
206+
204,3,0,1000,100,10,5,49,42,9,2598,33,2631,2046,55,52
207+
205,3,0,1000,100,10,5,49,42,9,2598,33,2631,2046,56,39
208+
206,3,0,1000,100,10,5,49,42,9,2598,33,2631,2046,57,112
209+
207,3,0,1000,100,10,5,49,42,9,2598,33,2631,2046,58,39
210+
208,3,0,1000,100,10,5,49,42,9,2598,33,2631,2046,59,-57
211+
209,3,0,1000,100,10,5,49,42,9,2598,33,2631,2046,60,108
212+
210,3,0,1000,100,10,5,49,42,9,2598,33,2631,2046,61,-33
213+
211,3,0,1000,100,10,5,49,42,9,2598,33,2631,2046,62,28
214+
212,3,0,1000,100,10,5,49,42,9,2598,33,2631,2046,63,7
215+
213,3,0,1000,100,10,5,49,42,9,2598,33,2631,2046,64,33
216+
214,3,0,1000,100,10,5,49,42,9,2598,33,2631,2046,65,-22
217+
215,3,0,1000,100,10,5,49,42,9,2598,33,2631,2046,66,69
218+
216,3,0,1000,100,10,5,49,42,9,2598,33,2631,2046,67,-77
219+
217,3,0,1000,100,10,5,49,42,9,2598,33,2631,2046,68,-58
220+
218,3,0,1000,100,10,5,49,42,9,2598,33,2631,2046,69,19
221+
219,3,0,1000,100,10,5,49,42,9,2598,33,2631,2046,70,27
222+
220,3,0,1000,100,10,5,49,42,9,2598,33,2631,2046,71,-41
223+
221,3,0,1000,100,10,5,49,42,9,2598,33,2631,2046,72,63
224+
222,3,0,1000,100,10,5,49,42,9,2598,33,2631,2046,73,97
225+
223,3,0,1000,100,10,5,49,42,9,2598,33,2631,2046,74,60
226+
224,3,0,1000,100,10,5,49,42,9,2598,33,2631,2046,75,32
227+
225,3,0,1000,100,10,5,49,42,9,2598,33,2631,2046,76,36
228+
226,3,0,1000,100,10,5,49,42,9,2598,33,2631,2046,77,-48
229+
227,3,0,1000,100,10,5,49,42,9,2598,33,2631,2046,78,-47
230+
228,3,0,1000,100,10,5,49,42,9,2598,33,2631,2046,79,45
231+
229,3,0,1000,100,10,5,49,42,9,2598,33,2631,2046,80,-5
232+
230,3,0,1000,100,10,5,49,42,9,2598,33,2631,2046,81,-27
233+
231,3,0,1000,100,10,5,49,42,9,2598,33,2631,2046,82,13
234+
232,3,0,1000,100,10,5,49,42,9,2598,33,2631,2046,83,48
235+
233,3,0,1000,100,10,5,49,42,9,2598,33,2631,2046,84,-69
236+
234,3,0,1000,100,10,5,49,42,9,2598,33,2631,2046,85,-55
237+
235,3,0,1000,100,10,5,49,42,9,2598,33,2631,2046,86,-41
238+
236,3,0,1000,100,10,5,49,42,9,2598,33,2631,2046,87,-31
239+
237,3,0,1000,100,10,5,49,42,9,2598,33,2631,2046,88,-14
240+
238,3,0,1000,100,10,5,49,42,9,2598,33,2631,2046,89,-103
241+
239,3,0,1000,100,10,5,49,42,9,2598,33,2631,2046,90,-29
242+
240,3,0,1000,100,10,5,49,42,9,2598,33,2631,2046,91,64
243+
241,3,0,1000,100,10,5,49,42,9,2598,33,2631,2046,92,-74
244+
242,3,0,1000,100,10,5,49,42,9,2598,33,2631,2046,93,1
245+
243,3,0,1000,100,10,5,49,42,9,2598,33,2631,2046,94,-72
246+
244,3,0,1000,100,10,5,49,42,9,2598,33,2631,2046,95,57
247+
245,3,0,1000,100,10,5,49,42,9,2598,33,2631,2046,96,6
248+
246,3,0,1000,100,10,5,49,42,9,2598,33,2631,2046,97,-15
249+
247,3,0,1000,100,10,5,49,42,9,2598,33,2631,2046,98,-15
250+
248,3,0,1000,100,10,5,49,42,9,2598,33,2631,2046,99,-46
251+
249,3,0,1000,100,10,5,49,42,9,2598,33,2631,2046,100,58

examples/bank_reserves/batch_run.py

Lines changed: 8 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -36,97 +36,17 @@
3636
get_total_money,
3737
get_total_savings,
3838
get_total_wallets,
39+
BankReservesModel
3940
)
4041

41-
42-
def track_params(model):
43-
return (model.init_people, model.rich_threshold, model.reserve_percent)
44-
45-
46-
def track_run(model):
47-
return model.uid
48-
49-
50-
class BankReservesModel(mesa.Model):
51-
# id generator to track run number in batch run data
52-
53-
# grid height
54-
grid_h = 20
55-
# grid width
56-
grid_w = 20
57-
58-
"""init parameters "init_people", "rich_threshold", and "reserve_percent"
59-
are all set via Slider"""
60-
61-
def __init__(
62-
self,
63-
height=grid_h,
64-
width=grid_w,
65-
init_people=2,
66-
rich_threshold=10,
67-
reserve_percent=50,
68-
):
69-
super().__init__()
70-
self.uid = next(self.id_gen)
71-
self.height = height
72-
self.width = width
73-
self.init_people = init_people
74-
75-
self.grid = mesa.space.MultiGrid(self.width, self.height, torus=True)
76-
# rich_threshold is the amount of savings a person needs to be considered "rich"
77-
self.rich_threshold = rich_threshold
78-
self.reserve_percent = reserve_percent
79-
# see datacollector functions above
80-
self.datacollector = mesa.DataCollector(
81-
model_reporters={
82-
"Rich": get_num_rich_agents,
83-
"Poor": get_num_poor_agents,
84-
"Middle Class": get_num_mid_agents,
85-
"Savings": get_total_savings,
86-
"Wallets": get_total_wallets,
87-
"Money": get_total_money,
88-
"Loans": get_total_loans,
89-
"Model Params": track_params,
90-
"Run": track_run,
91-
},
92-
agent_reporters={"Wealth": "wealth"},
93-
)
94-
95-
# create a single bank object for the model
96-
self.bank = Bank(self, self.reserve_percent)
97-
98-
# create people for the model according to number of people set by user
99-
for i in range(self.init_people):
100-
# set x coordinate as a random number within the width of the grid
101-
x = self.random.randrange(self.width)
102-
# set y coordinate as a random number within the height of the grid
103-
y = self.random.randrange(self.height)
104-
p = Person(i, (x, y), self, True, self.bank, self.rich_threshold)
105-
# place the Person object on the grid at coordinates (x, y)
106-
self.grid.place_agent(p, (x, y))
107-
108-
self.running = True
109-
110-
def step(self):
111-
# collect data
112-
self.datacollector.collect(self)
113-
# tell all the agents in the model to run their step function
114-
self.agents.shuffle_do("step")
115-
116-
def run_model(self):
117-
for i in range(self.run_time):
118-
self.step()
119-
120-
121-
# parameter lists for each parameter to be tested in batch run
122-
br_params = {
123-
"init_people": [25, 100],
124-
"rich_threshold": [5, 10],
125-
"reserve_percent": 5,
126-
}
127-
128-
12942
def main():
43+
# parameter lists for each parameter to be tested in batch run
44+
br_params = {
45+
"init_people": [25, 100],
46+
"rich_threshold": [5, 10],
47+
"reserve_percent": 5,
48+
}
49+
13050
# The existing batch run logic here
13151
data = mesa.batch_run(
13252
BankReservesModel,

0 commit comments

Comments
 (0)