-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest_simulationv2.py
More file actions
48 lines (34 loc) · 1.29 KB
/
test_simulationv2.py
File metadata and controls
48 lines (34 loc) · 1.29 KB
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
import datetime
import pandas as pd
from World import World
# from data_loader import DataLoader
from models.data_source import DataSourceFactory
from models.person import Person
import asyncio
from simulation.places_graph import build_graph
from simulation.simulationv2 import run_simulation
def main():
# dl = DataLoader()
# print('initializing database')
# client = AsyncIOMotorClient("mongodb://localhost:27017/")
# Initialize beanie with the Product document class and a database
# await init_beanie(database=client.db_name, document_models=[Person, Household, School, Workplace])
# w = World('data.json')
print("Generating Population")
for i in range(100):
data_source = DataSourceFactory().create_random_population()
print("population:", data_source.total_population)
w = World(data_source=data_source)
w.generate_population(str(i))
print("Done!, Simmulating days now...")
run_simulation(w)
print(i)
# w.run_simulation("pinar", 100)
# print("Building Matrix")
# labels = [str(i[0])+"-"+str(i[1]) for i in dl.age_groups]
# m = w.generate_contact_matrix("CUBA")
# df = pd.DataFrame(m, columns=labels)
# df.to_csv("matrix.csv")
if __name__ == '__main__':
main()
# build_graph()