-
Notifications
You must be signed in to change notification settings - Fork 0
/
multi_sim.py
35 lines (29 loc) · 1.01 KB
/
multi_sim.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
# library imports
import os
# project imports
class MultiSim:
"""
Run the simulation for multiple times and save some results
"""
RESULTS_FOLDER = os.path.join(os.path.dirname(__file__), "results")
def __init__(self):
pass
@staticmethod
def run(sim_generator_function,
sim_info_extraction_function,
repeat_times: int,
node_count: int,
edge_count: int,
max_time: int,
control_units: int,
population_count: int):
answer = []
for _ in range(repeat_times):
sim = sim_generator_function(node_count=node_count,
edge_count=edge_count,
max_time=max_time,
control_units=control_units,
population_count=population_count)
sim.run()
answer.append(sim_info_extraction_function(sim))
return answer