@@ -64,30 +64,37 @@ graph_model = ABM(GraphAgent, GraphSpace(complete_digraph(200)))
64
64
graph_agent = GraphAgent (1 , 82 , 6.5 , false )
65
65
graph_union_model = ABM (
66
66
Union{GraphAgent,GraphAgentTwo,GraphAgentThree,GraphAgentFour,GraphAgentFive},
67
- GraphSpace (complete_digraph (200 )),
68
- warn = false ,
67
+ GraphSpace (complete_digraph (200 ));
68
+ warn= false ,
69
69
)
70
70
71
71
# Limit samples here so space does not saturate with agents
72
- SUITE[" graph" ][" add" ][" agent" ] =
73
- @benchmarkable add_agent! ($ graph_agent, $ graph_model) samples = 100
74
- SUITE[" graph" ][" add" ][" agent_pos" ] =
75
- @benchmarkable add_agent_pos! ($ graph_agent, $ graph_model) samples = 100
76
- SUITE[" graph" ][" add" ][" agent_single" ] =
77
- @benchmarkable add_agent_single! ($ graph_agent, $ graph_model) samples = 100
78
- SUITE[" graph" ][" add" ][" create_pos" ] =
79
- @benchmarkable add_agent! (26 , $ graph_model, 6.5 , false ) samples = 100
80
- SUITE[" graph" ][" add" ][" create_single" ] =
81
- @benchmarkable add_agent_single! ($ graph_model, 6.5 , false ) samples = 100
82
- SUITE[" graph" ][" add" ][" create" ] =
83
- @benchmarkable add_agent! ($ graph_model, 6.5 , false ) samples = 100
84
-
85
- SUITE[" graph" ][" add_union" ][" agent" ] =
86
- @benchmarkable add_agent! ($ graph_agent, $ graph_union_model) samples = 100
87
- SUITE[" graph" ][" add_union" ][" agent_pos" ] =
88
- @benchmarkable add_agent_pos! ($ graph_agent, $ graph_union_model) samples = 100
89
- SUITE[" graph" ][" add_union" ][" agent_single" ] =
90
- @benchmarkable add_agent_single! ($ graph_agent, $ graph_union_model) samples = 100
72
+ SUITE[" graph" ][" add" ][" agent" ] = @benchmarkable add_agent! ($ graph_agent, $ graph_model) samples =
73
+ 100
74
+ SUITE[" graph" ][" add" ][" agent_pos" ] = @benchmarkable add_agent_pos! (
75
+ $ graph_agent, $ graph_model
76
+ ) samples = 100
77
+ SUITE[" graph" ][" add" ][" agent_single" ] = @benchmarkable add_agent_single! (
78
+ $ graph_agent, $ graph_model
79
+ ) samples = 100
80
+ SUITE[" graph" ][" add" ][" create_pos" ] = @benchmarkable add_agent! (
81
+ 26 , $ graph_model, 6.5 , false
82
+ ) samples = 100
83
+ SUITE[" graph" ][" add" ][" create_single" ] = @benchmarkable add_agent_single! (
84
+ $ graph_model, 6.5 , false
85
+ ) samples = 100
86
+ SUITE[" graph" ][" add" ][" create" ] = @benchmarkable add_agent! ($ graph_model, 6.5 , false ) samples =
87
+ 100
88
+
89
+ SUITE[" graph" ][" add_union" ][" agent" ] = @benchmarkable add_agent! (
90
+ $ graph_agent, $ graph_union_model
91
+ ) samples = 100
92
+ SUITE[" graph" ][" add_union" ][" agent_pos" ] = @benchmarkable add_agent_pos! (
93
+ $ graph_agent, $ graph_union_model
94
+ ) samples = 100
95
+ SUITE[" graph" ][" add_union" ][" agent_single" ] = @benchmarkable add_agent_single! (
96
+ $ graph_agent, $ graph_union_model
97
+ ) samples = 100
91
98
92
99
graph_model = ABM (GraphAgent, GraphSpace (complete_digraph (100 )))
93
100
for position in 1 : 100
@@ -102,20 +109,24 @@ SUITE["graph"]["move"]["pos"] = @benchmarkable move_agent!($a, 68, $graph_model)
102
109
SUITE[" graph" ][" move" ][" single" ] = @benchmarkable move_agent_single! ($ a, $ graph_model)
103
110
104
111
# We use a digraph, so all agents are neighbors of each other
105
- SUITE[" graph" ][" neighbors" ][" nearby_ids" ] =
106
- @benchmarkable nearby_ids ($ pos, $ graph_model) setup = (nearby_ids ($ pos, $ graph_model))
107
- SUITE[" graph" ][" neighbors" ][" nearby_agents" ] =
108
- @benchmarkable nearby_ids ($ a, $ graph_model) setup = (nearby_ids ($ a, $ graph_model))
109
- SUITE[" graph" ][" neighbors" ][" nearby_ids_iterate" ] =
110
- @benchmarkable iterate_over_neighbors ($ pos, $ graph_model, 1 ) setup =
111
- (nearby_ids ($ pos, $ graph_model))
112
- SUITE[" graph" ][" neighbors" ][" nearby_agents_iterate" ] =
113
- @benchmarkable iterate_over_neighbors ($ a, $ graph_model, 1 ) setup =
114
- (nearby_ids ($ a, $ graph_model))
115
- SUITE[" graph" ][" neighbors" ][" position_pos" ] =
116
- @benchmarkable nearby_positions ($ pos, $ graph_model)
117
- SUITE[" graph" ][" neighbors" ][" position_agent" ] =
118
- @benchmarkable nearby_positions ($ a, $ graph_model)
112
+ SUITE[" graph" ][" neighbors" ][" nearby_ids" ] = @benchmarkable nearby_ids ($ pos, $ graph_model) setup = (nearby_ids (
113
+ $ pos, $ graph_model
114
+ ))
115
+ SUITE[" graph" ][" neighbors" ][" nearby_agents" ] = @benchmarkable nearby_ids ($ a, $ graph_model) setup = (nearby_ids (
116
+ $ a, $ graph_model
117
+ ))
118
+ SUITE[" graph" ][" neighbors" ][" nearby_ids_iterate" ] = @benchmarkable iterate_over_neighbors (
119
+ $ pos, $ graph_model, 1
120
+ ) setup = (nearby_ids ($ pos, $ graph_model))
121
+ SUITE[" graph" ][" neighbors" ][" nearby_agents_iterate" ] = @benchmarkable iterate_over_neighbors (
122
+ $ a, $ graph_model, 1
123
+ ) setup = (nearby_ids ($ a, $ graph_model))
124
+ SUITE[" graph" ][" neighbors" ][" position_pos" ] = @benchmarkable nearby_positions (
125
+ $ pos, $ graph_model
126
+ )
127
+ SUITE[" graph" ][" neighbors" ][" position_agent" ] = @benchmarkable nearby_positions (
128
+ $ a, $ graph_model
129
+ )
119
130
120
131
SUITE[" graph" ][" position" ][" contents" ] = @benchmarkable ids_in_position ($ pos, $ graph_model)
121
132
SUITE[" graph" ][" position" ][" positions" ] = @benchmarkable positions ($ graph_model)
@@ -127,18 +138,20 @@ grid_agent = GridAgent(1, (2, 3), 6.5, false)
127
138
grid_union_model = ABM (
128
139
Union{GridAgent,GridAgentTwo,GridAgentThree,GridAgentFour,GridAgentFive},
129
140
GridSpace ((15 , 15 ));
130
- warn = false ,
141
+ warn= false ,
131
142
)
132
143
133
- SUITE[" grid" ][" add" ][" agent_pos" ] =
134
- @benchmarkable add_agent_pos! ( $ grid_agent, $ grid_model) samples = 100
135
- SUITE[" grid" ][" add" ][" create_fill" ] =
136
- @benchmarkable fill_space! ( $ grid_model, 6.5 , false ) samples = 100
144
+ SUITE[" grid" ][" add" ][" agent_pos" ] = @benchmarkable add_agent_pos! ( $ grid_agent, $ grid_model) samples =
145
+ 100
146
+ SUITE[" grid" ][" add" ][" create_fill" ] = @benchmarkable fill_space! ( $ grid_model, 6.5 , false ) samples =
147
+ 100
137
148
138
- SUITE[" grid" ][" add_union" ][" agent_pos" ] =
139
- @benchmarkable add_agent_pos! ($ grid_agent, $ grid_union_model) samples = 100
140
- SUITE[" grid" ][" add_union" ][" agent_fill" ] =
141
- @benchmarkable fill_space! (GridAgent, $ grid_union_model, 6.5 , false ) samples = 100
149
+ SUITE[" grid" ][" add_union" ][" agent_pos" ] = @benchmarkable add_agent_pos! (
150
+ $ grid_agent, $ grid_union_model
151
+ ) samples = 100
152
+ SUITE[" grid" ][" add_union" ][" agent_fill" ] = @benchmarkable fill_space! (
153
+ GridAgent, $ grid_union_model, 6.5 , false
154
+ ) samples = 100
142
155
143
156
grid_model = ABM (GridAgent, GridSpace ((50 , 50 )))
144
157
for x in 1 : 50
@@ -154,58 +167,62 @@ SUITE["grid"]["move"]["random"] = @benchmarkable move_agent!($a, $grid_model)
154
167
SUITE[" grid" ][" move" ][" pos" ] = @benchmarkable move_agent! ($ a, (14 , 35 ), $ grid_model)
155
168
SUITE[" grid" ][" move" ][" single" ] = @benchmarkable move_agent_single! ($ a, $ grid_model)
156
169
157
- SUITE[" grid" ][" neighbors" ][" nearby_ids" ] =
158
- @benchmarkable nearby_ids ($ pos, $ grid_model, 5 ) setup =
159
- (nearby_ids ($ pos, $ grid_model, 5 ))
160
- SUITE[" grid" ][" neighbors" ][" nearby_agents" ] =
161
- @benchmarkable nearby_ids ($ a, $ grid_model, 5 ) setup = (nearby_ids ($ a, $ grid_model, 5 ))
170
+ SUITE[" grid" ][" neighbors" ][" nearby_ids" ] = @benchmarkable nearby_ids ($ pos, $ grid_model, 5 ) setup = (nearby_ids (
171
+ $ pos, $ grid_model, 5
172
+ ))
173
+ SUITE[" grid" ][" neighbors" ][" nearby_agents" ] = @benchmarkable nearby_ids ($ a, $ grid_model, 5 ) setup = (nearby_ids (
174
+ $ a, $ grid_model, 5
175
+ ))
162
176
163
- SUITE[" grid" ][" neighbors" ][" nearby_ids_iterate" ] =
164
- @benchmarkable iterate_over_neighbors ( $ pos, $ grid_model, 30 ) setup =
165
- (nearby_ids ($ pos, $ grid_model, 30 ))
177
+ SUITE[" grid" ][" neighbors" ][" nearby_ids_iterate" ] = @benchmarkable iterate_over_neighbors (
178
+ $ pos, $ grid_model, 30
179
+ ) setup = (nearby_ids ($ pos, $ grid_model, 30 ))
166
180
167
- SUITE[" grid" ][" neighbors" ][" nearby_agents_iterate" ] =
168
- @benchmarkable iterate_over_neighbors ( $ a, $ grid_model, 30 ) setup =
169
- (nearby_ids ($ a, $ grid_model, 30 ))
181
+ SUITE[" grid" ][" neighbors" ][" nearby_agents_iterate" ] = @benchmarkable iterate_over_neighbors (
182
+ $ a, $ grid_model, 30
183
+ ) setup = (nearby_ids ($ a, $ grid_model, 30 ))
170
184
171
- SUITE[" grid" ][" neighbors" ][" position_pos" ] =
172
- @benchmarkable nearby_positions ($ a, $ grid_model)
173
- SUITE[" grid" ][" neighbors" ][" position_agent" ] =
174
- @benchmarkable nearby_positions ($ a, $ grid_model)
185
+ SUITE[" grid" ][" neighbors" ][" position_pos" ] = @benchmarkable nearby_positions (
186
+ $ a, $ grid_model
187
+ )
188
+ SUITE[" grid" ][" neighbors" ][" position_agent" ] = @benchmarkable nearby_positions (
189
+ $ a, $ grid_model
190
+ )
175
191
176
192
SUITE[" grid" ][" position" ][" contents" ] = @benchmarkable ids_in_position ($ pos, $ grid_model)
177
193
SUITE[" graph" ][" position" ][" positions" ] = @benchmarkable positions ($ graph_model)
178
194
179
195
# ### API -> CONTINUOUS ####
180
196
181
- continuous_model = ABM (ContinuousAgent, ContinuousSpace ((10.0 , 10.0 , 10.0 ); spacing = 0.5 ))
197
+ continuous_model = ABM (ContinuousAgent, ContinuousSpace ((10.0 , 10.0 , 10.0 ); spacing= 0.5 ))
182
198
continuous_agent = ContinuousAgent (1 , (2.2 , 1.9 , 7.5 ), (0.5 , 1.0 , 0.01 ), 6.5 , false )
183
199
184
200
# We must use setup create the model inside some benchmarks here, otherwise we hit the issue from #226.
185
201
# For tuning, this is actually impossible. So until ContinuousSpace is implemented, we drop these tests.
186
- SUITE[" continuous" ][" add" ][" agent_pos" ] =
187
- @benchmarkable add_agent_pos! ($ continuous_agent, cmodel) setup =
188
- (cmodel = ABM (ContinuousAgent, ContinuousSpace ((10.0 , 10.0 , 10.0 ); spacing = 0.5 ))) samples =
189
- 100
190
-
191
- SUITE[" continuous" ][" add_union" ][" agent_pos" ] =
192
- @benchmarkable add_agent_pos! ($ continuous_agent, cmodel) setup = (
193
- cmodel = ABM (
194
- Union{
195
- ContinuousAgent,
196
- ContinuousAgentTwo,
197
- ContinuousAgentThree,
198
- ContinuousAgentFour,
199
- ContinuousAgentFive,
200
- },
201
- ContinuousSpace ((10.0 , 10.0 , 10.0 ), spacing = 0.5 );
202
- warn = false ,
203
- )
204
- ) samples = 100
205
-
206
- for x in range (0 , stop = 9.99 , length = 7 )
207
- for y in range (0 , stop = 9.99 , length = 7 )
208
- for z in range (0 , stop = 9.99 , length = 7 )
202
+ SUITE[" continuous" ][" add" ][" agent_pos" ] = @benchmarkable add_agent_pos! (
203
+ $ continuous_agent, cmodel
204
+ ) setup = (cmodel = ABM (ContinuousAgent, ContinuousSpace ((10.0 , 10.0 , 10.0 ); spacing= 0.5 ))) samples =
205
+ 100
206
+
207
+ SUITE[" continuous" ][" add_union" ][" agent_pos" ] = @benchmarkable add_agent_pos! (
208
+ $ continuous_agent, cmodel
209
+ ) setup = (
210
+ cmodel = ABM (
211
+ Union{
212
+ ContinuousAgent,
213
+ ContinuousAgentTwo,
214
+ ContinuousAgentThree,
215
+ ContinuousAgentFour,
216
+ ContinuousAgentFive,
217
+ },
218
+ ContinuousSpace ((10.0 , 10.0 , 10.0 ); spacing= 0.5 );
219
+ warn= false ,
220
+ )
221
+ ) samples = 100
222
+
223
+ for x in range (0 ; stop= 9.99 , length= 7 )
224
+ for y in range (0 ; stop= 9.99 , length= 7 )
225
+ for z in range (0 ; stop= 9.99 , length= 7 )
209
226
add_agent! ((x, y, z), continuous_model, (0.8 , 0.7 , 1.3 ), 6.5 , false )
210
227
end
211
228
end
@@ -214,22 +231,23 @@ a = continuous_model[139]
214
231
pos = (7.07 , 8.10 , 6.58 )
215
232
SUITE[" continuous" ][" move" ][" update" ] = @benchmarkable move_agent! ($ a, $ continuous_model)
216
233
217
- SUITE[" continuous" ][" neighbors" ][" nearby_ids" ] =
218
- @benchmarkable nearby_ids ($ pos, $ continuous_model, 5 ) setup =
219
- (nearby_ids ($ pos, $ continuous_model, 5 ))
220
-
221
- SUITE[" continuous" ][" neighbors" ][" nearby_agents" ] =
222
- @benchmarkable nearby_ids ($ a, $ continuous_model, 5 ) setup =
223
- (nearby_ids ($ a, $ continuous_model, 5 ))
224
-
225
- SUITE[" continuous" ][" neighbors" ][" nearby_ids_iterate" ] =
226
- @benchmarkable iterate_over_neighbors ($ pos, $ continuous_model, 10 ) setup =
227
- (nearby_ids ($ pos, $ continuous_model, 10 ))
228
- SUITE[" continuous" ][" neighbors" ][" nearby_agents_iterate" ] =
229
- @benchmarkable iterate_over_neighbors ($ a, $ continuous_model, 10 ) setup =
230
- (nearby_ids ($ a, $ continuous_model, 10 ))
231
- SUITE[" continuous" ][" neighbors" ][" nearest" ] =
232
- @benchmarkable nearest_neighbor ($ a, $ continuous_model, 5 )
234
+ SUITE[" continuous" ][" neighbors" ][" nearby_ids" ] = @benchmarkable nearby_ids (
235
+ $ pos, $ continuous_model, 5
236
+ ) setup = (nearby_ids ($ pos, $ continuous_model, 5 ))
237
+
238
+ SUITE[" continuous" ][" neighbors" ][" nearby_agents" ] = @benchmarkable nearby_ids (
239
+ $ a, $ continuous_model, 5
240
+ ) setup = (nearby_ids ($ a, $ continuous_model, 5 ))
241
+
242
+ SUITE[" continuous" ][" neighbors" ][" nearby_ids_iterate" ] = @benchmarkable iterate_over_neighbors (
243
+ $ pos, $ continuous_model, 10
244
+ ) setup = (nearby_ids ($ pos, $ continuous_model, 10 ))
245
+ SUITE[" continuous" ][" neighbors" ][" nearby_agents_iterate" ] = @benchmarkable iterate_over_neighbors (
246
+ $ a, $ continuous_model, 10
247
+ ) setup = (nearby_ids ($ a, $ continuous_model, 10 ))
248
+ SUITE[" continuous" ][" neighbors" ][" nearest" ] = @benchmarkable nearest_neighbor (
249
+ $ a, $ continuous_model, 5
250
+ )
233
251
234
252
# Benchmark takes too long to be reasonable, even with a small sample.
235
253
# This needs to be looked at in the future, but it's being ignored for the moment
@@ -245,12 +263,15 @@ graph_df = init_agent_dataframe(graph_model, adata)
245
263
grid_df = init_agent_dataframe (grid_model, adata)
246
264
continuous_df = init_agent_dataframe (continuous_model, adata)
247
265
248
- SUITE[" graph" ][" collect" ][" store_agent" ] =
249
- @benchmarkable collect_agent_data! ($ graph_df, $ graph_model, $ adata, 0 )
250
- SUITE[" grid" ][" collect" ][" store_agent" ] =
251
- @benchmarkable collect_agent_data! ($ grid_df, $ grid_model, $ adata, 0 )
252
- SUITE[" continuous" ][" collect" ][" store_agent" ] =
253
- @benchmarkable collect_agent_data! ($ continuous_df, $ continuous_model, $ adata, 0 )
266
+ SUITE[" graph" ][" collect" ][" store_agent" ] = @benchmarkable collect_agent_data! (
267
+ $ graph_df, $ graph_model, $ adata, 0
268
+ )
269
+ SUITE[" grid" ][" collect" ][" store_agent" ] = @benchmarkable collect_agent_data! (
270
+ $ grid_df, $ grid_model, $ adata, 0
271
+ )
272
+ SUITE[" continuous" ][" collect" ][" store_agent" ] = @benchmarkable collect_agent_data! (
273
+ $ continuous_df, $ continuous_model, $ adata, 0
274
+ )
254
275
255
276
# ### SCHEDULERS ###
256
277
include (" schedulers.jl" )
0 commit comments