Examples

All the current data and python files for the examples in the main episimmer repository exists here. Do note that due to the large number of files, we have limited each file’s length to 200 lines.

Warning

This page is created only for reference to the examples. Please do not copy them and try running them in your simulation until you are sure of what you are doing. Copying them may lead to errors due to the files being incomplete. Go to the examples/ directory in the Episimmer repository to get the complete files.

Basic_Disease_Models

The examples in this directory shows the basic models that the user can implement. Episimmer currently provides two kinds of disease models namely, Stochastic and Scheduled models. Both these modelling types are variants of the well known Compartmental Models that exist today. Some of them implemented here are the SIR, SEYAR, SIRID models. For further details on these models refer to Tutorial 2.1.

To run an example :

            cd examples/Basic_Disease_Models
            python ../../episimmer/main.py Stochastic_SIR

Example_1

This example uses the Stochastic model comprising of the states- Susceptible, Exposed, Asymptomatic, Symptomatic and Recovered.

It represents a university environment where the agents like students, teachers, visitors, etc. receive or contribute to infection through interactions and events laid out across different campus locations.

Interactions as well as events have been defined for the weekdays and weekends from Monday through Sunday.

Episimmer uses this example to study disease spread using a real-life scenario (university).

The specificity of this example comes from defining interactions between agents as well as the events that each agent was part of for every single day throughout the week.

It shows how the probability of getting infected by a single interaction is also dependent on additional parameters such as time of contact and intensity of interaction (these parameters are passed by the user). This is how infection spread can be influenced by introducing factors that are characteristic to the way the agents of the population interact with one another.

This introduces more flexibily in terms of implementation and the university can use this opportunity to make better decisions in the fight against COVID or any other disease/infection breakout.


Generate_policy.py

 1from episimmer.policy import lockdown_policy
 2
 3
 4def generate_policy():
 5	policy_list=[]
 6
 7	def lockdown_fn(time_step):
 8		return False
 9
10	policy_list.append(lockdown_policy.FullLockdown(lockdown_fn))
11
12	return policy_list

UserModel.py

 1import math
 2
 3import episimmer.model as model
 4
 5
 6#User defined functions
 7#This function is user defined, based on the parameters the user has inputed in agents file and interaction/contact file
 8#This function represents the probability of getting infected during a single interaction/contact
 9def probability_of_infection_fn(p_infected_states_list,contact_agent,c_dict,current_time_step):
10
11	p_inf_symp,p_inf_asymp=p_infected_states_list[0],p_infected_states_list[1]
12	#EXAMPLE 1
13	if contact_agent.state=='Symptomatic':
14		return math.tanh(float(c_dict['Time Interval']))*p_inf_symp
15	elif contact_agent.state=='Asymptomatic':
16		return math.tanh(float(c_dict['Time Interval']))*p_inf_asymp
17	else:
18		return 0
19
20	#Example 2
21	if contact_agent.state=='Symptomatic':
22		return math.tanh(float(c_dict['Time Interval'])*float(c_dict['Intensity']))*p_inf_symp
23	elif contact_agent.state=='Asymptomatic':
24		return math.tanh(float(c_dict['Time Interval'])*float(c_dict['Intensity']))*p_inf_asymp
25	else:
26		return 0
27
28def event_contribute_fn(agent,event_info,location,current_time_step):
29	#Example 1
30	if agent.state=='Symptomatic':
31		return 1
32	elif agent.state=='Asymptomatic':
33		return 0.3
34	else:
35		return 0
36
37	#Example 2
38	susceptibility=1
39	if agent.info['HLA Type']=='A':
40		susceptibility=0.9
41
42	if agent.state=='Symptomatic':
43		return math.tanh(float(event_info['Time Interval']))*(1-location.info['Ventilation'])*susceptibility
44	elif agent.state=='Asymptomatic':
45		return 0.3*math.tanh(float(event_info['Time Interval']))*(1-location.info['Ventilation'])*susceptibility
46
47def event_receive_fn(agent,ambient_infection,event_info,location,current_time_step):
48	p=math.tanh(ambient_infection*0.3)
49	return p
50
51
52
53
54class UserModel(model.StochasticModel):
55	def __init__(self):
56		individual_types=['Susceptible','Exposed','Asymptomatic','Symptomatic','Recovered']
57		infected_states=['Asymptomatic','Symptomatic']
58		state_proportion={
59							'Susceptible':0.99,
60							'Exposed':0.01,
61							'Recovered':0,
62							'Asymptomatic':0,
63							'Symptomatic':0
64						}
65		model.StochasticModel.__init__(self,individual_types,infected_states,state_proportion)
66		self.set_transition('Susceptible', 'Exposed', self.p_infection(probability_of_infection_fn, [0.3,0.1]))
67		self.set_transition('Exposed', 'Symptomatic', self.p_standard(0.15))
68		self.set_transition('Exposed', 'Asymptomatic', self.p_standard(0.2))
69		self.set_transition('Symptomatic', 'Recovered', self.p_standard(0.2))
70		self.set_transition('Asymptomatic', 'Recovered', self.p_standard(0.2))
71
72		self.set_event_contribution_fn(event_contribute_fn)
73		self.set_event_receive_fn(event_receive_fn)

agents.csv

  1Agent Index,Type,Residence,HLA Type
  20,Staff,Dorm B,C
  31,Student,Teacher Dorm,C
  42,Visitor,Dorm B,A
  53,Student,Teacher Dorm,C
  64,Visitor,Dorm A,A
  75,Administration,Dorm A,B
  86,Teacher,Teacher Dorm,C
  97,Teacher,Teacher Dorm,C
 108,Visitor,Dorm B,C
 119,Visitor,Dorm B,C
 1210,Visitor,Outside,C
 1311,Administration,Dorm A,C
 1412,Student,Outside,A
 1513,Visitor,Outside,B
 1614,Administration,Dorm A,B
 1715,Student,Outside,C
 1816,Student,Teacher Dorm,A
 1917,Student,Dorm A,C
 2018,Teacher,Teacher Dorm,A
 2119,Visitor,Dorm A,B
 2220,Student,Dorm A,A
 2321,Administration,Outside,C
 2422,Visitor,Dorm B,A
 2523,Staff,Dorm A,B
 2624,Visitor,Dorm B,A
 2725,Staff,Teacher Dorm,C
 2826,Teacher,Teacher Dorm,B
 2927,Student,Teacher Dorm,A
 3028,Teacher,Outside,C
 3129,Administration,Outside,A
 3230,Administration,Dorm B,A
 3331,Teacher,Dorm B,A
 3432,Teacher,Outside,A
 3533,Teacher,Dorm A,C
 3634,Staff,Outside,B
 3735,Student,Dorm B,C
 3836,Visitor,Outside,C
 3937,Staff,Dorm A,C
 4038,Staff,Teacher Dorm,B
 4139,Student,Dorm A,C
 4240,Administration,Outside,C
 4341,Teacher,Teacher Dorm,A
 4442,Visitor,Dorm A,C
 4543,Administration,Teacher Dorm,C
 4644,Administration,Dorm A,B
 4745,Administration,Dorm B,C
 4846,Student,Dorm A,B
 4947,Visitor,Dorm B,B
 5048,Staff,Dorm A,A
 5149,Student,Outside,B
 5250,Visitor,Dorm B,C
 5351,Student,Teacher Dorm,B
 5452,Teacher,Teacher Dorm,B
 5553,Student,Outside,A
 5654,Administration,Dorm A,A
 5755,Teacher,Outside,C
 5856,Teacher,Dorm A,A
 5957,Visitor,Dorm A,A
 6058,Visitor,Dorm A,B
 6159,Staff,Dorm A,A
 6260,Staff,Dorm A,A
 6361,Teacher,Teacher Dorm,B
 6462,Teacher,Dorm B,C
 6563,Staff,Dorm A,B
 6664,Visitor,Dorm B,C
 6765,Staff,Outside,C
 6866,Administration,Dorm A,B
 6967,Administration,Outside,A
 7068,Teacher,Teacher Dorm,B
 7169,Student,Outside,A
 7270,Staff,Dorm B,C
 7371,Visitor,Outside,A
 7472,Staff,Dorm B,A
 7573,Student,Outside,B
 7674,Administration,Outside,C
 7775,Teacher,Dorm B,A
 7876,Administration,Outside,A
 7977,Teacher,Teacher Dorm,C
 8078,Teacher,Teacher Dorm,B
 8179,Staff,Outside,A
 8280,Student,Dorm A,C
 8381,Visitor,Outside,B
 8482,Administration,Outside,C
 8583,Teacher,Dorm B,C
 8684,Staff,Teacher Dorm,C
 8785,Student,Dorm B,B
 8886,Teacher,Dorm B,C
 8987,Teacher,Dorm A,A
 9088,Staff,Teacher Dorm,B
 9189,Visitor,Dorm B,C
 9290,Administration,Teacher Dorm,B
 9391,Visitor,Dorm B,C
 9492,Student,Teacher Dorm,C
 9593,Visitor,Teacher Dorm,B
 9694,Administration,Outside,B
 9795,Administration,Teacher Dorm,C
 9896,Administration,Dorm B,A
 9997,Staff,Dorm B,C
10098,Visitor,Teacher Dorm,B
10199,Teacher,Dorm B,B

agents.txt

  1100
  2Agent Index:Type:Residence:HLA Type
  30:Visitor:Outside:B
  41:Visitor:Teacher Dorm:C
  52:Visitor:Outside:C
  63:Staff:Teacher Dorm:A
  74:Student:Dorm A:A
  85:Visitor:Dorm A:B
  96:Administration:Teacher Dorm:C
 107:Staff:Teacher Dorm:C
 118:Staff:Outside:A
 129:Teacher:Dorm B:B
 1310:Visitor:Teacher Dorm:C
 1411:Administration:Outside:B
 1512:Visitor:Outside:C
 1613:Staff:Outside:B
 1714:Staff:Dorm A:B
 1815:Visitor:Teacher Dorm:B
 1916:Staff:Outside:A
 2017:Staff:Dorm A:B
 2118:Teacher:Dorm B:C
 2219:Staff:Dorm A:A
 2320:Visitor:Outside:B
 2421:Student:Teacher Dorm:B
 2522:Teacher:Teacher Dorm:C
 2623:Staff:Dorm A:C
 2724:Visitor:Dorm B:B
 2825:Visitor:Outside:C
 2926:Visitor:Outside:B
 3027:Staff:Outside:C
 3128:Teacher:Dorm A:C
 3229:Student:Dorm A:B
 3330:Staff:Dorm A:A
 3431:Student:Teacher Dorm:C
 3532:Administration:Teacher Dorm:A
 3633:Teacher:Dorm A:A
 3734:Administration:Dorm A:C
 3835:Teacher:Dorm B:B
 3936:Student:Dorm A:A
 4037:Administration:Dorm A:A
 4138:Teacher:Outside:B
 4239:Teacher:Dorm B:B
 4340:Administration:Teacher Dorm:A
 4441:Staff:Teacher Dorm:A
 4542:Teacher:Outside:B
 4643:Administration:Teacher Dorm:B
 4744:Teacher:Outside:C
 4845:Visitor:Outside:A
 4946:Visitor:Teacher Dorm:A
 5047:Administration:Teacher Dorm:A
 5148:Staff:Dorm A:A
 5249:Student:Outside:B
 5350:Staff:Teacher Dorm:B
 5451:Administration:Outside:C
 5552:Student:Dorm B:C
 5653:Administration:Dorm A:C
 5754:Administration:Outside:A
 5855:Administration:Outside:C
 5956:Administration:Dorm A:C
 6057:Visitor:Outside:B
 6158:Teacher:Outside:A
 6259:Staff:Outside:A
 6360:Administration:Teacher Dorm:A
 6461:Student:Teacher Dorm:A
 6562:Student:Dorm B:A
 6663:Teacher:Dorm A:C
 6764:Staff:Dorm A:A
 6865:Student:Teacher Dorm:C
 6966:Teacher:Outside:C
 7067:Staff:Dorm B:B
 7168:Administration:Teacher Dorm:B
 7269:Teacher:Teacher Dorm:C
 7370:Administration:Teacher Dorm:C
 7471:Visitor:Outside:B
 7572:Visitor:Teacher Dorm:C
 7673:Visitor:Teacher Dorm:C
 7774:Administration:Dorm A:C
 7875:Student:Outside:C
 7976:Visitor:Outside:C
 8077:Student:Teacher Dorm:A
 8178:Teacher:Dorm A:B
 8279:Visitor:Dorm B:C
 8380:Administration:Outside:C
 8481:Student:Dorm B:A
 8582:Visitor:Dorm B:B
 8683:Administration:Outside:A
 8784:Student:Teacher Dorm:A
 8885:Student:Dorm A:C
 8986:Staff:Dorm B:A
 9087:Administration:Teacher Dorm:B
 9188:Administration:Dorm A:A
 9289:Teacher:Dorm A:C
 9390:Administration:Dorm A:B
 9491:Student:Outside:C
 9592:Student:Dorm A:B
 9693:Teacher:Teacher Dorm:C
 9794:Student:Outside:C
 9895:Administration:Teacher Dorm:C
 9996:Staff:Outside:B
10097:Staff:Dorm A:C
10198:Teacher:Outside:A
10299:Administration:Dorm A:B

config.txt

 1Random Seed <3>
 2Number of worlds <3>
 3Number of Days <30>
 4Agent Parameter Keys <Agent Index:Type:Residence:HLA Type>
 5Agent list filename <agents.csv>
 6Interaction Info Keys <Agent Index:Interacting Agent Index:Time Interval:Intensity>
 7Interaction Files list filename <interaction_files_list.txt>
 8Probabilistic Interaction Files list filename <>
 9Location Parameter Keys <Location Index:Type:Ventilation:Roomsize:Capacity>
10Location list filename <locations.txt>
11Event Parameter Keys <Location Index:Agents:Time Interval>
12Event Files list filename <event_files_list.txt>
13One Time Event filename <>

event_files_list.txt

1<monday_events.txt>
2<tuesday_events.txt>
3<wednesday_events.txt>
4<thursday_events.txt>
5<friday_events.txt>
6<saturday_events.txt>
7<sunday_events.txt>

friday_contacts.csv

  1Agent Index,Interacting Agent Index,Time Interval,Intensity
  296,57,5.004142877127,0.42191921620925354
  354,27,5.641672551963007,0.7462919078948316
  425,8,1.794290991869778,0.8194479950290448
  548,12,0.22317783046829742,0.5930024147218874
  632,1,2.0332990080122935,0.9049495038090604
  779,4,5.349489905495666,0.25834688605446654
  816,19,7.482148590293117,0.8597260125619213
  91,84,1.643656099054901,0.6492400176694979
 1091,92,7.539420185381803,0.1572574957436378
 110,18,0.412793980070838,0.12359152155948494
 1227,4,2.1036845816262373,0.7556071327228134
 1344,93,0.5338106410878762,0.3250995579281485
 147,85,2.700768270414009,0.6396363196460858
 1525,54,7.851908992747192,0.03235332764508547
 1686,18,4.264343699418963,0.03294294008400289
 1747,49,2.2001671472930973,0.8547969093028639
 1888,57,9.21067656780389,0.9149669418045047
 1991,60,5.954707715564772,0.5719792018299477
 2070,13,8.590870958001473,0.3467306495161502
 2139,25,3.0242832181735766,0.4138264196643887
 2231,32,4.446511361608556,0.3307555630717903
 2372,16,7.152478159718685,0.4051997279355414
 2451,56,5.126758363544265,0.03510071951222604
 2557,69,1.8038913841447546,0.6695529982166318
 2650,34,6.781050924626727,0.00925049088045582
 279,57,2.0483981637076076,0.8150216743517682
 282,46,1.9695147002286972,0.8236731954676536
 2976,10,3.2367032040028865,0.189359530938495
 3093,40,3.5290802325675985,0.5770031224285761
 3113,51,8.366286124001043,0.7531077788790762
 323,43,4.667816904834296,0.5663977961774596
 3328,87,4.033038804641689,0.523226854909037
 3495,61,4.099665005428983,0.382169865819883
 3511,58,5.760839569829173,0.5331949513335849
 3618,26,0.09758072728262124,0.7763890421115288
 3713,8,3.3584379922185317,0.1863867865578278
 3860,60,7.177857666160996,0.10434104385849963
 3965,96,1.1312776613884845,0.9674134933532024
 406,33,5.839416802331847,0.378146491269558
 4148,43,7.271644108335251,0.8995373336774743
 4284,81,0.43165651762144375,0.3493858177036441
 4317,78,4.34280471192559,0.2029239277672824
 4458,12,3.017355257636595,0.08158660374123372
 4523,76,2.964865343386526,0.0690704096811312
 4648,35,5.776276020339678,0.893577319760597
 4773,2,1.7577645470923775,0.06759772321371171
 4837,96,1.933497529060112,0.38664529916662904
 4955,16,9.506699244782125,0.5224209433841157
 5021,89,3.9832543315545896,0.21727916670097103
 5130,43,9.439600407370815,0.4025782968889513
 524,94,4.0558134618401365,0.4412080905758925
 5383,87,0.5577932147347009,0.46357822403968507
 5464,17,5.698770885091612,0.3799729422257563
 5582,6,7.314244632540017,0.9379001142886053
 5651,47,4.972927027027878,0.7498405462605637
 5746,21,3.7018950508852324,0.5939738834476441
 5819,24,9.129329003202235,0.3757168235721946
 5978,68,9.318254737275796,0.30123710713292373
 6065,48,2.7578489748122936,0.7651692440439245
 6185,96,4.750884998198361,0.30555530537592257
 6244,59,3.7588664444315434,0.029012995900403737
 6342,53,7.965520525420933,0.500322500665823
 6434,89,8.137472839811998,0.10683445931853242
 6531,74,7.154376619192167,0.020288324506276934
 6614,87,5.458581884838476,0.4920008942367613
 6780,69,8.248995001589027,0.23526849665722827
 6850,21,2.5306642194391116,0.3794406316118146
 6961,45,5.298710794959918,0.37907685807994806
 7085,24,8.321777043104493,0.536579378508093
 7162,76,7.7095256085339345,0.3829852909795268
 7297,68,6.720884566803925,0.3390071114792286
 7360,77,4.533234610599038,0.8113433047634149
 7426,10,8.06790434062078,0.30299925326446464
 7547,43,8.69852562934309,0.7895856290622782
 7678,27,3.6823345284575018,0.6433166905984297
 7782,95,2.9028972238732917,0.5743434116842108
 7848,50,1.2885001947678354,0.5845643239525443
 7924,92,5.10702514748865,0.8295933418361403
 804,70,3.697077445626795,0.7706536847343546
 8119,48,9.705052235091756,0.270603140864078
 8211,35,1.6398273857230894,0.5619636810964064
 8364,82,8.60868600219238,0.5136674086504184
 8424,73,4.747910218034176,0.9698540725625405
 8577,39,9.537053731100741,0.3184912393594964
 8626,65,6.623026331783141,0.12464013667280971
 8718,6,3.118879056544123,0.1687671012080162
 8825,88,1.661248992411558,0.0027643427331558446
 8930,16,1.7496507474499778,0.7533736018848727
 9014,68,4.7877230911941435,0.8567674787579299
 9190,35,4.017104747627666,0.3475651824665301
 9250,90,7.885812663252305,0.15224668925837392
 9388,69,3.527703312016046,0.321127267891277
 9460,76,4.367915897127837,0.855080625730378
 9565,1,1.2124336273196634,0.09352156937936174
 9641,44,2.1441067147164086,0.8308344029216161
 9775,37,5.23272398959814,0.12124510374511377
 9887,47,4.538318227134673,0.9102798004594629
 9965,93,8.049689874685107,0.6156585039063263
10027,58,0.3047661250962619,0.7169403094641904
10183,16,9.20113436803063,0.07680089025478865
10252,32,3.3875605244645546,0.44228488826006074
1035,90,7.7095709383023046,0.9799160115631094
10452,97,3.6345203156375074,0.7827122469716974
10512,58,4.838114696803647,0.05473584699724787
10610,72,0.508058948403507,0.9765336364302032
10717,50,4.027819358150032,0.24275873502950995
10814,97,9.524236590404163,0.11350964370743688
10911,77,3.527122966633823,0.5955015777009192
11091,45,4.772816223394329,0.7847202464900873
11178,67,6.20973216289181,0.8563825326861786
1120,64,0.9431439754563342,0.5482371426367199
11358,16,6.549678084867544,0.7318436530470492
1147,1,8.399829627881095,0.4050885728277188
11592,79,2.5015507201515397,0.6365583371748141
11688,12,9.988248273349624,0.91778648665744
11736,78,3.5159152629245307,0.2713837465739497
11851,55,9.375528856307408,0.3026126573046497
11992,16,4.027980101435947,0.9242330260173324
1203,39,7.560986956014491,0.3032799651405086
12169,93,8.318737374058491,0.9468290390539934
12256,19,8.769740801633382,0.7910807429615233
1233,78,4.85867456393448,0.9293999905478831
12443,34,7.62621241841282,0.4909205436131492
12538,70,0.8485749761563488,0.8174025274111226
12697,21,1.4620852192773992,0.28112583098770594
12778,0,3.6170753191985927,0.08955589947833242
1284,75,6.741010108321763,0.042069505873642
12985,91,9.104591257308506,0.6706786433254306
13077,47,7.373105749484914,0.342128451024016
13197,25,7.551534579609695,0.8037059903606372
1320,65,0.18652005163854013,0.5596295475108785
13374,32,3.8660598542307167,0.36416943608251073
13432,42,2.979184547336715,0.8546082155458167
13558,37,7.356194239909315,0.6748553130671284
1366,4,9.441521880256872,0.6546753816907176

friday_contacts.txt

  1135
  2Agent Index:Interacting Agent Index:Time Interval:Intensity
  310:88:6.688619668606895:0.9667447062422788
  49:95:0.9007299229441801:0.29413754832944883
  531:65:2.3104869981567724:0.13629109371609527
  676:96:3.014786047555358:0.06339801582240967
  751:45:3.131052149585477:0.4445434382525858
  889:8:1.9427263725803523:0.8808337927621033
  910:58:2.495396084901178:0.3683191418222923
 1021:6:9.164811448710253:0.9149064054528824
 1120:94:9.073726154746812:0.09172186189747888
 1211:35:5.811227020170672:0.04277875290311006
 1381:67:7.382044703884041:0.7562618254548581
 1435:88:5.427284912563087:0.4919887871599472
 1564:98:3.2931497408328347:0.20795695942795245
 1621:60:5.309981205719868:0.011521792726691515
 1796:55:9.656859364978201:0.3703774321272413
 1856:15:9.416354213552863:0.6794383500051776
 1926:84:1.984408867513613:0.29733391878026927
 2020:92:4.853416282497795:0.7638596564144793
 2174:36:4.155107158450942:0.3304639571662785
 2298:80:5.883730603507602:0.7125416288385673
 2348:58:4.237992321318459:0.2184722842877974
 2463:11:9.4185033672319:0.6937998477526771
 2593:84:0.07677001757306234:0.48147174789615876
 264:14:3.9106702580659745:0.8198449581478692
 2720:25:9.759725526106168:0.7121362469200376
 288:40:9.859266700927066:0.9002242531813217
 297:48:5.9862020774776905:0.2562517464656725
 3023:54:1.687746631438165:0.5900449712604049
 3150:10:7.664351665510184:0.34811947944265953
 3228:46:5.972242241867672:0.8446013225231795
 3348:84:0.4610657004284924:0.6920856877392875
 3422:80:5.797512189699676:0.5749543208902808
 3515:69:0.6755755530815644:0.16837016924547443
 3689:21:3.7647209748264734:0.022369240867610274
 3795:99:7.419111728757224:0.6755793454767197
 3846:1:6.0869705981206765:0.9392659049557766
 3996:62:0.38005028756432413:0.9685916051859171
 4075:35:1.5759150731503702:0.7930309701559252
 4183:18:6.419755471582778:0.8909924833495784
 4263:5:4.374873831058975:0.14767216650642556
 4377:36:1.1436741940145367:0.027032871240488587
 4431:27:0.03543073074623537:0.26791737345013567
 4593:58:8.600159028547823:0.5089371541057991
 4637:83:9.525552257972498:0.7630639782440107
 4712:71:0.1838245228022528:0.16301999982715865
 484:28:7.201106455933197:0.639241011778947
 4939:55:2.1450605439606854:0.0072084624135791975
 5076:28:0.8317688391569544:0.11354085521055068
 5192:75:8.891200749890123:0.40037278495757134
 5263:67:0.6057359831130937:0.49096137048602173
 531:78:2.175748319238159:0.1973094235179783
 5444:90:6.603685950367471:0.07742541911225254
 5543:48:5.313085158201147:0.0031820058422277198
 5640:66:5.140130492045794:0.3522022574851984
 5773:47:7.622359504852094:0.3803414058582355
 5844:6:9.90535715069833:0.7067631788482184
 5982:71:8.438586749469684:0.05817509423223455
 6027:89:6.191647064682342:0.4954437234413782
 6140:16:2.7203192040973834:0.20918796475319368
 6272:94:1.0722333108247561:0.29041196859888474
 6371:3:4.911064356203861:0.40762232519762864
 6496:13:6.0216102844761465:0.18221116663426262
 6587:44:8.942071102975323:0.6762865235784432
 6681:87:5.828205005560443:0.43654291147178037
 6767:0:9.558161218422207:0.9782982086424898
 6826:15:2.747686471657702:0.5841505638191209
 6960:64:3.1877027193758387:0.7852519193645222
 7028:21:8.89719398196214:0.7796779703774409
 7137:27:6.148709351415107:0.11498229333292553
 7211:64:2.588199198086797:0.9232497898570643
 7394:60:4.584180815888526:0.6663030600822625
 7496:14:0.50361178946847:0.6276123660867005
 7560:21:6.304111960148045:0.40129177112848724
 7672:1:7.946241811259695:0.7384589147638106
 7716:72:8.280083142609529:0.4050472195277236
 789:11:9.83701917013762:0.5098460996889553
 7972:29:2.7846659029729883:0.040863074669492905
 800:87:2.5247982332670693:0.1763267929861304
 819:42:4.288106193000074:0.2738502204725093
 8283:42:0.7506400165327698:0.7642430599819986
 8312:76:9.9768333694983:0.2717578760733744
 8420:49:5.381409836273989:0.6346301712804985
 8516:16:3.6726867565695507:0.5582714052891703
 863:85:1.3686976214395152:0.29712675725144
 8774:15:3.4809262245707284:0.08676173861125958
 8899:0:6.3566236770104645:0.7076734815700955
 8992:2:1.2152547236516253:0.06654621024479845
 9062:39:1.2779870965308293:0.45103199912883984
 910:67:0.001817668070662748:0.29057807898622035
 9268:31:7.533477004492588:0.9192380824068297
 9312:95:3.6035444861225017:0.6605518577198357
 9480:59:7.992128919597919:0.4588233013708509
 9592:9:5.942982815932124:0.8525527661682476
 9654:49:2.5528781753994645:0.1674153560281869
 9767:56:2.4068751851152905:0.06936911168175486
 9899:22:3.5335711374409917:0.39379603080655945
 9991:95:3.9199908183515664:0.25378177050876816
10073:18:3.503121031888783:0.7584130737841819
10168:46:1.4189787199600157:0.019877623645405795
10244:23:4.212711155988669:0.30143615210535746
10347:39:0.5087911598281225:0.5893668330016113
10448:92:2.3542849120881657:0.9451616102571446
1058:54:6.903186150983789:0.2695255667504325
10614:84:9.462171277620177:0.060500538799988846
10791:25:3.697664572724438:0.4079539487067759
10888:55:7.346264967721757:0.552949376315497
10952:88:9.665066927538911:0.7401975800017172
11018:7:4.4697307603688285:0.3782737394491341
11190:32:2.916400428655871:0.536697768154158
1122:74:8.317196407757693:0.2955317179537563
11365:73:8.914697419270194:0.8930540458434777
11420:21:4.219761483887274:0.2632063077194766
11575:97:6.310357238443305:0.14546059647798926
11626:69:5.469932282412852:0.1777212237813397
11722:31:8.687063973633554:0.02966055949862567
11887:78:3.4690077115478637:0.5578236892580205
11962:47:7.198318314161049:0.8276001292402286
12074:98:2.3265643497552024:0.22498444445538013
12151:72:4.797553032172871:0.13299317181491055
12236:76:5.369674743302922:0.6308887356663198
12381:59:5.147324117443669:0.8496019187336087
12455:82:5.933758031306022:0.4066184094819313
12554:6:2.448195518938933:0.0869846065164368
12631:97:6.658117713557282:0.4701995171802008
12744:26:5.384133256347262:0.2881262392733547
12866:93:4.77688056130655:0.02994329042677224
12991:19:2.565625338887955:0.888807228949255
13040:4:4.003688953910921:0.9128964821711357
13194:91:7.023901631427076:0.6382076850534217
13217:52:9.229885545120888:0.3200856999256
13382:5:6.528401052084762:0.747569444766493
13420:29:3.094567113936595:0.6996607131893888
13585:19:3.4859677673907297:0.4504028250467983
13612:62:2.279581910720033:0.31311123094403015
13796:66:7.081217549271823:0.7148731929250536

friday_events.txt

 110
 2Location Index:Agents:Time Interval
 32:45,66,63,77,71,80,50,14,92,19:60
 47:42,17,26,76,4,4,1,42,29,78,2,24,24,48,35,10,52,57,1,94,11:30
 59:19,99:10
 65:1,74,5,46,18,27,43,60,17,29,70,4,92,94,37,63,96,33,11,81:60
 74:43,29,49,74,40,99,3,48,31,96,93,69:10
 81:24,57,37,92,20,6,28,94,2,95,88,16,81:45
 91:71,65,42,66,49,79,32,50,16,43,55,67,32,92,81,91,87,76,82,4:30
100:68,57,48,79,3,26,63,25,29,21,44,35,37,56,85,55,39,6,40,97:30
119:74,26,10,55,59,41,64,38,46,76,70,33,17,31:60
120:55,16,79,60,40,54:60

generate_agents.py

 1import random
 2
 3import numpy as np
 4
 5
 6def write_to_file(filename,n):
 7	info_dict={}
 8	#ID enumerates from 0 to n-1
 9	header='Agent Index:Type:Residence:HLA Type'
10	info_dict['Type']=['Student','Teacher','Administration','Staff','Visitor']
11	info_dict['Residence']=['Dorm A','Dorm B','Outside','Teacher Dorm']
12	info_dict['HLA Type']=['A','B','C']
13
14	f=open(filename,'w')
15	f.write(str(n)+'\n')
16	f.write(header+'\n')
17
18	for i in range(n):
19		f.write(str(i))
20		for j in info_dict.keys():
21			f.write(':'+random.choice(info_dict[j]))
22		f.write('\n')
23
24
25write_to_file('agents.txt',100)

generate_agents_csv.py

 1import random
 2from csv import DictWriter
 3
 4with open('agents.csv', 'w', newline='') as file:
 5    fieldnames = ['Agent Index','Type','Residence','HLA Type']
 6    writer = DictWriter(file, fieldnames=fieldnames)
 7    writer.writeheader()
 8    for i in range(100):
 9        info_dict={}
10        info_dict['Agent Index']=i
11        info_dict['Type']=random.choice(['Student','Teacher','Administration','Staff','Visitor'])
12        info_dict['Residence']=random.choice(['Dorm A','Dorm B','Outside','Teacher Dorm'])
13        info_dict['HLA Type']=random.choice(['A','B','C'])
14        writer.writerow(info_dict)

generate_contacts.py

 1import random
 2
 3import numpy as np
 4
 5
 6def write_to_file(filename,n,no_contacts):
 7	info_dict={}
 8	#ID enumerates from 0 to n-1
 9	header='Agent Index:Interacting Agent Index:Time Interval:Intensity'
10
11	f=open(filename,'w')
12	f.write(str(no_contacts)+'\n')
13	f.write(header+'\n')
14
15	for i in range(no_contacts):
16		agent=random.randint(0,n-1)
17		contact_agent=random.randint(0,n-1)
18		time=random.random()*10
19		intensity=random.random()
20		f.write(str(agent)+':'+str(contact_agent)+':'+str(time)+':'+str(intensity)+'\n')
21
22
23write_to_file('monday_contacts.txt',100,300)
24write_to_file('tuesday_contacts.txt',100,100)
25write_to_file('wednesday_contacts.txt',100,500)
26write_to_file('thursday_contacts.txt',100,200)
27write_to_file('friday_contacts.txt',100,135)
28write_to_file('saturday_contacts.txt',100,50)
29write_to_file('sunday_contacts.txt',100,70)

generate_events.py

 1import random
 2
 3import numpy as np
 4
 5
 6def write_to_file(filename,no_locations,no_agents):
 7	info_dict={}
 8	#ID enumerates from 0 to n-1
 9	header='Location Index:Agents:Time Interval'
10	n=random.randint(10,20)
11	f=open(filename,'w')
12	f.write(str(n)+'\n')
13	f.write(header+'\n')
14
15	for i in range(n):
16		line=str(random.randint(0,no_locations-1))+':'
17		for i in range(random.randint(0,20)):
18			line+=str(random.randint(0,no_agents-1))+','
19		line+=str(random.randint(0,no_agents-1))
20		line+=':'+str(random.choice([10,30,45,60]))+'\n'
21
22		f.write(line)
23
24write_to_file('monday_events.txt',10,100)
25write_to_file('tuesday_events.txt',10,100)
26write_to_file('wednesday_events.txt',10,100)
27write_to_file('thursday_events.txt',10,100)
28write_to_file('friday_events.txt',10,100)
29write_to_file('saturday_events.txt',5,100)
30write_to_file('sunday_events.txt',2,100)

generate_interactions.py

 1import csv
 2import random
 3
 4
 5def write_interactions(filename,n,no_contacts):
 6	with open(filename, 'w', newline='') as file:
 7		fieldnames = ['Agent Index', 'Interacting Agent Index', 'Time Interval', 'Intensity']
 8		writer = csv.DictWriter(file, fieldnames=fieldnames)
 9		writer.writeheader()
10		for i in range(no_contacts):
11			agent=random.randint(0,n-1)
12			contact_agent=random.randint(0,n-1)
13			time=random.random()*10
14			intensity=random.random()
15			writer.writerow({'Agent Index':agent, 'Interacting Agent Index':contact_agent, 'Time Interval':time, 'Intensity':intensity})
16
17
18write_interactions('monday_contacts.csv',100,300)
19write_interactions('tuesday_contacts.csv',100,100)
20write_interactions('wednesday_contacts.csv',100,500)
21write_interactions('thursday_contacts.csv',100,200)
22write_interactions('friday_contacts.csv',100,135)
23write_interactions('saturday_contacts.csv',100,50)
24write_interactions('sunday_contacts.csv',100,70)

generate_locations.py

 1import random
 2
 3import numpy as np
 4
 5
 6def write_to_file(filename,n):
 7	info_dict={}
 8	#ID enumerates from 0 to n-1
 9	header='Location Index:Type:Ventilation:Roomsize:Capacity'
10
11	f=open(filename,'w')
12	f.write(str(n)+'\n')
13	f.write(header+'\n')
14
15	for i in range(n):
16		f.write(str(i))
17		f.write(':'+random.choice(['Open Air','Lab','Classroom','Cafeteria','Library']))
18		f.write(':'+str(random.random()))
19		f.write(':'+str(random.randint(10,20)))
20		f.write(':'+str(random.randint(30,40)))
21		f.write('\n')
22
23
24write_to_file('locations.txt',10)

interaction_files_list.txt

1<monday_contacts.csv>
2<tuesday_contacts.csv>
3<wednesday_contacts.csv>
4<thursday_contacts.csv>
5<friday_contacts.csv>
6<saturday_contacts.csv>
7<sunday_contacts.csv>

locations.txt

 110
 2Location Index:Type:Ventilation:Roomsize:Capacity
 30:Lab:0.17931671057168175:14:33
 41:Open Air:0.29934348486313356:17:34
 52:Open Air:0.8567996764630795:19:36
 63:Lab:0.15045983775394045:13:31
 74:Open Air:0.37538590106059433:18:38
 85:Library:0.12777319682254162:14:40
 96:Open Air:0.5840889324453068:13:34
107:Cafeteria:0.9846490323043516:16:34
118:Classroom:0.7226268679741341:20:33
129:Open Air:0.25595540385626603:12:38

monday_contacts.csv

  1Agent Index,Interacting Agent Index,Time Interval,Intensity
  253,50,6.513987164288512,0.009841241328195971
  375,41,9.148192540295673,0.24346079227118766
  448,15,7.767801788987083,0.7136052498759755
  552,88,1.5827087482234237,0.20764631674966094
  691,29,2.7343235816879474,0.14895783199367685
  738,8,4.334045729516742,0.6439094471011881
  829,63,4.210981817246595,0.2554432621369428
  927,36,8.47635840100173,0.3832054559612531
 1061,26,9.548384089998105,0.6427227428081111
 1159,75,0.19282581475098315,0.6828452816536151
 1243,36,2.766678550264544,0.09873500692734027
 1325,65,3.1770527299851494,0.3435712193957915
 148,40,8.102382721566547,0.09587949195147027
 1594,25,8.241622912147497,0.5730417318280656
 1659,47,7.699772353241968,0.39279197145264855
 1789,56,0.5541668883448503,0.06333660535403263
 1817,97,0.39998863659011175,0.7631024669772002
 1921,24,9.481067041452134,0.383204002416655
 2089,60,6.957525839570176,0.30328744337885094
 2152,38,2.3412395878589987,0.16383796788949623
 2228,0,6.141151899527708,0.7962272950902385
 2386,66,0.2603884125232203,0.7358136231991173
 2491,84,3.6123649897326304,0.7799712779618293
 2510,8,8.663266709710413,0.12171387351501184
 2661,29,1.6262042324661152,0.10065614499197328
 2750,21,4.841685610806538,0.7543211044433643
 2836,87,3.452267039247221,0.24586831246758334
 2981,82,8.650432434700082,0.06323310864576226
 3092,22,5.715589643104055,0.31823996685111133
 3173,35,6.284157263259199,0.11694633297875623
 3210,84,8.999192526045253,0.6437786483355039
 3341,24,3.329425451169008,0.5970435365473865
 3483,28,6.085727947739475,0.16747815697677937
 3591,92,2.3851917083174436,0.7073630889864982
 3643,70,8.455754235213357,0.10182165120349396
 375,83,6.174698872178428,0.941209396024936
 3859,14,2.291049580905622,0.5455844456290104
 3913,2,9.46944893647284,0.7369595962496633
 4058,44,3.57900560392034,0.6837125615283298
 4125,93,5.116785984157063,0.13994535890464188
 4262,46,7.148574887294899,0.5405338300800007
 4322,90,1.0063834871966304,0.4877659103098638
 4499,46,0.8665745698758154,0.10833600628847495
 4538,43,0.7143250674023671,0.23448581373131705
 464,16,8.1451375328301,0.16790513318785627
 474,92,4.96476895002348,0.8104031815415705
 4898,4,5.911646782174485,0.7988305382316447
 4965,93,2.6847021765065024,0.287871730729368
 507,54,9.222677019633089,0.537725039535849
 5129,68,2.9028843779458393,0.3334779206701901
 5281,42,9.099960055312769,0.344508935524367
 5396,3,1.8276294599828247,0.5879862401519191
 5412,69,7.444276394152981,0.14065410813768553
 5553,24,3.8426989168155936,0.553110116244658
 5632,53,2.8024046447519813,0.14749352841808105
 5731,26,1.8300810567986148,0.2511953179826105
 5852,63,8.181614960177079,0.5342722919206799
 5943,79,3.6303269687559436,0.041962863257867467
 6032,67,6.808129891567074,0.9655803746876441
 6188,7,6.529327196638947,0.8705529513644207
 6224,22,2.343935060531636,0.9962011342143507
 6352,76,9.903506135903946,0.24535465759316943
 6434,71,3.440764716127096,0.8830014936240537
 6590,8,4.9723666216465015,0.8660633726701565
 662,16,3.981201904138718,0.5462666429394176
 6751,73,9.173840400289956,0.865539433334778
 6829,47,3.148978965476934,0.008528755768497653
 6949,17,4.411053661515005,0.29462045868329656
 7094,20,2.99799449269492,0.008094047003058158
 7114,89,6.932501717103873,0.47267759190124015
 7271,63,2.4410782836620495,0.8450391983408515
 7365,41,8.452847533443084,0.2344428882511541
 7493,89,5.446234835932727,0.330607083902015
 7575,74,7.1764769352007916,0.025050360616053924
 764,20,5.261301134184475,0.8635716467281545
 7750,54,9.317619443580812,0.648110436821533
 7874,16,0.9372646530940454,0.9950542940364594
 7987,38,7.183818262108614,0.13361402344750717
 8014,30,9.169442123777605,0.16886440853265938
 8188,71,3.3102347294712953,0.5561612966102644
 8285,33,7.070634425610756,0.2863648970197845
 8389,46,9.177775831868844,0.07552739773663264
 843,94,8.183009216900762,0.4620521108586507
 8534,24,2.1401199464054477,0.5509220560673987
 8672,6,1.7324077130068205,0.8059066985821882
 8779,34,0.44615888882443167,0.36544912453839706
 8880,10,8.963528390783331,0.6351811175877636
 8950,9,7.047409633314041,0.41897643552173114
 9018,41,8.56145461013509,0.43182853230932194
 9114,83,7.53361659631241,0.217323186288224
 9286,35,8.89767842506425,0.9536791563015704
 9382,4,8.12157962871083,0.37018509361329277
 9497,31,8.648762210396342,0.34765263360451615
 957,99,8.776027691582023,0.25878808302839884
 9618,83,6.269859483863993,0.3125403759007429
 9744,77,4.464382164004213,0.13901033013312758
 9815,84,8.98611873951888,0.5071629988483005
 9971,12,4.984748548530953,0.40055692578644464
10055,15,2.5012472920711772,0.5476296836584915
10129,20,1.323833021883356,0.28336173169726786
10218,29,0.1507888595102047,0.07317326091711773
10387,31,5.74536343344707,0.4686744188513029
10416,46,3.6391719351673633,0.0794946256761716
10547,6,4.142412582685995,0.12319743144062067
10644,62,4.543247941899508,0.247526152958766
10737,3,8.042882111482527,0.7441702016120487
10816,62,5.768476020179256,0.47664663572590715
10962,70,1.8980155315166736,0.23647147445571282
11022,5,8.046646738605578,0.6345913535526976
1112,30,5.274857202949921,0.3008106462729032
11225,77,1.2803466196095459,0.36112700934738684
11325,88,0.27025905784243576,0.33565355291757737
11499,62,8.168023992027726,0.10124829380096845
11526,41,1.8811304853591704,0.9029155005956867
11626,17,8.589612826175477,0.9213970386212076
11777,47,7.831043375818597,0.4247028116988881
11835,17,4.152762492180637,0.4745679027732439
11971,70,6.160068068019173,0.6521567323522888
12010,93,4.425380020352634,0.7054440482566736
12116,28,3.311087652028042,0.9166201071677543
12285,31,6.45496925102327,0.22055188410179216
12359,85,3.2656053850868405,0.4212341556171103
12437,1,2.483329632428263,0.2826638966987185
12593,70,3.188395899451053,0.21875828829817812
12676,73,7.711950568255208,0.5022244747840047
12756,50,2.785621560145656,0.9185163236605833
12824,30,9.29755591451815,0.4328965887063524
12943,79,6.304758039767384,0.8186748853057808
13043,42,5.542757737114167,0.19833513133534986
13116,68,3.102059433024935,0.11092284566460309
13255,22,4.48744700920494,0.8547061529638681
13324,45,9.16283607437596,0.5803737376495258
13455,49,9.957213997749054,0.18841253768327848
13598,92,5.763243882706385,0.9134748899042435
13679,45,2.0356604853285454,0.9602500660221783
13742,49,5.046691251349574,0.12302780997543783
13819,8,8.395827945704132,0.5118220858973469
13986,67,3.3253137878628913,0.31971277856462366
14088,59,2.9664952022095536,0.19401296630828513
14122,68,0.3384038872996886,0.20935264425984557
14229,80,6.115713782624931,0.7495259112078474
14328,91,9.320314287253098,0.16028074257299518
14453,20,0.14522197751418386,0.6035801190491846
1459,3,7.584164121549164,0.15831465204436646
14631,88,2.730702741829185,0.29430232215069896
14752,61,0.15088073664091484,0.8229746138822506
14827,9,4.728286397295321,0.2628311922872978
14933,86,7.614042631030896,0.6361740132693546
15088,96,7.931938114936079,0.8622558475628161
15182,59,7.5582925932469145,0.618105304402339
15269,92,6.098154553251156,0.8344150383601279
15323,50,2.771872594923157,0.5233656747968031
15432,79,2.9523425703149506,0.05141448060184706
15543,96,5.495483582006947,0.6075736888332405
15647,49,8.948174139790332,0.703515789046357
15747,82,7.79232272382948,0.28713868588623237
1583,55,2.1197005987232687,0.8710215637843753
15917,16,7.636187145481843,0.4463501376184047
16066,17,5.96216082558347,0.1156295679843291
16188,40,3.8833354969600564,0.7827144296503963
16296,65,2.7887703424127586,0.00308759494866484
16362,32,2.018292224720104,0.5025080299253926
16455,54,1.7003344426926126,0.08895997472318506
16560,57,9.673556267275426,0.6050642601172523
16667,52,4.877761334010176,0.9199827916724133
16763,13,1.7776983995884343,0.460048381662998
16882,12,2.3935471506408144,0.8012083235883181
16966,32,0.11754795261362139,0.37092099189472627
1703,11,6.846716842391126,0.5511448261403317
17198,78,8.156000887373777,0.07543486878681582
17256,15,7.6584173143233,0.11395001805719251
17382,67,2.510812196657246,0.2697436040624521
17466,88,5.850870985161633,0.5194042053397994
17578,22,5.318050188652826,0.3741489531161384
17617,17,5.682766690116123,0.20102723484565566
17784,58,4.600053324359877,0.8665601602485907
17851,83,7.905940738999307,0.23155308931227125
17938,92,6.330499459552722,0.3949879347311296
18017,51,2.305887472499214,0.8529892916573967
18193,49,5.043004483856393,0.6064709004839419
18269,95,0.2476376406695313,0.17395004518990098
1838,41,2.59984936498891,0.42830518585779387
18464,74,7.659173451036309,0.7110193229540483
18549,67,4.430934873881354,0.6036641096307729
18646,56,8.343715010160377,0.46405645321798394
18793,84,8.20735245970513,0.9654588716041783
18852,36,4.071777045509133,0.09514425913775437
18956,13,9.263991384633917,0.7514734590438714
19029,74,6.844402733610884,0.9869675256906077
19140,54,4.596949606037163,0.051095680266435295
19254,52,9.074772108375173,0.8012517742676243
19320,9,5.9595745038121715,0.6852065620945298
19425,43,9.578013720201213,0.33143069568800143
19553,94,8.883872807719479,0.143434155051809
19637,86,1.0007570551447964,0.3335433501456836
19790,12,8.867737588204768,0.7987419668276835
19876,26,4.114199161021061,0.2052471840848128
19984,37,6.40601059783028,0.29110876156895105
20071,36,3.164557443444541,0.3836278225803993

monday_contacts.txt

  1300
  2Agent Index:Interacting Agent Index:Time Interval:Intensity
  332:91:3.901351436822462:0.7339762595213493
  478:90:3.5626711544249745:0.6746469145132054
  55:85:3.045488921169931:0.039540230198430115
  686:81:3.35308756346429:0.3633954339845933
  711:89:6.326551736128173:0.6289266025075126
  841:89:9.329187350891646:0.6353349553288311
  920:71:0.38645434909083676:0.04041798989591305
 1092:68:5.889425651825421:0.3950396909932594
 112:47:6.557852441820289:0.7245690803250271
 1299:32:8.402723639687704:0.0029308245084296303
 133:33:3.5133963523940634:0.5984631970990983
 1459:72:5.370053020778495:0.531313701010571
 1594:59:5.361572617932277:0.9886697867090888
 1621:82:9.786681409791774:0.644945666368522
 1748:42:5.011982887515333:0.051662026866201693
 1862:94:3.2808909541391196:0.9379521953670432
 1970:28:3.856798574421678:0.2557608578207182
 206:59:5.678890997712748:0.3530777753051588
 2137:67:9.131898601767697:0.858499260774226
 2252:74:9.986369997027031:0.3156120836947629
 2331:94:1.507816879463777:0.750555105240906
 2499:93:2.121959362802376:0.09703892296171557
 2537:94:5.400780286788532:0.4299044759629851
 2615:81:4.75977897522104:0.3232455011774399
 2751:63:8.55510185721477:0.31288557896015257
 284:59:5.9222428832641425:0.12157485621270103
 2943:73:6.795602865846028:0.06744185332954145
 3059:1:2.7021747467696375:0.050538725122540984
 3160:93:2.943901539081496:0.4982339562937653
 323:84:4.133634564366487:0.3075102931608772
 3373:44:8.134038990032534:0.8418295238039117
 3417:86:0.542806560857374:0.7588119151895625
 3585:77:0.2859974668290466:0.7241059456194887
 3614:16:5.329831905451478:0.9195203828276385
 371:90:2.211130035725443:0.23639098557775062
 388:70:1.5406578056068143:0.4262130830791522
 3941:0:1.1579089653984453:0.7851213807119591
 4050:37:4.484956048115092:0.3060348403762886
 4189:88:8.043811518556971:0.4727074037001201
 4258:95:0.8868990689387879:0.3467640517252304
 433:86:6.190128446233331:0.8176423375406843
 4419:22:6.298136491836642:0.5649230836250814
 4564:54:4.536312531879237:0.7989489195824466
 461:61:7.833473806936388:0.650092667048976
 4743:76:3.44149914401369:0.8746721680294639
 4826:4:6.373337730771791:0.17592940756741804
 4960:35:9.934829550819842:0.5345586622312622
 5016:51:1.5764360886713513:0.6770030520140922
 5191:75:9.528950938813134:0.6204530683653462
 5239:42:7.840684207317652:0.6089954987487575
 5361:65:3.319567445374041:0.5478018921036643
 5452:46:4.646705033209998:0.537254045209896
 5595:50:1.7647409730344588:0.02688151759300872
 5651:35:4.156824965180649:0.7123780511350246
 5775:78:3.9226537983258227:0.596842377897293
 5874:58:7.563226282263413:0.8062241896776831
 597:84:0.7120251049265447:0.9302238734157992
 6047:95:8.024189071209314:0.2387216724542346
 6157:28:6.2859322129180475:0.1556546337774144
 6270:30:2.530642559415648:0.25633238312842377
 6388:16:9.06713427487879:0.41516872075378486
 6432:35:8.09237307848392:0.5857892642742539
 6517:65:7.8134917233836285:0.28104998118729463
 6658:79:6.223781312011015:0.012229676686173363
 6790:90:4.692384410823149:0.46217556562178697
 6871:62:9.08294852508194:0.7287708959264037
 6933:20:1.542102652267403:0.8389929454049759
 7090:74:4.633437833538752:0.65537480210047
 7197:11:8.325837108492266:0.08894675467827051
 7210:72:6.557672074227439:0.8651050525879831
 732:73:4.872758588552571:0.09357856657833297
 7457:65:6.828660337659751:0.48495229529925665
 7595:47:0.7466953354057215:0.6603079823678228
 7692:49:2.0077342778968554:0.9189494309774255
 7782:53:0.24061611784117698:0.9198471939191474
 7864:6:0.5767175723374529:0.5800677289768271
 7956:50:2.8103728644720705:0.7661027286936849
 8088:65:5.495737535254017:0.13475930874418607
 8139:26:4.520441829762211:0.7752928037603906
 8262:15:2.527874839657712:0.1705345466390138
 8375:37:6.949647409442933:0.5105509864259511
 844:20:2.97399456614634:0.11289483289257596
 8541:6:4.273511532203043:0.09718585800915025
 864:46:7.362236247628521:0.04058096586641702
 8743:36:8.117474485572878:0.14526881403519276
 8856:47:3.855901848144012:0.06033216610055803
 8982:62:7.36834872994402:0.7504447501739113
 9034:37:6.940059348353467:0.9688323772735252
 9180:84:1.746381666139043:0.7823637521600265
 9211:48:7.364223469449296:0.36985754872005294
 9324:63:8.322818469697424:0.26920941824660416
 9495:93:8.565298534711246:0.36630815362030034
 9555:98:8.261077047953284:0.24720488756898507
 9667:32:8.928969126003851:0.2768960055237545
 9761:35:8.836832665518946:0.8525592430588332
 984:79:9.86527008653734:0.5241984425341051
 9915:84:7.895868992916919:0.9243365521462359
1004:44:8.716228021549393:0.9307245519590631
10196:55:6.888764694183994:0.0792443519258833
10272:90:7.406214716467515:0.8859191527012792
10316:14:4.69851133682884:0.19881286599667536
10461:63:3.380324616991465:0.8268422238613041
10552:16:0.19216831328206507:0.8647705352734371
10645:84:1.2697886559236449:0.6513461320262995
10750:83:6.159864427212866:0.23346664207112955
10869:30:3.4770888522834897:0.36611239444780763
10970:90:3.5286680285590846:0.061422783069107645
11093:39:0.9637079127853909:0.807360297039483
11159:97:7.043532289504258:0.12207223530271005
11243:84:2.227673296719175:0.8300830010185617
11347:42:1.833397217400502:0.21499046911985964
11476:1:7.8677237896729535:0.1308918842693122
11536:55:1.3055580188425742:0.7277279779721338
11662:0:0.6371814138898102:0.739520928356319
1179:66:3.6931844772562252:0.49433217498267423
1185:88:1.486445418424901:0.7994315842241301
11967:44:4.389739626245813:0.7501063883906391
12087:66:1.5283456139385265:0.933656123136008
12123:48:6.137030114523152:0.9235785663451955
12255:39:5.593904911357448:0.7918698321362837
1236:98:8.573685590443334:0.6643971331641266
12458:40:9.370090787366754:0.16062179115642827
1259:7:5.99552450577316:0.22398865033159399
12678:78:1.6985126182973498:0.23431129397478678
12727:36:1.7553777448861463:0.9571656933455291
12810:2:3.340403747124703:0.266154426065234
12920:32:9.04965093388158:0.7998074320401931
13062:43:4.48824832171709:0.19692009534109944
13166:68:1.044013500391131:0.17518002535790944
13281:91:2.032022113548353:0.590068376259575
13379:5:3.6678672963264725:0.8583172648269328
13488:25:2.7906016247631857:0.3417441357034283
13548:22:8.274301104789616:0.6180500643903922
13637:34:4.895008043767715:0.470617322501378
13765:98:3.9939963178189073:0.7597707393883737
1388:99:4.344354090436447:0.08000834895567921
13933:14:2.721637241356134:0.5469317967238905
14097:61:4.480139087307686:0.9370228932878472
14120:89:5.052620560783816:0.2537641232093184
14277:4:7.5548012755079155:0.7647336265540196
14334:53:2.3637671040815222:0.8631258102243161
14497:97:1.1517561038645152:0.6080198126602016
14547:4:4.764917096374596:0.5152616692151232
14656:7:0.7673797837521523:0.05295581093999868
14712:65:5.820115979848362:0.6738384932399847
14822:33:8.160077472113436:0.35575801582167244
1490:24:2.5976244236881127:0.07228477664392474
15097:67:1.3349001353042622:0.5467070433629635
1514:12:5.412935866383392:0.11638905261774857
15295:64:4.328183987891099:0.5038839316589997
15391:91:1.8006275689774043:0.7069818589813456
15433:64:9.979922860196544:0.1730588104192059
15582:14:5.625659929969839:0.427124084779392
15680:66:0.12556782560516622:0.6318204731180151
15784:81:8.965005435252678:0.1329683648749237
1587:7:2.7621652564272834:0.22081572672352956
15960:97:1.6189519082706272:0.5054371256483898
16061:47:1.001552280836816:0.44870613684494454
16112:28:1.7394787076567975:0.15123469338547757
16292:66:1.9575307012529986:0.5143410029855222
16335:60:5.974833467758106:0.18060226652566203
16419:47:2.4143782472302853:0.7229634935521948
16532:33:4.084222023013261:0.8052825167982911
16661:42:3.880567198086904:0.33785485991760156
1679:7:4.797609189111243:0.6557842812818759
16860:17:6.786175767301016:0.855473866429063
16987:80:6.840555606112167:0.10932325733796955
17014:84:5.475907747014465:0.23291755605347986
17191:29:9.17560043418257:0.17718783157595752
17228:78:3.4425085921579193:0.8242337800670188
17360:34:7.2394297827991005:0.8755428155410877
17454:64:2.2671905891345414:0.7334964590961794
17567:84:5.948336450041793:0.3098471787427216
17611:56:6.700839762851763:0.3207358083318562
17738:77:0.9674523146234348:0.6023850656632548
1789:44:4.69793570668195:0.5029890933381677
17947:20:5.319830568980307:0.38707577261884796
18026:86:4.7817534968627555:0.2976309298220806
18141:47:0.20291653431164902:0.4554712242013542
18217:64:7.3452775056010955:0.6483550983905965
1838:2:2.016021005062094:0.47350242384381125
18427:52:5.803404417975604:0.9532995101175942
18529:20:9.704176176125863:0.08789736542495086
18650:87:3.1885515636171515:0.9367769520102764
18793:29:2.0395613845066887:0.4946398943812982
18876:97:9.019353389326039:0.1445289893279038
18999:46:6.582281848173897:0.5425316978102004
19086:6:1.6825724869426617:0.22432772872032958
19190:29:7.500546164660645:0.30905885655729015
19216:78:2.424664767871816:0.18813093908551015
19387:61:3.2116382773342567:0.8869057054380951
19427:0:6.159493456473577:0.2276835244003813
19590:78:7.329164728333016:0.26167298307249465
19676:42:6.930905362346148:0.9096883575644671
19746:6:8.782850221647784:0.3169474488876317
19862:40:1.370250262759245:0.5553566618394318
19981:15:5.902292977530621:0.0556777547804056
20032:33:2.3285018362586083:0.22805846655926876

monday_events.txt

 117
 2Location Index:Agents:Time Interval
 35:27,68:10
 49:34:60
 56:12,16,55,23,59,24,96,9,94,63,65,23,13,86,49,98,78,41,89,45:10
 64:51,26,83,88,43,59,17,67,21,9,26,54,85:45
 72:56,69,37,67,50,3,28:30
 80:57,30,66,27,37,58,42,82,47,90,86,89,86,75:30
 92:99,59,82,38,38,31,61,23,10,70,62,47,66:10
104:69,24,63,26,87,28,36,91,28,86,80:10
111:49,78,77,56,26,26,92,38,47,64,54,45,46,74,46,8,86,50,55,76:30
122:91,9,88,70,2,19,72,0,43,88,15,26,93,81:60
137:77,62,88,76,28,37,29,92,97,55,2,19:30
145:4:30
158:74,3,31,48,6,32,63,79,99,32,95,1,50,16,29,7,99:10
167:89,75,36,95,17,40,58,64,53,11,69,70,34,21,12,53,26,23,38:45
178:4,8,42,46,82,18,58,38,33,76:45
187:97,93,67,45,10,4,89,55,43,42,86,65,28,77,44,63:60
192:46,18,6,75,17,6,15,69,22,75,58,36:10

saturday_contacts.csv

 1Agent Index,Interacting Agent Index,Time Interval,Intensity
 267,66,9.857117310137038,0.5920888806387263
 339,40,2.9606587904019332,0.28799857726311495
 419,48,9.933376750841031,0.5563869797724015
 547,14,2.707792838677613,0.11910322049310873
 697,93,7.330200583028975,0.05479876188162769
 736,52,5.8053943720215395,0.5087501005692888
 816,29,2.9259700624959297,0.7450077742936179
 924,76,6.615452592843672,0.23066023231585764
1098,1,0.6129732778252273,0.03079626452546913
1152,51,4.991234253861199,0.11029211445761467
1249,64,4.281211334785262,0.09369780403627248
1376,15,3.110100778578777,0.16882508544803732
144,82,5.018950780821032,0.4528425446162895
1525,23,1.523435869691594,0.8698275706188255
1669,26,5.982815427997005,0.8195210582557968
176,69,6.002756213947941,0.47565948855915063
1851,92,0.9693831534702857,0.8545362381598459
194,54,8.926690297564479,0.19650516555917197
2096,37,1.0761711632578574,0.2856646294271543
2156,11,6.206036904245246,0.025636240561556556
2263,45,9.243970250499935,0.8459046432706034
2318,80,7.21308647170134,0.18639074663509203
2422,25,8.566766221711488,0.9194158046579632
2546,78,9.436676144535742,0.3066038278097547
2655,33,0.36786224695660175,0.46598870340260434
2780,31,4.295593090845587,0.7887243574197714
2874,96,9.079412546074366,0.2008470536485456
2993,11,1.811367363309666,0.24854787128323197
3017,45,1.3031037142786772,0.736713001093112
3154,77,6.689236468914333,0.18914544406995604
3248,55,6.561686523837922,0.8415382745176084
3395,24,2.1199045466842223,0.3191748832651885
340,43,6.361037571365211,0.054785174673453896
350,86,0.05530006267194132,0.44722966677561227
3667,8,5.108232528265227,0.0780720907027247
376,57,9.073223985113284,0.6305218263588744
3816,8,6.875884563883529,0.7889755826254277
3935,48,3.63455049866231,0.23653026160724466
4093,72,2.726782980498262,0.7473684674491506
4143,65,0.5285308238378339,0.8079994482515851
4230,84,5.435250398044084,0.22794249938945577
4368,66,5.812705194521447,0.3987768568223644
4437,30,5.462713140719986,0.2651939540942704
4517,49,9.554281145866424,0.2854383038592877
463,1,7.129363264331846,0.6332198675617925
4734,66,3.7040828036302886,0.15835840507645926
4839,53,8.70713280127657,0.7521303893855847
4985,42,2.9065301405226784,0.4061131567948121
504,71,7.566520295016451,0.4702871038447024
5125,72,3.3524932671715546,0.991241688877458

saturday_contacts.txt

 150
 2Agent Index:Interacting Agent Index:Time Interval:Intensity
 378:67:6.687995944426314:0.4033605962521598
 460:25:9.766242543855506:0.06792652175390823
 518:90:3.76439853374662:0.9833305943472379
 64:19:6.506721718246754:0.47110824328789613
 773:26:2.5400982744608336:0.40140270897106645
 868:57:0.7095173223023121:0.2328466079907241
 957:54:1.545474789816078:0.6593172582955799
1090:25:7.843174009450287:0.8268544568417224
1128:52:1.3914812455190517:0.8024812081343093
129:71:1.5518951054968155:0.9318507773242553
1339:28:8.476359135606552:0.7763246795933149
1449:50:4.7211099258761555:0.2950133516599971
1552:12:1.6886708754449598:0.27197127175998526
1619:20:5.6781326401719046:0.9590963962294797
1722:77:1.530950907625851:0.3754295473613327
1889:88:5.658452775120387:0.0803874959012173
194:12:7.636759575481204:0.2831880696193816
2058:57:8.601430915297016:0.5434659477112249
214:32:6.147275128372893:0.856773362268219
2275:95:3.3575411423184542:0.46747804925146763
2348:73:4.294729247064641:0.050670872480034546
2487:31:0.20788603769580694:0.06469788200264015
2550:44:2.983096090063986:0.02735893758806829
2612:73:3.5332686474645323:0.6308187130898412
2759:18:6.507883109382785:0.8679178454556692
2890:76:0.6431511136089729:0.38181470878945245
2993:55:0.688031974008203:0.02165710753326533
3093:54:0.5174288624109147:0.4172063304023521
3190:55:2.351244324988293:0.20155062301576254
326:69:3.204281646873234:0.6853704116954752
3337:45:4.207020809561934:0.5062926163922263
3450:85:3.3126767901315013:0.11439025603353281
3518:98:0.5483540344431337:0.5831224256744627
363:20:8.466441890639738:0.15531801936817402
3770:84:4.252674278698835:0.1021412687119303
3884:96:9.65755023003075:0.9104362499713785
3985:30:4.477617210548132:0.2798872009598208
4027:81:3.4726517979202596:0.6867846228811487
4133:5:9.418615513088076:0.3089650238414625
4282:19:5.969411859418942:0.9201045742327656
4316:63:4.806229721717362:0.9196419859150736
4429:41:7.958618332948535:0.44643319464470743
4532:85:7.863072004177757:0.8397192112109673
4664:63:2.8034310396456483:0.5005219190796429
4722:53:8.636229353574626:0.5573464209207643
4820:81:1.3492272749291145:0.5759296391255372
4972:1:3.170961659254469:0.864395776604293
5051:5:6.983939525485372:0.3998399286929163
516:11:2.828084537368467:0.7569874076404247
5284:6:3.225352755378524:0.13692972894786104

saturday_events.txt

 110
 2Location Index:Agents:Time Interval
 31:63,91,41,97,7,44,73,88,6,36,22:45
 45:70,76,47:60
 51:50,91,48,78:10
 69:60,55,98,50,0,11,22,13,92,54,33,84,14:60
 75:7,76,83,54,90,94,79,2,75,34,7,96,50,10,23,54,94,15,41,87,6:30
 82:44,90,20,90,40,99,25,95,5,3,31,31,50,31,4,48,40,80,6:10
 91:99,53,83,90,63,45,12,82,28,96,68:10
102:61,99,34,2,53,88,77,16,90,28,43,63,62,88,42:30
113:93,29,68,43,29,0,67,49,9,92:10
126:91,31,55,9,57,71,39,25,76,76,17,6,18,34,27,4,75,4,62,29,6:60

sunday_contacts.csv

 1Agent Index,Interacting Agent Index,Time Interval,Intensity
 288,99,8.486887539457896,0.6304214594796798
 322,98,3.2976061937586563,0.781281314136626
 475,99,4.430757248996154,0.1192555052707921
 51,16,7.048835094335958,0.13157790618351306
 664,56,4.655156331391267,0.6998835788082481
 752,23,0.40055384199715993,0.75098379425079
 857,7,1.5925582330513355,0.18543205571638421
 948,53,6.490406524470783,0.2868193033569312
1029,51,4.493661262409669,0.5815858845665998
1143,75,0.6573777627777944,0.48978674189411686
1250,69,1.5519768951778778,0.054714720400359296
1383,70,9.975574102080033,0.29285241977157617
1450,61,3.8682067678943124,0.4261808134423466
1575,33,6.740529736522591,0.2455572388334618
1664,22,5.975520317563916,0.339408352827008
1712,25,8.123063683302792,0.5784864212678281
1826,1,1.4395665451710782,0.9527690571698493
1914,60,1.4430820158919855,0.39247712631007536
202,85,3.8006454199690043,0.2921826762943228
2167,47,4.673025133711266,0.8086927544736627
2290,80,0.6743678721890989,0.8176138774275091
230,56,8.047433934786856,0.2559808833574637
2495,81,5.215697774477086,0.9006825144319155
2530,35,3.990730095641025,0.5069325770991455
2639,65,2.3811238779362887,0.30447260187846537
2770,7,7.576691410586301,0.09327402375535143
2898,41,2.769033142970916,0.052943430372137
2940,9,1.53999525068522,0.3637708934017183
3025,26,7.337572932448316,0.9914045891898488
3185,24,0.6183737562734581,0.12280394449800236
3292,64,2.7937380809337697,0.38492439656092525
3354,3,0.358907903107174,0.6108859228588672
3488,13,5.20066638591457,0.6428277196598772
3558,14,5.132696666075683,0.7770071741679037
3696,37,8.951072527951148,0.15909392193657212
3719,5,2.667024065530701,0.16760141110060367
3838,65,4.776675413849936,0.6358673983241082
3933,43,9.388244029403698,0.2677659863381495
4074,3,1.920978437228692,0.8181512011809285
414,22,1.1168095443666715,0.49875323614048606
4233,78,5.247483529457279,0.1808059413598897
4327,55,1.4802711152787895,0.2644792206222256
4413,47,9.879205440524398,0.8262467807502241
4591,41,6.006774424396097,0.36409489715815657
4691,18,6.618327483739249,0.808798335582276
4728,70,1.2853107381027506,0.07098388830301883
4859,30,7.047303701965818,0.6403449892486467
4938,14,6.185026335954712,0.299405530751356
5090,4,8.716153438777326,0.8234338404902319
5131,81,2.4693304094766266,0.08279562712445887
5272,3,5.256897773525066,0.6592241405225215
536,20,6.098476239562825,0.7645209043837615
5486,36,0.08937541961729134,0.35642021687049374
5575,94,8.854515849420165,0.9606419685383933
5654,98,4.638295722864876,0.5073037465495944
5798,46,2.1629311222063374,0.27936623481924505
5856,65,4.647708874943114,0.3714395293129583
5976,77,5.891978882816718,0.22901678369513967
608,24,7.3415194739594805,0.16260056535985934
616,95,7.261061146157749,0.521374883996052
623,57,8.603304779092946,0.5139482482796789
638,9,7.012907842879529,0.4997630558711238
6466,69,7.715026519996071,0.8236282668323782
6587,9,4.079938354014608,0.4660587190357144
6664,48,0.8764088012451265,0.2749338760438347
6775,12,7.643239456414168,0.6320420632107933
6844,35,8.966995279467467,0.24014856201649082
6913,30,7.402636843700636,0.022401560118258
7057,73,2.820428173846705,0.943722059836342
7161,73,9.41610911071566,0.5783995362749058

sunday_contacts.txt

 170
 2Agent Index:Interacting Agent Index:Time Interval:Intensity
 329:74:9.16372608230145:0.796954964751048
 46:51:7.883900864399966:0.4086674799106108
 580:96:0.14815771583060466:0.9598774863311844
 674:97:4.308374781710823:0.5469594486352
 751:13:9.042079023826053:0.4951854351944386
 880:59:1.194192610139505:0.1806780778265884
 929:52:8.298008123594673:0.6055655082754013
1011:99:7.398529511198307:0.8423463023583696
1194:96:0.8114992155173495:0.6185711886621139
1232:66:2.3703816553952883:0.35420962128864475
1339:99:3.855243189079789:0.19683280636170353
1414:20:6.993801240807475:0.9924238391700014
1569:5:5.368207898395178:0.3296239694354882
1622:82:5.141505384517688:0.6680939851970867
1716:14:4.381681285284316:0.13324126477503573
1863:73:1.1377617766820813:0.016765931895245334
1953:42:4.331827823657975:0.560247114997433
2074:72:8.487044883624892:0.44857507061224955
2148:53:8.142210501452041:0.22185756589964178
2239:80:0.919320244588725:0.0066855429075109996
233:21:9.289809772081991:0.48205140669390023
2468:46:4.536474019847931:0.6855403269937351
2558:90:0.8335888281998161:0.5829499953459416
265:56:8.623750119046413:0.6850571684408665
2737:46:2.19563994708889:0.32831432045342446
2843:16:6.54823708272073:0.7241818732660742
2955:95:1.356326584676878:0.8593548177807079
3033:51:5.72041717661566:0.524825828129498
3156:97:0.05304038966948088:0.9396784738557239
3239:25:1.6057401908444169:0.7729036122188875
3375:49:5.1930718546095:0.6210496845686397
3450:72:6.400159461397456:0.4083531569308648
3516:36:3.095902490181952:0.7697749975800223
3698:36:8.736666708714022:0.9269722338361613
3725:4:0.1996745353487972:0.3912838723392581
3854:37:4.379634943637777:0.14566373998141358
3992:55:0.019798603565377437:0.7045448754207068
4036:91:1.6904254816989417:0.9488514792773272
4175:0:9.344337089059099:0.31555189896437286
4298:93:5.920573213081997:0.0028759470703639822
4373:27:6.323996215279141:0.9268743088920766
4410:26:0.3335853333487415:0.22327795239905257
4583:6:1.8792327407608012:0.5844054293798739
4680:39:8.666561745531057:0.6341570680368916
4785:64:8.279808342659074:0.10714932227380469
4851:80:2.597488396875214:0.0753952752053868
4936:39:5.6836065070360675:0.6191528017058452
5072:11:4.7881710302403455:0.7655770299526184
5146:90:1.0209935816785076:0.3288165509174008
5244:3:3.9645570905388516:0.9433763441413141
5320:19:4.608574167399386:0.879494666634502
545:30:3.2439699423921597:0.1099899352310858
5582:95:2.2446524075665786:0.3730883570466935
5636:47:7.523082303216631:0.46842401692247715
5767:80:0.46591410875939654:0.43019339282451874
5886:1:4.153321745378494:0.8744248883962594
5932:87:3.740524247725736:0.3904419258374895
604:88:7.107645004605604:0.971958195970546
6180:46:6.087211809269826:0.5332140334707597
6220:16:9.743912977300749:0.06325827742806112
6311:68:3.451500943176198:0.1235586691736077
647:86:1.3489846728692534:0.9380271839281606
6598:76:2.3319468321605408:0.23635317254322508
6659:48:0.5527503420919422:0.9217009076588242
6745:94:8.674582793785653:0.6210440386455588
6824:38:1.587140836439298:0.7617430249347842
6966:36:1.1370077466599082:0.7580769247367519
7092:66:5.149056575604316:0.20909269304442213
7196:32:7.470321654585279:0.14446721285379327
7257:32:5.236089542116535:0.012270130984272543

sunday_events.txt

 111
 2Location Index:Agents:Time Interval
 31:0,91,50,25,99,16,48,67,28,96,50,4,80:10
 40:74,4,62,93,73,44,56:60
 50:7,21,89,8,27,80,40,21,5,85,48,40,47,44,77,28,83:30
 60:45,2,58,75,53,99,82,23,42,63,9:45
 70:70,79,66,53,46,99,73,66,31,61,49,14,21,54,55,37,57,23,72:45
 80:17,13,47,80,92,35,39,66,86,75,83,14,25,97,65,21,33:30
 91:53,69,20,0,61,11,55,39,69,35,58:45
101:80,7,55:30
111:49,34,43,54,73,35,38,82,39,50,66,41,90,93,3,96,90,40,83:45
121:8,63,58,69,43,4,78,97,20,14,9,74,37,29,12,58,29,63:45
130:21,39,32,72,31,7,55,40,76,38,75,69:45

thursday_contacts.csv

  1Agent Index,Interacting Agent Index,Time Interval,Intensity
  29,72,2.914227778302505,0.6826991464281399
  34,23,1.7626573477813823,0.1867575121778262
  496,10,6.188166718934582,0.5343467721947005
  50,58,7.089036604140549,0.10775487424959562
  69,11,9.67302895627405,0.8980069940395575
  793,82,3.5711730462818903,0.8470185341812573
  844,20,7.492920372324567,0.8767819235925547
  981,59,8.877288545955315,0.5726311240333285
 1013,58,7.855807841441584,0.943416360883798
 1155,41,8.615477261049776,0.28432691622917616
 123,25,4.451749865199233,0.8913642362995232
 1311,22,2.9730546580604997,0.29981855155001325
 1476,71,3.8844120704576577,0.7286341972286404
 1548,36,1.5232199132644864,0.5145761295979717
 1698,22,2.718914273776586,0.7076840108883607
 1726,15,2.1845358786259785,0.7831605938784265
 1888,80,7.478995841823769,0.6409935415627314
 1941,71,4.602269400448483,0.9921185937661067
 209,72,3.4198736933186646,0.9166824813396153
 2157,54,5.300520828275738,0.6892351426205671
 2254,56,5.816201895124036,0.8659727417260997
 2384,47,4.094474084211179,0.3997958008433463
 2415,45,7.993018008393561,0.8704458892221738
 2517,51,6.13897007916667,0.9648374061250926
 2621,97,1.8012852087460351,0.36901019639081134
 2769,22,2.416538351050921,0.9864639695301223
 2874,60,4.362163305391271,0.3712260589076263
 2994,87,9.872530116893952,0.38401371533485174
 3072,19,6.7283068678525755,0.32881118325285585
 3122,29,6.68050847751975,0.9697631261691214
 3261,46,4.930428144808266,0.4172336148672652
 3356,7,8.72630136004489,0.21157918158984157
 348,23,2.9498170927352128,0.6137918778944923
 3516,3,6.210064056150158,0.5153153524864713
 3634,15,1.3792770232659568,0.9517064711431299
 3767,94,9.48326600196943,0.9458851803129598
 3839,8,4.438852003317232,0.5900555758968664
 3988,92,0.024873423364663028,0.024753883423453193
 4091,41,4.98413218316343,0.847102271146868
 4146,92,2.681589592840341,0.35983462243833575
 4233,27,5.404912374265333,0.6721719225515167
 4326,88,4.635528942368791,0.9482013513281706
 4483,78,6.094650214477303,0.7149120805237638
 458,38,3.792069398035318,0.057350140158731966
 4669,26,5.28691302773999,0.003072222774669897
 4770,4,2.9854952898326124,0.23203797932624926
 4867,69,0.6928829210410559,0.07763575576610571
 4940,84,2.5102336158353697,0.8960826689678371
 5033,31,3.977974273644035,0.5884174903951659
 5111,54,0.08465506592757133,0.6803844913904717
 5213,81,1.5661540838375687,0.34374535391176464
 5370,32,4.390982356838365,0.4622252382126143
 5480,11,6.4996703453849864,0.915809779678598
 5560,1,2.0111652888340013,0.9496414908132494
 5672,5,1.3238998665651902,0.49677849650953776
 5776,76,0.21973026748088764,0.9611826411513842
 5826,19,6.599848837190305,0.6225975506807934
 5997,84,7.907613923056919,0.1741259596155258
 6010,47,7.94232102985182,0.417089659665809
 6168,95,8.71933405152487,0.4730314036714953
 6287,7,2.273143230465149,0.941884830527986
 6378,95,0.7959663612567724,0.7807901682100586
 6443,64,8.268799497585611,0.9771738202667778
 6569,39,5.785017466876434,0.7661568652822905
 6683,23,2.157365752619306,0.6391250192403155
 671,39,7.83307894998671,0.7311494293277346
 6845,70,2.623901876474808,0.2777724331353346
 6916,60,4.989352872396161,0.10707498471394494
 7011,17,2.729649547935531,0.8204342446345623
 7180,77,6.588965105333038,0.2867543980568842
 7246,98,6.693191757579374,0.40880065076358685
 7391,65,2.903597713934033,0.3931442047883065
 7498,47,3.8489534597418995,0.41097128089722157
 7512,3,6.854179151003045,0.04163972350503187
 7686,28,2.9960330864729148,0.8641050432288885
 7772,76,2.990552826012225,0.22519385952105397
 7880,4,5.530859821727081,0.38228882244996387
 7995,84,0.7199327596161764,0.036165290628866864
 8042,47,3.9865585053480834,0.6858625250509734
 8198,3,2.5758390391803863,0.4244230074059112
 8217,63,4.812652214934011,0.3686661931997619
 8314,78,2.6316982476663964,0.05211874976005215
 8422,94,0.6972111448385587,0.48403632622951254
 8542,43,9.515787037107701,0.009831527561575903
 8662,88,0.007127490780595158,0.2768895268006344
 8767,71,0.6313198403195397,0.041723659955730574
 8866,25,2.2595588525399313,0.3722392929544631
 8958,46,0.41879041384945803,0.08989144881754885
 9058,95,7.9549707494999815,0.2616410486899894
 9126,90,8.137043823209007,0.5491274799034928
 9234,25,3.5311620347403028,0.22867874954885714
 9353,2,3.3618329417577018,0.6602261848682114
 9448,86,1.9010065638418583,0.5222332913436765
 9513,69,5.81815018391909,0.9740220343398174
 9628,24,7.023058277512709,0.7600614904391981
 9772,63,5.96743005840613,0.7802621400177376
 9819,14,4.847806924816364,0.0602715099349338
 994,90,5.268067740613599,0.10222213350582032
10036,27,1.8701202916050896,0.8153445538596785
10163,39,3.7330060909108207,0.49651367627585763
10298,22,3.562740173389175,0.584405499328503
10363,58,2.1213512446978147,0.36973486712719394
10444,99,9.011727052172976,0.10133689707492555
10517,96,6.0744716926653926,0.7885691635402455
10668,5,7.739478589670432,0.44061535046167766
10792,84,2.1120488722262367,0.74843764299737
10842,47,3.1066401119398446,0.11698435709564625
10924,22,2.9126818485457227,0.3062502402593752
11070,75,7.2640730025786295,0.629716149201804
11131,18,7.330169099939212,0.8053978568791952
11293,4,6.636463080011932,0.9417900029895555
11339,36,7.258963395972463,0.5027535711183595
11467,8,8.3118070759105,0.40722458815879303
11558,18,3.6859792198408057,0.02514212638286395
11619,67,6.436887485383876,0.5813921401237467
11755,20,6.006766646751819,0.766861522605022
11856,37,4.369580401099724,0.7545066063955993
11976,1,3.090850736286833,0.9860410422879425
12020,2,2.2122538751064735,0.3612336038689087
12134,12,6.975430024529682,0.624613234003694
12232,96,3.050587676311365,0.28375970412714413
12375,41,7.85166045809857,0.5441072252205454
12440,17,4.941838509462828,0.6923794762394322
12596,10,5.122349273134413,0.1602343210968591
12622,0,0.29742176804522846,0.07935201348428711
12738,75,8.115305318521397,0.1872478777553287
12855,58,9.866422364691775,0.799434072835278
1297,49,0.1231596065458973,0.006019103130803227
1307,66,0.32837469341490233,0.09775416603535003
13111,90,1.9215277216415894,0.3608638863999387
13295,58,1.6549052827063115,0.7388836894644241
13355,89,3.4918943509555342,0.501100680228859
13433,47,2.063003195825238,0.6254691951767559
13514,17,0.2866509121548366,0.5602100703307697
13673,44,8.314534585649568,0.6427245865074744
13764,8,6.914977634415856,0.5303422875831179
13892,29,4.618361545030978,0.4025247887701302
13978,52,8.394118930513107,0.8428192212566906
1408,9,7.154540591525763,0.7681419593535012
14116,78,5.870375376288676,0.2516987688916821
14245,15,7.22290052422495,0.5789335840015365
14330,70,0.9304791318675509,0.4358317276440241
14449,58,3.6431043294920187,0.04814527874300567
14558,7,9.247696072347372,0.6255585831106495
14657,37,1.2072493171597976,0.3312372284986912
14755,53,5.920168404176785,0.021570225426554734
14893,95,9.270889095454812,0.990510265653494
14981,21,0.0194679340984949,0.25879309573438447
15014,68,7.476177081485364,0.5803638849832051
15148,12,5.871094693209179,0.016679144323287654
15231,68,4.764475343220857,0.5689332577292193
15372,42,5.742546755802016,0.63520652056623
1542,77,4.337892096324857,0.6947518771064183
15549,70,2.689481916031582,0.2346540171653292
1564,73,7.586705427025796,0.9864978247869635
1570,55,7.520409724267434,0.5196642784240297
15855,29,6.569064747805761,0.8986552476757952
15996,39,0.4746965956888305,0.981056242780302
16083,27,4.201419237470898,0.11884356937492535
16149,43,2.002194361076721,0.21120283217260039
16211,18,7.816131132470934,0.8352094974903228
16375,78,1.7360727049404534,0.5661042498991689
16466,18,4.324707202155118,0.9011730389581124
16544,62,5.963336327035632,0.590330831248187
16686,5,5.694819517099006,0.9624636894458778
16786,32,8.635331937347214,0.42298712237986
16859,37,9.119485006460856,0.04608631468556046
16965,55,8.96179606900532,0.03603698154347401
17053,57,3.169648036370525,0.3497514597548387
17133,32,5.0467562135871615,0.6017709305141903
17231,84,2.7072533056392634,0.47866019548591976
17382,10,5.102039222186429,0.11077315602194338
17420,59,0.4262601008151967,0.8410589832717688
17577,61,6.402821803711511,0.3226962865941335
17672,79,5.309314703913507,0.047961724848451626
1770,47,8.776170972386415,0.032613562673203145
17873,53,0.4579456252085079,0.22056235957099768
17964,43,1.5696490819412223,0.0337971025431677
18068,96,5.0651056351305845,0.0023909162306597898
18148,77,6.4972649113014285,0.1609880879803035
18289,79,5.287643091155157,0.9218511948809394
18346,65,9.890000965899008,0.2799321359444805
18487,9,7.147425047713284,0.6823879887739884
18583,53,8.643393817035033,0.12893600630222457
18632,9,4.919093266911232,0.6053801243752489
18789,5,0.18834847867871263,0.08013066781696387
1883,97,2.8701443642449354,0.40692134454910356
18950,62,6.655688252252143,0.5996512305554584
19052,18,4.281205400374355,0.6759452861604844
19176,71,8.61244360242969,0.5435611879375963
1925,17,7.416150191560677,0.6566592232635489
19341,7,8.476104785876835,0.7795940299564589
19419,20,1.5760014696603353,0.4746578912950198
19580,32,4.164773840970143,0.6471675445446147
19676,23,1.057749908595711,0.17445219531009748
19712,24,6.31441926298651,0.029933610271667965
19871,48,0.1112348878803271,0.7676168247170366
1995,41,5.523272358997677,0.8850282091920424
20076,40,1.2565672000595307,0.5671999232754229

thursday_contacts.txt

  1200
  2Agent Index:Interacting Agent Index:Time Interval:Intensity
  39:80:7.0382921246333705:0.9556820598269046
  444:69:8.573011972540401:0.07924998376906311
  510:57:1.5325958641775272:0.3093902519850843
  642:10:8.701123888970558:0.962585163449696
  792:17:6.157994099854182:0.7080803028223787
  830:59:9.725783500251366:0.7314558080633391
  975:50:3.8058557518124214:0.3168807779694327
 1040:62:6.43557676676667:0.9763099081805485
 1192:27:0.04439101149650737:0.417023535886784
 129:96:4.064443587754805:0.3627068026184982
 1357:97:2.9937333519214326:0.04831281631023343
 1415:10:5.893399813507008:0.47319793911862373
 154:58:2.189181419606845:0.6803283844589387
 1671:62:1.7525285905496146:0.13896567010484562
 1779:36:8.506352552863355:0.8691976202423097
 1876:53:6.137904467285217:0.07106840002404269
 1984:36:2.560188707141876:0.7771950084819546
 2052:43:7.668274637265973:0.7312993690534784
 2154:93:7.939847618469336:0.7776433290453468
 2281:68:5.384535911579822:0.23525255976832482
 2393:16:9.920757993127333:0.8934543441881765
 241:72:7.758134739731689:0.24703891010135515
 2594:31:4.736159938253104:0.279716657877369
 2611:91:6.604975713945529:0.2980626079316899
 2722:89:7.307471438634465:0.8331314885020186
 2866:92:5.074020217973926:0.5867164552992925
 2946:20:7.872054213346798:0.07697026703119414
 3068:84:0.014172442899552662:0.3614765333867669
 3182:9:1.0094025461973999:0.7513051533741296
 3288:35:8.916625728448652:0.13212679832443874
 333:61:8.879634677276655:0.16048328962110692
 3430:63:0.889562352523886:0.14175368432296465
 3560:41:4.057982037703882:0.9460153048461237
 3627:8:3.4522820993929315:0.263099965041526
 3776:33:5.350168457592791:0.4817138552741015
 381:85:6.03291472992156:0.7362304926092693
 3947:46:5.151177915023272:0.524784652285693
 4043:80:6.3260521909884115:0.20238179959236602
 4146:6:1.4188793789888487:0.9554001282463949
 4268:2:8.760839211072776:0.5522656652793739
 4371:87:9.866051901497453:0.050298054713874385
 4490:11:5.444448491136552:0.9347109216145608
 4517:22:3.1981154659531565:0.21362937499069423
 4655:24:0.31133364718463397:0.9904127541387862
 4739:36:6.652772458814239:0.32511126196824647
 4851:17:0.1908445268782133:0.7776073952742899
 4938:27:4.9287219964583775:0.6766708526045345
 5043:68:2.345297470120279:0.4888662207402883
 5152:77:6.2704802068309515:0.9727888002522699
 5257:65:0.31410385209842073:0.5678620629870902
 5358:9:4.5043887132533875:0.9529991526026419
 5432:91:8.856779214806078:0.6205084549405729
 5536:9:2.99684211320568:0.20084350883099966
 5652:42:2.234391573182888:0.7936651279874264
 5766:97:5.497317602861229:0.8037936396717074
 5843:75:8.631273282189033:0.6467101601379966
 5991:93:5.899984231792686:0.5589976222351022
 6089:98:3.4357223028901385:0.28650955658054356
 6132:69:7.035480596894519:0.715682876100546
 6236:47:0.702440123848932:0.37014161233455
 6397:35:7.795073444954294:0.690234242431429
 6449:26:8.188641044378683:0.2854457891281498
 6523:48:5.8860192391972745:0.9858892118609247
 6694:66:4.8331558942120045:0.9392247213322765
 671:28:3.940617896767412:0.8119157936104054
 6894:9:9.511243180423108:0.4866582339311317
 6916:13:1.3706419546146398:0.4606816198641699
 704:94:6.079250764705122:0.664159392552753
 718:95:9.367600455819955:0.28978090388795374
 7287:94:0.009281959133973228:0.9533789826774827
 7358:89:1.9742256941383884:0.12038943184213302
 7484:58:8.2927498262796:0.6289705093238441
 7596:78:6.145813134167143:0.8797391678218863
 7615:29:7.304166478831061:0.37660257369721994
 7733:10:8.415998407750381:0.3884970977718254
 7844:83:1.5842806601754167:0.8979250123521796
 790:89:2.301629122139719:0.07010399854914007
 8056:69:2.2033530452009864:0.0386290184572774
 8139:21:8.365740266584353:0.8769992573517463
 8235:8:0.6039725358473025:0.7231100758772858
 8316:29:1.1869583871524414:0.7934164894804442
 8413:60:1.1083952560802401:0.8160926988887836
 850:76:7.296924179379242:0.04145973049986551
 8696:10:7.083416807339589:0.31052447378674664
 8767:95:7.3778033130326035:0.4699849766808416
 8814:60:6.545948462503307:0.28553558881248886
 8943:46:9.73653464036593:0.08518557315885533
 9039:55:8.001834086567442:0.1449534039528918
 9196:29:3.3347114644129827:0.4751405480035604
 921:3:3.9843061077162076:0.2904432377787004
 9322:86:0.7737914282516112:0.9949485827235354
 9439:54:9.44229177563296:0.7555177614543236
 9513:8:2.9093184369975322:0.4074161100925633
 9690:56:6.3954756331314115:0.3630477505326515
 9795:59:7.741332185095796:0.0686127194562044
 9863:6:7.329546037754219:0.047602827898245326
 9957:55:2.2058024651955788:0.5420130616536876
10045:64:7.972444005640122:0.9346612569555631
10117:96:0.5028192989338531:0.602861775981457
10219:47:1.1593911790613642:0.3294905796595542
1035:73:5.053371460984918:0.43453735386468306
10447:14:1.671267644260136:0.7617381750767552
1055:17:3.8521114646242918:0.9027839801336598
10630:95:8.155368057480747:0.3039655272261964
10742:0:5.301894475432239:0.12825534758882506
10859:93:0.867332721346481:0.8543727044000994
10961:24:4.545866060225478:0.29454914795747555
11085:51:7.265989073625477:0.9771268329383078
11119:63:4.114022700622767:0.40193113111336387
11245:47:1.0866634685103327:0.6439994336060687
11336:54:3.3080183883197356:0.05478430344551444
11427:43:4.491839482154164:0.34138799298187006
11596:83:3.2537132537203695:0.4690103280088781
1163:17:8.210480957200954:0.6785354918047558
11760:0:8.166288756067337:0.009825187110891531
11880:57:3.6405957600181194:0.9731578767400095
1194:12:5.167714502627886:0.08442010394327959
12036:60:1.5436074012458656:0.38231602955762645
12113:81:7.487919848355968:0.7720185857814735
12286:81:9.832572756034889:0.932466012208083
12385:43:2.3720109674290333:0.8201010230106307
12432:21:9.953311147163454:0.011674606541613675
12541:94:0.5708653782110851:0.8171371735366577
12680:62:7.826269089129624:0.8054818446439931
12759:42:3.4752456682963286:0.16962944629105137
12835:30:8.950010240117711:0.7321501698872532
12936:68:8.049175109984219:0.8751769192948862
13090:78:8.313662977740753:0.021380973721606078
1314:60:0.3863981340857503:0.64324289181507
13292:5:1.5821836994859562:0.6832838495910474
13392:35:5.759253574243678:0.6722529014859097
13463:52:0.3248004646469238:0.889428065406194
13576:58:4.657899334607473:0.1269797853566087
13620:23:2.030506718629682:0.623571833876037
13767:56:5.721392098935411:0.9740022252292175
13839:71:2.3800650310864215:0.39527668002658867
13957:68:8.743679973789662:0.11559725358582273
1409:57:4.426655660307315:0.3831574189336966
14190:35:4.500662171278994:0.6457649176495883
14211:15:3.610230581472095:0.7749786563954427
14378:30:3.537127278785983:0.672334116297062
14494:51:8.461216862609769:0.5454202707832448
14575:26:7.878760507607612:0.23953114774140905
14662:21:8.03728326258731:0.7317362756887453
14741:28:9.881900293689839:0.5158710625716576
14855:59:5.187576120008606:0.09037421440274218
14966:30:0.2822708894510517:0.8239935690953065
15014:86:2.4350591158958035:0.0451732234158444
15110:13:7.540167443077943:0.9128796041719606
15211:11:2.5872234084376977:0.2745810085653637
15363:18:5.8349459811306135:0.2628000302629594
1548:70:7.389502622983511:0.33781675668735134
15594:92:9.716335252977252:0.7560749193156806
15646:6:6.697843308826012:0.3071889852788805
15714:56:3.0115810056757883:0.019309987557965647
15843:59:7.70335287625792:0.07801146422444183
15913:19:7.1531177132632635:0.46172693965817924
16032:58:0.0947302768753655:0.4435550454724231
16165:41:7.846459075221219:0.20486103557339408
16279:30:4.855795600531242:0.6324741482930949
16394:72:9.192984245755726:0.47308851194268364
1641:19:2.5189273919855326:0.5697138720443463
16543:89:5.623253504764232:0.3205680634577276
16623:49:5.996101075819311:0.3092468469691083
16724:77:1.1575274845932815:0.29449933851511156
16897:14:1.542998906358647:0.5324160705560573
16924:34:2.8547843066335075:0.8823443962826881
17088:94:3.3126621067162567:0.36194029301617625
17159:89:8.775881914064165:0.8253261132282622
1726:80:3.9288893586194327:0.10275972449442927
17371:59:1.6479602486244127:0.04174936740649626
17455:54:1.5015663207731555:0.06830746730647275
17552:2:0.9008968763444658:0.4046997291491362
17653:73:1.8688136024961355:0.5830614775602793
17736:8:3.9728441806543637:0.135649600130743
17864:44:3.9868053958346583:0.12018302290146932
17920:81:2.3295936709442913:0.16782594204362378
18070:98:2.4625686349731533:0.7447068575679722
18183:68:3.0500910480749255:0.18871352909901662
18212:36:1.3232525955055607:0.6301253264588437
18324:4:8.511899833302598:0.03323414664925628
18450:77:7.491775365021729:0.2614312397444818
18577:8:8.606105243413465:0.6596871488477454
18641:11:3.3624084193448764:0.5842044609543943
18798:13:5.435720234282897:0.07937243127913918
18821:65:0.5322387729059574:0.38013044360335524
18911:81:1.473579773422019:0.4182034100396437
19071:6:4.054832359579801:0.994191633021709
19191:44:3.9765231844593063:0.6317211275561101
19293:14:5.805280716375303:0.662059365871648
19386:69:3.1533754603139252:0.6050328383845425
19436:22:4.280692953835742:0.7771808522245846
19576:78:7.500105794724697:0.5285135775933644
19678:73:9.218428037446689:0.6502891286543955
19777:24:9.141627497458963:0.6764185110368829
19899:20:2.9402718121860625:0.94933964891294
19951:60:5.440972736761095:0.08167094302929112
20053:46:1.4756695868875869:0.5147498179121255

thursday_events.txt

 112
 2Location Index:Agents:Time Interval
 34:77,31,38,72,99:10
 45:82,32,83,3,34,99,17,14,16,63,9,71,30,4,55,33,74:10
 59:69,63:60
 60:1,33:10
 72:56,84,16,7,32,61,16,91,4,82,78,62,61,56:30
 89:51,93,72,82,73,58,39,80,29,12,42,49,30,47,58,71,20:10
 98:44,68,84,13,76,11,20,3,0,46,15:10
102:64,53,99,84,91,79,25,20,4,11,60,53,56,28,77,81,9,8:30
113:13,99,8,72,12,60,21,51,23,21,40,7,60,15,54,93,62,25:60
129:57,86,23,14,99,44,86,56,38,57,6,1,71:30
136:56,53,13,83,76:30
144:48,44,36,38,69,60,52,96,56:60

tuesday_contacts.csv

  1Agent Index,Interacting Agent Index,Time Interval,Intensity
  266,0,1.8172369246500197,0.006012368176620986
  374,92,4.063473307316592,0.44764113765276414
  410,28,2.5078058170016004,0.9556666937503718
  528,6,5.0663925880424,0.030157397136076347
  614,34,0.9023473288248696,0.40762532229169424
  782,17,4.409706397800109,0.8581145623573369
  843,2,4.156581552776811,0.2765556802005179
  962,27,1.2914385251065508,0.009513514017428504
 1039,15,4.862643162759489,0.3406184083074584
 1137,61,6.003686928238557,0.7615036747316247
 1226,25,0.75888883318599,0.7458770745925443
 1331,38,6.903844182398593,0.9278421364738013
 1478,11,3.956008580201522,0.6503839273684523
 1590,48,6.769446426997564,0.10888629056775989
 1685,91,0.7232151612815041,0.5467854056064144
 1748,61,2.2328510614263974,0.44718384957966695
 1878,96,0.7063783545238811,0.8896588296914104
 196,48,9.293321418971457,0.8244605077577327
 2059,60,1.346910814314961,0.1075512883150157
 2191,18,4.159645334446736,0.9035452588829113
 2249,29,6.086884750360499,0.3383082213819574
 2349,65,6.530330988330888,0.6544708521532662
 2422,21,2.359281478670309,0.6932914366816318
 2536,11,0.6214541407681629,0.277228132146625
 2668,35,1.384050140411951,0.9858517993039427
 2727,3,8.941691191907072,0.8676675804245452
 2821,20,1.805147298856169,0.8465608015601254
 2984,86,2.4225104203737757,0.43038948235552
 3026,63,6.483320436344188,0.6967437250929029
 3129,96,0.8799624974435949,0.49727731725706925
 3214,27,9.114149895145916,0.3607316314698501
 3356,94,3.436609544657556,0.03583350304170885
 3492,83,7.224940852275099,0.796582912719368
 3536,14,1.9585817639216085,0.5523849902001531
 3631,13,4.484949871338362,0.26768807176332765
 3723,83,0.015340968768530194,0.10036970882600071
 3856,88,9.644090451403999,0.4768964287882195
 3949,31,7.09441961853263,0.06924208901127449
 4093,71,1.9071767620603308,0.1034237044014571
 4147,60,7.971199482192748,0.18391554416077116
 4226,87,4.1078464708973215,0.27716258035987584
 434,84,1.187407367890705,0.591748889516374
 4440,49,1.5983463783361906,0.7862069123228235
 4535,37,9.477098230814514,0.6785201377250942
 4655,46,4.4392432669147865,0.8755928204327293
 4778,45,3.267941991588039,0.8380363457231991
 4854,81,7.164718663466019,0.1620363873309948
 495,92,5.380116701363553,0.20282298378753127
 5052,93,8.344482466024907,0.8636854730280744
 5162,23,6.701569229007836,0.5040441233693438
 5273,98,8.118088212815017,0.28909432113979583
 5358,27,1.8661553338044412,0.950297468551335
 5466,1,6.492082007243933,0.46419110664867524
 5539,48,5.019406802332588,0.8247073034288753
 5614,50,1.4376340264666165,0.5119841394352085
 5799,26,1.8385790775577826,0.3252535154166645
 5856,24,3.81520574287756,0.9493833892557094
 5912,85,4.590511092408569,0.8830225997371698
 6086,49,2.256171992717796,0.23012674462476623
 6188,49,4.176669994920607,0.29142550506828013
 6278,12,7.834379855411703,0.7857791594264615
 6332,25,5.98743219341273,0.6017363643492531
 6422,64,6.920059245930357,0.40418357976938335
 6561,67,7.614317747527228,0.1194139638185292
 6649,48,5.287355461807298,0.6925352138956495
 6792,33,1.0903989744713527,0.7393398513964201
 6867,19,3.4874417270160754,0.7594694251871744
 6919,47,0.16504452846147655,0.6950781665506448
 7023,53,3.9361428532544496,0.2553940611426446
 7123,35,3.5450049204356415,0.24938808055450234
 7290,68,8.123188697688832,0.5077132957074547
 7345,38,8.489594860937716,0.8518278364060441
 7431,98,0.7355476804641636,0.4276085779375872
 7594,67,6.91245915282636,0.2578313271797378
 7669,66,1.4941880378682837,0.48289983567784056
 7730,14,8.822005482549379,0.6672125252010723
 7894,45,6.8878032268713305,0.4353270629542777
 7992,56,9.772394909616143,0.6595689986069757
 8098,37,7.6484985184170124,0.3917151822749264
 8170,59,3.702798635248433,0.061744383601446184
 8224,86,0.9885849505381816,0.46973558683739525
 8320,2,0.04912805020394151,0.6576301400716553
 8490,77,7.622215907800679,0.45040666331175994
 8563,97,2.5762955502800877,0.06689564467549869
 8640,22,3.184498179260392,0.4423936808955783
 8723,85,3.913729685022269,0.9982090099271226
 8819,45,2.038237218553247,0.8103181976684201
 8960,1,9.762520396551164,0.5486821038416273
 900,29,7.192738832418542,0.6131583807313137
 9184,17,8.749307528435297,0.5225577012900724
 9283,48,7.086116913452992,0.9900778680704334
 9374,40,2.2821555707866126,0.35018334993217504
 943,13,0.36995864315547355,0.11846637314579411
 9550,78,3.941694960962491,0.6034833071010233
 9637,56,1.2302019767572725,0.4601094370224549
 9725,82,8.558629082547203,0.18125777696742207
 9856,50,5.666529201636958,0.34450397914279596
 9946,23,6.008069289249349,0.8728988105709846
1002,52,1.7097510664836613,0.13851074831486443
1017,78,5.960466354795643,0.397621705031562

tuesday_contacts.txt

  1100
  2Agent Index:Interacting Agent Index:Time Interval:Intensity
  332:45:6.213436231456636:0.3731609728338897
  489:81:4.579771459232793:0.11434815810612176
  50:16:3.242934650368129:0.3141918044148243
  615:82:7.975466857130672:0.6128656081719708
  712:29:1.371000381482833:0.3302304647764601
  814:7:7.821227878776517:0.02845995074557328
  985:83:6.395632457075665:0.7751395265422735
 1076:14:3.5755744413957458:0.5574299399414683
 115:62:9.58634391552728:0.7052359820907551
 1233:45:0.7076539116973712:0.29372417115115146
 1346:38:6.129146387692819:0.2609382873034033
 1425:66:7.924473535575229:0.5101208649146122
 1525:30:2.2435787778590233:0.34060744129158593
 1634:60:4.927953728053525:0.6700587895933668
 1747:5:2.684771776287241:0.2574115092392507
 1889:58:9.625734441309854:0.5968114997896796
 193:61:5.220803442701763:0.8620230034643891
 2029:91:2.4686173240322318:0.6230867759670403
 212:95:1.5754431658870482:0.6105753814387738
 2299:4:7.691047725707579:0.3413757611023611
 2378:93:2.9318192055348415:0.4648065055530436
 2451:24:8.197221547880316:0.9718876331351113
 2592:27:9.198396797255626:0.16543165396821713
 2660:99:1.9852917319237706:0.6754749253049644
 2747:60:2.926189356051805:0.9833964216145247
 2862:53:8.777231457375235:0.7284431458587418
 297:93:9.19597804582149:0.36088453244829266
 3018:16:6.90568418912085:0.47964664098450793
 3139:75:8.829446299574954:0.8566338306237319
 3279:27:0.30209164979904113:0.9162862348077758
 3341:47:2.8150099179100363:0.2202297658034008
 3434:87:5.121262434689546:0.34522516985978635
 3552:69:8.376611116331295:0.9721430380048826
 3631:7:8.568390078953934:0.2609747271152305
 3790:39:3.3323074765201985:0.3738473348752833
 388:48:9.61161080916259:0.11255940822682353
 3929:42:1.046490193853703:0.9703762943992277
 408:52:1.3703006046548538:0.06626361915074641
 4175:91:1.4840408750275702:0.6152611616346282
 4237:26:7.825349435322081:0.8239794472248464
 4322:84:4.940400200673159:0.7619456896388551
 4459:90:5.784623371260322:0.10666187082198009
 4521:86:0.3471548050285156:0.6173979174975259
 4642:90:8.178704998755766:0.4609972690917916
 4729:95:4.8406036225093:0.09106867309864752
 4853:58:2.9237402820948066:0.8880798506295625
 4964:21:9.633445470500215:0.3795317805234453
 5062:36:1.3372576343073461:0.9333367878739499
 5140:29:6.759730185924982:0.40384662674309035
 5220:56:0.9484204437096111:0.2700243168712728
 5391:13:5.593847444401174:0.14251730023029452
 548:38:0.8118455773477451:0.15534571880671544
 559:58:1.9613155867738086:0.9964979966329512
 5628:44:8.039543224362301:0.92149645738936
 5788:93:6.612640065946129:0.7475311567942813
 5840:19:7.620144079622059:0.3182416084415045
 5957:79:4.092781780687574:0.7267655904498955
 6011:49:5.677218509537134:0.620710266950606
 6187:9:0.5998969632207896:0.9462038643902423
 6279:52:0.3517405280543384:0.4570039635821589
 6398:32:3.0513911846409467:0.11192808504123763
 6448:26:2.144916542978387:0.7649703267181862
 6519:60:2.5378878697564122:0.5125815380642406
 6682:21:6.355984386247059:0.7538837278153913
 6776:82:9.092557531602177:0.74210496101346
 6818:7:9.409297527034369:0.9147893913873082
 6919:22:1.2673823917478577:0.3677686846010142
 706:64:4.108843727499912:0.9996670729666973
 7159:39:3.968592643367236:0.6153826071593608
 7231:3:4.102429735302982:0.8091549649634372
 7375:67:6.408176908148027:0.4632439420199308
 7434:51:3.29285916399488:0.07362754325129339
 7596:44:0.8606828956909396:0.6380526760438952
 7632:55:7.632667913997516:0.8151815459035505
 7792:96:9.988069711163364:0.4201982040837776
 7876:55:2.7540455819170298:0.2728983302205812
 7971:69:0.2404635910591657:0.7019088464354047
 8083:7:3.7833428461767804:0.5059053649402946
 8154:81:3.347201881226524:0.6078784506485931
 8278:11:2.377145199017725:0.7250049576896354
 8328:25:0.6506573295260609:0.36397213695897845
 8471:55:5.388066989872032:0.7128044897824171
 8592:36:3.198366280780307:0.22223364625950692
 8687:38:1.1459230613858307:0.7737585259260796
 8730:20:4.088682224830098:0.9133713693060721
 8861:96:0.8000325343560455:0.9509401081347084
 8964:96:4.276249476121806:0.5545140479374902
 9030:46:5.864776032398824:0.9878159000860662
 9141:70:5.026586660801719:0.2196825484242737
 925:2:9.153538434547116:0.6408688000252408
 9394:57:1.5258929617167616:0.3422495707436871
 943:89:7.383070659810189:0.502938336341504
 9597:34:9.399292391381532:0.24970335740592198
 9616:30:3.8929316804406353:0.22739535842351322
 9769:8:2.1316090927287434:0.49286696627785687
 9874:15:8.485630359109985:0.11702412916620186
 9927:7:2.1637920715821535:0.18835559198252183
10069:82:7.987112691829116:0.8388020770869082
10166:3:4.0359322253773:0.8073362451987808
10264:21:0.4793067219400504:0.8144255386406495

tuesday_events.txt

 114
 2Location Index:Agents:Time Interval
 31:73,50,39,25,14,89,73,35,67,97,80,81,13,65,3,41,71,33,10,93,72:10
 42:44,5,88:45
 56:46,48,82,17,74,98,75,50,71,66,80,62,54,30,16,4,88,9:10
 61:36,65:30
 74:94,43,78,9,76:10
 83:84,73,44,97,4,70,95,77,74,99,18,6:30
 95:16,28,88,88,12,5,62,65,83,26,8,40,11,10,6,21,59,21,5,80:10
107:69,18,55,49,68,69,16:45
110:97,73:10
123:39,36,99,78,15,63,48,86,67,48,73,31,41:45
133:86,56:45
149:79,20,8,63,28:10
151:49,81,39,95,54,48,86,62,97,20:60
163:5,68,87,94,53,83,0,53,65,99:45

wednesday_contacts.csv

  1Agent Index,Interacting Agent Index,Time Interval,Intensity
  261,65,4.328046668612032,0.985927575919051
  384,10,7.620089774123224,0.6894406168171453
  485,1,0.49660140501557426,0.17113663902996323
  566,61,5.911171322512088,0.8477257541038907
  635,91,8.445849141778336,0.18743157653601095
  725,36,3.6993149390935107,0.19610294657542104
  820,52,7.652041015033962,0.593720732276105
  938,37,8.776325054105284,0.44489657060726107
 1039,14,7.182823185974644,0.5994661734860806
 1156,84,6.1841616156809724,0.5447149497146385
 1241,12,3.2364163292005967,0.053084247009199115
 1370,51,1.0121018670684523,0.9439448340792216
 1496,31,2.3861925565270967,0.2077179825704527
 1530,15,2.7503704544016703,0.6584814644942648
 1691,57,7.701924871045484,0.5625320422657776
 1772,88,7.966795926989233,0.765764986379312
 1849,98,9.395141283755242,0.4936464057057941
 1945,21,2.554777957118036,0.19138996793090324
 2013,75,2.0523722473181785,0.1172558789366045
 2149,11,4.510140468018347,0.6685610259751634
 2267,76,0.0892268472350799,0.7595045810121461
 2379,81,6.905425986319638,0.28652218091888504
 2492,41,8.965797259331046,0.1111830483334203
 2557,88,1.6077903602598542,0.23666508265851227
 2694,18,2.9623650828995207,0.8286818654503474
 277,43,3.5320340020252647,0.4900135259408406
 2870,23,6.9623452942853215,0.5989422292851269
 2946,90,1.2278281431609717,0.9809655525147104
 3088,82,3.6256539203044325,0.652968150803639
 3158,98,5.840166797355345,0.08341004682389153
 3246,92,1.9089385990892749,0.7922878921350877
 3348,4,6.5047384781314985,0.8623586866547435
 3497,17,4.859962975118499,0.26880367017223195
 3552,54,4.117961501993132,0.5779175887357123
 3644,44,6.3947200819473515,0.5191303061352239
 3717,20,8.77562936067531,0.5443645239302862
 3883,2,9.291858605237366,0.0553401914041618
 3996,38,4.392063292685494,0.7924637198155704
 4091,89,0.8634506601414438,0.8852301102932261
 4165,12,1.506487876908037,0.7230459861844032
 4273,9,6.040549612355375,0.48445441990887483
 4366,80,7.6930935709725325,0.35808034570668446
 4421,23,0.6893080651209738,0.6919562246517463
 4526,73,9.453648282840796,0.6472476848303975
 4680,15,0.9429433783029362,0.7874479617653929
 4767,30,9.713077959999799,0.10013524617085334
 4873,93,4.430791012289528,0.642167550276483
 4993,69,3.5884355542121726,0.30318563816332755
 5089,37,4.286112169752502,0.5006202264717081
 5191,69,0.7687621918845333,0.07230042085270683
 5262,81,6.654205605701176,0.045457620301632806
 539,55,5.672536509959393,0.8385270018459005
 5468,51,0.24483441268529527,0.25713405068918527
 5514,99,7.621207045483196,0.8167099553391018
 5676,4,7.024219118326971,0.9943720801149437
 5749,69,1.3221231617256168,0.5328342003072312
 5866,43,4.887747382953863,0.20394253573112664
 5994,98,7.4126996949549815,0.29367037924723427
 6037,99,6.286106627722551,0.2619126643141313
 6163,6,0.832812218767901,0.9470207041963251
 6276,70,1.342204503326736,0.2937613524203415
 6398,37,6.626794154267101,0.9018444572054648
 6461,39,8.09451181666891,0.1964693047685787
 6542,99,3.3919911278057735,0.29072383449269557
 6644,45,1.2717686725097233,0.20486822969594776
 6750,69,7.69505963695207,0.6525106814545318
 683,59,7.885329446684147,0.06484688289840057
 6967,70,3.253587218808436,0.11322294635609997
 7027,59,1.3979048716689257,0.888610582901755
 7116,15,9.725008138989033,0.6695882206932914
 7214,97,7.050542723813264,0.2280615100325062
 7371,3,3.099115781837357,0.4945560296945123
 7479,10,0.873045716297951,0.062218995783478004
 7572,32,3.837300145160926,0.34717495460382664
 7681,40,1.2811957884594871,0.20557462707871643
 7764,5,7.560186810066449,0.038954161433137124
 7844,51,7.547289644141214,0.6010275473664155
 7923,21,4.476984832575663,0.5376453780892193
 8034,32,9.401593609226843,0.02609028242161371
 8188,73,5.109582358750917,0.2502588811398663
 8250,20,0.2841553213291781,0.7347148282160669
 8353,49,0.7949851053601231,0.6723526724414021
 8411,59,3.1526743438539437,0.038438264425936564
 8517,92,4.954915369342104,0.5765202209730164
 8697,11,0.7430553059434564,0.07048154609904489
 8797,74,2.2559935402409836,0.19891247729586103
 8872,34,7.1045669560761215,0.7861633793033821
 8926,12,7.775725464106991,0.731181169906113
 9033,97,1.8568769510888994,0.5079134227431802
 9168,75,3.630914775760127,0.20061235101170882
 9216,94,1.2526813019006278,0.14847667968699463
 9357,67,8.877938195945346,0.9337752911284403
 9465,73,2.7637284496203307,0.841993871379342
 9543,6,6.325645938549286,0.7258209512232121
 9622,17,7.307170412248213,0.5234005003613431
 9773,51,3.13037572001468,0.6477820575490124
 9893,32,5.505042987502752,0.35835921674752025
 9999,78,2.6454288356693367,0.3164982894755156
10057,92,9.812289350517588,0.5623329686119016
1011,37,2.0648879347633176,0.24980254796571322
10235,16,1.891855439278518,0.3822843921947797
10322,8,7.762475116667491,0.17771103329866533
10438,11,0.5324183508455382,0.034949273885693244
10576,77,4.261420288493316,0.37360747330332966
10681,41,7.164236487952083,0.7101325593900163
10766,43,0.8935357969412583,0.8657665711676644
10876,50,3.428200761017467,0.25890478593172395
10999,46,0.8468548979927304,0.3191644147119663
1109,22,5.089410865355925,0.1669946263236376
11186,65,6.166238548237065,0.6861667846158687
1125,40,9.952574759084564,0.5740822008793284
11331,61,6.196867190769683,0.5013408241986123
1141,31,9.786293451410323,0.7493047221140382
11532,57,5.955203040682413,0.5154476797308712
11653,16,7.899925691111145,0.6717976199569338
11744,89,2.2887770907730607,0.5437877431298486
11874,3,6.927331092250767,0.7711408817356543
11943,85,0.3502160717277869,0.25177275481441486
12050,68,3.191663096305529,0.7859630170530432
12131,90,2.466720863401598,0.4172613934183278
12270,65,5.890885485744323,0.7187113099960679
12399,17,4.516599984695651,0.1336996859828995
12413,53,8.345028778119513,0.42274493851882244
12570,81,4.843046108814995,0.29882949899115174
12633,96,5.086940545320671,0.5693637966446243
12771,54,8.642047367290424,0.8744982799729936
12817,61,2.340219219631605,0.31956414897879293
12926,57,6.074845384645643,0.5409699197771384
13069,21,2.1294574890971907,0.2709643921783146
13149,55,2.800586970486286,0.9267876256478454
13226,42,2.044916946626083,0.16778512659495093
13314,32,4.404038389281584,0.45118631201309967
13423,73,4.896898976924822,0.6552105197229967
13514,40,7.208749458944464,0.4052460999354285
13674,34,5.2590702640617675,0.3484693657371496
13757,4,2.284649090331927,0.9101126726234063
13897,45,5.31945308320389,0.9879016506375161
13999,6,1.7667532909232442,0.981717913265498
14014,21,6.949122932005802,0.3766728232278491
14115,83,7.233802451412097,0.33188304141952363
14227,53,9.16598064470289,0.5799604444665396
14395,61,7.772594985484835,0.23932845465875385
14450,1,9.12755457213107,0.7933504476682264
14549,71,3.751756909835703,0.7044445200349657
14699,0,0.9529698943986609,0.1734518386196756
14717,9,8.368977669400305,0.6747855066510295
14838,8,7.922329631466242,0.17003065570665266
14963,66,0.08248394411642601,0.025204125415014267
15018,14,0.35037893477147697,0.2570432890998742
15120,12,1.1093342026532693,0.8637866257748087
15248,9,1.4385408523522425,0.6011023785605366
15327,82,0.8959795585527275,0.8263894883421955
15449,29,9.912928347878655,0.1687802962067968
15570,31,4.826779819867998,0.7976424167280071
15611,94,5.4073162992369515,0.9911025818470419
15712,15,0.18557679011843575,0.34219655525217973
15835,91,8.388443772655819,0.6190861620759786
15937,41,7.3793540838599405,0.27457526357482476
16081,21,9.990002615945281,0.15798023159047025
1612,68,4.7421748908980526,0.7041157877982428
16246,9,3.4582306462648438,0.0982649453911274
16312,35,5.7297343030678425,0.8156908469788527
16421,80,3.1452009426140846,0.36813466433394093
16584,77,0.8745670685564488,0.462304690992159
16673,79,5.466148061501178,0.03678380515291757
16782,11,4.212045965447891,0.5243474989886192
16821,28,8.780982456238265,0.9291271311944286
16912,39,7.352457920431851,0.31530648470158695
17042,22,6.701632453253513,0.4388446954693722
17147,66,7.604844544393275,0.8250566829750561
17215,70,7.194567032478998,0.8641595346076059
17324,97,2.7169131094048824,0.4711799178846521
17421,18,5.221192538365581,0.8151971747381243
17584,4,6.8823319278684565,0.550435690861847
17675,75,0.8186212924814562,0.23191936021034265
17771,19,1.6874259567261274,0.6506780037830153
17873,47,3.334031924182553,0.39297451944792383
17929,79,9.355379226552895,0.9853684666915478
1804,11,1.570152606523092,0.3513192118111663
18163,37,0.041291099445380786,0.4773016708317034
18221,20,6.483665285102375,0.10154344154574824
18319,84,9.518422615895078,0.4711081541121517
18483,74,6.048261008286692,0.4656840049930332
1857,56,9.5918004379995,0.7993214229516233
18622,97,2.6271345433182547,0.735793220201614
18775,9,9.04822832573235,0.24573275248001913
18893,26,9.969699154601656,0.30249560798448794
18991,19,1.105952908729575,0.7445486552483508
19047,38,4.32787900607325,0.6363361898649607
19131,21,2.801506738243793,0.47238990052666696
19234,34,6.227871652666583,0.7127394795977807
19315,36,3.9270782124055383,0.20733096743112944
19429,23,6.319658248786027,0.45740263269721837
19558,26,4.676403660977934,0.7337944076762869
19683,27,2.901365627284349,0.7166612123493752
19728,73,6.9471069326973245,0.22598254492640868
19857,62,3.6176705454479565,0.25728408216306686
19969,25,1.594419559468615,0.39618628353300334
2003,56,6.452354020091264,0.5262731669374942

wednesday_contacts.txt

  1500
  2Agent Index:Interacting Agent Index:Time Interval:Intensity
  335:35:7.326649613582364:0.01880486356965283
  435:53:7.365575713168727:0.07226775243298234
  555:76:1.7425302606537474:0.4079740971798641
  630:95:4.307720149563242:0.5889349769548973
  798:69:6.544728451402593:0.48025388395194957
  86:88:5.072512252507798:0.8389958044296311
  945:47:3.8194943780736357:0.06756325928583062
 1060:36:3.4337954746207435:0.780608576755907
 1128:58:3.9573951790562067:0.8814937045907152
 1246:4:3.762262794683556:0.16848724165974238
 1397:11:8.693414441617387:0.7460650092914961
 1492:75:0.660206718405888:0.07335924898540769
 1546:82:3.8637328951746017:0.5951215759777483
 1628:22:9.800867101130882:0.20271952020628436
 1737:49:7.060494204085794:0.5366861962135869
 1830:86:0.33597015028233757:0.10758491189019004
 1946:77:1.2885169728264612:0.10729300794480534
 2010:50:5.187607731001368:0.6703832544752654
 2174:34:8.93544026576964:0.04549012455350221
 2273:68:9.591015242175292:0.6962332597341828
 2310:44:0.5823210493669018:0.9689789406714906
 2433:32:8.436879771291043:0.021557896227508477
 2522:11:3.438680750408264:0.5398584734054681
 2691:60:7.210324988424461:0.8787960159091067
 2736:78:6.454046898476056:0.18222360148833006
 2844:28:0.883667185292053:0.922569686376188
 2964:47:8.689647085944292:0.1418009831093382
 3062:89:2.7679253812446216:0.6435851301783628
 3178:1:3.352951970635684:0.4754766055188496
 3269:62:8.345007894678666:0.23798159130601404
 3350:92:4.481913480277774:0.006233696946746248
 3498:26:1.1338952630227828:0.673962261965644
 3537:99:1.0643710496145387:0.5908347291714198
 3628:4:9.920590767349442:0.6963377903623542
 3718:50:1.3809350166002898:0.9872588601452001
 3824:49:2.094116142874566:0.5748045544228527
 3925:42:5.693608169443762:0.2879191230183471
 4054:42:2.4086948504552073:0.02547746034366105
 4151:2:4.451408189223509:0.6032579558452265
 4260:20:9.005811670608857:0.9856136917050264
 4365:67:3.19976980590579:0.9186950562480023
 443:47:7.181260983583534:0.3040250437725214
 4568:57:0.7383565151524951:0.723133921333527
 4655:66:8.367449475616333:0.07980719114975277
 479:11:9.97517977101612:0.6127447997868063
 4831:33:9.975729093568951:0.1045218021830403
 4983:27:6.640381396448985:0.15661340183018102
 5095:37:0.726266659582897:0.8758271106350278
 5117:27:3.731549646431953:0.3229035252474013
 5286:73:9.8942767252751:0.3990519563823193
 533:78:8.720720998194327:0.264559175826406
 5474:46:5.4153651996120225:0.4173530824931695
 5595:95:9.484928224637814:0.022785741619000488
 5682:9:9.340319131198878:0.7952612413547455
 578:42:2.475879993476423:0.3886327787838908
 5882:97:9.866336760171512:0.7188202155620746
 5956:34:4.302447425405743:0.28633873882974836
 6081:45:3.724740927783703:0.9167028205119899
 6125:29:9.199922961967527:0.835041826144438
 6294:68:3.8825993503747194:0.1168420663032067
 6394:13:0.42404086307323285:0.7521313232183118
 6449:11:8.607236167340723:0.6186404850761289
 6520:25:2.005728328797962:0.05980946246418717
 6659:91:2.961636869772523:0.1292205857836043
 6752:74:5.743776860036771:0.9984405022263465
 6875:72:8.15665662213246:0.8856720647622587
 6952:74:7.689955305723457:0.24021318982090323
 7059:44:1.6743181640329041:0.1378869655341155
 7172:12:7.638936582230792:0.8289049815374233
 7216:20:5.910006486116654:0.8403350173657851
 7380:0:9.524612020268266:0.9890454406593926
 7446:85:0.1978619520777969:0.7542955579200908
 7594:45:8.182315486473957:0.5539970521800692
 7626:68:2.410142904138397:0.831822112439275
 7712:59:4.111959521312285:0.2511690380469713
 7816:41:8.11653477037407:0.4864135139348226
 797:6:8.41408841840117:0.5166597024174876
 8082:88:7.539262351768925:0.4934590077378854
 8123:87:2.0191699791040407:0.4650993959348293
 8214:42:7.959803809049787:0.3859274394432979
 8372:39:4.988558132860267:0.9719137961462334
 8436:87:7.904796353087814:0.9033328489705758
 8549:41:6.441286834271189:0.8596066636809503
 8626:45:1.5494084880416248:0.21286592285078343
 8769:84:2.68713252804031:0.6352927537106948
 8892:50:8.125056564396175:0.964640333194231
 8925:50:5.745327231004454:0.4996238922147982
 9048:58:9.430548312366577:0.9662240771532448
 9151:7:1.5407008662168198:0.43018447051424324
 9294:85:0.33708865480739925:0.3999028227241679
 938:42:0.4676328396476981:0.24681536908527746
 943:54:2.082373656993525:0.8211009673756547
 9547:5:4.176150167437918:0.0068115940272549524
 9613:18:1.9920879889202947:0.4530248033751796
 9775:58:4.656733076780746:0.11008410284813352
 9887:66:5.736523536915983:0.714940200457393
 990:99:5.146933211148694:0.14934608064069932
10014:37:8.826800764399827:0.36862157844671417
10144:89:8.617130159606878:0.629612083711045
10276:62:3.808269227488712:0.720616750357066
10385:88:6.012459883150846:0.16207079061869079
10470:45:8.460933196001442:0.03484670155649383
10591:61:9.052509705425388:0.8533345550696678
10672:53:7.626567323195205:0.6547255311759907
10714:87:6.123814961834867:0.10799512631697394
10847:38:9.703366381545296:0.7861481672561152
10950:2:6.921877657912186:0.0901922793109946
11055:69:8.194239438728719:0.25190470736562665
11198:56:2.4951109730602985:0.313928578913919
1124:36:2.5502983171221585:0.13611513898232153
11379:69:3.7285925099089035:0.17979490568657208
11452:95:8.298231631001554:0.2418250870038332
11554:74:0.683477780477264:0.12947423620560494
11688:35:1.449078957263129:0.9971706032369194
11742:6:0.35682089991305177:0.8220981329520314
1186:81:5.059336042688641:0.06759370944002929
11941:79:9.740240133624962:0.3483763795581215
12019:82:6.050535299281256:0.2265648321824162
12146:47:1.6596588569359982:0.1808366243887748
12218:26:1.7194269810771157:0.469856221060189
12340:25:4.586799772966139:0.011566746615992107
12444:85:7.874474589247804:0.21940431108028746
12521:86:2.022571555919419:0.0267482489112576
12655:1:2.4888121465990034:0.6949916683725545
1276:65:2.0048251474987087:0.6007769598222094
12846:99:5.203358357806579:0.49351952534458354
12916:89:7.784970962656438:0.3795554828381028
13083:56:4.564802235334828:0.30456464371028225
13119:79:1.6659490128697307:0.09406007012891293
13277:23:8.95317196939301:0.861612362884061
13394:93:5.5446862725779695:0.6345596358727227
13417:81:0.8694353708834501:0.8610458639123718
13542:77:1.0046753749712778:0.8361913703426427
13680:82:7.898528087560851:0.7837288261770342
13799:67:5.6795968227766185:0.37214616970155145
13857:36:2.7938124820144363:0.10872997346449254
13945:73:5.180491151160156:0.183795261793106
14010:7:7.565100574481845:0.033325877812489635
14179:38:3.158002500478579:0.8762332523999679
14246:13:0.8163960575888862:0.11687793448566342
14321:98:6.981821368222011:0.6207591025489955
14473:8:2.3297846497396932:0.38686431622259887
14578:63:0.4436434330479888:0.3894958140703567
14634:59:7.191388054443503:0.20095769579977418
14773:30:6.053525772644528:0.5967585140005333
14841:40:1.3838754859326574:0.502405241786681
14949:60:8.295110054329713:0.4305993322400177
15083:63:0.48547541285623885:0.32805016959748434
15193:31:3.6848854616150293:0.35643612817628656
15212:78:0.2273456842385202:0.953077640082888
15330:89:7.153927919430508:0.43586809846112506
15456:81:0.09816756643055147:0.6295484364565437
15583:7:7.4085537764271745:0.033305634133947604
15692:42:9.988928688371795:0.2761232871677961
15770:88:6.140537017964541:0.9795273172673395
1582:90:6.461894038111831:0.1185444682840926
15972:46:9.953506502098817:0.15329163492922593
16023:90:1.9471840933452211:0.7386518914419935
16110:35:6.373387939809772:0.7171440826931259
16262:22:0.5596942604876298:0.1432896719544473
16338:92:0.9481383578775293:0.7677431462939046
16474:22:0.24856782036149716:0.42812724703916316
16514:83:8.576386817177024:0.9396215064528413
16699:2:9.30095330632649:0.5066561439508125
16763:22:6.403955394913:0.1571691479302042
16878:87:8.344142685105586:0.2861576111801998
16971:55:1.4476785659120595:0.33708688327676783
17036:87:0.21348728262420402:0.28711138205567277
1714:65:5.67218610317065:0.36711320844191897
1722:81:9.67653850599029:0.03156219872649857
17361:88:5.724543360415383:0.7932661225893052
17453:59:9.185083874031697:0.026215655980081132
1757:40:2.8312580779681875:0.49196082108715233
17676:96:2.7315283363582776:0.6519656627078148
17786:93:8.443020347066351:0.1248034896150344
17820:95:3.9697649231974808:0.04606324434996534
17973:11:2.5528837643963884:0.6948268362453378
18050:68:5.756463265683402:0.995685718348466
18141:92:6.3336884749824645:0.1621356000106734
18243:18:9.664694397742583:0.8045465791810523
1832:39:3.9394795994181777:0.5867371111778215
1841:82:4.841485437297484:0.49371708023469907
18565:53:2.7498717037820644:0.20583454120465094
18673:90:1.121137779062057:0.7937686270961586
18753:87:6.2353544374513845:0.015946094567476976
18844:63:7.393381816549878:0.3472456996800237
18915:90:6.9611182251442685:0.8039647151078758
19088:27:8.01133506522802:0.4130507216742557
19154:87:0.23852744551902894:0.6264091805644847
19221:16:1.081879835206111:0.7790590360105223
19322:69:4.123929864290275:0.9702498443951281
1949:97:3.0488474948409316:0.677209238072471
19567:83:4.86032668987452:0.27054126955750546
19662:20:7.499374514038265:0.003010254325323869
19724:69:0.3027367484925514:0.42734474246664456
19890:30:8.329167767245044:0.13749033066927274
19984:33:5.994927378398588:0.3756720097493309
2009:76:7.402293740792216:0.05790492058061891

wednesday_events.txt

 120
 2Location Index:Agents:Time Interval
 31:24,85,69,73,76,29:10
 44:92,10,68,85,96,4,99,56,54,56,52,41,36:45
 58:2,72,22:10
 61:63,20,94,35,35,18,15,1,36,26,38,35,12:10
 74:97,40,12,26,17,84,60,87,99,44,79,15,53:60
 80:39,60,6,4:45
 95:35,14,24,51,29,41,21,65:30
109:78,8,6,51,18,2,4,53,31,50:30
116:67,97,1,68,59,78,59:60
126:49,61,22,82:30
130:0,79,83,18,77,31,7:60
143:83,15,51,85,22,78,61,33,22,26,17,28,38,58,69,5,36,5,58:60
152:49,60,2:10
169:16,37,29,82,95,68,71,14,12,92,2,11,62,12,9,4,77:60
170:28,88:30
183:72,38,92,9,71,10,41,15,58,85,76,13,48,87,71,18,73,86:45
195:4,56,3:45
205:6,12,70,86,41,36,70,49,14,78,38,15,67,75,32,24,5,60:30
211:23,55:10
226:21,25,65,44,7,57,44,89,54,37,46,93,50,24:45

Example_2

This example is a remodelling of Example_1. It however uses a Scheduled model comprising of the states- Susceptible, Exposed, Asymptomatic, Symptomatic and Recovered (Scheduled SEYAR).

Only interactions between the agents have been defined for the weekdays and weekends from Monday through Sunday.

Time of contact may be a criterion for probabilistically determining the infection transmission between the students, visitors, teacher, etc.


Generate_policy.py

 1from episimmer.policy import lockdown_policy
 2
 3
 4def generate_policy():
 5	policy_list=[]
 6
 7	def lockdown_fn(time_step):
 8		return False
 9
10	policy_list.append(lockdown_policy.FullLockdown(lockdown_fn))
11
12	return policy_list

UserModel.py

 1import math
 2
 3import episimmer.model as model
 4
 5
 6#User defined functions
 7#This function is user defined, based on the parameters the user has inputed in agents file and interaction/contact file
 8#This function represents the probability of getting infected during a single interaction/contact
 9def probability_of_infection_fn(p_infected_states_list,contact_agent,c_dict,current_time_step):
10
11	p_inf_symp,p_inf_asymp=p_infected_states_list[0],p_infected_states_list[1]
12	#EXAMPLE 1
13	if contact_agent.state=='Symptomatic':
14		return math.tanh(float(c_dict['Time Interval']))*p_inf_symp
15	elif contact_agent.state=='Asymptomatic':
16		return math.tanh(float(c_dict['Time Interval']))*p_inf_asymp
17	else:
18		return 0
19
20
21
22class UserModel(model.ScheduledModel):
23	def __init__(self):
24		model.ScheduledModel.__init__(self)
25		self.insert_state('Susceptible',None, None,self.p_infection({'Exposed':1},probability_of_infection_fn,[0.3,0.1]),False,0.99)
26		self.insert_state('Exposed',5,2,self.scheduled({'Symptomatic':0.3,'Asymptomatic':0.7}),False,0.01)
27		self.insert_state('Symptomatic',11,5,self.scheduled({'Recovered':1}),True,0)
28		self.insert_state('Asymptomatic',6,3,self.scheduled({'Recovered':1}),True,0)
29		self.insert_state('Recovered',100, 0,self.scheduled({'Recovered':1}),False,0)

agents.txt

  1100
  2Agent Index:Type:Residence:HLA Type
  30:Visitor:Outside:B
  41:Visitor:Teacher Dorm:C
  52:Visitor:Outside:C
  63:Staff:Teacher Dorm:A
  74:Student:Dorm A:A
  85:Visitor:Dorm A:B
  96:Administration:Teacher Dorm:C
 107:Staff:Teacher Dorm:C
 118:Staff:Outside:A
 129:Teacher:Dorm B:B
 1310:Visitor:Teacher Dorm:C
 1411:Administration:Outside:B
 1512:Visitor:Outside:C
 1613:Staff:Outside:B
 1714:Staff:Dorm A:B
 1815:Visitor:Teacher Dorm:B
 1916:Staff:Outside:A
 2017:Staff:Dorm A:B
 2118:Teacher:Dorm B:C
 2219:Staff:Dorm A:A
 2320:Visitor:Outside:B
 2421:Student:Teacher Dorm:B
 2522:Teacher:Teacher Dorm:C
 2623:Staff:Dorm A:C
 2724:Visitor:Dorm B:B
 2825:Visitor:Outside:C
 2926:Visitor:Outside:B
 3027:Staff:Outside:C
 3128:Teacher:Dorm A:C
 3229:Student:Dorm A:B
 3330:Staff:Dorm A:A
 3431:Student:Teacher Dorm:C
 3532:Administration:Teacher Dorm:A
 3633:Teacher:Dorm A:A
 3734:Administration:Dorm A:C
 3835:Teacher:Dorm B:B
 3936:Student:Dorm A:A
 4037:Administration:Dorm A:A
 4138:Teacher:Outside:B
 4239:Teacher:Dorm B:B
 4340:Administration:Teacher Dorm:A
 4441:Staff:Teacher Dorm:A
 4542:Teacher:Outside:B
 4643:Administration:Teacher Dorm:B
 4744:Teacher:Outside:C
 4845:Visitor:Outside:A
 4946:Visitor:Teacher Dorm:A
 5047:Administration:Teacher Dorm:A
 5148:Staff:Dorm A:A
 5249:Student:Outside:B
 5350:Staff:Teacher Dorm:B
 5451:Administration:Outside:C
 5552:Student:Dorm B:C
 5653:Administration:Dorm A:C
 5754:Administration:Outside:A
 5855:Administration:Outside:C
 5956:Administration:Dorm A:C
 6057:Visitor:Outside:B
 6158:Teacher:Outside:A
 6259:Staff:Outside:A
 6360:Administration:Teacher Dorm:A
 6461:Student:Teacher Dorm:A
 6562:Student:Dorm B:A
 6663:Teacher:Dorm A:C
 6764:Staff:Dorm A:A
 6865:Student:Teacher Dorm:C
 6966:Teacher:Outside:C
 7067:Staff:Dorm B:B
 7168:Administration:Teacher Dorm:B
 7269:Teacher:Teacher Dorm:C
 7370:Administration:Teacher Dorm:C
 7471:Visitor:Outside:B
 7572:Visitor:Teacher Dorm:C
 7673:Visitor:Teacher Dorm:C
 7774:Administration:Dorm A:C
 7875:Student:Outside:C
 7976:Visitor:Outside:C
 8077:Student:Teacher Dorm:A
 8178:Teacher:Dorm A:B
 8279:Visitor:Dorm B:C
 8380:Administration:Outside:C
 8481:Student:Dorm B:A
 8582:Visitor:Dorm B:B
 8683:Administration:Outside:A
 8784:Student:Teacher Dorm:A
 8885:Student:Dorm A:C
 8986:Staff:Dorm B:A
 9087:Administration:Teacher Dorm:B
 9188:Administration:Dorm A:A
 9289:Teacher:Dorm A:C
 9390:Administration:Dorm A:B
 9491:Student:Outside:C
 9592:Student:Dorm A:B
 9693:Teacher:Teacher Dorm:C
 9794:Student:Outside:C
 9895:Administration:Teacher Dorm:C
 9996:Staff:Outside:B
10097:Staff:Dorm A:C
10198:Teacher:Outside:A
10299:Administration:Dorm A:B

config.txt

 1Random Seed <3>
 2Number of worlds <1>
 3Number of Days <30>
 4Agent Parameter Keys <Agent Index:Type:Residence:HLA Type>
 5Agent list filename <agents.txt>
 6Interaction Info Keys <Agent Index:Interacting Agent Index:Time Interval:Intensity>
 7Interaction Files list filename <interaction_files_list.txt>
 8Probabilistic Interaction Files list filename <>
 9Location Parameter Keys <>
10Location list filename <>
11Event Parameter Keys <>
12Event Files list filename <>
13One Time Event filename <>

friday_contacts.txt

  1135
  2Agent Index:Interacting Agent Index:Time Interval:Intensity
  310:88:6.688619668606895:0.9667447062422788
  49:95:0.9007299229441801:0.29413754832944883
  531:65:2.3104869981567724:0.13629109371609527
  676:96:3.014786047555358:0.06339801582240967
  751:45:3.131052149585477:0.4445434382525858
  889:8:1.9427263725803523:0.8808337927621033
  910:58:2.495396084901178:0.3683191418222923
 1021:6:9.164811448710253:0.9149064054528824
 1120:94:9.073726154746812:0.09172186189747888
 1211:35:5.811227020170672:0.04277875290311006
 1381:67:7.382044703884041:0.7562618254548581
 1435:88:5.427284912563087:0.4919887871599472
 1564:98:3.2931497408328347:0.20795695942795245
 1621:60:5.309981205719868:0.011521792726691515
 1796:55:9.656859364978201:0.3703774321272413
 1856:15:9.416354213552863:0.6794383500051776
 1926:84:1.984408867513613:0.29733391878026927
 2020:92:4.853416282497795:0.7638596564144793
 2174:36:4.155107158450942:0.3304639571662785
 2298:80:5.883730603507602:0.7125416288385673
 2348:58:4.237992321318459:0.2184722842877974
 2463:11:9.4185033672319:0.6937998477526771
 2593:84:0.07677001757306234:0.48147174789615876
 264:14:3.9106702580659745:0.8198449581478692
 2720:25:9.759725526106168:0.7121362469200376
 288:40:9.859266700927066:0.9002242531813217
 297:48:5.9862020774776905:0.2562517464656725
 3023:54:1.687746631438165:0.5900449712604049
 3150:10:7.664351665510184:0.34811947944265953
 3228:46:5.972242241867672:0.8446013225231795
 3348:84:0.4610657004284924:0.6920856877392875
 3422:80:5.797512189699676:0.5749543208902808
 3515:69:0.6755755530815644:0.16837016924547443
 3689:21:3.7647209748264734:0.022369240867610274
 3795:99:7.419111728757224:0.6755793454767197
 3846:1:6.0869705981206765:0.9392659049557766
 3996:62:0.38005028756432413:0.9685916051859171
 4075:35:1.5759150731503702:0.7930309701559252
 4183:18:6.419755471582778:0.8909924833495784
 4263:5:4.374873831058975:0.14767216650642556
 4377:36:1.1436741940145367:0.027032871240488587
 4431:27:0.03543073074623537:0.26791737345013567
 4593:58:8.600159028547823:0.5089371541057991
 4637:83:9.525552257972498:0.7630639782440107
 4712:71:0.1838245228022528:0.16301999982715865
 484:28:7.201106455933197:0.639241011778947
 4939:55:2.1450605439606854:0.0072084624135791975
 5076:28:0.8317688391569544:0.11354085521055068
 5192:75:8.891200749890123:0.40037278495757134
 5263:67:0.6057359831130937:0.49096137048602173
 531:78:2.175748319238159:0.1973094235179783
 5444:90:6.603685950367471:0.07742541911225254
 5543:48:5.313085158201147:0.0031820058422277198
 5640:66:5.140130492045794:0.3522022574851984
 5773:47:7.622359504852094:0.3803414058582355
 5844:6:9.90535715069833:0.7067631788482184
 5982:71:8.438586749469684:0.05817509423223455
 6027:89:6.191647064682342:0.4954437234413782
 6140:16:2.7203192040973834:0.20918796475319368
 6272:94:1.0722333108247561:0.29041196859888474
 6371:3:4.911064356203861:0.40762232519762864
 6496:13:6.0216102844761465:0.18221116663426262
 6587:44:8.942071102975323:0.6762865235784432
 6681:87:5.828205005560443:0.43654291147178037
 6767:0:9.558161218422207:0.9782982086424898
 6826:15:2.747686471657702:0.5841505638191209
 6960:64:3.1877027193758387:0.7852519193645222
 7028:21:8.89719398196214:0.7796779703774409
 7137:27:6.148709351415107:0.11498229333292553
 7211:64:2.588199198086797:0.9232497898570643
 7394:60:4.584180815888526:0.6663030600822625
 7496:14:0.50361178946847:0.6276123660867005
 7560:21:6.304111960148045:0.40129177112848724
 7672:1:7.946241811259695:0.7384589147638106
 7716:72:8.280083142609529:0.4050472195277236
 789:11:9.83701917013762:0.5098460996889553
 7972:29:2.7846659029729883:0.040863074669492905
 800:87:2.5247982332670693:0.1763267929861304
 819:42:4.288106193000074:0.2738502204725093
 8283:42:0.7506400165327698:0.7642430599819986
 8312:76:9.9768333694983:0.2717578760733744
 8420:49:5.381409836273989:0.6346301712804985
 8516:16:3.6726867565695507:0.5582714052891703
 863:85:1.3686976214395152:0.29712675725144
 8774:15:3.4809262245707284:0.08676173861125958
 8899:0:6.3566236770104645:0.7076734815700955
 8992:2:1.2152547236516253:0.06654621024479845
 9062:39:1.2779870965308293:0.45103199912883984
 910:67:0.001817668070662748:0.29057807898622035
 9268:31:7.533477004492588:0.9192380824068297
 9312:95:3.6035444861225017:0.6605518577198357
 9480:59:7.992128919597919:0.4588233013708509
 9592:9:5.942982815932124:0.8525527661682476
 9654:49:2.5528781753994645:0.1674153560281869
 9767:56:2.4068751851152905:0.06936911168175486
 9899:22:3.5335711374409917:0.39379603080655945
 9991:95:3.9199908183515664:0.25378177050876816
10073:18:3.503121031888783:0.7584130737841819
10168:46:1.4189787199600157:0.019877623645405795
10244:23:4.212711155988669:0.30143615210535746
10347:39:0.5087911598281225:0.5893668330016113
10448:92:2.3542849120881657:0.9451616102571446
1058:54:6.903186150983789:0.2695255667504325
10614:84:9.462171277620177:0.060500538799988846
10791:25:3.697664572724438:0.4079539487067759
10888:55:7.346264967721757:0.552949376315497
10952:88:9.665066927538911:0.7401975800017172
11018:7:4.4697307603688285:0.3782737394491341
11190:32:2.916400428655871:0.536697768154158
1122:74:8.317196407757693:0.2955317179537563
11365:73:8.914697419270194:0.8930540458434777
11420:21:4.219761483887274:0.2632063077194766
11575:97:6.310357238443305:0.14546059647798926
11626:69:5.469932282412852:0.1777212237813397
11722:31:8.687063973633554:0.02966055949862567
11887:78:3.4690077115478637:0.5578236892580205
11962:47:7.198318314161049:0.8276001292402286
12074:98:2.3265643497552024:0.22498444445538013
12151:72:4.797553032172871:0.13299317181491055
12236:76:5.369674743302922:0.6308887356663198
12381:59:5.147324117443669:0.8496019187336087
12455:82:5.933758031306022:0.4066184094819313
12554:6:2.448195518938933:0.0869846065164368
12631:97:6.658117713557282:0.4701995171802008
12744:26:5.384133256347262:0.2881262392733547
12866:93:4.77688056130655:0.02994329042677224
12991:19:2.565625338887955:0.888807228949255
13040:4:4.003688953910921:0.9128964821711357
13194:91:7.023901631427076:0.6382076850534217
13217:52:9.229885545120888:0.3200856999256
13382:5:6.528401052084762:0.747569444766493
13420:29:3.094567113936595:0.6996607131893888
13585:19:3.4859677673907297:0.4504028250467983
13612:62:2.279581910720033:0.31311123094403015
13796:66:7.081217549271823:0.7148731929250536

generate_agents.py

 1import random
 2
 3import numpy as np
 4
 5
 6def write_to_file(filename,n):
 7	info_dict={}
 8	#ID enumerates from 0 to n-1
 9	header='Agent Index:Type:Residence:HLA Type'
10	info_dict['Type']=['Student','Teacher','Administration','Staff','Visitor']
11	info_dict['Residence']=['Dorm A','Dorm B','Outside','Teacher Dorm']
12	info_dict['HLA Type']=['A','B','C']
13
14	f=open(filename,'w')
15	f.write(str(n)+'\n')
16	f.write(header+'\n')
17
18	for i in range(n):
19		f.write(str(i))
20		for j in info_dict.keys():
21			f.write(':'+random.choice(info_dict[j]))
22		f.write('\n')
23
24
25write_to_file('agents.txt',100)

generate_contacts.py

 1import random
 2
 3import numpy as np
 4
 5
 6def write_to_file(filename,n,no_contacts):
 7	info_dict={}
 8	#ID enumerates from 0 to n-1
 9	header='Agent Index:Interacting Agent Index:Time Interval:Intensity'
10
11	f=open(filename,'w')
12	f.write(str(no_contacts)+'\n')
13	f.write(header+'\n')
14
15	for i in range(no_contacts):
16		agent=random.randint(0,n-1)
17		contact_agent=random.randint(0,n-1)
18		time=random.random()*10
19		intensity=random.random()
20		f.write(str(agent)+':'+str(contact_agent)+':'+str(time)+':'+str(intensity)+'\n')
21
22
23write_to_file('monday_contacts.txt',100,300)
24write_to_file('tuesday_contacts.txt',100,100)
25write_to_file('wednesday_contacts.txt',100,500)
26write_to_file('thursday_contacts.txt',100,200)
27write_to_file('friday_contacts.txt',100,135)
28write_to_file('saturday_contacts.txt',100,50)
29write_to_file('sunday_contacts.txt',100,70)

interaction_files_list.txt

1<monday_contacts.txt>
2<tuesday_contacts.txt>
3<wednesday_contacts.txt>
4<thursday_contacts.txt>
5<friday_contacts.txt>
6<saturday_contacts.txt>
7<sunday_contacts.txt>

monday_contacts.txt

  1300
  2Agent Index:Interacting Agent Index:Time Interval:Intensity
  332:91:3.901351436822462:0.7339762595213493
  478:90:3.5626711544249745:0.6746469145132054
  55:85:3.045488921169931:0.039540230198430115
  686:81:3.35308756346429:0.3633954339845933
  711:89:6.326551736128173:0.6289266025075126
  841:89:9.329187350891646:0.6353349553288311
  920:71:0.38645434909083676:0.04041798989591305
 1092:68:5.889425651825421:0.3950396909932594
 112:47:6.557852441820289:0.7245690803250271
 1299:32:8.402723639687704:0.0029308245084296303
 133:33:3.5133963523940634:0.5984631970990983
 1459:72:5.370053020778495:0.531313701010571
 1594:59:5.361572617932277:0.9886697867090888
 1621:82:9.786681409791774:0.644945666368522
 1748:42:5.011982887515333:0.051662026866201693
 1862:94:3.2808909541391196:0.9379521953670432
 1970:28:3.856798574421678:0.2557608578207182
 206:59:5.678890997712748:0.3530777753051588
 2137:67:9.131898601767697:0.858499260774226
 2252:74:9.986369997027031:0.3156120836947629
 2331:94:1.507816879463777:0.750555105240906
 2499:93:2.121959362802376:0.09703892296171557
 2537:94:5.400780286788532:0.4299044759629851
 2615:81:4.75977897522104:0.3232455011774399
 2751:63:8.55510185721477:0.31288557896015257
 284:59:5.9222428832641425:0.12157485621270103
 2943:73:6.795602865846028:0.06744185332954145
 3059:1:2.7021747467696375:0.050538725122540984
 3160:93:2.943901539081496:0.4982339562937653
 323:84:4.133634564366487:0.3075102931608772
 3373:44:8.134038990032534:0.8418295238039117
 3417:86:0.542806560857374:0.7588119151895625
 3585:77:0.2859974668290466:0.7241059456194887
 3614:16:5.329831905451478:0.9195203828276385
 371:90:2.211130035725443:0.23639098557775062
 388:70:1.5406578056068143:0.4262130830791522
 3941:0:1.1579089653984453:0.7851213807119591
 4050:37:4.484956048115092:0.3060348403762886
 4189:88:8.043811518556971:0.4727074037001201
 4258:95:0.8868990689387879:0.3467640517252304
 433:86:6.190128446233331:0.8176423375406843
 4419:22:6.298136491836642:0.5649230836250814
 4564:54:4.536312531879237:0.7989489195824466
 461:61:7.833473806936388:0.650092667048976
 4743:76:3.44149914401369:0.8746721680294639
 4826:4:6.373337730771791:0.17592940756741804
 4960:35:9.934829550819842:0.5345586622312622
 5016:51:1.5764360886713513:0.6770030520140922
 5191:75:9.528950938813134:0.6204530683653462
 5239:42:7.840684207317652:0.6089954987487575
 5361:65:3.319567445374041:0.5478018921036643
 5452:46:4.646705033209998:0.537254045209896
 5595:50:1.7647409730344588:0.02688151759300872
 5651:35:4.156824965180649:0.7123780511350246
 5775:78:3.9226537983258227:0.596842377897293
 5874:58:7.563226282263413:0.8062241896776831
 597:84:0.7120251049265447:0.9302238734157992
 6047:95:8.024189071209314:0.2387216724542346
 6157:28:6.2859322129180475:0.1556546337774144
 6270:30:2.530642559415648:0.25633238312842377
 6388:16:9.06713427487879:0.41516872075378486
 6432:35:8.09237307848392:0.5857892642742539
 6517:65:7.8134917233836285:0.28104998118729463
 6658:79:6.223781312011015:0.012229676686173363
 6790:90:4.692384410823149:0.46217556562178697
 6871:62:9.08294852508194:0.7287708959264037
 6933:20:1.542102652267403:0.8389929454049759
 7090:74:4.633437833538752:0.65537480210047
 7197:11:8.325837108492266:0.08894675467827051
 7210:72:6.557672074227439:0.8651050525879831
 732:73:4.872758588552571:0.09357856657833297
 7457:65:6.828660337659751:0.48495229529925665
 7595:47:0.7466953354057215:0.6603079823678228
 7692:49:2.0077342778968554:0.9189494309774255
 7782:53:0.24061611784117698:0.9198471939191474
 7864:6:0.5767175723374529:0.5800677289768271
 7956:50:2.8103728644720705:0.7661027286936849
 8088:65:5.495737535254017:0.13475930874418607
 8139:26:4.520441829762211:0.7752928037603906
 8262:15:2.527874839657712:0.1705345466390138
 8375:37:6.949647409442933:0.5105509864259511
 844:20:2.97399456614634:0.11289483289257596
 8541:6:4.273511532203043:0.09718585800915025
 864:46:7.362236247628521:0.04058096586641702
 8743:36:8.117474485572878:0.14526881403519276
 8856:47:3.855901848144012:0.06033216610055803
 8982:62:7.36834872994402:0.7504447501739113
 9034:37:6.940059348353467:0.9688323772735252
 9180:84:1.746381666139043:0.7823637521600265
 9211:48:7.364223469449296:0.36985754872005294
 9324:63:8.322818469697424:0.26920941824660416
 9495:93:8.565298534711246:0.36630815362030034
 9555:98:8.261077047953284:0.24720488756898507
 9667:32:8.928969126003851:0.2768960055237545
 9761:35:8.836832665518946:0.8525592430588332
 984:79:9.86527008653734:0.5241984425341051
 9915:84:7.895868992916919:0.9243365521462359
1004:44:8.716228021549393:0.9307245519590631
10196:55:6.888764694183994:0.0792443519258833
10272:90:7.406214716467515:0.8859191527012792
10316:14:4.69851133682884:0.19881286599667536
10461:63:3.380324616991465:0.8268422238613041
10552:16:0.19216831328206507:0.8647705352734371
10645:84:1.2697886559236449:0.6513461320262995
10750:83:6.159864427212866:0.23346664207112955
10869:30:3.4770888522834897:0.36611239444780763
10970:90:3.5286680285590846:0.061422783069107645
11093:39:0.9637079127853909:0.807360297039483
11159:97:7.043532289504258:0.12207223530271005
11243:84:2.227673296719175:0.8300830010185617
11347:42:1.833397217400502:0.21499046911985964
11476:1:7.8677237896729535:0.1308918842693122
11536:55:1.3055580188425742:0.7277279779721338
11662:0:0.6371814138898102:0.739520928356319
1179:66:3.6931844772562252:0.49433217498267423
1185:88:1.486445418424901:0.7994315842241301
11967:44:4.389739626245813:0.7501063883906391
12087:66:1.5283456139385265:0.933656123136008
12123:48:6.137030114523152:0.9235785663451955
12255:39:5.593904911357448:0.7918698321362837
1236:98:8.573685590443334:0.6643971331641266
12458:40:9.370090787366754:0.16062179115642827
1259:7:5.99552450577316:0.22398865033159399
12678:78:1.6985126182973498:0.23431129397478678
12727:36:1.7553777448861463:0.9571656933455291
12810:2:3.340403747124703:0.266154426065234
12920:32:9.04965093388158:0.7998074320401931
13062:43:4.48824832171709:0.19692009534109944
13166:68:1.044013500391131:0.17518002535790944
13281:91:2.032022113548353:0.590068376259575
13379:5:3.6678672963264725:0.8583172648269328
13488:25:2.7906016247631857:0.3417441357034283
13548:22:8.274301104789616:0.6180500643903922
13637:34:4.895008043767715:0.470617322501378
13765:98:3.9939963178189073:0.7597707393883737
1388:99:4.344354090436447:0.08000834895567921
13933:14:2.721637241356134:0.5469317967238905
14097:61:4.480139087307686:0.9370228932878472
14120:89:5.052620560783816:0.2537641232093184
14277:4:7.5548012755079155:0.7647336265540196
14334:53:2.3637671040815222:0.8631258102243161
14497:97:1.1517561038645152:0.6080198126602016
14547:4:4.764917096374596:0.5152616692151232
14656:7:0.7673797837521523:0.05295581093999868
14712:65:5.820115979848362:0.6738384932399847
14822:33:8.160077472113436:0.35575801582167244
1490:24:2.5976244236881127:0.07228477664392474
15097:67:1.3349001353042622:0.5467070433629635
1514:12:5.412935866383392:0.11638905261774857
15295:64:4.328183987891099:0.5038839316589997
15391:91:1.8006275689774043:0.7069818589813456
15433:64:9.979922860196544:0.1730588104192059
15582:14:5.625659929969839:0.427124084779392
15680:66:0.12556782560516622:0.6318204731180151
15784:81:8.965005435252678:0.1329683648749237
1587:7:2.7621652564272834:0.22081572672352956
15960:97:1.6189519082706272:0.5054371256483898
16061:47:1.001552280836816:0.44870613684494454
16112:28:1.7394787076567975:0.15123469338547757
16292:66:1.9575307012529986:0.5143410029855222
16335:60:5.974833467758106:0.18060226652566203
16419:47:2.4143782472302853:0.7229634935521948
16532:33:4.084222023013261:0.8052825167982911
16661:42:3.880567198086904:0.33785485991760156
1679:7:4.797609189111243:0.6557842812818759
16860:17:6.786175767301016:0.855473866429063
16987:80:6.840555606112167:0.10932325733796955
17014:84:5.475907747014465:0.23291755605347986
17191:29:9.17560043418257:0.17718783157595752
17228:78:3.4425085921579193:0.8242337800670188
17360:34:7.2394297827991005:0.8755428155410877
17454:64:2.2671905891345414:0.7334964590961794
17567:84:5.948336450041793:0.3098471787427216
17611:56:6.700839762851763:0.3207358083318562
17738:77:0.9674523146234348:0.6023850656632548
1789:44:4.69793570668195:0.5029890933381677
17947:20:5.319830568980307:0.38707577261884796
18026:86:4.7817534968627555:0.2976309298220806
18141:47:0.20291653431164902:0.4554712242013542
18217:64:7.3452775056010955:0.6483550983905965
1838:2:2.016021005062094:0.47350242384381125
18427:52:5.803404417975604:0.9532995101175942
18529:20:9.704176176125863:0.08789736542495086
18650:87:3.1885515636171515:0.9367769520102764
18793:29:2.0395613845066887:0.4946398943812982
18876:97:9.019353389326039:0.1445289893279038
18999:46:6.582281848173897:0.5425316978102004
19086:6:1.6825724869426617:0.22432772872032958
19190:29:7.500546164660645:0.30905885655729015
19216:78:2.424664767871816:0.18813093908551015
19387:61:3.2116382773342567:0.8869057054380951
19427:0:6.159493456473577:0.2276835244003813
19590:78:7.329164728333016:0.26167298307249465
19676:42:6.930905362346148:0.9096883575644671
19746:6:8.782850221647784:0.3169474488876317
19862:40:1.370250262759245:0.5553566618394318
19981:15:5.902292977530621:0.0556777547804056
20032:33:2.3285018362586083:0.22805846655926876

saturday_contacts.txt

 150
 2Agent Index:Interacting Agent Index:Time Interval:Intensity
 378:67:6.687995944426314:0.4033605962521598
 460:25:9.766242543855506:0.06792652175390823
 518:90:3.76439853374662:0.9833305943472379
 64:19:6.506721718246754:0.47110824328789613
 773:26:2.5400982744608336:0.40140270897106645
 868:57:0.7095173223023121:0.2328466079907241
 957:54:1.545474789816078:0.6593172582955799
1090:25:7.843174009450287:0.8268544568417224
1128:52:1.3914812455190517:0.8024812081343093
129:71:1.5518951054968155:0.9318507773242553
1339:28:8.476359135606552:0.7763246795933149
1449:50:4.7211099258761555:0.2950133516599971
1552:12:1.6886708754449598:0.27197127175998526
1619:20:5.6781326401719046:0.9590963962294797
1722:77:1.530950907625851:0.3754295473613327
1889:88:5.658452775120387:0.0803874959012173
194:12:7.636759575481204:0.2831880696193816
2058:57:8.601430915297016:0.5434659477112249
214:32:6.147275128372893:0.856773362268219
2275:95:3.3575411423184542:0.46747804925146763
2348:73:4.294729247064641:0.050670872480034546
2487:31:0.20788603769580694:0.06469788200264015
2550:44:2.983096090063986:0.02735893758806829
2612:73:3.5332686474645323:0.6308187130898412
2759:18:6.507883109382785:0.8679178454556692
2890:76:0.6431511136089729:0.38181470878945245
2993:55:0.688031974008203:0.02165710753326533
3093:54:0.5174288624109147:0.4172063304023521
3190:55:2.351244324988293:0.20155062301576254
326:69:3.204281646873234:0.6853704116954752
3337:45:4.207020809561934:0.5062926163922263
3450:85:3.3126767901315013:0.11439025603353281
3518:98:0.5483540344431337:0.5831224256744627
363:20:8.466441890639738:0.15531801936817402
3770:84:4.252674278698835:0.1021412687119303
3884:96:9.65755023003075:0.9104362499713785
3985:30:4.477617210548132:0.2798872009598208
4027:81:3.4726517979202596:0.6867846228811487
4133:5:9.418615513088076:0.3089650238414625
4282:19:5.969411859418942:0.9201045742327656
4316:63:4.806229721717362:0.9196419859150736
4429:41:7.958618332948535:0.44643319464470743
4532:85:7.863072004177757:0.8397192112109673
4664:63:2.8034310396456483:0.5005219190796429
4722:53:8.636229353574626:0.5573464209207643
4820:81:1.3492272749291145:0.5759296391255372
4972:1:3.170961659254469:0.864395776604293
5051:5:6.983939525485372:0.3998399286929163
516:11:2.828084537368467:0.7569874076404247
5284:6:3.225352755378524:0.13692972894786104

sunday_contacts.txt

 170
 2Agent Index:Interacting Agent Index:Time Interval:Intensity
 329:74:9.16372608230145:0.796954964751048
 46:51:7.883900864399966:0.4086674799106108
 580:96:0.14815771583060466:0.9598774863311844
 674:97:4.308374781710823:0.5469594486352
 751:13:9.042079023826053:0.4951854351944386
 880:59:1.194192610139505:0.1806780778265884
 929:52:8.298008123594673:0.6055655082754013
1011:99:7.398529511198307:0.8423463023583696
1194:96:0.8114992155173495:0.6185711886621139
1232:66:2.3703816553952883:0.35420962128864475
1339:99:3.855243189079789:0.19683280636170353
1414:20:6.993801240807475:0.9924238391700014
1569:5:5.368207898395178:0.3296239694354882
1622:82:5.141505384517688:0.6680939851970867
1716:14:4.381681285284316:0.13324126477503573
1863:73:1.1377617766820813:0.016765931895245334
1953:42:4.331827823657975:0.560247114997433
2074:72:8.487044883624892:0.44857507061224955
2148:53:8.142210501452041:0.22185756589964178
2239:80:0.919320244588725:0.0066855429075109996
233:21:9.289809772081991:0.48205140669390023
2468:46:4.536474019847931:0.6855403269937351
2558:90:0.8335888281998161:0.5829499953459416
265:56:8.623750119046413:0.6850571684408665
2737:46:2.19563994708889:0.32831432045342446
2843:16:6.54823708272073:0.7241818732660742
2955:95:1.356326584676878:0.8593548177807079
3033:51:5.72041717661566:0.524825828129498
3156:97:0.05304038966948088:0.9396784738557239
3239:25:1.6057401908444169:0.7729036122188875
3375:49:5.1930718546095:0.6210496845686397
3450:72:6.400159461397456:0.4083531569308648
3516:36:3.095902490181952:0.7697749975800223
3698:36:8.736666708714022:0.9269722338361613
3725:4:0.1996745353487972:0.3912838723392581
3854:37:4.379634943637777:0.14566373998141358
3992:55:0.019798603565377437:0.7045448754207068
4036:91:1.6904254816989417:0.9488514792773272
4175:0:9.344337089059099:0.31555189896437286
4298:93:5.920573213081997:0.0028759470703639822
4373:27:6.323996215279141:0.9268743088920766
4410:26:0.3335853333487415:0.22327795239905257
4583:6:1.8792327407608012:0.5844054293798739
4680:39:8.666561745531057:0.6341570680368916
4785:64:8.279808342659074:0.10714932227380469
4851:80:2.597488396875214:0.0753952752053868
4936:39:5.6836065070360675:0.6191528017058452
5072:11:4.7881710302403455:0.7655770299526184
5146:90:1.0209935816785076:0.3288165509174008
5244:3:3.9645570905388516:0.9433763441413141
5320:19:4.608574167399386:0.879494666634502
545:30:3.2439699423921597:0.1099899352310858
5582:95:2.2446524075665786:0.3730883570466935
5636:47:7.523082303216631:0.46842401692247715
5767:80:0.46591410875939654:0.43019339282451874
5886:1:4.153321745378494:0.8744248883962594
5932:87:3.740524247725736:0.3904419258374895
604:88:7.107645004605604:0.971958195970546
6180:46:6.087211809269826:0.5332140334707597
6220:16:9.743912977300749:0.06325827742806112
6311:68:3.451500943176198:0.1235586691736077
647:86:1.3489846728692534:0.9380271839281606
6598:76:2.3319468321605408:0.23635317254322508
6659:48:0.5527503420919422:0.9217009076588242
6745:94:8.674582793785653:0.6210440386455588
6824:38:1.587140836439298:0.7617430249347842
6966:36:1.1370077466599082:0.7580769247367519
7092:66:5.149056575604316:0.20909269304442213
7196:32:7.470321654585279:0.14446721285379327
7257:32:5.236089542116535:0.012270130984272543

thursday_contacts.txt

  1200
  2Agent Index:Interacting Agent Index:Time Interval:Intensity
  39:80:7.0382921246333705:0.9556820598269046
  444:69:8.573011972540401:0.07924998376906311
  510:57:1.5325958641775272:0.3093902519850843
  642:10:8.701123888970558:0.962585163449696
  792:17:6.157994099854182:0.7080803028223787
  830:59:9.725783500251366:0.7314558080633391
  975:50:3.8058557518124214:0.3168807779694327
 1040:62:6.43557676676667:0.9763099081805485
 1192:27:0.04439101149650737:0.417023535886784
 129:96:4.064443587754805:0.3627068026184982
 1357:97:2.9937333519214326:0.04831281631023343
 1415:10:5.893399813507008:0.47319793911862373
 154:58:2.189181419606845:0.6803283844589387
 1671:62:1.7525285905496146:0.13896567010484562
 1779:36:8.506352552863355:0.8691976202423097
 1876:53:6.137904467285217:0.07106840002404269
 1984:36:2.560188707141876:0.7771950084819546
 2052:43:7.668274637265973:0.7312993690534784
 2154:93:7.939847618469336:0.7776433290453468
 2281:68:5.384535911579822:0.23525255976832482
 2393:16:9.920757993127333:0.8934543441881765
 241:72:7.758134739731689:0.24703891010135515
 2594:31:4.736159938253104:0.279716657877369
 2611:91:6.604975713945529:0.2980626079316899
 2722:89:7.307471438634465:0.8331314885020186
 2866:92:5.074020217973926:0.5867164552992925
 2946:20:7.872054213346798:0.07697026703119414
 3068:84:0.014172442899552662:0.3614765333867669
 3182:9:1.0094025461973999:0.7513051533741296
 3288:35:8.916625728448652:0.13212679832443874
 333:61:8.879634677276655:0.16048328962110692
 3430:63:0.889562352523886:0.14175368432296465
 3560:41:4.057982037703882:0.9460153048461237
 3627:8:3.4522820993929315:0.263099965041526
 3776:33:5.350168457592791:0.4817138552741015
 381:85:6.03291472992156:0.7362304926092693
 3947:46:5.151177915023272:0.524784652285693
 4043:80:6.3260521909884115:0.20238179959236602
 4146:6:1.4188793789888487:0.9554001282463949
 4268:2:8.760839211072776:0.5522656652793739
 4371:87:9.866051901497453:0.050298054713874385
 4490:11:5.444448491136552:0.9347109216145608
 4517:22:3.1981154659531565:0.21362937499069423
 4655:24:0.31133364718463397:0.9904127541387862
 4739:36:6.652772458814239:0.32511126196824647
 4851:17:0.1908445268782133:0.7776073952742899
 4938:27:4.9287219964583775:0.6766708526045345
 5043:68:2.345297470120279:0.4888662207402883
 5152:77:6.2704802068309515:0.9727888002522699
 5257:65:0.31410385209842073:0.5678620629870902
 5358:9:4.5043887132533875:0.9529991526026419
 5432:91:8.856779214806078:0.6205084549405729
 5536:9:2.99684211320568:0.20084350883099966
 5652:42:2.234391573182888:0.7936651279874264
 5766:97:5.497317602861229:0.8037936396717074
 5843:75:8.631273282189033:0.6467101601379966
 5991:93:5.899984231792686:0.5589976222351022
 6089:98:3.4357223028901385:0.28650955658054356
 6132:69:7.035480596894519:0.715682876100546
 6236:47:0.702440123848932:0.37014161233455
 6397:35:7.795073444954294:0.690234242431429
 6449:26:8.188641044378683:0.2854457891281498
 6523:48:5.8860192391972745:0.9858892118609247
 6694:66:4.8331558942120045:0.9392247213322765
 671:28:3.940617896767412:0.8119157936104054
 6894:9:9.511243180423108:0.4866582339311317
 6916:13:1.3706419546146398:0.4606816198641699
 704:94:6.079250764705122:0.664159392552753
 718:95:9.367600455819955:0.28978090388795374
 7287:94:0.009281959133973228:0.9533789826774827
 7358:89:1.9742256941383884:0.12038943184213302
 7484:58:8.2927498262796:0.6289705093238441
 7596:78:6.145813134167143:0.8797391678218863
 7615:29:7.304166478831061:0.37660257369721994
 7733:10:8.415998407750381:0.3884970977718254
 7844:83:1.5842806601754167:0.8979250123521796
 790:89:2.301629122139719:0.07010399854914007
 8056:69:2.2033530452009864:0.0386290184572774
 8139:21:8.365740266584353:0.8769992573517463
 8235:8:0.6039725358473025:0.7231100758772858
 8316:29:1.1869583871524414:0.7934164894804442
 8413:60:1.1083952560802401:0.8160926988887836
 850:76:7.296924179379242:0.04145973049986551
 8696:10:7.083416807339589:0.31052447378674664
 8767:95:7.3778033130326035:0.4699849766808416
 8814:60:6.545948462503307:0.28553558881248886
 8943:46:9.73653464036593:0.08518557315885533
 9039:55:8.001834086567442:0.1449534039528918
 9196:29:3.3347114644129827:0.4751405480035604
 921:3:3.9843061077162076:0.2904432377787004
 9322:86:0.7737914282516112:0.9949485827235354
 9439:54:9.44229177563296:0.7555177614543236
 9513:8:2.9093184369975322:0.4074161100925633
 9690:56:6.3954756331314115:0.3630477505326515
 9795:59:7.741332185095796:0.0686127194562044
 9863:6:7.329546037754219:0.047602827898245326
 9957:55:2.2058024651955788:0.5420130616536876
10045:64:7.972444005640122:0.9346612569555631
10117:96:0.5028192989338531:0.602861775981457
10219:47:1.1593911790613642:0.3294905796595542
1035:73:5.053371460984918:0.43453735386468306
10447:14:1.671267644260136:0.7617381750767552
1055:17:3.8521114646242918:0.9027839801336598
10630:95:8.155368057480747:0.3039655272261964
10742:0:5.301894475432239:0.12825534758882506
10859:93:0.867332721346481:0.8543727044000994
10961:24:4.545866060225478:0.29454914795747555
11085:51:7.265989073625477:0.9771268329383078
11119:63:4.114022700622767:0.40193113111336387
11245:47:1.0866634685103327:0.6439994336060687
11336:54:3.3080183883197356:0.05478430344551444
11427:43:4.491839482154164:0.34138799298187006
11596:83:3.2537132537203695:0.4690103280088781
1163:17:8.210480957200954:0.6785354918047558
11760:0:8.166288756067337:0.009825187110891531
11880:57:3.6405957600181194:0.9731578767400095
1194:12:5.167714502627886:0.08442010394327959
12036:60:1.5436074012458656:0.38231602955762645
12113:81:7.487919848355968:0.7720185857814735
12286:81:9.832572756034889:0.932466012208083
12385:43:2.3720109674290333:0.8201010230106307
12432:21:9.953311147163454:0.011674606541613675
12541:94:0.5708653782110851:0.8171371735366577
12680:62:7.826269089129624:0.8054818446439931
12759:42:3.4752456682963286:0.16962944629105137
12835:30:8.950010240117711:0.7321501698872532
12936:68:8.049175109984219:0.8751769192948862
13090:78:8.313662977740753:0.021380973721606078
1314:60:0.3863981340857503:0.64324289181507
13292:5:1.5821836994859562:0.6832838495910474
13392:35:5.759253574243678:0.6722529014859097
13463:52:0.3248004646469238:0.889428065406194
13576:58:4.657899334607473:0.1269797853566087
13620:23:2.030506718629682:0.623571833876037
13767:56:5.721392098935411:0.9740022252292175
13839:71:2.3800650310864215:0.39527668002658867
13957:68:8.743679973789662:0.11559725358582273
1409:57:4.426655660307315:0.3831574189336966
14190:35:4.500662171278994:0.6457649176495883
14211:15:3.610230581472095:0.7749786563954427
14378:30:3.537127278785983:0.672334116297062
14494:51:8.461216862609769:0.5454202707832448
14575:26:7.878760507607612:0.23953114774140905
14662:21:8.03728326258731:0.7317362756887453
14741:28:9.881900293689839:0.5158710625716576
14855:59:5.187576120008606:0.09037421440274218
14966:30:0.2822708894510517:0.8239935690953065
15014:86:2.4350591158958035:0.0451732234158444
15110:13:7.540167443077943:0.9128796041719606
15211:11:2.5872234084376977:0.2745810085653637
15363:18:5.8349459811306135:0.2628000302629594
1548:70:7.389502622983511:0.33781675668735134
15594:92:9.716335252977252:0.7560749193156806
15646:6:6.697843308826012:0.3071889852788805
15714:56:3.0115810056757883:0.019309987557965647
15843:59:7.70335287625792:0.07801146422444183
15913:19:7.1531177132632635:0.46172693965817924
16032:58:0.0947302768753655:0.4435550454724231
16165:41:7.846459075221219:0.20486103557339408
16279:30:4.855795600531242:0.6324741482930949
16394:72:9.192984245755726:0.47308851194268364
1641:19:2.5189273919855326:0.5697138720443463
16543:89:5.623253504764232:0.3205680634577276
16623:49:5.996101075819311:0.3092468469691083
16724:77:1.1575274845932815:0.29449933851511156
16897:14:1.542998906358647:0.5324160705560573
16924:34:2.8547843066335075:0.8823443962826881
17088:94:3.3126621067162567:0.36194029301617625
17159:89:8.775881914064165:0.8253261132282622
1726:80:3.9288893586194327:0.10275972449442927
17371:59:1.6479602486244127:0.04174936740649626
17455:54:1.5015663207731555:0.06830746730647275
17552:2:0.9008968763444658:0.4046997291491362
17653:73:1.8688136024961355:0.5830614775602793
17736:8:3.9728441806543637:0.135649600130743
17864:44:3.9868053958346583:0.12018302290146932
17920:81:2.3295936709442913:0.16782594204362378
18070:98:2.4625686349731533:0.7447068575679722
18183:68:3.0500910480749255:0.18871352909901662
18212:36:1.3232525955055607:0.6301253264588437
18324:4:8.511899833302598:0.03323414664925628
18450:77:7.491775365021729:0.2614312397444818
18577:8:8.606105243413465:0.6596871488477454
18641:11:3.3624084193448764:0.5842044609543943
18798:13:5.435720234282897:0.07937243127913918
18821:65:0.5322387729059574:0.38013044360335524
18911:81:1.473579773422019:0.4182034100396437
19071:6:4.054832359579801:0.994191633021709
19191:44:3.9765231844593063:0.6317211275561101
19293:14:5.805280716375303:0.662059365871648
19386:69:3.1533754603139252:0.6050328383845425
19436:22:4.280692953835742:0.7771808522245846
19576:78:7.500105794724697:0.5285135775933644
19678:73:9.218428037446689:0.6502891286543955
19777:24:9.141627497458963:0.6764185110368829
19899:20:2.9402718121860625:0.94933964891294
19951:60:5.440972736761095:0.08167094302929112
20053:46:1.4756695868875869:0.5147498179121255

tuesday_contacts.txt

  1100
  2Agent Index:Interacting Agent Index:Time Interval:Intensity
  332:45:6.213436231456636:0.3731609728338897
  489:81:4.579771459232793:0.11434815810612176
  50:16:3.242934650368129:0.3141918044148243
  615:82:7.975466857130672:0.6128656081719708
  712:29:1.371000381482833:0.3302304647764601
  814:7:7.821227878776517:0.02845995074557328
  985:83:6.395632457075665:0.7751395265422735
 1076:14:3.5755744413957458:0.5574299399414683
 115:62:9.58634391552728:0.7052359820907551
 1233:45:0.7076539116973712:0.29372417115115146
 1346:38:6.129146387692819:0.2609382873034033
 1425:66:7.924473535575229:0.5101208649146122
 1525:30:2.2435787778590233:0.34060744129158593
 1634:60:4.927953728053525:0.6700587895933668
 1747:5:2.684771776287241:0.2574115092392507
 1889:58:9.625734441309854:0.5968114997896796
 193:61:5.220803442701763:0.8620230034643891
 2029:91:2.4686173240322318:0.6230867759670403
 212:95:1.5754431658870482:0.6105753814387738
 2299:4:7.691047725707579:0.3413757611023611
 2378:93:2.9318192055348415:0.4648065055530436
 2451:24:8.197221547880316:0.9718876331351113
 2592:27:9.198396797255626:0.16543165396821713
 2660:99:1.9852917319237706:0.6754749253049644
 2747:60:2.926189356051805:0.9833964216145247
 2862:53:8.777231457375235:0.7284431458587418
 297:93:9.19597804582149:0.36088453244829266
 3018:16:6.90568418912085:0.47964664098450793
 3139:75:8.829446299574954:0.8566338306237319
 3279:27:0.30209164979904113:0.9162862348077758
 3341:47:2.8150099179100363:0.2202297658034008
 3434:87:5.121262434689546:0.34522516985978635
 3552:69:8.376611116331295:0.9721430380048826
 3631:7:8.568390078953934:0.2609747271152305
 3790:39:3.3323074765201985:0.3738473348752833
 388:48:9.61161080916259:0.11255940822682353
 3929:42:1.046490193853703:0.9703762943992277
 408:52:1.3703006046548538:0.06626361915074641
 4175:91:1.4840408750275702:0.6152611616346282
 4237:26:7.825349435322081:0.8239794472248464
 4322:84:4.940400200673159:0.7619456896388551
 4459:90:5.784623371260322:0.10666187082198009
 4521:86:0.3471548050285156:0.6173979174975259
 4642:90:8.178704998755766:0.4609972690917916
 4729:95:4.8406036225093:0.09106867309864752
 4853:58:2.9237402820948066:0.8880798506295625
 4964:21:9.633445470500215:0.3795317805234453
 5062:36:1.3372576343073461:0.9333367878739499
 5140:29:6.759730185924982:0.40384662674309035
 5220:56:0.9484204437096111:0.2700243168712728
 5391:13:5.593847444401174:0.14251730023029452
 548:38:0.8118455773477451:0.15534571880671544
 559:58:1.9613155867738086:0.9964979966329512
 5628:44:8.039543224362301:0.92149645738936
 5788:93:6.612640065946129:0.7475311567942813
 5840:19:7.620144079622059:0.3182416084415045
 5957:79:4.092781780687574:0.7267655904498955
 6011:49:5.677218509537134:0.620710266950606
 6187:9:0.5998969632207896:0.9462038643902423
 6279:52:0.3517405280543384:0.4570039635821589
 6398:32:3.0513911846409467:0.11192808504123763
 6448:26:2.144916542978387:0.7649703267181862
 6519:60:2.5378878697564122:0.5125815380642406
 6682:21:6.355984386247059:0.7538837278153913
 6776:82:9.092557531602177:0.74210496101346
 6818:7:9.409297527034369:0.9147893913873082
 6919:22:1.2673823917478577:0.3677686846010142
 706:64:4.108843727499912:0.9996670729666973
 7159:39:3.968592643367236:0.6153826071593608
 7231:3:4.102429735302982:0.8091549649634372
 7375:67:6.408176908148027:0.4632439420199308
 7434:51:3.29285916399488:0.07362754325129339
 7596:44:0.8606828956909396:0.6380526760438952
 7632:55:7.632667913997516:0.8151815459035505
 7792:96:9.988069711163364:0.4201982040837776
 7876:55:2.7540455819170298:0.2728983302205812
 7971:69:0.2404635910591657:0.7019088464354047
 8083:7:3.7833428461767804:0.5059053649402946
 8154:81:3.347201881226524:0.6078784506485931
 8278:11:2.377145199017725:0.7250049576896354
 8328:25:0.6506573295260609:0.36397213695897845
 8471:55:5.388066989872032:0.7128044897824171
 8592:36:3.198366280780307:0.22223364625950692
 8687:38:1.1459230613858307:0.7737585259260796
 8730:20:4.088682224830098:0.9133713693060721
 8861:96:0.8000325343560455:0.9509401081347084
 8964:96:4.276249476121806:0.5545140479374902
 9030:46:5.864776032398824:0.9878159000860662
 9141:70:5.026586660801719:0.2196825484242737
 925:2:9.153538434547116:0.6408688000252408
 9394:57:1.5258929617167616:0.3422495707436871
 943:89:7.383070659810189:0.502938336341504
 9597:34:9.399292391381532:0.24970335740592198
 9616:30:3.8929316804406353:0.22739535842351322
 9769:8:2.1316090927287434:0.49286696627785687
 9874:15:8.485630359109985:0.11702412916620186
 9927:7:2.1637920715821535:0.18835559198252183
10069:82:7.987112691829116:0.8388020770869082
10166:3:4.0359322253773:0.8073362451987808
10264:21:0.4793067219400504:0.8144255386406495

wednesday_contacts.txt

  1500
  2Agent Index:Interacting Agent Index:Time Interval:Intensity
  335:35:7.326649613582364:0.01880486356965283
  435:53:7.365575713168727:0.07226775243298234
  555:76:1.7425302606537474:0.4079740971798641
  630:95:4.307720149563242:0.5889349769548973
  798:69:6.544728451402593:0.48025388395194957
  86:88:5.072512252507798:0.8389958044296311
  945:47:3.8194943780736357:0.06756325928583062
 1060:36:3.4337954746207435:0.780608576755907
 1128:58:3.9573951790562067:0.8814937045907152
 1246:4:3.762262794683556:0.16848724165974238
 1397:11:8.693414441617387:0.7460650092914961
 1492:75:0.660206718405888:0.07335924898540769
 1546:82:3.8637328951746017:0.5951215759777483
 1628:22:9.800867101130882:0.20271952020628436
 1737:49:7.060494204085794:0.5366861962135869
 1830:86:0.33597015028233757:0.10758491189019004
 1946:77:1.2885169728264612:0.10729300794480534
 2010:50:5.187607731001368:0.6703832544752654
 2174:34:8.93544026576964:0.04549012455350221
 2273:68:9.591015242175292:0.6962332597341828
 2310:44:0.5823210493669018:0.9689789406714906
 2433:32:8.436879771291043:0.021557896227508477
 2522:11:3.438680750408264:0.5398584734054681
 2691:60:7.210324988424461:0.8787960159091067
 2736:78:6.454046898476056:0.18222360148833006
 2844:28:0.883667185292053:0.922569686376188
 2964:47:8.689647085944292:0.1418009831093382
 3062:89:2.7679253812446216:0.6435851301783628
 3178:1:3.352951970635684:0.4754766055188496
 3269:62:8.345007894678666:0.23798159130601404
 3350:92:4.481913480277774:0.006233696946746248
 3498:26:1.1338952630227828:0.673962261965644
 3537:99:1.0643710496145387:0.5908347291714198
 3628:4:9.920590767349442:0.6963377903623542
 3718:50:1.3809350166002898:0.9872588601452001
 3824:49:2.094116142874566:0.5748045544228527
 3925:42:5.693608169443762:0.2879191230183471
 4054:42:2.4086948504552073:0.02547746034366105
 4151:2:4.451408189223509:0.6032579558452265
 4260:20:9.005811670608857:0.9856136917050264
 4365:67:3.19976980590579:0.9186950562480023
 443:47:7.181260983583534:0.3040250437725214
 4568:57:0.7383565151524951:0.723133921333527
 4655:66:8.367449475616333:0.07980719114975277
 479:11:9.97517977101612:0.6127447997868063
 4831:33:9.975729093568951:0.1045218021830403
 4983:27:6.640381396448985:0.15661340183018102
 5095:37:0.726266659582897:0.8758271106350278
 5117:27:3.731549646431953:0.3229035252474013
 5286:73:9.8942767252751:0.3990519563823193
 533:78:8.720720998194327:0.264559175826406
 5474:46:5.4153651996120225:0.4173530824931695
 5595:95:9.484928224637814:0.022785741619000488
 5682:9:9.340319131198878:0.7952612413547455
 578:42:2.475879993476423:0.3886327787838908
 5882:97:9.866336760171512:0.7188202155620746
 5956:34:4.302447425405743:0.28633873882974836
 6081:45:3.724740927783703:0.9167028205119899
 6125:29:9.199922961967527:0.835041826144438
 6294:68:3.8825993503747194:0.1168420663032067
 6394:13:0.42404086307323285:0.7521313232183118
 6449:11:8.607236167340723:0.6186404850761289
 6520:25:2.005728328797962:0.05980946246418717
 6659:91:2.961636869772523:0.1292205857836043
 6752:74:5.743776860036771:0.9984405022263465
 6875:72:8.15665662213246:0.8856720647622587
 6952:74:7.689955305723457:0.24021318982090323
 7059:44:1.6743181640329041:0.1378869655341155
 7172:12:7.638936582230792:0.8289049815374233
 7216:20:5.910006486116654:0.8403350173657851
 7380:0:9.524612020268266:0.9890454406593926
 7446:85:0.1978619520777969:0.7542955579200908
 7594:45:8.182315486473957:0.5539970521800692
 7626:68:2.410142904138397:0.831822112439275
 7712:59:4.111959521312285:0.2511690380469713
 7816:41:8.11653477037407:0.4864135139348226
 797:6:8.41408841840117:0.5166597024174876
 8082:88:7.539262351768925:0.4934590077378854
 8123:87:2.0191699791040407:0.4650993959348293
 8214:42:7.959803809049787:0.3859274394432979
 8372:39:4.988558132860267:0.9719137961462334
 8436:87:7.904796353087814:0.9033328489705758
 8549:41:6.441286834271189:0.8596066636809503
 8626:45:1.5494084880416248:0.21286592285078343
 8769:84:2.68713252804031:0.6352927537106948
 8892:50:8.125056564396175:0.964640333194231
 8925:50:5.745327231004454:0.4996238922147982
 9048:58:9.430548312366577:0.9662240771532448
 9151:7:1.5407008662168198:0.43018447051424324
 9294:85:0.33708865480739925:0.3999028227241679
 938:42:0.4676328396476981:0.24681536908527746
 943:54:2.082373656993525:0.8211009673756547
 9547:5:4.176150167437918:0.0068115940272549524
 9613:18:1.9920879889202947:0.4530248033751796
 9775:58:4.656733076780746:0.11008410284813352
 9887:66:5.736523536915983:0.714940200457393
 990:99:5.146933211148694:0.14934608064069932
10014:37:8.826800764399827:0.36862157844671417
10144:89:8.617130159606878:0.629612083711045
10276:62:3.808269227488712:0.720616750357066
10385:88:6.012459883150846:0.16207079061869079
10470:45:8.460933196001442:0.03484670155649383
10591:61:9.052509705425388:0.8533345550696678
10672:53:7.626567323195205:0.6547255311759907
10714:87:6.123814961834867:0.10799512631697394
10847:38:9.703366381545296:0.7861481672561152
10950:2:6.921877657912186:0.0901922793109946
11055:69:8.194239438728719:0.25190470736562665
11198:56:2.4951109730602985:0.313928578913919
1124:36:2.5502983171221585:0.13611513898232153
11379:69:3.7285925099089035:0.17979490568657208
11452:95:8.298231631001554:0.2418250870038332
11554:74:0.683477780477264:0.12947423620560494
11688:35:1.449078957263129:0.9971706032369194
11742:6:0.35682089991305177:0.8220981329520314
1186:81:5.059336042688641:0.06759370944002929
11941:79:9.740240133624962:0.3483763795581215
12019:82:6.050535299281256:0.2265648321824162
12146:47:1.6596588569359982:0.1808366243887748
12218:26:1.7194269810771157:0.469856221060189
12340:25:4.586799772966139:0.011566746615992107
12444:85:7.874474589247804:0.21940431108028746
12521:86:2.022571555919419:0.0267482489112576
12655:1:2.4888121465990034:0.6949916683725545
1276:65:2.0048251474987087:0.6007769598222094
12846:99:5.203358357806579:0.49351952534458354
12916:89:7.784970962656438:0.3795554828381028
13083:56:4.564802235334828:0.30456464371028225
13119:79:1.6659490128697307:0.09406007012891293
13277:23:8.95317196939301:0.861612362884061
13394:93:5.5446862725779695:0.6345596358727227
13417:81:0.8694353708834501:0.8610458639123718
13542:77:1.0046753749712778:0.8361913703426427
13680:82:7.898528087560851:0.7837288261770342
13799:67:5.6795968227766185:0.37214616970155145
13857:36:2.7938124820144363:0.10872997346449254
13945:73:5.180491151160156:0.183795261793106
14010:7:7.565100574481845:0.033325877812489635
14179:38:3.158002500478579:0.8762332523999679
14246:13:0.8163960575888862:0.11687793448566342
14321:98:6.981821368222011:0.6207591025489955
14473:8:2.3297846497396932:0.38686431622259887
14578:63:0.4436434330479888:0.3894958140703567
14634:59:7.191388054443503:0.20095769579977418
14773:30:6.053525772644528:0.5967585140005333
14841:40:1.3838754859326574:0.502405241786681
14949:60:8.295110054329713:0.4305993322400177
15083:63:0.48547541285623885:0.32805016959748434
15193:31:3.6848854616150293:0.35643612817628656
15212:78:0.2273456842385202:0.953077640082888
15330:89:7.153927919430508:0.43586809846112506
15456:81:0.09816756643055147:0.6295484364565437
15583:7:7.4085537764271745:0.033305634133947604
15692:42:9.988928688371795:0.2761232871677961
15770:88:6.140537017964541:0.9795273172673395
1582:90:6.461894038111831:0.1185444682840926
15972:46:9.953506502098817:0.15329163492922593
16023:90:1.9471840933452211:0.7386518914419935
16110:35:6.373387939809772:0.7171440826931259
16262:22:0.5596942604876298:0.1432896719544473
16338:92:0.9481383578775293:0.7677431462939046
16474:22:0.24856782036149716:0.42812724703916316
16514:83:8.576386817177024:0.9396215064528413
16699:2:9.30095330632649:0.5066561439508125
16763:22:6.403955394913:0.1571691479302042
16878:87:8.344142685105586:0.2861576111801998
16971:55:1.4476785659120595:0.33708688327676783
17036:87:0.21348728262420402:0.28711138205567277
1714:65:5.67218610317065:0.36711320844191897
1722:81:9.67653850599029:0.03156219872649857
17361:88:5.724543360415383:0.7932661225893052
17453:59:9.185083874031697:0.026215655980081132
1757:40:2.8312580779681875:0.49196082108715233
17676:96:2.7315283363582776:0.6519656627078148
17786:93:8.443020347066351:0.1248034896150344
17820:95:3.9697649231974808:0.04606324434996534
17973:11:2.5528837643963884:0.6948268362453378
18050:68:5.756463265683402:0.995685718348466
18141:92:6.3336884749824645:0.1621356000106734
18243:18:9.664694397742583:0.8045465791810523
1832:39:3.9394795994181777:0.5867371111778215
1841:82:4.841485437297484:0.49371708023469907
18565:53:2.7498717037820644:0.20583454120465094
18673:90:1.121137779062057:0.7937686270961586
18753:87:6.2353544374513845:0.015946094567476976
18844:63:7.393381816549878:0.3472456996800237
18915:90:6.9611182251442685:0.8039647151078758
19088:27:8.01133506522802:0.4130507216742557
19154:87:0.23852744551902894:0.6264091805644847
19221:16:1.081879835206111:0.7790590360105223
19322:69:4.123929864290275:0.9702498443951281
1949:97:3.0488474948409316:0.677209238072471
19567:83:4.86032668987452:0.27054126955750546
19662:20:7.499374514038265:0.003010254325323869
19724:69:0.3027367484925514:0.42734474246664456
19890:30:8.329167767245044:0.13749033066927274
19984:33:5.994927378398588:0.3756720097493309
2009:76:7.402293740792216:0.05790492058061891

Example_3

This example is a remodelling of Example_1 which uses a Scheduled model comprising of the states- Susceptible, Exposed, Asymptomatic, Symptomatic and Recovered (Scheduled SEYAR).

Here, the interactions have been broadly classified as weekday interactions and weekend interactions.

This example helps to gauge the disease transmission by generalising contacts over the weekdays and weekends.

Users who do not have valid data about the interactions and events taking place every single day throughout the week may use this example to get an approximate idea about infection spread.


Generate_policy.py

 1from episimmer.policy import lockdown_policy
 2
 3
 4def generate_policy():
 5	policy_list=[]
 6
 7	def lockdown_fn(time_step):
 8		return False
 9
10	policy_list.append(lockdown_policy.FullLockdown(lockdown_fn))
11
12	return policy_list

UserModel.py

 1import math
 2
 3import episimmer.model as model
 4
 5
 6#User defined functions
 7#This function is user defined, based on the parameters the user has inputed in agents file and interaction/contact file
 8#This function represents the probability of getting infected during a single interaction/contact
 9def probability_of_infection_fn(p_infected_states_list,contact_agent,c_dict,current_time_step):
10
11	p_inf_symp,p_inf_asymp=p_infected_states_list[0],p_infected_states_list[1]
12	#EXAMPLE 1
13	if contact_agent.state=='Symptomatic':
14		return math.tanh(float(c_dict['Time Interval']))*p_inf_symp
15	elif contact_agent.state=='Asymptomatic':
16		return math.tanh(float(c_dict['Time Interval']))*p_inf_asymp
17	else:
18		return 0
19
20
21class UserModel(model.ScheduledModel):
22	def __init__(self):
23		model.ScheduledModel.__init__(self)
24		self.insert_state('Susceptible',None, None,self.p_infection({'Exposed':1},probability_of_infection_fn,[0.4,0.2]),False,0.9)
25		self.insert_state('Exposed',1,0,self.scheduled({'Symptomatic':0.4,'Asymptomatic':0.6}),False,0.1)
26		self.insert_state('Symptomatic',11,5,self.scheduled({'Recovered':1}),True,0)
27		self.insert_state('Asymptomatic',9,3,self.scheduled({'Recovered':1}),True,0)
28		self.insert_state('Recovered',100, 0,self.scheduled({'Recovered':1}),False,0)

agents.txt

  1300
  2Agent Index:Type:Susceptibility
  30:Office Staff:0.7
  41:Office Staff:0.7
  52:Office Staff:0.7
  63:Office Staff:0.7
  74:Office Staff:0.7
  85:Office Staff:0.7
  96:Office Staff:0.7
 107:Office Staff:0.7
 118:Office Staff:0.7
 129:Office Staff:0.7
 1310:Office Staff:0.7
 1411:Office Staff:0.7
 1512:Office Staff:0.7
 1613:Office Staff:0.7
 1714:Office Staff:0.7
 1815:Office Staff:0.7
 1916:Office Staff:0.7
 2017:Office Staff:0.7
 2118:Office Staff:0.7
 2219:Office Staff:0.7
 2320:Office Staff:0.7
 2421:Office Staff:0.7
 2522:Office Staff:0.7
 2623:Office Staff:0.7
 2724:Office Staff:0.7
 2825:Office Staff:0.7
 2926:Office Staff:0.7
 3027:Office Staff:0.7
 3128:Office Staff:0.7
 3229:Office Staff:0.7
 3330:Office Staff:0.7
 3431:Office Staff:0.7
 3532:Office Staff:0.7
 3633:Office Staff:0.7
 3734:Office Staff:0.7
 3835:Office Staff:0.7
 3936:Office Staff:0.7
 4037:Office Staff:0.7
 4138:Office Staff:0.7
 4239:Office Staff:0.7
 4340:Office Staff:0.7
 4441:Office Staff:0.7
 4542:Office Staff:0.7
 4643:Office Staff:0.7
 4744:Office Staff:0.7
 4845:Office Staff:0.7
 4946:Office Staff:0.7
 5047:Office Staff:0.7
 5148:Office Staff:0.7
 5249:Office Staff:0.7
 5350:Office Staff:0.7
 5451:Office Staff:0.7
 5552:Office Staff:0.7
 5653:Office Staff:0.7
 5754:Office Staff:0.7
 5855:Office Staff:0.7
 5956:Office Staff:0.7
 6057:Office Staff:0.7
 6158:Office Staff:0.7
 6259:Office Staff:0.7
 6360:Office Staff:0.7
 6461:Office Staff:0.7
 6562:Office Staff:0.7
 6663:Office Staff:0.7
 6764:Office Staff:0.7
 6865:Office Staff:0.7
 6966:Office Staff:0.7
 7067:Office Staff:0.7
 7168:Office Staff:0.7
 7269:Office Staff:0.7
 7370:Office Staff:0.7
 7471:Office Staff:0.7
 7572:Office Staff:0.7
 7673:Office Staff:0.7
 7774:Office Staff:0.7
 7875:Office Staff:0.7
 7976:Office Staff:0.7
 8077:Office Staff:0.7
 8178:Office Staff:0.7
 8279:Office Staff:0.7
 8380:Office Staff:0.7
 8481:Office Staff:0.7
 8582:Office Staff:0.7
 8683:Office Staff:0.7
 8784:Office Staff:0.7
 8885:Office Staff:0.7
 8986:Office Staff:0.7
 9087:Office Staff:0.7
 9188:Office Staff:0.7
 9289:Office Staff:0.7
 9390:Office Staff:0.7
 9491:Office Staff:0.7
 9592:Office Staff:0.7
 9693:Office Staff:0.7
 9794:Office Staff:0.7
 9895:Office Staff:0.7
 9996:Office Staff:0.7
10097:Office Staff:0.7
10198:Office Staff:0.7
10299:Office Staff:0.7
103100:Developer:0.5
104101:Developer:0.5
105102:Developer:0.5
106103:Developer:0.5
107104:Developer:0.5
108105:Developer:0.5
109106:Developer:0.5
110107:Developer:0.5
111108:Developer:0.5
112109:Developer:0.5
113110:Developer:0.5
114111:Developer:0.5
115112:Developer:0.5
116113:Developer:0.5
117114:Developer:0.5
118115:Developer:0.5
119116:Developer:0.5
120117:Developer:0.5
121118:Developer:0.5
122119:Developer:0.5
123120:Developer:0.5
124121:Developer:0.5
125122:Developer:0.5
126123:Developer:0.5
127124:Developer:0.5
128125:Developer:0.5
129126:Developer:0.5
130127:Developer:0.5
131128:Developer:0.5
132129:Developer:0.5
133130:Developer:0.5
134131:Developer:0.5
135132:Developer:0.5
136133:Developer:0.5
137134:Developer:0.5
138135:Developer:0.5
139136:Developer:0.5
140137:Developer:0.5
141138:Developer:0.5
142139:Developer:0.5
143140:Developer:0.5
144141:Developer:0.5
145142:Developer:0.5
146143:Developer:0.5
147144:Developer:0.5
148145:Developer:0.5
149146:Developer:0.5
150147:Developer:0.5
151148:Developer:0.5
152149:Developer:0.5
153150:Developer:0.5
154151:Developer:0.5
155152:Developer:0.5
156153:Developer:0.5
157154:Developer:0.5
158155:Developer:0.5
159156:Developer:0.5
160157:Developer:0.5
161158:Developer:0.5
162159:Developer:0.5
163160:Developer:0.5
164161:Developer:0.5
165162:Developer:0.5
166163:Developer:0.5
167164:Developer:0.5
168165:Developer:0.5
169166:Developer:0.5
170167:Developer:0.5
171168:Developer:0.5
172169:Developer:0.5
173170:Developer:0.5
174171:Developer:0.5
175172:Developer:0.5
176173:Developer:0.5
177174:Developer:0.5
178175:Developer:0.5
179176:Developer:0.5
180177:Developer:0.5
181178:Developer:0.5
182179:Developer:0.5
183180:Developer:0.5
184181:Developer:0.5
185182:Developer:0.5
186183:Developer:0.5
187184:Developer:0.5
188185:Developer:0.5
189186:Developer:0.5
190187:Developer:0.5
191188:Developer:0.5
192189:Developer:0.5
193190:Developer:0.5
194191:Developer:0.5
195192:Developer:0.5
196193:Developer:0.5
197194:Developer:0.5
198195:Developer:0.5
199196:Developer:0.5
200197:Developer:0.5

config.txt

 1Random Seed <3>
 2Number of worlds <10>
 3Number of Days <50>
 4Agent Parameter Keys <Agent Index:Type:Susceptibility>
 5Agent list filename <agents.txt>
 6Interaction Info Keys <Agent Index:Interacting Agent Index:Time Interval>
 7Interaction Files list filename <interaction_files_list.txt>
 8Probabilistic Interaction Files list filename <>
 9Location Parameter Keys <>
10Location list filename <>
11Event Parameter Keys <>
12Event Files list filename <>
13One Time Event filename <>

generate_agents.py

 1import numpy as np
 2
 3
 4def write_to_file(filename,n):
 5	info_dict={}
 6	#ID enumerates from 0 to n-1
 7	header='Agent Index:Type:Susceptibility'
 8	info_dict['Type']=['Office Staff','Developer','Designer']
 9	info_dict['Susceptibility']=['0.7','0.5','1']
10
11	f=open(filename,'w')
12	f.write(str(n)+'\n')
13	f.write(header+'\n')
14
15	for i in range(n):
16		f.write(str(i))
17		for j in info_dict.keys():
18			f.write(':'+info_dict[j][int(i/100)])
19		f.write('\n')
20
21
22write_to_file('agents.txt',300)

generate_contacts.py

 1import random
 2
 3import numpy as np
 4
 5
 6def write_to_file(filename,n,no_contacts):
 7	info_dict={}
 8	#ID enumerates from 0 to n-1
 9	header='Agent Index:Interacting Agent Index:Room Ventilation'
10
11	f=open(filename,'w')
12	f.write(str(no_contacts)+'\n')
13	f.write(header+'\n')
14
15	for i in range(no_contacts):
16		agent=random.randint(0,n-1)
17		contact_agent=random.randint(0,n-1)
18		room_ventilation=random.random()
19		f.write(str(agent)+':'+str(contact_agent)+':'+str(room_ventilation)+'\n')
20
21
22write_to_file('weekday_contacts.txt',300,500)
23write_to_file('weekend_contacts.txt',100,200)

interaction_files_list.txt

1<weekday_contacts.txt>
2<weekday_contacts.txt>
3<weekday_contacts.txt>
4<weekday_contacts.txt>
5<weekday_contacts.txt>
6<weekend_contacts.txt>
7<weekend_contacts.txt>

weekday_contacts.txt

  1500
  2Agent Index:Interacting Agent Index:Time Interval
  386:194:0.363382677097838
  423:60:0.05737508630439536
  5109:88:0.45794609256026597
  623:141:0.5326634717797075
  7299:29:0.006734061473219755
  813:247:0.6286590175132486
  9158:57:0.18082438170571258
 10251:251:0.9519285487708604
 11107:23:0.742462470241382
 1244:160:0.10285448532918684
 13246:274:0.39491731832217347
 14105:127:0.3341803119034249
 151:174:0.9969373839469244
 16263:200:0.8423653895324584
 17244:65:0.33937038548754117
 18269:57:0.48614330828732555
 19132:136:0.44976001666591714
 20226:230:0.49539846919393515
 2193:200:0.7559543913204214
 2258:147:0.01834053747072839
 23260:273:0.21822865069483433
 24178:136:0.298072406473165
 25221:32:0.7558013532248159
 26106:161:0.7996376078347497
 27246:94:0.960508722484202
 28233:58:0.07019633430167904
 29117:244:0.060562662456084326
 30158:271:0.6641867817478397
 3137:135:0.40423448794829175
 3250:72:0.8232365257744092
 33291:196:0.5856674426589038
 3437:95:0.17594777098447156
 35137:218:0.2764172465951007
 36248:270:0.48124554876359227
 37226:162:0.462186877573173
 38115:282:0.8971316529276944
 39226:249:0.786932309810938
 40239:162:0.3991380771019811
 41152:175:0.5038893774078231
 4257:143:0.24785503325970137
 43197:232:0.5422477248558065
 4470:216:0.4438739309259937
 45183:262:0.07745927132117303
 46297:223:0.3242344852921568
 4778:58:0.04656415789927448
 48288:90:0.9065990607024984
 49237:49:0.5221692082913499
 50111:15:0.7534925296966496
 51142:293:0.20347231872591687
 5258:111:0.9130598304242583
 53244:239:0.883233212874234
 5437:289:0.4526572251099553
 5523:272:0.656652850732811
 56132:180:0.15193979711878325
 57285:132:0.38719252083343847
 58265:70:0.7102260860264488
 59275:281:0.3801859777615577
 60234:125:0.9046412406218968
 6165:292:0.11839064287684187
 6284:260:0.2530985966726006
 6390:31:0.4016686706133782
 64163:146:0.14287369519201176
 658:248:0.6967240386110859
 6677:156:0.26515665703947633
 67183:287:0.6989534834349946
 6868:215:0.11481872440923402
 6998:245:0.7722998686336559
 70143:158:0.3681875412524903
 71224:183:0.502218145131218
 72158:2:0.6026560984068073
 73189:94:0.9319973057671235
 7459:280:0.41894970612916904
 75289:0:0.33455374399786897
 7646:5:0.8071199222806446
 7733:271:0.18449984750803194
 78233:299:0.09056863000660853
 79231:48:0.17758642516269996
 80280:39:0.04328882534444067
 81282:67:0.669048440451856
 82254:64:0.3189782344027632
 8376:17:0.2196952676995123
 84246:277:0.15192436983253998
 8569:56:0.4247050422014911
 8674:157:0.5939188585025204
 87265:36:0.30084578810895235
 88110:225:0.22643940227841797
 8913:103:0.8332915331978291
 9013:16:0.06488051084215773
 91279:100:0.9615034503622395
 92131:7:0.6821420773438361
 931:37:0.6677760907690996
 94188:158:0.8626653776959949
 956:237:0.8348739038044689
 9666:89:0.6182622079932064
 9749:32:0.353727219858078
 9834:271:0.003003110714105084
 99146:110:0.025196453940818486
100119:147:0.4497086397318325
10120:211:0.6739909753015358
102240:293:0.4550940251868444
103209:6:0.7890407556568965
104142:256:0.32959011831311325
105160:287:0.9716755722220477
106243:49:0.48470610304984507
10747:5:0.3806170044235232
108114:49:0.8109087230488309
10941:201:0.34982385429562946
110105:109:0.15453140623929296
111189:182:0.9987148573984527
112190:10:0.6884612962428445
113128:144:0.4197320908568287
114194:9:0.18474621844504158
115147:215:0.03680454870432193
116253:107:0.9203894716002635
11743:269:0.24002484994371742
11878:220:0.6502655201684909
119137:280:0.1401085158602715
120151:118:0.07167680488633343
121254:292:0.6529724699042042
122141:265:0.39900166693133055
123138:88:0.9932565879608933
124272:37:0.30850648882541
125275:187:0.6482628935877461
12652:101:0.7989984618298684
127224:46:0.9994325610813167
128235:57:0.2563353771650976
129262:275:0.44538958692385966
130278:197:0.053750049353002205
131158:111:0.37436177958465555
13276:66:0.3348842707235894
13346:115:0.7142496848656643
134279:206:0.06842916154209433
135141:206:0.17021915688443245
136224:32:0.7961735112777278
137130:107:0.7073683270230737
138243:69:0.12452186337589866
13926:73:0.3939868537230834
140218:250:0.49626620772379104
14130:18:0.9131388595492964
1421:296:0.5125777820034538
143253:178:0.4164696825851325
144138:278:0.597683741507795
145288:151:0.4352091237102317
14616:74:0.8947838287826291
14756:161:0.4232408850483762
148125:247:0.573706510635327
14940:102:0.18154180653123564
15060:40:0.4198515964666686
15172:149:0.4187418837320297
15275:251:0.39660787331923975
1531:249:0.8028977438395267
154148:49:0.0470201864939368
155213:124:0.9649994646127331
156190:233:0.14775262245870946
157103:71:0.05474865415255736
15847:265:0.8533566610628922
159269:228:0.7375518597879671
16067:169:0.9496769944040246
1617:218:0.8304403416049523
162104:210:0.6686329684597243
16331:55:0.7776200366434306
164184:249:0.7222393916956648
16542:119:0.08564625136703519
166266:119:0.2236585583035382
16760:163:0.6738857354376312
16872:40:0.07448199525388277
16921:80:0.0748936140349411
170278:40:0.4805754800661015
171171:37:0.1522121169824765
172255:40:0.7705164164916082
173200:94:0.9761227908663562
174150:80:0.8026269260870561
175147:129:0.18643765593714945
176153:292:0.10091816738929849
17732:255:0.41186308663387594
17815:42:0.186276427571201
179272:167:0.790901664913838
180118:233:0.6465225126239372
18170:282:0.7745919435644555
182120:65:0.1454760297186556
183228:230:0.6333391258668252
184239:229:0.4543077744078845
185174:199:0.6027975994256701
186219:25:0.13238273280484747
187269:299:0.3449185353142791
188117:4:0.5341178811039785
189288:26:0.10512978773834103
190299:253:0.03606322419137731
1914:20:0.96866090907813
192142:298:0.8176190418375724
193228:56:0.7157321928629918
194252:236:0.2780206260172835
195160:70:0.7394534717330496
19651:236:0.9378676232322529
19715:284:0.7276905018224065
19812:228:0.45925036590036117
199142:233:0.8257956616436953
200150:18:0.5973796855420124

weekend_contacts.txt

  1200
  2Agent Index:Interacting Agent Index:Time Interval
  39:27:0.7285820490251275
  479:30:0.43643267663334784
  541:97:0.3154443198946647
  689:81:0.11728253995313387
  761:0:0.6292758581589997
  881:68:0.11658195025730422
  951:42:0.8663124120452983
 1053:36:0.13745025623570328
 1124:23:0.5454298200874506
 1274:30:0.4418880258696175
 1384:50:0.7426280143108092
 141:56:0.48148017923781816
 1547:31:0.060247113295321064
 1648:33:0.027821145349981813
 1715:46:0.4047557258531924
 1858:57:0.7677138219259788
 197:37:0.5695610700353275
 2041:80:0.4868919400666598
 2191:1:0.44572956054671264
 2265:65:0.8184337090007665
 2372:93:0.6233878336385458
 2413:50:0.7982555614439892
 2550:43:0.6435229692924852
 2674:48:0.18735649262419363
 2797:21:0.5197075259377777
 2811:46:0.505955942211802
 2913:61:0.4288339878254973
 309:51:0.43044501616932207
 3167:16:0.1502552019369643
 3227:44:0.7830943076006983
 3338:66:0.13861648219027933
 3487:65:0.4241581472297228
 3525:96:0.02322988852501151
 3674:25:0.9414510134524089
 3768:69:0.2738617364986812
 3813:5:0.9005335573109458
 3954:45:0.1924656860815962
 4059:17:0.36171522590733096
 4116:46:0.9090115224227183
 4288:75:0.6889231457811219
 4366:98:0.060084372913805195
 4415:5:0.7382695034997636
 4542:26:0.7534090986161659
 4610:59:0.7406463452145128
 471:56:0.5223259583426555
 482:53:0.3778207773493224
 4912:59:0.6527332906907739
 5062:40:0.6488937581016144
 5129:99:0.8133083770929995
 5233:90:0.6747685263582849
 5334:43:0.24268710004046734
 5435:26:0.532751273683614
 5587:57:0.1501292799958357
 5657:40:0.6123648951398082
 5774:10:0.4152419866455974
 5880:78:0.5012705076900813
 5969:24:0.6676719379202161
 6031:29:0.6662890500090981
 6114:5:0.8210185511790247
 6294:85:0.7720579665922562
 6329:4:0.25164912122147276
 6420:51:0.5105009112231861
 6589:46:0.6528751025315475
 6695:66:0.802192342698625
 6739:33:0.9101612303599376
 6881:33:0.8543775546407352
 6921:56:0.3706113844831149
 7068:44:0.12422646481572663
 7148:43:0.34682001446864763
 7213:17:0.6276500371441114
 7363:94:0.8146946568645466
 7488:78:0.5209578611791694
 7597:36:0.5123862949195922
 7652:97:0.4574947691538137
 7743:30:0.44561396193011504
 7846:29:0.6217236713947522
 7956:5:0.8772376795860019
 804:16:0.6217621242078103
 8194:12:0.8230146856102053
 8214:74:0.6988758758853924
 8317:66:0.3472631714141693
 8440:20:0.12207650155552974
 8525:23:0.5800189525117784
 8666:88:0.6231440219982287
 8744:18:0.1322346728631314
 8825:63:0.6618679383445565
 8931:47:0.4610914135225338
 9046:89:0.5190042465490252
 9147:42:0.00815358980027292
 9286:65:0.6629266107589123
 9341:6:0.3054998038668849
 947:26:0.6170363111465597
 957:71:0.057822962934058086
 9620:99:0.10650563537390068
 9788:50:0.8519175577245196
 9880:68:0.9045120816451955
 9995:93:0.6002774315662224
10055:17:0.05348533516312315
1019:73:0.9434486171598113
10224:67:0.9653899553809171
10326:72:0.3500033869960779
10498:94:0.6471491235861588
10544:64:0.4925243637130817
10680:24:0.36347250972453493
10768:14:0.10755205351312014
10841:92:0.5534739132333136
10968:76:0.32888896259325007
11078:62:0.1829331563912473
11162:52:0.7666092813105568
1129:35:0.605864942537051
11372:14:0.7603134311799778
11497:55:0.18169217686916594
11536:31:0.9554387517081616
11681:80:0.7878947956757256
11777:3:0.34460592606183593
11855:22:0.46426480497754763
11982:11:0.566208134085341
12075:13:0.2120654842769314
12172:72:0.6860038205658056
12214:44:0.19369672128787352
12328:92:0.843721177343362
12413:77:0.19323777487351812
12524:51:0.5449500685706895
12611:18:0.7713598344121039
12775:40:0.07904358227043118
12895:88:0.5352527545939727
12991:22:0.8217839918727673
13019:62:0.6616821073865188
13185:84:0.2956423186993312
13238:94:0.9384682183894522
1336:55:0.3665512544012547
13492:84:0.708453603460874
13594:58:0.08117462718888191
13696:51:0.4178148231204242
13726:52:0.838227869464405
13843:94:0.5552463928422697
13928:72:0.379227837297593
14055:41:0.6264748109369973
14139:77:0.598279966773809
14260:32:0.4893552884083898
14332:91:0.4214880241005229
14488:59:0.09083345798603704
14573:27:0.9462435120077348
14623:18:0.06916520818263272
14715:95:0.9016398071698573
14877:59:0.28385632668515914
1490:3:0.29921694525977405
15030:14:0.9626807472136768
15142:24:0.8850199206146271
15276:88:0.3795640240125865
15336:7:0.7645121997604492
15484:42:0.7746278270508948
15589:18:0.8065816783548845
15641:25:0.23240771047169273
15781:6:0.7955775578407817
15845:9:0.9731745872561515
15990:9:0.6247358599634997
16017:31:0.2630901922381782
16123:33:0.34624303536116974
16289:17:0.9900291304139344
16316:53:0.6706330916247727
16454:62:0.5258139282918697
16564:19:0.008898383173741808
16632:17:0.7090567698435072
1673:0:0.4598274286770714
16852:26:0.16077246925129873
16976:49:0.9206884789189445
17056:22:0.034833882748383616
17173:3:0.895648468674582
17268:74:0.7933804792856991
17373:91:0.12836423179759393
17474:33:0.7975432659046741
1758:46:0.3595264311357027
17641:77:0.528005322314149
17717:21:0.14794508161072506
17828:76:0.032913082466142884
17941:55:0.360780391399085
18019:94:0.535819004389484
18132:6:0.6930718827077623
18289:65:0.7794182681357521
18332:11:0.20415982454366854
18498:69:0.9823460910304447
18586:45:0.5727646627164533
18633:65:0.5688298896215904
1871:33:0.360258869666344
18895:22:0.15350203769224513
18938:86:0.18196978924728302
19020:45:0.5166470856920276
19171:64:0.23502842989578565
19287:39:0.41301175814214985
19377:52:0.37615432912780833
19471:30:0.7061446694808394
19597:22:0.6138999794578468
19666:21:0.07118958421535238
19768:89:0.8631414492866706
1985:59:0.40500132701992997
1995:33:0.4418457705742146
20052:94:0.40395873627358325

Scheduled_SEYAR

This example has been built by introducing two additional states to the Scheduled SIR disease model- “Asymptomatic” and “Symptomatic”.

It includes one event where the agents either contribute to or receive from ambient infection.

This is a basic example which is used as a baseline for building more complex Scheduled models by introducing complexity in events, interactions, policies and restrictions.

This example helps in showing disease spread through an event where all agents interact with each other, and where transition from one state to another, for a population, may be symmetric about a mean. This is important for scenarios in which the population under consideration collectively shows a state transition that averages to a mean with some deviation. For custom distributions, please refer to the Miscellaneous examples directory.


Generate_policy.py

 1from episimmer.policy import lockdown_policy
 2
 3
 4def generate_policy():
 5	policy_list=[]
 6
 7	def lockdown_fn(time_step):
 8		return False
 9
10	policy_list.append(lockdown_policy.FullLockdown(lockdown_fn))
11
12	return policy_list

UserModel.py

 1import episimmer.model as model
 2
 3
 4def event_contribute_fn(agent,event_info,location,current_time_step):
 5	if agent.state=='Symptomatic':
 6		return 1
 7	elif agent.state=='Asymptomatic':
 8		return 0.6
 9	return 0
10
11def event_receive_fn(agent,ambient_infection,event_info,location,current_time_step):
12	#Example 1
13	beta=0.001
14	return ambient_infection*beta
15
16
17class UserModel(model.ScheduledModel):
18	def __init__(self):
19		model.ScheduledModel.__init__(self)
20		self.insert_state('Susceptible',None, None,self.p_infection({'Exposed':1}),False,0.95)
21		self.insert_state('Exposed',5,2,self.scheduled({'Symptomatic':0.3,'Asymptomatic':0.7}),False,0.02)
22		self.insert_state('Symptomatic',11,5,self.scheduled({'Recovered':1}),True,0.02)
23		self.insert_state('Asymptomatic',6,3,self.scheduled({'Recovered':1}),True,0.01)
24		self.insert_state('Recovered',100, 0,self.scheduled({'Recovered':1}),False,0)
25
26		self.set_event_contribution_fn(event_contribute_fn)
27		self.set_event_receive_fn(event_receive_fn)

agents.txt

  11000
  2Agent Index
  30
  41
  52
  63
  74
  85
  96
 107
 118
 129
 1310
 1411
 1512
 1613
 1714
 1815
 1916
 2017
 2118
 2219
 2320
 2421
 2522
 2623
 2724
 2825
 2926
 3027
 3128
 3229
 3330
 3431
 3532
 3633
 3734
 3835
 3936
 4037
 4138
 4239
 4340
 4441
 4542
 4643
 4744
 4845
 4946
 5047
 5148
 5249
 5350
 5451
 5552
 5653
 5754
 5855
 5956
 6057
 6158
 6259
 6360
 6461
 6562
 6663
 6764
 6865
 6966
 7067
 7168
 7269
 7370
 7471
 7572
 7673
 7774
 7875
 7976
 8077
 8178
 8279
 8380
 8481
 8582
 8683
 8784
 8885
 8986
 9087
 9188
 9289
 9390
 9491
 9592
 9693
 9794
 9895
 9996
10097
10198
10299
103100
104101
105102
106103
107104
108105
109106
110107
111108
112109
113110
114111
115112
116113
117114
118115
119116
120117
121118
122119
123120
124121
125122
126123
127124
128125
129126
130127
131128
132129
133130
134131
135132
136133
137134
138135
139136
140137
141138
142139
143140
144141
145142
146143
147144
148145
149146
150147
151148
152149
153150
154151
155152
156153
157154
158155
159156
160157
161158
162159
163160
164161
165162
166163
167164
168165
169166
170167
171168
172169
173170
174171
175172
176173
177174
178175
179176
180177
181178
182179
183180
184181
185182
186183
187184
188185
189186
190187
191188
192189
193190
194191
195192
196193
197194
198195
199196
200197

config.txt

 1Random Seed <3>
 2Number of worlds <10>
 3Number of Days <30>
 4Agent Parameter Keys <Agent Index>
 5Agent list filename <agents.txt>
 6Interaction Info Keys <>
 7Interaction Files list filename <>
 8Probabilistic Interaction Files list filename <>
 9Location Parameter Keys <Location Index>
10Location list filename <locations.txt>
11Event Parameter Keys <Location Index:Agents>
12Event Files list filename <event_files_list.txt>
13One Time Event filename <>

event_files_list.txt

1<one_event.txt>

generate_files.py

 1import sys
 2
 3import numpy as np
 4
 5
 6def write_agents(filename,n):
 7	header='Agent Index'
 8
 9	f=open(filename,'w')
10	f.write(str(n)+'\n')
11	f.write(header+'\n')
12
13	for i in range(n):
14		f.write(str(i)+'\n')
15
16def write_events(filename,no_locations,no_agents):
17	info_dict={}
18	#ID enumerates from 0 to n-1
19	header='Location Index:Agents'
20
21	f=open(filename,'w')
22	f.write(str(1)+'\n')
23	f.write(header+'\n')
24
25	line=str(0)+':'
26	for i in range(no_agents):
27		line+=str(i)
28		if i!=no_agents-1:
29			line+=','
30
31	f.write(line)
32
33number_of_agents=int(sys.argv[1])
34write_agents('agents.txt',number_of_agents)
35write_events('one_event.txt',1,number_of_agents)

locations.txt

11
2Location Index
30

one_event.txt

11
2Location Index:Agents
30:0,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,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271,272,273,274,275,276,277,278,279,280,281,282,283,284,285,286,287,288,289,290,291,292,293,294,295,296,297,298,299,300,301,302,303,304,305,306,307,308,309,310,311,312,313,314,315,316,317,318,319,320,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,337,338,339,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,356,357,358,359,360,361,362,363,364,365,366,367,368,369,370,371,372,373,374,375,376,377,378,379,380,381,382,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,399,400,401,402,403,404,405,406,407,408,409,410,411,412,413,414,415,416,417,418,419,420,421,422,423,424,425,426,427,428,429,430,431,432,433,434,435,436,437,438,439,440,441,442,443,444,445,446,447,448,449,450,451,452,453,454,455,456,457,458,459,460,461,462,463,464,465,466,467,468,469,470,471,472,473,474,475,476,477,478,479,480,481,482,483,484,485,486,487,488,489,490,491,492,493,494,495,496,497,498,499,500,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600,601,602,603,604,605,606,607,608,609,610,611,612,613,614,615,616,617,618,619,620,621,622,623,624,625,626,627,628,629,630,631,632,633,634,635,636,637,638,639,640,641,642,643,644,645,646,647,648,649,650,651,652,653,654,655,656,657,658,659,660,661,662,663,664,665,666,667,668,669,670,671,672,673,674,675,676,677,678,679,680,681,682,683,684,685,686,687,688,689,690,691,692,693,694,695,696,697,698,699,700,701,702,703,704,705,706,707,708,709,710,711,712,713,714,715,716,717,718,719,720,721,722,723,724,725,726,727,728,729,730,731,732,733,734,735,736,737,738,739,740,741,742,743,744,745,746,747,748,749,750,751,752,753,754,755,756,757,758,759,760,761,762,763,764,765,766,767,768,769,770,771,772,773,774,775,776,777,778,779,780,781,782,783,784,785,786,787,788,789,790,791,792,793,794,795,796,797,798,799,800,801,802,803,804,805,806,807,808,809,810,811,812,813,814,815,816,817,818,819,820,821,822,823,824,825,826,827,828,829,830,831,832,833,834,835,836,837,838,839,840,841,842,843,844,845,846,847,848,849,850,851,852,853,854,855,856,857,858,859,860,861,862,863,864,865,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,919,920,921,922,923,924,925,926,927,928,929,930,931,932,933,934,935,936,937,938,939,940,941,942,943,944,945,946,947,948,949,950,951,952,953,954,955,956,957,958,959,960,961,962,963,964,965,966,967,968,969,970,971,972,973,974,975,976,977,978,979,980,981,982,983,984,985,986,987,988,989,990,991,992,993,994,995,996,997,998,999

Scheduled_SIR

The disease transmission between states may be defined by schedule change in states. The states are Susceptible, Infected and Recovered.

The mean and variance parameters are used for the independent transitions.

Episimmer has used this example as a fundamental Scheduled model which uses the SIR compartmentalised representation.

In some populations, the agents might show a recovery period of 10 days on an average with a deviation of say 3 days, instead of the whole population recovering at some constant rate. In other words, the transition between states may be symmetric about some mean. In such situations, the transition between the states can be scheduled with some mean and standard deviation.

This model provides a more realistic method of transitioning between states with respect to how the general population reacts to disease spread.


Generate_policy.py

 1from episimmer.policy import lockdown_policy
 2
 3
 4def generate_policy():
 5	policy_list=[]
 6
 7	def lockdown_fn(time_step):
 8		return False
 9
10	policy_list.append(lockdown_policy.FullLockdown(lockdown_fn))
11
12	return policy_list

UserModel.py

 1import episimmer.model as model
 2
 3
 4def event_contribute_fn(agent,event_info,location,current_time_step):
 5	if agent.state=='Infected':
 6		return 1
 7	return 0
 8
 9def event_receive_fn(agent,ambient_infection,event_info,location,current_time_step):
10	#Example 1
11	beta=0.001
12	return ambient_infection*beta
13
14
15class UserModel(model.ScheduledModel):
16	def __init__(self):
17		model.ScheduledModel.__init__(self)
18		self.insert_state('Susceptible',None, None,self.p_infection({'Infected':1}),False,0.99)
19		self.insert_state('Infected',6,3,self.scheduled({'Recovered':1}),True,0.01)
20		self.insert_state('Recovered',0, 0,self.scheduled({'Recovered':1}),False,0)
21
22		self.set_event_contribution_fn(event_contribute_fn)
23		self.set_event_receive_fn(event_receive_fn)

agents.txt

  11000
  2Agent Index
  30
  41
  52
  63
  74
  85
  96
 107
 118
 129
 1310
 1411
 1512
 1613
 1714
 1815
 1916
 2017
 2118
 2219
 2320
 2421
 2522
 2623
 2724
 2825
 2926
 3027
 3128
 3229
 3330
 3431
 3532
 3633
 3734
 3835
 3936
 4037
 4138
 4239
 4340
 4441
 4542
 4643
 4744
 4845
 4946
 5047
 5148
 5249
 5350
 5451
 5552
 5653
 5754
 5855
 5956
 6057
 6158
 6259
 6360
 6461
 6562
 6663
 6764
 6865
 6966
 7067
 7168
 7269
 7370
 7471
 7572
 7673
 7774
 7875
 7976
 8077
 8178
 8279
 8380
 8481
 8582
 8683
 8784
 8885
 8986
 9087
 9188
 9289
 9390
 9491
 9592
 9693
 9794
 9895
 9996
10097
10198
10299
103100
104101
105102
106103
107104
108105
109106
110107
111108
112109
113110
114111
115112
116113
117114
118115
119116
120117
121118
122119
123120
124121
125122
126123
127124
128125
129126
130127
131128
132129
133130
134131
135132
136133
137134
138135
139136
140137
141138
142139
143140
144141
145142
146143
147144
148145
149146
150147
151148
152149
153150
154151
155152
156153
157154
158155
159156
160157
161158
162159
163160
164161
165162
166163
167164
168165
169166
170167
171168
172169
173170
174171
175172
176173
177174
178175
179176
180177
181178
182179
183180
184181
185182
186183
187184
188185
189186
190187
191188
192189
193190
194191
195192
196193
197194
198195
199196
200197

config.txt

 1Random Seed <3>
 2Number of worlds <10>
 3Number of Days <30>
 4Agent Parameter Keys <Agent Index>
 5Agent list filename <agents.txt>
 6Interaction Info Keys <>
 7Interaction Files list filename <>
 8Probabilistic Interaction Files list filename <>
 9Location Parameter Keys <Location Index>
10Location list filename <locations.txt>
11Event Parameter Keys <Location Index:Agents>
12Event Files list filename <event_files_list.txt>
13One Time Event filename <>

event_files_list.txt

1<one_event.txt>

generate_files.py

 1import sys
 2
 3import numpy as np
 4
 5
 6def write_agents(filename,n):
 7	header='Agent Index'
 8
 9	f=open(filename,'w')
10	f.write(str(n)+'\n')
11	f.write(header+'\n')
12
13	for i in range(n):
14		f.write(str(i)+'\n')
15
16def write_events(filename,no_locations,no_agents):
17	info_dict={}
18	#ID enumerates from 0 to n-1
19	header='Location Index:Agents'
20
21	f=open(filename,'w')
22	f.write(str(1)+'\n')
23	f.write(header+'\n')
24
25	line=str(0)+':'
26	for i in range(no_agents):
27		line+=str(i)
28		if i!=no_agents-1:
29			line+=','
30
31	f.write(line)
32
33number_of_agents=int(sys.argv[1])
34write_agents('agents.txt',number_of_agents)
35write_events('one_event.txt',1,number_of_agents)

locations.txt

11
2Location Index
30

one_event.txt

11
2Location Index:Agents
30:0,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,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271,272,273,274,275,276,277,278,279,280,281,282,283,284,285,286,287,288,289,290,291,292,293,294,295,296,297,298,299,300,301,302,303,304,305,306,307,308,309,310,311,312,313,314,315,316,317,318,319,320,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,337,338,339,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,356,357,358,359,360,361,362,363,364,365,366,367,368,369,370,371,372,373,374,375,376,377,378,379,380,381,382,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,399,400,401,402,403,404,405,406,407,408,409,410,411,412,413,414,415,416,417,418,419,420,421,422,423,424,425,426,427,428,429,430,431,432,433,434,435,436,437,438,439,440,441,442,443,444,445,446,447,448,449,450,451,452,453,454,455,456,457,458,459,460,461,462,463,464,465,466,467,468,469,470,471,472,473,474,475,476,477,478,479,480,481,482,483,484,485,486,487,488,489,490,491,492,493,494,495,496,497,498,499,500,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600,601,602,603,604,605,606,607,608,609,610,611,612,613,614,615,616,617,618,619,620,621,622,623,624,625,626,627,628,629,630,631,632,633,634,635,636,637,638,639,640,641,642,643,644,645,646,647,648,649,650,651,652,653,654,655,656,657,658,659,660,661,662,663,664,665,666,667,668,669,670,671,672,673,674,675,676,677,678,679,680,681,682,683,684,685,686,687,688,689,690,691,692,693,694,695,696,697,698,699,700,701,702,703,704,705,706,707,708,709,710,711,712,713,714,715,716,717,718,719,720,721,722,723,724,725,726,727,728,729,730,731,732,733,734,735,736,737,738,739,740,741,742,743,744,745,746,747,748,749,750,751,752,753,754,755,756,757,758,759,760,761,762,763,764,765,766,767,768,769,770,771,772,773,774,775,776,777,778,779,780,781,782,783,784,785,786,787,788,789,790,791,792,793,794,795,796,797,798,799,800,801,802,803,804,805,806,807,808,809,810,811,812,813,814,815,816,817,818,819,820,821,822,823,824,825,826,827,828,829,830,831,832,833,834,835,836,837,838,839,840,841,842,843,844,845,846,847,848,849,850,851,852,853,854,855,856,857,858,859,860,861,862,863,864,865,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,919,920,921,922,923,924,925,926,927,928,929,930,931,932,933,934,935,936,937,938,939,940,941,942,943,944,945,946,947,948,949,950,951,952,953,954,955,956,957,958,959,960,961,962,963,964,965,966,967,968,969,970,971,972,973,974,975,976,977,978,979,980,981,982,983,984,985,986,987,988,989,990,991,992,993,994,995,996,997,998,999

Stochastic_SEYAR

This example has been built by extending the Stochastic SIR model by introducing the additional states “Asymptomatic” and “Symptomatic”.

Episimmer uses this example to explore a different type of compartmentalised model. This helps ascertain the fact that the simulation works for more complex state transitions as well (Exposed to Asymptomatic and Symptomatic).

This example proves that we can have multiple transitions from a single state and each of these transitions can be chosen with a certain probability.


Generate_policy.py

 1from episimmer.policy import lockdown_policy
 2
 3
 4def generate_policy():
 5	policy_list=[]
 6
 7	def lockdown_fn(time_step):
 8		return False
 9
10	policy_list.append(lockdown_policy.FullLockdown(lockdown_fn))
11
12	return policy_list

UserModel.py

 1import episimmer.model as model
 2
 3
 4def event_contribute_fn(agent,event_info,location,current_time_step):
 5	if agent.state=='Symptomatic':
 6		return 1
 7	elif agent.state=='Asymptomatic':
 8		return 0.5
 9	return 0
10
11def event_receive_fn(agent,ambient_infection,event_info,location,current_time_step):
12	#Example 1
13	beta=0.001
14	return ambient_infection*beta
15
16
17class UserModel(model.StochasticModel):
18	def __init__(self):
19		individual_types=['Susceptible','Exposed','Asymptomatic','Symptomatic','Recovered']
20		infected_states=['Asymptomatic','Symptomatic']
21		state_proportion={
22							'Susceptible':0.99,
23							'Exposed':0,
24							'Recovered':0,
25							'Asymptomatic':0,
26							'Symptomatic':0.01
27						}
28		model.StochasticModel.__init__(self,individual_types,infected_states,state_proportion)
29		self.set_transition('Susceptible', 'Exposed', self.p_infection())
30		self.set_transition('Exposed', 'Symptomatic', self.p_standard(0.15))
31		self.set_transition('Exposed', 'Asymptomatic', self.p_standard(0.2))
32		self.set_transition('Symptomatic', 'Recovered', self.p_standard(0.1))
33		self.set_transition('Asymptomatic', 'Recovered', self.p_standard(0.1))
34
35		self.set_event_contribution_fn(event_contribute_fn)
36		self.set_event_receive_fn(event_receive_fn)

agents.txt

  11000
  2Agent Index
  30
  41
  52
  63
  74
  85
  96
 107
 118
 129
 1310
 1411
 1512
 1613
 1714
 1815
 1916
 2017
 2118
 2219
 2320
 2421
 2522
 2623
 2724
 2825
 2926
 3027
 3128
 3229
 3330
 3431
 3532
 3633
 3734
 3835
 3936
 4037
 4138
 4239
 4340
 4441
 4542
 4643
 4744
 4845
 4946
 5047
 5148
 5249
 5350
 5451
 5552
 5653
 5754
 5855
 5956
 6057
 6158
 6259
 6360
 6461
 6562
 6663
 6764
 6865
 6966
 7067
 7168
 7269
 7370
 7471
 7572
 7673
 7774
 7875
 7976
 8077
 8178
 8279
 8380
 8481
 8582
 8683
 8784
 8885
 8986
 9087
 9188
 9289
 9390
 9491
 9592
 9693
 9794
 9895
 9996
10097
10198
10299
103100
104101
105102
106103
107104
108105
109106
110107
111108
112109
113110
114111
115112
116113
117114
118115
119116
120117
121118
122119
123120
124121
125122
126123
127124
128125
129126
130127
131128
132129
133130
134131
135132
136133
137134
138135
139136
140137
141138
142139
143140
144141
145142
146143
147144
148145
149146
150147
151148
152149
153150
154151
155152
156153
157154
158155
159156
160157
161158
162159
163160
164161
165162
166163
167164
168165
169166
170167
171168
172169
173170
174171
175172
176173
177174
178175
179176
180177
181178
182179
183180
184181
185182
186183
187184
188185
189186
190187
191188
192189
193190
194191
195192
196193
197194
198195
199196
200197

config.txt

 1Random Seed <3>
 2Number of worlds <10>
 3Number of Days <50>
 4Agent Parameter Keys <Agent Index>
 5Agent list filename <agents.txt>
 6Interaction Info Keys <>
 7Interaction Files list filename <>
 8Probabilistic Interaction Files list filename <>
 9Location Parameter Keys <Location Index>
10Location list filename <locations.txt>
11Event Parameter Keys <Location Index:Agents>
12Event Files list filename <event_files_list.txt>
13One Time Event filename <>

event_files_list.txt

1<one_event.txt>

generate_files.py

 1import sys
 2
 3import numpy as np
 4
 5
 6def write_agents(filename,n):
 7	header='Agent Index'
 8
 9	f=open(filename,'w')
10	f.write(str(n)+'\n')
11	f.write(header+'\n')
12
13	for i in range(n):
14		f.write(str(i)+'\n')
15
16def write_events(filename,no_locations,no_agents):
17	info_dict={}
18	#ID enumerates from 0 to n-1
19	header='Location Index:Agents'
20
21	f=open(filename,'w')
22	f.write(str(1)+'\n')
23	f.write(header+'\n')
24
25	line=str(0)+':'
26	for i in range(no_agents):
27		line+=str(i)
28		if i!=no_agents-1:
29			line+=','
30
31	f.write(line)
32
33number_of_agents=int(sys.argv[1])
34write_agents('agents.txt',number_of_agents)
35write_events('one_event.txt',1,number_of_agents)

locations.txt

11
2Location Index
30

one_event.txt

11
2Location Index:Agents
30:0,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,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271,272,273,274,275,276,277,278,279,280,281,282,283,284,285,286,287,288,289,290,291,292,293,294,295,296,297,298,299,300,301,302,303,304,305,306,307,308,309,310,311,312,313,314,315,316,317,318,319,320,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,337,338,339,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,356,357,358,359,360,361,362,363,364,365,366,367,368,369,370,371,372,373,374,375,376,377,378,379,380,381,382,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,399,400,401,402,403,404,405,406,407,408,409,410,411,412,413,414,415,416,417,418,419,420,421,422,423,424,425,426,427,428,429,430,431,432,433,434,435,436,437,438,439,440,441,442,443,444,445,446,447,448,449,450,451,452,453,454,455,456,457,458,459,460,461,462,463,464,465,466,467,468,469,470,471,472,473,474,475,476,477,478,479,480,481,482,483,484,485,486,487,488,489,490,491,492,493,494,495,496,497,498,499,500,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600,601,602,603,604,605,606,607,608,609,610,611,612,613,614,615,616,617,618,619,620,621,622,623,624,625,626,627,628,629,630,631,632,633,634,635,636,637,638,639,640,641,642,643,644,645,646,647,648,649,650,651,652,653,654,655,656,657,658,659,660,661,662,663,664,665,666,667,668,669,670,671,672,673,674,675,676,677,678,679,680,681,682,683,684,685,686,687,688,689,690,691,692,693,694,695,696,697,698,699,700,701,702,703,704,705,706,707,708,709,710,711,712,713,714,715,716,717,718,719,720,721,722,723,724,725,726,727,728,729,730,731,732,733,734,735,736,737,738,739,740,741,742,743,744,745,746,747,748,749,750,751,752,753,754,755,756,757,758,759,760,761,762,763,764,765,766,767,768,769,770,771,772,773,774,775,776,777,778,779,780,781,782,783,784,785,786,787,788,789,790,791,792,793,794,795,796,797,798,799,800,801,802,803,804,805,806,807,808,809,810,811,812,813,814,815,816,817,818,819,820,821,822,823,824,825,826,827,828,829,830,831,832,833,834,835,836,837,838,839,840,841,842,843,844,845,846,847,848,849,850,851,852,853,854,855,856,857,858,859,860,861,862,863,864,865,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,919,920,921,922,923,924,925,926,927,928,929,930,931,932,933,934,935,936,937,938,939,940,941,942,943,944,945,946,947,948,949,950,951,952,953,954,955,956,957,958,959,960,961,962,963,964,965,966,967,968,969,970,971,972,973,974,975,976,977,978,979,980,981,982,983,984,985,986,987,988,989,990,991,992,993,994,995,996,997,998,999

Stochastic_SIR

This example has been built using the Stochastic Model consisting of three states Susceptible, Infected and Recovered.

The agents are allowed to interact in an event at a location where they can contribute to or receive from an ambient infection.

As output, it plots a graph that helps us visualize disease spread over a specified number of time steps and a specified number of worlds.

This example is the fundamental Stochastic model in Episummer which uses the SIR compartmentalised representation.


Generate_policy.py

 1from episimmer.policy import lockdown_policy
 2
 3
 4def generate_policy():
 5	policy_list=[]
 6
 7	def lockdown_fn(time_step):
 8		return False
 9
10	policy_list.append(lockdown_policy.FullLockdown(lockdown_fn))
11
12	return policy_list

UserModel.py

 1import episimmer.model as model
 2
 3#The two functions event_contribute_fn and event_receive_fn together control the spread of infection
 4
 5# This function states the amount an agent contributes to ambient infection in the region
 6#note that only infected agents contibute to the ambient infection
 7def event_contribute_fn(agent,event_info,location,current_time_step):
 8	if agent.state=='Infected':
 9		return 1
10	return 0
11
12#This function states the probability of an agent becoming infected from the ambient infection
13def event_receive_fn(agent,ambient_infection,event_info,location,current_time_step):
14	beta=0.001
15	return ambient_infection*beta
16
17
18class UserModel(model.StochasticModel):
19	def __init__(self):
20		individual_types=['Susceptible','Infected','Recovered']	#These are the states that will be used by the compartmental model
21		infected_states=['Infected']	#These are the states that can infect
22		state_proportion={				#This is the starting proportions of each state
23							'Susceptible':0.99,
24							'Infected':0.01,
25							'Recovered':0
26						}
27		model.StochasticModel.__init__(self,individual_types,infected_states,state_proportion)  #We use the inbuilt model in the package
28		self.set_transition('Susceptible', 'Infected', self.p_infection())	#Adding S-> I dependent transition
29		self.set_transition('Infected', 'Recovered', self.p_standard(0.2))	#Adding the I->R independent transition
30
31
32		self.set_event_contribution_fn(event_contribute_fn)
33		self.set_event_receive_fn(event_receive_fn)
34
35		self.name='Stochastic SIR'

agents.csv

  1Agent Index
  20
  31
  42
  53
  64
  75
  86
  97
 108
 119
 1210
 1311
 1412
 1513
 1614
 1715
 1816
 1917
 2018
 2119
 2220
 2321
 2422
 2523
 2624
 2725
 2826
 2927
 3028
 3129
 3230
 3331
 3432
 3533
 3634
 3735
 3836
 3937
 4038
 4139
 4240
 4341
 4442
 4543
 4644
 4745
 4846
 4947
 5048
 5149
 5250
 5351
 5452
 5553
 5654
 5755
 5856
 5957
 6058
 6159
 6260
 6361
 6462
 6563
 6664
 6765
 6866
 6967
 7068
 7169
 7270
 7371
 7472
 7573
 7674
 7775
 7876
 7977
 8078
 8179
 8280
 8381
 8482
 8583
 8684
 8785
 8886
 8987
 9088
 9189
 9290
 9391
 9492
 9593
 9694
 9795
 9896
 9997
10098
10199
102100
103101
104102
105103
106104
107105
108106
109107
110108
111109
112110
113111
114112
115113
116114
117115
118116
119117
120118
121119
122120
123121
124122
125123
126124
127125
128126
129127
130128
131129
132130
133131
134132
135133
136134
137135
138136
139137
140138
141139
142140
143141
144142
145143
146144
147145
148146
149147
150148
151149
152150
153151
154152
155153
156154
157155
158156
159157
160158
161159
162160
163161
164162
165163
166164
167165
168166
169167
170168
171169
172170
173171
174172
175173
176174
177175
178176
179177
180178
181179
182180
183181
184182
185183
186184
187185
188186
189187
190188
191189
192190
193191
194192
195193
196194
197195
198196
199197
200198

agents.txt

  11000
  2Agent Index
  30
  41
  52
  63
  74
  85
  96
 107
 118
 129
 1310
 1411
 1512
 1613
 1714
 1815
 1916
 2017
 2118
 2219
 2320
 2421
 2522
 2623
 2724
 2825
 2926
 3027
 3128
 3229
 3330
 3431
 3532
 3633
 3734
 3835
 3936
 4037
 4138
 4239
 4340
 4441
 4542
 4643
 4744
 4845
 4946
 5047
 5148
 5249
 5350
 5451
 5552
 5653
 5754
 5855
 5956
 6057
 6158
 6259
 6360
 6461
 6562
 6663
 6764
 6865
 6966
 7067
 7168
 7269
 7370
 7471
 7572
 7673
 7774
 7875
 7976
 8077
 8178
 8279
 8380
 8481
 8582
 8683
 8784
 8885
 8986
 9087
 9188
 9289
 9390
 9491
 9592
 9693
 9794
 9895
 9996
10097
10198
10299
103100
104101
105102
106103
107104
108105
109106
110107
111108
112109
113110
114111
115112
116113
117114
118115
119116
120117
121118
122119
123120
124121
125122
126123
127124
128125
129126
130127
131128
132129
133130
134131
135132
136133
137134
138135
139136
140137
141138
142139
143140
144141
145142
146143
147144
148145
149146
150147
151148
152149
153150
154151
155152
156153
157154
158155
159156
160157
161158
162159
163160
164161
165162
166163
167164
168165
169166
170167
171168
172169
173170
174171
175172
176173
177174
178175
179176
180177
181178
182179
183180
184181
185182
186183
187184
188185
189186
190187
191188
192189
193190
194191
195192
196193
197194
198195
199196
200197

config.txt

 1Random Seed <3>
 2Number of worlds <1>
 3Number of Days <30>
 4Agent Parameter Keys <Agent Index>
 5Agent list filename <agents.csv>
 6Interaction Info Keys <>
 7Interaction Files list filename <>
 8Probabilistic Interaction Files list filename <>
 9Location Parameter Keys <Location Index>
10Location list filename <locations.txt>
11Event Parameter Keys <Location Index:Agents>
12Event Files list filename <event_files_list.txt>
13One Time Event filename <>

event_files_list.txt

1<one_event.txt>

generate_files.py

 1import sys
 2
 3import numpy as np
 4
 5
 6def write_agents(filename,n):
 7	header='Agent Index'
 8
 9	f=open(filename,'w')
10	f.write(str(n)+'\n')
11	f.write(header+'\n')
12
13	for i in range(n):
14		f.write(str(i)+'\n')
15
16def write_events(filename,no_locations,no_agents):
17	info_dict={}
18	#ID enumerates from 0 to n-1
19	header='Location Index:Agents'
20
21	f=open(filename,'w')
22	f.write(str(1)+'\n')
23	f.write(header+'\n')
24
25	line=str(0)+':'
26	for i in range(no_agents):
27		line+=str(i)
28		if i!=no_agents-1:
29			line+=','
30
31	f.write(line)
32
33number_of_agents=int(sys.argv[1])
34write_agents('agents.txt',number_of_agents)
35write_events('one_event.txt',1,number_of_agents)

generate_files_csv.py

1from csv import DictWriter
2
3with open('agents.csv', 'w', newline='') as file:
4    fieldnames = ['Agent Index']
5    writer = DictWriter(file, fieldnames=fieldnames)
6
7    writer.writeheader()
8    for i in range(1000):
9    	writer.writerow({'Agent Index': i})

generate_interactions.py

 1from csv import DictWriter
 2
 3with open('interactions.csv', 'w', newline='') as file:
 4    fieldnames = ['Agent Index','Interacting Agent']
 5    writer = DictWriter(file, fieldnames=fieldnames)
 6
 7    writer.writeheader()
 8    for i in range(1000):
 9    	if i!=10:
10    		writer.writerow({'Agent Index': i,'Interacting Agent':i+1})

locations.txt

11
2Location Index
30

one_event.txt

11
2Location Index:Agents
30:0,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,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271,272,273,274,275,276,277,278,279,280,281,282,283,284,285,286,287,288,289,290,291,292,293,294,295,296,297,298,299,300,301,302,303,304,305,306,307,308,309,310,311,312,313,314,315,316,317,318,319,320,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,337,338,339,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,356,357,358,359,360,361,362,363,364,365,366,367,368,369,370,371,372,373,374,375,376,377,378,379,380,381,382,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,399,400,401,402,403,404,405,406,407,408,409,410,411,412,413,414,415,416,417,418,419,420,421,422,423,424,425,426,427,428,429,430,431,432,433,434,435,436,437,438,439,440,441,442,443,444,445,446,447,448,449,450,451,452,453,454,455,456,457,458,459,460,461,462,463,464,465,466,467,468,469,470,471,472,473,474,475,476,477,478,479,480,481,482,483,484,485,486,487,488,489,490,491,492,493,494,495,496,497,498,499,500,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600,601,602,603,604,605,606,607,608,609,610,611,612,613,614,615,616,617,618,619,620,621,622,623,624,625,626,627,628,629,630,631,632,633,634,635,636,637,638,639,640,641,642,643,644,645,646,647,648,649,650,651,652,653,654,655,656,657,658,659,660,661,662,663,664,665,666,667,668,669,670,671,672,673,674,675,676,677,678,679,680,681,682,683,684,685,686,687,688,689,690,691,692,693,694,695,696,697,698,699,700,701,702,703,704,705,706,707,708,709,710,711,712,713,714,715,716,717,718,719,720,721,722,723,724,725,726,727,728,729,730,731,732,733,734,735,736,737,738,739,740,741,742,743,744,745,746,747,748,749,750,751,752,753,754,755,756,757,758,759,760,761,762,763,764,765,766,767,768,769,770,771,772,773,774,775,776,777,778,779,780,781,782,783,784,785,786,787,788,789,790,791,792,793,794,795,796,797,798,799,800,801,802,803,804,805,806,807,808,809,810,811,812,813,814,815,816,817,818,819,820,821,822,823,824,825,826,827,828,829,830,831,832,833,834,835,836,837,838,839,840,841,842,843,844,845,846,847,848,849,850,851,852,853,854,855,856,857,858,859,860,861,862,863,864,865,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,919,920,921,922,923,924,925,926,927,928,929,930,931,932,933,934,935,936,937,938,939,940,941,942,943,944,945,946,947,948,949,950,951,952,953,954,955,956,957,958,959,960,961,962,963,964,965,966,967,968,969,970,971,972,973,974,975,976,977,978,979,980,981,982,983,984,985,986,987,988,989,990,991,992,993,994,995,996,997,998,999

Stochastic_SIRID_variable_rates

This example has been built by extending the Stochastic SIR model by introducing the additional states “ICU” and “Dead”.

This example demonstrates the flexibility that can be achieved while working with different compartmentalised models.

During the outbreak of an infection, the agents of the population may adapt to the changing environments by inventing new and better medication. Such behavioural approaches may influence the rate at which the population progresses to a state.

This shows that it is not always necessary to have a constant rate of transition between states. The variable rates of state transition may be defined as a function of the current time step (as seen in UserModel.py).


Generate_policy.py

 1from episimmer.policy import lockdown_policy
 2
 3
 4def generate_policy():
 5	policy_list=[]
 6
 7	def lockdown_fn(time_step):
 8		#if time_step%10<2:
 9		#	return True
10		return False
11
12	policy_list.append(lockdown_policy.FullLockdown(lockdown_fn))
13
14	return policy_list

UserModel.py

 1import episimmer.model as model
 2
 3
 4#User defined functions
 5def fn1(current_time_step): #ICU recovery improves over time as doctors learn how to treat better
 6	return min(0.5,0.2+current_time_step*0.01)
 7
 8def fn2(current_time_step): #People going into ICU decreases due to better drugs
 9	return max(0.02,0.1-current_time_step*0.001)
10
11def event_contribute_fn(agent,event_info,location,current_time_step):
12	if agent.state=='Infected':
13		return 1
14	return 0
15
16def event_receive_fn(agent,ambient_infection,event_info,location,current_time_step):
17	#Example 1
18	#6th to 10th day lockdown so no spread, after that precations are taken so rate of infection decreases
19	if current_time_step<5:
20		beta=0.001
21	elif current_time_step<10:
22		beta=0
23	else:
24		beta=0.0008
25	return ambient_infection*beta
26
27
28class UserModel(model.StochasticModel):
29	def __init__(self):
30		individual_types=['Susceptible','Infected','Recovered','ICU','Dead']
31		infected_states=['Infected']
32		state_proportion={
33							'Susceptible':0.99,
34							'Infected':0.01,
35							'Recovered':0,
36							'ICU':0,
37							'Dead':0
38						}
39		model.StochasticModel.__init__(self,individual_types,infected_states,state_proportion)
40		self.set_transition('Susceptible', 'Infected', self.p_infection())
41		self.set_transition('Infected', 'Recovered', self.p_standard(0.1))
42		self.set_transition('Infected', 'ICU', self.p_function(fn2))
43		self.set_transition('ICU', 'Recovered', self.p_function(fn1))
44		self.set_transition('ICU', 'Dead', self.p_standard(0.05))
45
46		self.set_event_contribution_fn(event_contribute_fn)
47		self.set_event_receive_fn(event_receive_fn)

agents.txt

  11000
  2Agent Index
  30
  41
  52
  63
  74
  85
  96
 107
 118
 129
 1310
 1411
 1512
 1613
 1714
 1815
 1916
 2017
 2118
 2219
 2320
 2421
 2522
 2623
 2724
 2825
 2926
 3027
 3128
 3229
 3330
 3431
 3532
 3633
 3734
 3835
 3936
 4037
 4138
 4239
 4340
 4441
 4542
 4643
 4744
 4845
 4946
 5047
 5148
 5249
 5350
 5451
 5552
 5653
 5754
 5855
 5956
 6057
 6158
 6259
 6360
 6461
 6562
 6663
 6764
 6865
 6966
 7067
 7168
 7269
 7370
 7471
 7572
 7673
 7774
 7875
 7976
 8077
 8178
 8279
 8380
 8481
 8582
 8683
 8784
 8885
 8986
 9087
 9188
 9289
 9390
 9491
 9592
 9693
 9794
 9895
 9996
10097
10198
10299
103100
104101
105102
106103
107104
108105
109106
110107
111108
112109
113110
114111
115112
116113
117114
118115
119116
120117
121118
122119
123120
124121
125122
126123
127124
128125
129126
130127
131128
132129
133130
134131
135132
136133
137134
138135
139136
140137
141138
142139
143140
144141
145142
146143
147144
148145
149146
150147
151148
152149
153150
154151
155152
156153
157154
158155
159156
160157
161158
162159
163160
164161
165162
166163
167164
168165
169166
170167
171168
172169
173170
174171
175172
176173
177174
178175
179176
180177
181178
182179
183180
184181
185182
186183
187184
188185
189186
190187
191188
192189
193190
194191
195192
196193
197194
198195
199196
200197

config.txt

 1Random Seed <3>
 2Number of worlds <1>
 3Number of Days <30>
 4Agent Parameter Keys <Agent Index>
 5Agent list filename <agents.txt>
 6Interaction Info Keys <>
 7Interaction Files list filename <>
 8Probabilistic Interaction Files list filename <>
 9Location Parameter Keys <Location Index>
10Location list filename <locations.txt>
11Event Parameter Keys <Location Index:Agents>
12Event Files list filename <event_files_list.txt>
13One Time Event filename <>

event_files_list.txt

1<one_event.txt>

generate_files.py

 1import sys
 2
 3import numpy as np
 4
 5
 6def write_agents(filename,n):
 7	header='Agent Index'
 8
 9	f=open(filename,'w')
10	f.write(str(n)+'\n')
11	f.write(header+'\n')
12
13	for i in range(n):
14		f.write(str(i)+'\n')
15
16def write_events(filename,no_locations,no_agents):
17	info_dict={}
18	#ID enumerates from 0 to n-1
19	header='Location Index:Agents'
20
21	f=open(filename,'w')
22	f.write(str(1)+'\n')
23	f.write(header+'\n')
24
25	line=str(0)+':'
26	for i in range(no_agents):
27		line+=str(i)
28		if i!=no_agents-1:
29			line+=','
30
31	f.write(line)
32
33number_of_agents=int(sys.argv[1])
34write_agents('agents.txt',number_of_agents)
35write_events('one_event.txt',1,number_of_agents)

locations.txt

11
2Location Index
30

one_event.txt

11
2Location Index:Agents
30:0,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,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271,272,273,274,275,276,277,278,279,280,281,282,283,284,285,286,287,288,289,290,291,292,293,294,295,296,297,298,299,300,301,302,303,304,305,306,307,308,309,310,311,312,313,314,315,316,317,318,319,320,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,337,338,339,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,356,357,358,359,360,361,362,363,364,365,366,367,368,369,370,371,372,373,374,375,376,377,378,379,380,381,382,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,399,400,401,402,403,404,405,406,407,408,409,410,411,412,413,414,415,416,417,418,419,420,421,422,423,424,425,426,427,428,429,430,431,432,433,434,435,436,437,438,439,440,441,442,443,444,445,446,447,448,449,450,451,452,453,454,455,456,457,458,459,460,461,462,463,464,465,466,467,468,469,470,471,472,473,474,475,476,477,478,479,480,481,482,483,484,485,486,487,488,489,490,491,492,493,494,495,496,497,498,499,500,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600,601,602,603,604,605,606,607,608,609,610,611,612,613,614,615,616,617,618,619,620,621,622,623,624,625,626,627,628,629,630,631,632,633,634,635,636,637,638,639,640,641,642,643,644,645,646,647,648,649,650,651,652,653,654,655,656,657,658,659,660,661,662,663,664,665,666,667,668,669,670,671,672,673,674,675,676,677,678,679,680,681,682,683,684,685,686,687,688,689,690,691,692,693,694,695,696,697,698,699,700,701,702,703,704,705,706,707,708,709,710,711,712,713,714,715,716,717,718,719,720,721,722,723,724,725,726,727,728,729,730,731,732,733,734,735,736,737,738,739,740,741,742,743,744,745,746,747,748,749,750,751,752,753,754,755,756,757,758,759,760,761,762,763,764,765,766,767,768,769,770,771,772,773,774,775,776,777,778,779,780,781,782,783,784,785,786,787,788,789,790,791,792,793,794,795,796,797,798,799,800,801,802,803,804,805,806,807,808,809,810,811,812,813,814,815,816,817,818,819,820,821,822,823,824,825,826,827,828,829,830,831,832,833,834,835,836,837,838,839,840,841,842,843,844,845,846,847,848,849,850,851,852,853,854,855,856,857,858,859,860,861,862,863,864,865,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,919,920,921,922,923,924,925,926,927,928,929,930,931,932,933,934,935,936,937,938,939,940,941,942,943,944,945,946,947,948,949,950,951,952,953,954,955,956,957,958,959,960,961,962,963,964,965,966,967,968,969,970,971,972,973,974,975,976,977,978,979,980,981,982,983,984,985,986,987,988,989,990,991,992,993,994,995,996,997,998,999

Interaction_Spaces

The examples covered under this sub-directory cover clear cut examples of Episimmer’s flexibility on how agents can interact with each other in the simulation environment.

Currently, Episimmer can model the following modules for agent interactions :

  1. Interactions (Simple one-to-one agent contact)

  2. Events (Complete graph of interactions)

  3. One time event

  4. Probabilistic Interactions

For further details, refer to Tutorial 2.2.

To run an example :

            cd examples/Interaction_Spaces
            python ../../episimmer/main.py Two_events_alternating_with_intersection

Double_Style_Interactions

This example showcases the use of both regular and probabilistic interactions.

Since we have both types of interactions, we should use ‘Agent Index:Interacting Agent Index’ key, omitting the ‘Probability:Agents’ as the parameter keys. Additional user-defined parameters (like ‘duration’) must be present in both the interaction files and appended to the Interaction Info Keys.

Thus our config.txt has the parameters : ‘Agent Index:Interacting Agent Index:duration’

The disease model being used here is the Stochastic Model comprising of the states Susceptible, Infected and Recovered.


Generate_policy.py

 1from episimmer.policy import lockdown_policy
 2
 3
 4def generate_policy():
 5	policy_list=[]
 6
 7	def lockdown_fn(time_step):
 8		return False
 9
10	policy_list.append(lockdown_policy.FullLockdown(lockdown_fn))
11
12	return policy_list

UserModel.py

 1import episimmer.model as model
 2
 3
 4def probability_of_infection_fn(p_infected_states_list,contact_agent,c_dict,current_time_step):
 5	if contact_agent.state=='Infected':
 6		return 0.8
 7	return 0
 8
 9class UserModel(model.StochasticModel):
10	def __init__(self):
11		individual_types=['Susceptible','Infected','Recovered']
12		infected_states=['Infected']
13		state_proportion={
14							'Susceptible':0.8,
15							'Infected':0.1,
16							'Recovered':0.1
17						}
18		model.StochasticModel.__init__(self,individual_types,infected_states,state_proportion)
19		self.set_transition('Susceptible', 'Infected', self.p_infection(probability_of_infection_fn,None))
20		self.set_transition('Infected', 'Recovered', self.p_standard(0.2))
21
22
23
24		self.name='Stochastic SIR'

agents.txt

 112
 2Agent Index
 30
 41
 52
 63
 74
 85
 96
107
118
129
1310
1411

config.txt

 1Random Seed <10>
 2Number of worlds <10>
 3Number of Days <10>
 4Agent Parameter Keys <Agent Index>
 5Agent list filename <agents.txt>
 6Interaction Info Keys <Agent Index:Interacting Agent Index:duration>
 7Interaction Files list filename <interaction_files_list.txt>
 8Probabilistic Interaction Files list filename <probabilistic_interaction_files_list.txt>
 9Location Parameter Keys <Location Index>
10Location list filename <locations.txt>
11Event Parameter Keys <>
12Event Files list filename <>
13One Time Event filename <>

generate_files.py

 1# This code require two inputs, 'number of agents' and 'probability of edge'
 2# To run <python generate_files.py 100 0.1>
 3
 4import random
 5import sys
 6
 7import numpy as np
 8
 9
10def write_agents(filename,n):
11	header='Agent Index'
12
13	f=open(filename,'w')
14	f.write(str(n)+'\n')
15	f.write(header+'\n')
16
17	for i in range(n):
18		f.write(str(i)+'\n')
19
20def write_interactions(filename,no_agents,p):
21	info_dict={}
22	#Agent ID enumerates from 0 to n-1
23	header='Agent Index:Interacting Agent Index'
24	lines=[]
25	for i in range(no_agents-1):
26		for j in range(i+1,no_agents):
27			if random.random()<p:
28				lines.append(str(i)+':'+str(j)+'\n')
29				lines.append(str(j)+':'+str(i)+'\n')
30
31	f=open(filename,'w')
32	f.write(str(len(lines))+'\n')
33	f.write(header+'\n')
34
35	for line in lines:
36		f.write(line)
37
38number_of_agents=int(sys.argv[1])
39p=float(sys.argv[2])
40write_agents('agents.txt',number_of_agents)
41write_interactions('interactions_list.txt',number_of_agents,p)

generate_files_csv.py

 1import csv
 2import random
 3
 4
 5def write_agents(filename,no_agents):
 6	with open(filename, 'w', newline='') as file:
 7	    fieldnames = ['Agent Index']
 8	    writer = csv.DictWriter(file, fieldnames=fieldnames)
 9
10	    writer.writeheader()
11	    for i in range(no_agents):
12	    	writer.writerow({'Agent Index': i})
13
14
15def write_interactions(filename,no_agents,p):
16	agent_list=[]
17	interacting_agent_list=[]
18	for i in range(no_agents-1):
19		for j in range(i+1,no_agents):
20			if random.random()<p:
21				agent_list.append(i)
22				agent_list.append(j)
23				interacting_agent_list.append(j)
24				interacting_agent_list.append(i)
25
26	with open(filename, 'w', newline='') as file:
27	    fieldnames = ['Agent Index','Interacting Agent Index']
28	    writer = csv.DictWriter(file, fieldnames=fieldnames)
29	    writer.writeheader()
30	    for i in range(len(agent_list)):
31	        writer.writerow({'Agent Index':agent_list[i],'Interacting Agent Index':interacting_agent_list[i]})
32
33
34
35
36write_agents('agents.csv',100)
37write_interactions('interactions_list.csv', 100, 0.1)

interaction_files_list.txt

1<interactions_list.csv>

interactions_list.csv

1Agent Index,Interacting Agent Index,duration
20,1,9
31,2,4
43,4,4
54,5,3
66,7,5

locations.txt

11
2Location Index
30

probabilistic_interaction_files_list.txt

1<probabilistic_interactions_list.txt>

probabilistic_interactions_list.txt

 110
 2Probability:Agents:duration
 31:3,5,10,11:4
 40.5:0,1,2:4
 50.2:6,7:45
 61:8:67
 70:9:2
 80.1:3,4,5,6:44
 90.1:1,2,9:45
100.1:4,7:67
110.1:10,11:12
120.1:1,10:34

One_Time_Event

This example uses the Stochastic SIR model where the agents can interact with each other via cycling events (standard events) and one time events.

The one time event has to be configured in a separate file which then needs to be included in the config.txt file.

While configuring the file containing the one time event, along with specifying the agents that are a part of it, it is also necessary to specify the times steps which are involved in the event.

In Episimmer, an event is enforced by calling it cyclicly in an order specified in the event_files_list.txt, and these events take place throughout the specified number of time steps.

At times, in realistic scenarios such as in a university, there are some events that do not take place periodically. For instance, cultural week might be for only one week within a span of two months.

Hence, the concept of one time events has been introduced in this example which helps us specify such infrequent and exceptional events as part of the considered time period.


Generate_policy.py

 1from episimmer.policy import lockdown_policy
 2
 3
 4def generate_policy():
 5	policy_list=[]
 6
 7	def lockdown_fn(time_step):
 8		return False
 9
10	policy_list.append(lockdown_policy.FullLockdown(lockdown_fn))
11
12	return policy_list

UserModel.py

 1import episimmer.model as model
 2
 3
 4def event_contribute_fn(agent,event_info,location,current_time_step):
 5	if agent.state=='Infected':
 6		return 1
 7	return 0
 8
 9
10def event_receive_fn(agent,ambient_infection,event_info,location,current_time_step):
11	beta=0.001
12	return ambient_infection*beta
13
14
15class UserModel(model.StochasticModel):
16	def __init__(self):
17		individual_types=['Susceptible','Infected','Recovered']
18		infected_states=['Infected']
19		state_proportion={
20							'Susceptible':0.99,
21							'Infected':0.01,
22							'Recovered':0
23						}
24		model.StochasticModel.__init__(self,individual_types,infected_states,state_proportion)
25		self.set_transition('Susceptible', 'Infected', self.p_infection())
26		self.set_transition('Infected', 'Recovered', self.p_standard(0.2))
27
28
29		self.set_event_contribution_fn(event_contribute_fn)
30		self.set_event_receive_fn(event_receive_fn)
31
32		self.name='Stochastic SIR'

agents.csv

  1Agent Index
  20
  31
  42
  53
  64
  75
  86
  97
 108
 119
 1210
 1311
 1412
 1513
 1614
 1715
 1816
 1917
 2018
 2119
 2220
 2321
 2422
 2523
 2624
 2725
 2826
 2927
 3028
 3129
 3230
 3331
 3432
 3533
 3634
 3735
 3836
 3937
 4038
 4139
 4240
 4341
 4442
 4543
 4644
 4745
 4846
 4947
 5048
 5149
 5250
 5351
 5452
 5553
 5654
 5755
 5856
 5957
 6058
 6159
 6260
 6361
 6462
 6563
 6664
 6765
 6866
 6967
 7068
 7169
 7270
 7371
 7472
 7573
 7674
 7775
 7876
 7977
 8078
 8179
 8280
 8381
 8482
 8583
 8684
 8785
 8886
 8987
 9088
 9189
 9290
 9391
 9492
 9593
 9694
 9795
 9896
 9997
10098
10199
102100
103101
104102
105103
106104
107105
108106
109107
110108
111109
112110
113111
114112
115113
116114
117115
118116
119117
120118
121119
122120
123121
124122
125123
126124
127125
128126
129127
130128
131129
132130
133131
134132
135133
136134
137135
138136
139137
140138
141139
142140
143141
144142
145143
146144
147145
148146
149147
150148
151149
152150
153151
154152
155153
156154
157155
158156
159157
160158
161159
162160
163161
164162
165163
166164
167165
168166
169167
170168
171169
172170
173171
174172
175173
176174
177175
178176
179177
180178
181179
182180
183181
184182
185183
186184
187185
188186
189187
190188
191189
192190
193191
194192
195193
196194
197195
198196
199197
200198

agents.txt

  11000
  2Agent Index
  30
  41
  52
  63
  74
  85
  96
 107
 118
 129
 1310
 1411
 1512
 1613
 1714
 1815
 1916
 2017
 2118
 2219
 2320
 2421
 2522
 2623
 2724
 2825
 2926
 3027
 3128
 3229
 3330
 3431
 3532
 3633
 3734
 3835
 3936
 4037
 4138
 4239
 4340
 4441
 4542
 4643
 4744
 4845
 4946
 5047
 5148
 5249
 5350
 5451
 5552
 5653
 5754
 5855
 5956
 6057
 6158
 6259
 6360
 6461
 6562
 6663
 6764
 6865
 6966
 7067
 7168
 7269
 7370
 7471
 7572
 7673
 7774
 7875
 7976
 8077
 8178
 8279
 8380
 8481
 8582
 8683
 8784
 8885
 8986
 9087
 9188
 9289
 9390
 9491
 9592
 9693
 9794
 9895
 9996
10097
10198
10299
103100
104101
105102
106103
107104
108105
109106
110107
111108
112109
113110
114111
115112
116113
117114
118115
119116
120117
121118
122119
123120
124121
125122
126123
127124
128125
129126
130127
131128
132129
133130
134131
135132
136133
137134
138135
139136
140137
141138
142139
143140
144141
145142
146143
147144
148145
149146
150147
151148
152149
153150
154151
155152
156153
157154
158155
159156
160157
161158
162159
163160
164161
165162
166163
167164
168165
169166
170167
171168
172169
173170
174171
175172
176173
177174
178175
179176
180177
181178
182179
183180
184181
185182
186183
187184
188185
189186
190187
191188
192189
193190
194191
195192
196193
197194
198195
199196
200197

config.txt

 1Random Seed <3>
 2Number of worlds <3>
 3Number of Days <10>
 4Agent Parameter Keys <Agent Index>
 5Agent list filename <agents.csv>
 6Interaction Info Keys <>
 7Interaction Files list filename <>
 8Probabilistic Interaction Files list filename <>
 9Location Parameter Keys <Location Index>
10Location list filename <locations.txt>
11Event Parameter Keys <Location Index:Agents>
12Event Files list filename <event_files_list.txt>
13One Time Event filename <one_time_event.txt>

empty_event.txt

10
2Location Index:Agents

event_files_list.txt

1<non_empty_event.txt>
2<empty_event.txt>

generate_files.py

 1import sys
 2
 3import numpy as np
 4
 5
 6def write_agents(filename,n):
 7	header='Agent Index'
 8
 9	f=open(filename,'w')
10	f.write(str(n)+'\n')
11	f.write(header+'\n')
12
13	for i in range(n):
14		f.write(str(i)+'\n')
15
16def write_events(filename,no_locations,no_agents):
17	info_dict={}
18	#ID enumerates from 0 to n-1
19	header='Location Index:Agents'
20
21	f=open(filename,'w')
22	f.write(str(1)+'\n')
23	f.write(header+'\n')
24
25	line=str(0)+':'
26	for i in range(no_agents):
27		line+=str(i)
28		if i!=no_agents-1:
29			line+=','
30
31	f.write(line)
32
33number_of_agents=int(sys.argv[1])
34write_agents('agents.txt',number_of_agents)
35write_events('one_event.txt',1,number_of_agents)

generate_files_csv.py

1from csv import DictWriter
2
3with open('agents.csv', 'w', newline='') as file:
4    fieldnames = ['Agent Index']
5    writer = DictWriter(file, fieldnames=fieldnames)
6
7    writer.writeheader()
8    for i in range(1000):
9    	writer.writerow({'Agent Index': i})

generate_interactions.py

 1from csv import DictWriter
 2
 3with open('interactions.csv', 'w', newline='') as file:
 4    fieldnames = ['Agent Index','Interacting Agent']
 5    writer = DictWriter(file, fieldnames=fieldnames)
 6
 7    writer.writeheader()
 8    for i in range(1000):
 9    	if i!=10:
10    		writer.writerow({'Agent Index': i,'Interacting Agent':i+1})

locations.txt

11
2Location Index
30

non_empty_event.txt

11
2Location Index:Agents
30:0,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,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271,272,273,274,275,276,277,278,279,280,281,282,283,284,285,286,287,288,289,290,291,292,293,294,295,296,297,298,299,300,301,302,303,304,305,306,307,308,309,310,311,312,313,314,315,316,317,318,319,320,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,337,338,339,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,356,357,358,359,360,361,362,363,364,365,366,367,368,369,370,371,372,373,374,375,376,377,378,379,380,381,382,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,399,400,401,402,403,404,405,406,407,408,409,410,411,412,413,414,415,416,417,418,419,420,421,422,423,424,425,426,427,428,429,430,431,432,433,434,435,436,437,438,439,440,441,442,443,444,445,446,447,448,449,450,451,452,453,454,455,456,457,458,459,460,461,462,463,464,465,466,467,468,469,470,471,472,473,474,475,476,477,478,479,480,481,482,483,484,485,486,487,488,489,490,491,492,493,494,495,496,497,498,499,500,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600,601,602,603,604,605,606,607,608,609,610,611,612,613,614,615,616,617,618,619,620,621,622,623,624,625,626,627,628,629,630,631,632,633,634,635,636,637,638,639,640,641,642,643,644,645,646,647,648,649,650,651,652,653,654,655,656,657,658,659,660,661,662,663,664,665,666,667,668,669,670,671,672,673,674,675,676,677,678,679,680,681,682,683,684,685,686,687,688,689,690,691,692,693,694,695,696,697,698,699,700,701,702,703,704,705,706,707,708,709,710,711,712,713,714,715,716,717,718,719,720,721,722,723,724,725,726,727,728,729,730,731,732,733,734,735,736,737,738,739,740,741,742,743,744,745,746,747,748,749,750,751,752,753,754,755,756,757,758,759,760,761,762,763,764,765,766,767,768,769,770,771,772,773,774,775,776,777,778,779,780,781,782,783,784,785,786,787,788,789,790,791,792,793,794,795,796,797,798,799,800,801,802,803,804,805,806,807,808,809,810,811,812,813,814,815,816,817,818,819,820,821,822,823,824,825,826,827,828,829,830,831,832,833,834,835,836,837,838,839,840,841,842,843,844,845,846,847,848,849,850,851,852,853,854,855,856,857,858,859,860,861,862,863,864,865,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,919,920,921,922,923,924,925,926,927,928,929,930,931,932,933,934,935,936,937,938,939,940,941,942,943,944,945,946,947,948,949,950,951,952,953,954,955,956,957,958,959,960,961,962,963,964,965,966,967,968,969,970,971,972,973,974,975,976,977,978,979,980,981,982,983,984,985,986,987,988,989,990,991,992,993,994,995,996,997,998,999

one_time_event.txt

11
2Time Step:Location Index:Agents
31,3:0:0,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,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271,272,273,274,275,276,277,278,279,280,281,282,283,284,285,286,287,288,289,290,291,292,293,294,295,296,297,298,299,300,301,302,303,304,305,306,307,308,309,310,311,312,313,314,315,316,317,318,319,320,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,337,338,339,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,356,357,358,359,360,361,362,363,364,365,366,367,368,369,370,371,372,373,374,375,376,377,378,379,380,381,382,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,399,400,401,402,403,404,405,406,407,408,409,410,411,412,413,414,415,416,417,418,419,420,421,422,423,424,425,426,427,428,429,430,431,432,433,434,435,436,437,438,439,440,441,442,443,444,445,446,447,448,449,450,451,452,453,454,455,456,457,458,459,460,461,462,463,464,465,466,467,468,469,470,471,472,473,474,475,476,477,478,479,480,481,482,483,484,485,486,487,488,489,490,491,492,493,494,495,496,497,498,499,500,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600,601,602,603,604,605,606,607,608,609,610,611,612,613,614,615,616,617,618,619,620,621,622,623,624,625,626,627,628,629,630,631,632,633,634,635,636,637,638,639,640,641,642,643,644,645,646,647,648,649,650,651,652,653,654,655,656,657,658,659,660,661,662,663,664,665,666,667,668,669,670,671,672,673,674,675,676,677,678,679,680,681,682,683,684,685,686,687,688,689,690,691,692,693,694,695,696,697,698,699,700,701,702,703,704,705,706,707,708,709,710,711,712,713,714,715,716,717,718,719,720,721,722,723,724,725,726,727,728,729,730,731,732,733,734,735,736,737,738,739,740,741,742,743,744,745,746,747,748,749,750,751,752,753,754,755,756,757,758,759,760,761,762,763,764,765,766,767,768,769,770,771,772,773,774,775,776,777,778,779,780,781,782,783,784,785,786,787,788,789,790,791,792,793,794,795,796,797,798,799,800,801,802,803,804,805,806,807,808,809,810,811,812,813,814,815,816,817,818,819,820,821,822,823,824,825,826,827,828,829,830,831,832,833,834,835,836,837,838,839,840,841,842,843,844,845,846,847,848,849,850,851,852,853,854,855,856,857,858,859,860,861,862,863,864,865,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,919,920,921,922,923,924,925,926,927,928,929,930,931,932,933,934,935,936,937,938,939,940,941,942,943,944,945,946,947,948,949,950,951,952,953,954,955,956,957,958,959,960,961,962,963,964,965,966,967,968,969,970,971,972,973,974,975,976,977,978,979,980,981,982,983,984,985,986,987,988,989,990,991,992,993,994,995,996,997,998,999

Probabilistic_Interaction

This example showcases the use of probabilistic interactions. The agents can contribute or receive infection based on who they interact with, and these interactions are probabilistically determined.

While configuring the probabilistic interactions file, along with specifying the agents that are interacting with each other, it is necessary to specify the probability with which they interact.

The probabilistic interactions are considered to be bidirectional (as compared to interactions which are unidirectional) and hence can be specified as: Probability:Agents where “Agents” are all the interacting agents separated by commas.

Also note that you need not pass ‘Probability:Agents’ in the config.txt interactions info keys but may do so to enforce the use of only probabilistic interactions (Adding normal interactions would give you an error).

The disease model being used here is the Stochastic Model comprising of the states Susceptible, Infected and Recovered.

For instance, the interaction between a student and a teacher in a university can be considered to be probabilistic taking into account that the student has a consistent 95% attendance.

Hence, probabilistic interactions allow us to specify interactions between agents that are not most definitely bound to happen.


Generate_policy.py

 1from episimmer.policy import lockdown_policy
 2
 3
 4def generate_policy():
 5	policy_list=[]
 6
 7	def lockdown_fn(time_step):
 8		return False
 9
10	policy_list.append(lockdown_policy.FullLockdown(lockdown_fn))
11
12	return policy_list

UserModel.py

 1import episimmer.model as model
 2
 3
 4def probability_of_infection_fn(p_infected_states_list,contact_agent,c_dict,current_time_step):
 5	if contact_agent.state=='Infected':
 6		return 0.8
 7	return 0
 8
 9class UserModel(model.StochasticModel):
10	def __init__(self):
11		individual_types=['Susceptible','Infected','Recovered']
12		infected_states=['Infected']
13		state_proportion={
14							'Susceptible':0.8,
15							'Infected':0.1,
16							'Recovered':0.1
17						}
18		model.StochasticModel.__init__(self,individual_types,infected_states,state_proportion)
19		self.set_transition('Susceptible', 'Infected', self.p_infection(probability_of_infection_fn,None))
20		self.set_transition('Infected', 'Recovered', self.p_standard(0.2))
21
22		self.name='Stochastic SIR'

agents.txt

 112
 2Agent Index
 30
 41
 52
 63
 74
 85
 96
107
118
129
1310
1411

config.txt

 1Random Seed <10>
 2Number of worlds <10>
 3Number of Days <10>
 4Agent Parameter Keys <Agent Index>
 5Agent list filename <agents.txt>
 6Interaction Info Keys <Probability:Agents>
 7Interaction Files list filename <>
 8Probabilistic Interaction Files list filename <probabilistic_interaction_files_list.txt>
 9Location Parameter Keys <Location Index>
10Location list filename <locations.txt>
11Event Parameter Keys <>
12Event Files list filename <>
13One Time Event filename <>

generate_files.py

 1# This code require two inputs, 'number of agents' and 'probability of edge'
 2# To run <python generate_files.py 100 0.1>
 3
 4import random
 5import sys
 6
 7import numpy as np
 8
 9
10def write_agents(filename,n):
11	header='Agent Index'
12
13	f=open(filename,'w')
14	f.write(str(n)+'\n')
15	f.write(header+'\n')
16
17	for i in range(n):
18		f.write(str(i)+'\n')
19
20def write_interactions(filename,no_agents,p):
21	info_dict={}
22	#Agent ID enumerates from 0 to n-1
23	header='Agent Index:Interacting Agent Index'
24	lines=[]
25	for i in range(no_agents-1):
26		for j in range(i+1,no_agents):
27			if random.random()<p:
28				lines.append(str(i)+':'+str(j)+'\n')
29				lines.append(str(j)+':'+str(i)+'\n')
30
31	f=open(filename,'w')
32	f.write(str(len(lines))+'\n')
33	f.write(header+'\n')
34
35	for line in lines:
36		f.write(line)
37
38number_of_agents=int(sys.argv[1])
39p=float(sys.argv[2])
40write_agents('agents.txt',number_of_agents)
41write_interactions('interactions_list.txt',number_of_agents,p)

generate_files_csv.py

 1import csv
 2import random
 3
 4
 5def write_agents(filename,no_agents):
 6	with open(filename, 'w', newline='') as file:
 7	    fieldnames = ['Agent Index']
 8	    writer = csv.DictWriter(file, fieldnames=fieldnames)
 9
10	    writer.writeheader()
11	    for i in range(no_agents):
12	    	writer.writerow({'Agent Index': i})
13
14
15def write_interactions(filename,no_agents,p):
16	agent_list=[]
17	interacting_agent_list=[]
18	for i in range(no_agents-1):
19		for j in range(i+1,no_agents):
20			if random.random()<p:
21				agent_list.append(i)
22				agent_list.append(j)
23				interacting_agent_list.append(j)
24				interacting_agent_list.append(i)
25
26	with open(filename, 'w', newline='') as file:
27	    fieldnames = ['Agent Index','Interacting Agent Index']
28	    writer = csv.DictWriter(file, fieldnames=fieldnames)
29	    writer.writeheader()
30	    for i in range(len(agent_list)):
31	        writer.writerow({'Agent Index':agent_list[i],'Interacting Agent Index':interacting_agent_list[i]})
32
33
34
35
36write_agents('agents.csv',100)
37write_interactions('interactions_list.csv', 100, 0.1)

locations.txt

11
2Location Index
30

probabilistic_interaction_files_list.txt

1<probabilistic_interactions_list.txt>

probabilistic_interactions_list.txt

 110
 2Probability:Agents
 31:3,5,10,11
 40.5:0,1,2
 50.2:6,7
 61:8
 70:9
 80.1:3,4,5,6
 90.1:1,2,9
100.1:4,7
110.1:10,11
120.1:1,10

Scheduled_SEYAR_Interactions

This example builds over the Scheduled SEYAR model. It uses interaction constructs in Episimmer to define contact between two agents, to influence the transmission of disease between states.

The file interactions_list.txt contains all the interactions between the agents.

The interactions are unidirectional, hence we have to specify two interactions to depict bidirectional contact between any two agents.


Generate_policy.py

 1from episimmer.policy import lockdown_policy
 2
 3
 4def generate_policy():
 5	policy_list=[]
 6
 7	def lockdown_fn(time_step):
 8		return False
 9
10	policy_list.append(lockdown_policy.FullLockdown(lockdown_fn))
11
12	return policy_list

UserModel.py

 1import episimmer.model as model
 2
 3
 4def probability_of_infection_fn(p_infected_states_list,contact_agent,c_dict,current_time_step):
 5	if contact_agent.state=='Infected':
 6		return 0.1
 7	return 0
 8
 9def event_contribute_fn(agent,event_info,location,current_time_step):
10	if agent.state=='Symptomatic':
11		return 1
12	elif agent.state=='Asymptomatic':
13		return 0.6
14	return 0
15
16def event_receive_fn(agent,ambient_infection,event_info,location,current_time_step):
17	beta=0.001
18	return ambient_infection*beta
19
20
21class UserModel(model.ScheduledModel):
22	def __init__(self):
23		model.ScheduledModel.__init__(self)
24		self.insert_state('Susceptible',None, None,self.p_infection({'Exposed':1},probability_of_infection_fn,[0.3,0.1]),False,0.95)
25		self.insert_state('Exposed',5,2,self.scheduled({'Symptomatic':0.3,'Asymptomatic':0.7}),False,0.02)
26		self.insert_state('Symptomatic',11,5,self.scheduled({'Recovered':1}),True,0.02)
27		self.insert_state('Asymptomatic',6,3,self.scheduled({'Recovered':1}),True,0.01)
28		self.insert_state('Recovered',100, 0,self.scheduled({'Recovered':1}),False,0)
29
30		self.set_event_contribution_fn(event_contribute_fn)
31		self.set_event_receive_fn(event_receive_fn)

agents.txt

  11000
  2Agent Index
  30
  41
  52
  63
  74
  85
  96
 107
 118
 129
 1310
 1411
 1512
 1613
 1714
 1815
 1916
 2017
 2118
 2219
 2320
 2421
 2522
 2623
 2724
 2825
 2926
 3027
 3128
 3229
 3330
 3431
 3532
 3633
 3734
 3835
 3936
 4037
 4138
 4239
 4340
 4441
 4542
 4643
 4744
 4845
 4946
 5047
 5148
 5249
 5350
 5451
 5552
 5653
 5754
 5855
 5956
 6057
 6158
 6259
 6360
 6461
 6562
 6663
 6764
 6865
 6966
 7067
 7168
 7269
 7370
 7471
 7572
 7673
 7774
 7875
 7976
 8077
 8178
 8279
 8380
 8481
 8582
 8683
 8784
 8885
 8986
 9087
 9188
 9289
 9390
 9491
 9592
 9693
 9794
 9895
 9996
10097
10198
10299
103100
104101
105102
106103
107104
108105
109106
110107
111108
112109
113110
114111
115112
116113
117114
118115
119116
120117
121118
122119
123120
124121
125122
126123
127124
128125
129126
130127
131128
132129
133130
134131
135132
136133
137134
138135
139136
140137
141138
142139
143140
144141
145142
146143
147144
148145
149146
150147
151148
152149
153150
154151
155152
156153
157154
158155
159156
160157
161158
162159
163160
164161
165162
166163
167164
168165
169166
170167
171168
172169
173170
174171
175172
176173
177174
178175
179176
180177
181178
182179
183180
184181
185182
186183
187184
188185
189186
190187
191188
192189
193190
194191
195192
196193
197194
198195
199196
200197

config.txt

 1Random Seed <3>
 2Number of worlds <1>
 3Number of Days <30>
 4Agent Parameter Keys <Agent Index>
 5Agent list filename <agents.txt>
 6Interaction Info Keys <Agent Index:Interacting Agent Index>
 7Interaction Files list filename <interactions_files_list.txt>
 8Probabilistic Interaction Files list filename <>
 9Location Parameter Keys <Location Index>
10Location list filename <locations.txt>
11Event Parameter Keys <>
12Event Files list filename <>
13One Time Event filename <>

generate_files.py

 1import random
 2import sys
 3
 4import numpy as np
 5
 6
 7def write_agents(filename,n):
 8	header='Agent Index'
 9
10	f=open(filename,'w')
11	f.write(str(n)+'\n')
12	f.write(header+'\n')
13
14	for i in range(n):
15		f.write(str(i)+'\n')
16
17def write_interactions(filename,no_agents,p):
18	info_dict={}
19	#Agent ID enumerates from 0 to n-1
20	header='Agent Index:Interacting Agent Index'
21	lines=[]
22	for i in range(no_agents-1):
23		for j in range(i+1,no_agents):
24			if random.random()<p:
25				lines.append(str(i)+':'+str(j)+'\n')
26				lines.append(str(j)+':'+str(i)+'\n')
27
28	f=open(filename,'w')
29	f.write(str(len(lines))+'\n')
30	f.write(header+'\n')
31
32	for line in lines:
33		f.write(line)
34
35number_of_agents=int(sys.argv[1])
36p=float(sys.argv[2])
37write_agents('agents.txt',number_of_agents)
38write_interactions('interactions_list.txt',number_of_agents,p)

interactions_files_list.txt

1<interactions_list.txt>

interactions_list.txt

  11006
  2Agent Index:Interacting Agent Index
  31:470
  4470:1
  52:968
  6968:2
  75:802
  8802:5
  96:95
 1095:6
 116:996
 12996:6
 138:373
 14373:8
 158:428
 16428:8
 178:676
 18676:8
 199:895
 20895:9
 2110:43
 2243:10
 2310:108
 24108:10
 2513:86
 2686:13
 2714:921
 28921:14
 2915:584
 30584:15
 3118:324
 32324:18
 3318:888
 34888:18
 3521:583
 36583:21
 3721:850
 38850:21
 3921:957
 40957:21
 4124:86
 4286:24
 4328:151
 44151:28
 4528:438
 46438:28
 4728:654
 48654:28
 4929:315
 50315:29
 5129:705
 52705:29
 5329:757
 54757:29
 5530:242
 56242:30
 5731:160
 58160:31
 5931:647
 60647:31
 6131:884
 62884:31
 6332:254
 64254:32
 6532:910
 66910:32
 6734:757
 68757:34
 6935:934
 70934:35
 7136:424
 72424:36
 7340:296
 74296:40
 7540:518
 76518:40
 7740:571
 78571:40
 7941:192
 80192:41
 8141:236
 82236:41
 8342:737
 84737:42
 8544:984
 86984:44
 8745:679
 88679:45
 8947:636
 90636:47
 9148:678
 92678:48
 9350:398
 94398:50
 9550:576
 96576:50
 9750:742
 98742:50
 9952:508
100508:52
10154:916
102916:54
10356:801
104801:56
10558:128
106128:58
10758:831
108831:58
10959:623
110623:59
11159:947
112947:59
11361:602
114602:61
11564:167
116167:64
11764:341
118341:64
11968:491
120491:68
12173:338
122338:73
12374:437
124437:74
12574:907
126907:74
12776:127
128127:76
12977:275
130275:77
13179:825
132825:79
13379:915
134915:79
13580:297
136297:80
13780:529
138529:80
13981:517
140517:81
14182:554
142554:82
14383:279
144279:83
14583:586
146586:83
14783:624
148624:83
14985:89
15089:85
15186:819
152819:86
15387:905
154905:87
15588:394
156394:88
15789:230
158230:89
15990:778
160778:90
16191:462
162462:91
16393:229
164229:93
16593:497
166497:93
16793:544
168544:93
16994:669
170669:94
17194:781
172781:94
17394:852
174852:94
17597:161
176161:97
17797:232
178232:97
17998:301
180301:98
181102:223
182223:102
183102:414
184414:102
185102:885
186885:102
187102:969
188969:102
189103:600
190600:103
191105:427
192427:105
193105:784
194784:105
195109:120
196120:109
197110:297
198297:110
199110:480
200480:110

locations.txt

11
2Location Index
30

Stochastic_SIR_complete_graph

This example is a variation of the Stochastic SIR model. Instead of having the disease spread in O(n) time using the concept of ambient infections as seen in Stochastic_SIR, it spreads between each pair of agents in O(n^2) time using interactions.

This is why Events as a disease spread module is very important in Episimmer. It is a very efficient way of modelling interactions between the agents where we have no information on single agent-agent interactions.

Here, each agent interacts with every other agent bidirectionally and all of these interactions are listed in the complete_interactions_list.txt file.

It considers the agents to be vertices of a complete graph with each edge being an interaction between the two connecting agent vertices.

Episimmer uses this example to give a different perspective of disease flow and can be used where all the considered agents are part of an event.


Generate_policy.py

 1from episimmer.policy import lockdown_policy
 2
 3
 4def generate_policy():
 5	policy_list=[]
 6
 7	def lockdown_fn(time_step):
 8		return False
 9
10	policy_list.append(lockdown_policy.FullLockdown(lockdown_fn))
11
12	return policy_list

UserModel.py

 1import episimmer.model as model
 2
 3
 4#This function represents the probability of getting infected during a single interaction/contact
 5def probability_of_infection_fn(p_infected_states_list,contact_agent,c_dict,current_time_step):
 6	if contact_agent.state=='Infected':
 7		return 0.001  #This is the probability of getting infected from contact in a time step isf contact is infected
 8	return 0 # If contact is not infected then the probability of them infecting you is 0
 9
10class UserModel(model.StochasticModel):
11	def __init__(self):
12		individual_types=['Susceptible','Infected','Recovered']
13		infected_states=['Infected']
14		state_proportion={
15							'Susceptible':0.99,
16							'Infected':0.01,
17							'Recovered':0
18						}
19		model.StochasticModel.__init__(self,individual_types,infected_states,state_proportion)
20		self.set_transition('Susceptible', 'Infected', self.p_infection(probability_of_infection_fn,None))	#Adding S-> I transition which is based on probability)fInfection_fn
21		self.set_transition('Infected', 'Recovered', self.p_standard(0.2))
22
23
24
25		self.name='Stochastic SIR on complete graph'

agents.txt

 130
 2Agent Index
 30
 41
 52
 63
 74
 85
 96
107
118
129
1310
1411
1512
1613
1714
1815
1916
2017
2118
2219
2320
2421
2522
2623
2724
2825
2926
3027
3128
3229

complete_interactions_list.txt

  1870
  2Agent Index:Interacting Agent Index
  30:1
  40:2
  50:3
  60:4
  70:5
  80:6
  90:7
 100:8
 110:9
 120:10
 130:11
 140:12
 150:13
 160:14
 170:15
 180:16
 190:17
 200:18
 210:19
 220:20
 230:21
 240:22
 250:23
 260:24
 270:25
 280:26
 290:27
 300:28
 310:29
 321:0
 331:2
 341:3
 351:4
 361:5
 371:6
 381:7
 391:8
 401:9
 411:10
 421:11
 431:12
 441:13
 451:14
 461:15
 471:16
 481:17
 491:18
 501:19
 511:20
 521:21
 531:22
 541:23
 551:24
 561:25
 571:26
 581:27
 591:28
 601:29
 612:0
 622:1
 632:3
 642:4
 652:5
 662:6
 672:7
 682:8
 692:9
 702:10
 712:11
 722:12
 732:13
 742:14
 752:15
 762:16
 772:17
 782:18
 792:19
 802:20
 812:21
 822:22
 832:23
 842:24
 852:25
 862:26
 872:27
 882:28
 892:29
 903:0
 913:1
 923:2
 933:4
 943:5
 953:6
 963:7
 973:8
 983:9
 993:10
1003:11
1013:12
1023:13
1033:14
1043:15
1053:16
1063:17
1073:18
1083:19
1093:20
1103:21
1113:22
1123:23
1133:24
1143:25
1153:26
1163:27
1173:28
1183:29
1194:0
1204:1
1214:2
1224:3
1234:5
1244:6
1254:7
1264:8
1274:9
1284:10
1294:11
1304:12
1314:13
1324:14
1334:15
1344:16
1354:17
1364:18
1374:19
1384:20
1394:21
1404:22
1414:23
1424:24
1434:25
1444:26
1454:27
1464:28
1474:29
1485:0
1495:1
1505:2
1515:3
1525:4
1535:6
1545:7
1555:8
1565:9
1575:10
1585:11
1595:12
1605:13
1615:14
1625:15
1635:16
1645:17
1655:18
1665:19
1675:20
1685:21
1695:22
1705:23
1715:24
1725:25
1735:26
1745:27
1755:28
1765:29
1776:0
1786:1
1796:2
1806:3
1816:4
1826:5
1836:7
1846:8
1856:9
1866:10
1876:11
1886:12
1896:13
1906:14
1916:15
1926:16
1936:17
1946:18
1956:19
1966:20
1976:21
1986:22
1996:23
2006:24

config.txt

 1Random Seed <3>
 2Number of worlds <1>
 3Number of Days <30>
 4Agent Parameter Keys <Agent Index>
 5Agent list filename <agents.txt>
 6Interaction Info Keys <Agent Index:Interacting Agent Index>
 7Interaction Files list filename <interaction_files_list.txt>
 8Probabilistic Interaction Files list filename <>
 9Location Parameter Keys <Location Index>
10Location list filename <locations.txt>
11Event Parameter Keys <>
12Event Files list filename <>
13One Time Event filename <>

generate_files.py

 1import sys
 2
 3import numpy as np
 4
 5
 6def write_agents(filename,n):
 7	header='Agent Index'
 8
 9	f=open(filename,'w')
10	f.write(str(n)+'\n')
11	f.write(header+'\n')
12
13	for i in range(n):
14		f.write(str(i)+'\n')
15
16def write_interactions(filename,no_agents):
17	info_dict={}
18	#ID enumerates from 0 to n-1
19	no_interactions=no_agents*(no_agents-1)
20	header='Agent Index:Interacting Agent Index'
21
22	f=open(filename,'w')
23	f.write(str(no_interactions)+'\n')
24	f.write(header+'\n')
25
26	for i in range(no_agents):
27		for j in range(no_agents):
28			if i!=j:
29				f.write(str(i)+':'+str(j)+'\n')
30
31number_of_agents=int(sys.argv[1])
32write_agents('agents.txt',number_of_agents)
33write_interactions('complete_interactions_list.txt',number_of_agents)

interaction_files_list.txt

1<complete_interactions_list.txt>

locations.txt

11
2Location Index
30

Stochastic_SIR_random_graph

This example is a variation of the Stochastic_SIR_complete_graph model.

Instead of all the agents participating in the interactions, only a set of agents interact with each other bidirectionally and all of these interactions are listed in the interactions_list.txt file.


Generate_policy.py

 1from episimmer.policy import lockdown_policy
 2
 3
 4def generate_policy():
 5	policy_list=[]
 6
 7	def lockdown_fn(time_step):
 8		return False
 9
10	policy_list.append(lockdown_policy.FullLockdown(lockdown_fn))
11
12	return policy_list

UserModel.py

 1import episimmer.model as model
 2
 3
 4#This function represents the probability of getting infected during a single interaction/contact
 5def probability_of_infection_fn(p_infected_states_list,contact_agent,c_dict,current_time_step):
 6	if contact_agent.state=='Infected':
 7		return 0.1  #This is the probability of getting infected from contact in a time step isf contact is infected
 8	return 0 # If contact is not infected then the probability of them infecting you is 0
 9
10class UserModel(model.StochasticModel):
11	def __init__(self):
12		individual_types=['Susceptible','Infected','Recovered']
13		infected_states=['Infected']
14		state_proportion={
15							'Susceptible':0.97,
16							'Infected':0.03,
17							'Recovered':0
18						}
19		model.StochasticModel.__init__(self,individual_types,infected_states,state_proportion)
20		self.set_transition('Susceptible', 'Infected', self.p_infection(probability_of_infection_fn,None))	#Adding S-> I transition which is based on probability_of_infection_fn
21		self.set_transition('Infected', 'Recovered', self.p_standard(0.2))
22
23		self.name='Stochastic SIR on complete graph'

agents.csv

  1Agent Index
  20
  31
  42
  53
  64
  75
  86
  97
 108
 119
 1210
 1311
 1412
 1513
 1614
 1715
 1816
 1917
 2018
 2119
 2220
 2321
 2422
 2523
 2624
 2725
 2826
 2927
 3028
 3129
 3230
 3331
 3432
 3533
 3634
 3735
 3836
 3937
 4038
 4139
 4240
 4341
 4442
 4543
 4644
 4745
 4846
 4947
 5048
 5149
 5250
 5351
 5452
 5553
 5654
 5755
 5856
 5957
 6058
 6159
 6260
 6361
 6462
 6563
 6664
 6765
 6866
 6967
 7068
 7169
 7270
 7371
 7472
 7573
 7674
 7775
 7876
 7977
 8078
 8179
 8280
 8381
 8482
 8583
 8684
 8785
 8886
 8987
 9088
 9189
 9290
 9391
 9492
 9593
 9694
 9795
 9896
 9997
10098
10199

agents.txt

  1100
  2Agent Index
  30
  41
  52
  63
  74
  85
  96
 107
 118
 129
 1310
 1411
 1512
 1613
 1714
 1815
 1916
 2017
 2118
 2219
 2320
 2421
 2522
 2623
 2724
 2825
 2926
 3027
 3128
 3229
 3330
 3431
 3532
 3633
 3734
 3835
 3936
 4037
 4138
 4239
 4340
 4441
 4542
 4643
 4744
 4845
 4946
 5047
 5148
 5249
 5350
 5451
 5552
 5653
 5754
 5855
 5956
 6057
 6158
 6259
 6360
 6461
 6562
 6663
 6764
 6865
 6966
 7067
 7168
 7269
 7370
 7471
 7572
 7673
 7774
 7875
 7976
 8077
 8178
 8279
 8380
 8481
 8582
 8683
 8784
 8885
 8986
 9087
 9188
 9289
 9390
 9491
 9592
 9693
 9794
 9895
 9996
10097
10198
10299

config.txt

 1Random Seed <3>
 2Number of worlds <1>
 3Number of Days <10>
 4Agent Parameter Keys <Agent Index>
 5Agent list filename <agents.csv>
 6Interaction Info Keys <Agent Index:Interacting Agent Index>
 7Interaction Files list filename <interaction_files_list.txt>
 8Probabilistic Interaction Files list filename <>
 9Location Parameter Keys <Location Index>
10Location list filename <locations.txt>
11Event Parameter Keys <>
12Event Files list filename <>
13One Time Event filename <>

generate_files.py

 1# This code require two inputs, 'number of agents' and 'probability of edge'
 2# To run <python generate_files.py 100 0.1>
 3
 4import random
 5import sys
 6
 7import numpy as np
 8
 9
10def write_agents(filename,n):
11	header='Agent Index'
12
13	f=open(filename,'w')
14	f.write(str(n)+'\n')
15	f.write(header+'\n')
16
17	for i in range(n):
18		f.write(str(i)+'\n')
19
20def write_interactions(filename,no_agents,p):
21	info_dict={}
22	#Agent ID enumerates from 0 to n-1
23	header='Agent Index:Interacting Agent Index'
24	lines=[]
25	for i in range(no_agents-1):
26		for j in range(i+1,no_agents):
27			if random.random()<p:
28				lines.append(str(i)+':'+str(j)+'\n')
29				lines.append(str(j)+':'+str(i)+'\n')
30
31	f=open(filename,'w')
32	f.write(str(len(lines))+'\n')
33	f.write(header+'\n')
34
35	for line in lines:
36		f.write(line)
37
38number_of_agents=int(sys.argv[1])
39p=float(sys.argv[2])
40write_agents('agents.txt',number_of_agents)
41write_interactions('interactions_list.txt',number_of_agents,p)

generate_files_csv.py

 1import csv
 2import random
 3import sys
 4
 5
 6def write_agents(filename,no_agents):
 7	with open(filename, 'w', newline='') as file:
 8	    fieldnames = ['Agent Index']
 9	    writer = csv.DictWriter(file, fieldnames=fieldnames)
10
11	    writer.writeheader()
12	    for i in range(no_agents):
13	    	writer.writerow({'Agent Index': i})
14
15
16def write_interactions(filename,no_agents,p):
17	agent_list=[]
18	interacting_agent_list=[]
19	for i in range(no_agents-1):
20		for j in range(i+1,no_agents):
21			if random.random()<p:
22				agent_list.append(i)
23				agent_list.append(j)
24				interacting_agent_list.append(j)
25				interacting_agent_list.append(i)
26
27	with open(filename, 'w', newline='') as file:
28	    fieldnames = ['Agent Index','Interacting Agent Index']
29	    writer = csv.DictWriter(file, fieldnames=fieldnames)
30	    writer.writeheader()
31	    for i in range(len(agent_list)):
32	        writer.writerow({'Agent Index':agent_list[i],'Interacting Agent Index':interacting_agent_list[i]})
33
34
35n = int(sys.argv[1])
36prob = float(sys.argv[2])
37
38write_agents('agents.csv',n)
39write_interactions('interactions_list.csv', n, prob)

interaction_files_list.txt

1<interactions_list.csv>

interactions_list.csv

  1Agent Index,Interacting Agent Index
  20,23
  323,0
  40,39
  539,0
  60,41
  741,0
  80,44
  944,0
 100,46
 1146,0
 120,61
 1361,0
 140,67
 1567,0
 160,80
 1780,0
 181,6
 196,1
 201,14
 2114,1
 221,16
 2316,1
 241,23
 2523,1
 261,27
 2727,1
 281,33
 2933,1
 301,52
 3152,1
 321,57
 3357,1
 341,61
 3561,1
 361,62
 3762,1
 381,67
 3967,1
 401,73
 4173,1
 421,86
 4386,1
 441,89
 4589,1
 462,7
 477,2
 482,14
 4914,2
 502,49
 5149,2
 522,53
 5353,2
 542,61
 5561,2
 562,68
 5768,2
 582,69
 5969,2
 602,70
 6170,2
 622,73
 6373,2
 642,76
 6576,2
 662,77
 6777,2
 682,95
 6995,2
 703,17
 7117,3
 723,50
 7350,3
 743,63
 7563,3
 763,64
 7764,3
 783,79
 7979,3
 803,88
 8188,3
 823,94
 8394,3
 843,95
 8595,3
 864,14
 8714,4
 884,24
 8924,4
 904,57
 9157,4
 924,80
 9380,4
 944,89
 9589,4
 964,94
 9794,4
 985,10
 9910,5
1005,15
10115,5
1025,27
10327,5
1045,52
10552,5
1066,8
1078,6
1086,14
10914,6
1106,16
11116,6
1126,30
11330,6
1146,39
11539,6
1166,41
11741,6
1186,47
11947,6
1206,51
12151,6
1226,58
12358,6
1246,72
12572,6
1266,75
12775,6
1286,86
12986,6
1306,94
13194,6
1327,9
1339,7
1347,13
13513,7
1367,15
13715,7
1387,19
13919,7
1407,22
14122,7
1427,26
14326,7
1447,43
14543,7
1467,44
14744,7
1487,49
14949,7
1507,68
15168,7
1527,69
15369,7
1547,73
15573,7
1567,78
15778,7
1588,11
15911,8
1608,21
16121,8
1628,28
16328,8
1648,39
16539,8
1668,44
16744,8
1688,47
16947,8
1708,49
17149,8
1728,58
17358,8
1748,59
17559,8
1768,60
17760,8
1788,66
17966,8
1808,74
18174,8
1828,86
18386,8
1848,99
18599,8
1869,18
18718,9
1889,25
18925,9
1909,28
19128,9
1929,29
19329,9
1949,30
19530,9
1969,39
19739,9
1989,40
19940,9
2009,49

interactions_list.txt

 190
 2Agent Index:Interacting Agent Index
 31:15
 415:1
 54:47
 647:4
 74:74
 874:4
 94:96
1096:4
117:90
1290:7
139:78
1478:9
1513:85
1685:13
1714:41
1841:14
1915:38
2038:15
2117:37
2237:17
2317:95
2495:17
2519:92
2692:19
2720:83
2883:20
2922:28
3028:22
3122:61
3261:22
3325:45
3445:25
3525:66
3666:25
3725:84
3884:25
3926:50
4050:26
4126:92
4292:26
4327:39
4439:27
4533:36
4636:33
4733:98
4898:33
4934:56
5056:34
5134:63
5263:34
5334:78
5478:34
5535:44
5644:35
5735:48
5848:35
5936:62
6062:36
6141:80
6280:41
6342:97
6497:42
6543:67
6667:43
6744:53
6853:44
6944:65
7065:44
7149:80
7280:49
7350:64
7464:50
7551:91
7691:51
7756:97
7897:56
7958:67
8067:58
8159:76
8276:59
8360:95
8495:60
8568:82
8682:68
8775:77
8877:75
8976:82
9082:76
9189:99
9299:89

locations.txt

11
2Location Index
30

Stochastic_SIR_two_locations

This example uses the Stochastic SIR model to show infection spread using events at two locations at the same time step.

The different locations may have multiple events taking place in them simultaneously.


Generate_policy.py

 1from episimmer.policy import lockdown_policy
 2
 3
 4def generate_policy():
 5	policy_list=[]
 6
 7	def lockdown_fn(time_step):
 8		return False
 9
10	policy_list.append(lockdown_policy.FullLockdown(lockdown_fn))
11
12	return policy_list

UserModel.py

 1import episimmer.model as model
 2
 3
 4def event_contribute_fn(agent,event_info,location,current_time_step):
 5	if agent.state=='Infected':
 6		return 1
 7	return 0
 8
 9
10def event_receive_fn(agent,ambient_infection,event_info,location,current_time_step):
11	beta=0.001
12	return ambient_infection*beta
13
14
15class UserModel(model.StochasticModel):
16	def __init__(self):
17		individual_types=['Susceptible','Infected','Recovered']
18		infected_states=['Infected']
19		state_proportion={
20							'Susceptible':0.99,
21							'Infected':0.01,
22							'Recovered':0
23						}
24		model.StochasticModel.__init__(self,individual_types,infected_states,state_proportion)
25		self.set_transition('Susceptible', 'Infected', self.p_infection())
26		self.set_transition('Infected', 'Recovered', self.p_standard(0.2))
27
28
29		self.set_event_contribution_fn(event_contribute_fn)
30		self.set_event_receive_fn(event_receive_fn)
31
32		self.name='Stochastic SIR'

agents.txt

  11000
  2Agent Index
  30
  41
  52
  63
  74
  85
  96
 107
 118
 129
 1310
 1411
 1512
 1613
 1714
 1815
 1916
 2017
 2118
 2219
 2320
 2421
 2522
 2623
 2724
 2825
 2926
 3027
 3128
 3229
 3330
 3431
 3532
 3633
 3734
 3835
 3936
 4037
 4138
 4239
 4340
 4441
 4542
 4643
 4744
 4845
 4946
 5047
 5148
 5249
 5350
 5451
 5552
 5653
 5754
 5855
 5956
 6057
 6158
 6259
 6360
 6461
 6562
 6663
 6764
 6865
 6966
 7067
 7168
 7269
 7370
 7471
 7572
 7673
 7774
 7875
 7976
 8077
 8178
 8279
 8380
 8481
 8582
 8683
 8784
 8885
 8986
 9087
 9188
 9289
 9390
 9491
 9592
 9693
 9794
 9895
 9996
10097
10198
10299
103100
104101
105102
106103
107104
108105
109106
110107
111108
112109
113110
114111
115112
116113
117114
118115
119116
120117
121118
122119
123120
124121
125122
126123
127124
128125
129126
130127
131128
132129
133130
134131
135132
136133
137134
138135
139136
140137
141138
142139
143140
144141
145142
146143
147144
148145
149146
150147
151148
152149
153150
154151
155152
156153
157154
158155
159156
160157
161158
162159
163160
164161
165162
166163
167164
168165
169166
170167
171168
172169
173170
174171
175172
176173
177174
178175
179176
180177
181178
182179
183180
184181
185182
186183
187184
188185
189186
190187
191188
192189
193190
194191
195192
196193
197194
198195
199196
200197

config.txt

 1Random Seed <3>
 2Number of worlds <1>
 3Number of Days <30>
 4Agent Parameter Keys <Agent Index>
 5Agent list filename <agents.txt>
 6Interaction Info Keys <>
 7Interaction Files list filename <>
 8Probabilistic Interaction Files list filename <>
 9Location Parameter Keys <Location Index>
10Location list filename <locations.txt>
11Event Parameter Keys <Location Index:Agents>
12Event Files list filename <event_files_list.txt>
13One Time Event filename <>

event_files_list.txt

1<two_events.txt>

generate_files.py

 1import sys
 2
 3import numpy as np
 4
 5
 6def write_agents(filename,n):
 7	header='Agent Index'
 8
 9	f=open(filename,'w')
10	f.write(str(n)+'\n')
11	f.write(header+'\n')
12
13	for i in range(n):
14		f.write(str(i)+'\n')
15
16def write_events(filename,start_agent_index, end_agent_index):
17	info_dict={}
18	#ID enumerates from 0 to n-1
19	header='Location Index:Agents'
20
21	f=open(filename,'w')
22	f.write(str(2)+'\n')
23	f.write(header+'\n')
24
25	line=str(0)+':'	#location index 0
26	for i in range(start_agent_index,int(end_agent_index/2)):
27		line+=str(i)
28		if i!=int(end_agent_index/2)-1:
29			line+=','
30	f.write(line+'\n')
31	line=str(1)+':'	#location index 1
32	for i in range(int(end_agent_index/2),end_agent_index):
33		line+=str(i)
34		if i!=end_agent_index-1:
35			line+=','
36
37	f.write(line)
38
39number_of_agents=int(sys.argv[1])
40write_agents('agents.txt',number_of_agents)
41write_events('two_events.txt',0,number_of_agents)

locations.txt

12
2Location Index
30
41

two_events.txt

12
2Location Index:Agents
30:0,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,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271,272,273,274,275,276,277,278,279,280,281,282,283,284,285,286,287,288,289,290,291,292,293,294,295,296,297,298,299,300,301,302,303,304,305,306,307,308,309,310,311,312,313,314,315,316,317,318,319,320,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,337,338,339,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,356,357,358,359,360,361,362,363,364,365,366,367,368,369,370,371,372,373,374,375,376,377,378,379,380,381,382,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,399,400,401,402,403,404,405,406,407,408,409,410,411,412,413,414,415,416,417,418,419,420,421,422,423,424,425,426,427,428,429,430,431,432,433,434,435,436,437,438,439,440,441,442,443,444,445,446,447,448,449,450,451,452,453,454,455,456,457,458,459,460,461,462,463,464,465,466,467,468,469,470,471,472,473,474,475,476,477,478,479,480,481,482,483,484,485,486,487,488,489,490,491,492,493,494,495,496,497,498,499
41:500,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600,601,602,603,604,605,606,607,608,609,610,611,612,613,614,615,616,617,618,619,620,621,622,623,624,625,626,627,628,629,630,631,632,633,634,635,636,637,638,639,640,641,642,643,644,645,646,647,648,649,650,651,652,653,654,655,656,657,658,659,660,661,662,663,664,665,666,667,668,669,670,671,672,673,674,675,676,677,678,679,680,681,682,683,684,685,686,687,688,689,690,691,692,693,694,695,696,697,698,699,700,701,702,703,704,705,706,707,708,709,710,711,712,713,714,715,716,717,718,719,720,721,722,723,724,725,726,727,728,729,730,731,732,733,734,735,736,737,738,739,740,741,742,743,744,745,746,747,748,749,750,751,752,753,754,755,756,757,758,759,760,761,762,763,764,765,766,767,768,769,770,771,772,773,774,775,776,777,778,779,780,781,782,783,784,785,786,787,788,789,790,791,792,793,794,795,796,797,798,799,800,801,802,803,804,805,806,807,808,809,810,811,812,813,814,815,816,817,818,819,820,821,822,823,824,825,826,827,828,829,830,831,832,833,834,835,836,837,838,839,840,841,842,843,844,845,846,847,848,849,850,851,852,853,854,855,856,857,858,859,860,861,862,863,864,865,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,919,920,921,922,923,924,925,926,927,928,929,930,931,932,933,934,935,936,937,938,939,940,941,942,943,944,945,946,947,948,949,950,951,952,953,954,955,956,957,958,959,960,961,962,963,964,965,966,967,968,969,970,971,972,973,974,975,976,977,978,979,980,981,982,983,984,985,986,987,988,989,990,991,992,993,994,995,996,997,998,999

Two_events_alternating_one_location

This example involves alternating events in a single location.

It is one of the different variations of real-life scenarios involving events and locations where these events occur.

Episimmer uses this example to highlight the cyclicity of events and how they are cyclicly called in some particular order. This is demonstrated by introducing two events in the event_files_list.txt file.

Such examples can be used to simulate university scenarios where there are for instance two classes being held in the same lecture hall on alternate days.

The user has the liberty decide whether these events occur in the same location or not.


Generate_policy.py

 1from episimmer.policy import lockdown_policy
 2
 3
 4def generate_policy():
 5	policy_list=[]
 6
 7	def lockdown_fn(time_step):
 8		return False
 9
10	policy_list.append(lockdown_policy.FullLockdown(lockdown_fn))
11
12	return policy_list

UserModel.py

 1import episimmer.model as model
 2
 3
 4def event_contribute_fn(agent,event_info,location,current_time_step):
 5	if agent.state=='Infected':
 6		return 1
 7	return 0
 8
 9
10def event_receive_fn(agent,ambient_infection,event_info,location,current_time_step):
11	beta=0.001
12	return ambient_infection*beta
13
14
15class UserModel(model.StochasticModel):
16	def __init__(self):
17		individual_types=['Susceptible','Infected','Recovered']
18		infected_states=['Infected']
19		state_proportion={
20							'Susceptible':0.99,
21							'Infected':0.01,
22							'Recovered':0
23						}
24		model.StochasticModel.__init__(self,individual_types,infected_states,state_proportion)
25		self.set_transition('Susceptible', 'Infected', self.p_infection())
26		self.set_transition('Infected', 'Recovered', self.p_standard(0.2))
27
28
29		self.set_event_contribution_fn(event_contribute_fn)
30		self.set_event_receive_fn(event_receive_fn)
31
32		self.name='Stochastic SIR'

agents.txt

  11000
  2Agent Index
  30
  41
  52
  63
  74
  85
  96
 107
 118
 129
 1310
 1411
 1512
 1613
 1714
 1815
 1916
 2017
 2118
 2219
 2320
 2421
 2522
 2623
 2724
 2825
 2926
 3027
 3128
 3229
 3330
 3431
 3532
 3633
 3734
 3835
 3936
 4037
 4138
 4239
 4340
 4441
 4542
 4643
 4744
 4845
 4946
 5047
 5148
 5249
 5350
 5451
 5552
 5653
 5754
 5855
 5956
 6057
 6158
 6259
 6360
 6461
 6562
 6663
 6764
 6865
 6966
 7067
 7168
 7269
 7370
 7471
 7572
 7673
 7774
 7875
 7976
 8077
 8178
 8279
 8380
 8481
 8582
 8683
 8784
 8885
 8986
 9087
 9188
 9289
 9390
 9491
 9592
 9693
 9794
 9895
 9996
10097
10198
10299
103100
104101
105102
106103
107104
108105
109106
110107
111108
112109
113110
114111
115112
116113
117114
118115
119116
120117
121118
122119
123120
124121
125122
126123
127124
128125
129126
130127
131128
132129
133130
134131
135132
136133
137134
138135
139136
140137
141138
142139
143140
144141
145142
146143
147144
148145
149146
150147
151148
152149
153150
154151
155152
156153
157154
158155
159156
160157
161158
162159
163160
164161
165162
166163
167164
168165
169166
170167
171168
172169
173170
174171
175172
176173
177174
178175
179176
180177
181178
182179
183180
184181
185182
186183
187184
188185
189186
190187
191188
192189
193190
194191
195192
196193
197194
198195
199196
200197

config.txt

 1Random Seed <3>
 2Number of worlds <1>
 3Number of Days <30>
 4Agent Parameter Keys <Agent Index>
 5Agent list filename <agents.txt>
 6Interaction Info Keys <>
 7Interaction Files list filename <>
 8Probabilistic Interaction Files list filename <>
 9Location Parameter Keys <Location Index>
10Location list filename <locations.txt>
11Event Parameter Keys <Location Index:Agents>
12Event Files list filename <event_files_list.txt>
13One Time Event filename <>

event_files_list.txt

1<first_event.txt>
2<second_event.txt>

first_event.txt

11
2Location Index:Agents
30:0,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,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271,272,273,274,275,276,277,278,279,280,281,282,283,284,285,286,287,288,289,290,291,292,293,294,295,296,297,298,299,300,301,302,303,304,305,306,307,308,309,310,311,312,313,314,315,316,317,318,319,320,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,337,338,339,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,356,357,358,359,360,361,362,363,364,365,366,367,368,369,370,371,372,373,374,375,376,377,378,379,380,381,382,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,399,400,401,402,403,404,405,406,407,408,409,410,411,412,413,414,415,416,417,418,419,420,421,422,423,424,425,426,427,428,429,430,431,432,433,434,435,436,437,438,439,440,441,442,443,444,445,446,447,448,449,450,451,452,453,454,455,456,457,458,459,460,461,462,463,464,465,466,467,468,469,470,471,472,473,474,475,476,477,478,479,480,481,482,483,484,485,486,487,488,489,490,491,492,493,494,495,496,497,498,499

generate_files.py

 1import sys
 2
 3import numpy as np
 4
 5
 6def write_agents(filename,n):
 7	header='Agent Index'
 8
 9	f=open(filename,'w')
10	f.write(str(n)+'\n')
11	f.write(header+'\n')
12
13	for i in range(n):
14		f.write(str(i)+'\n')
15
16def write_events(filename,start_agent_index, end_agent_index):
17	info_dict={}
18	#ID enumerates from 0 to n-1
19	header='Location Index:Agents'
20	no_agents=end_agent_index-start_agent_index
21
22	f=open(filename,'w')
23	f.write(str(1)+'\n')
24	f.write(header+'\n')
25
26	line=str(0)+':'
27	for i in range(start_agent_index,end_agent_index):
28		line+=str(i)
29		if i!=end_agent_index-1:
30			line+=','
31
32	f.write(line)
33
34number_of_agents=int(sys.argv[1])
35write_agents('agents.txt',number_of_agents)
36write_events('first_event.txt',0,int(number_of_agents/2))
37write_events('second_event.txt',int(number_of_agents/2),number_of_agents)

locations.txt

11
2Location Index
30

second_event.txt

11
2Location Index:Agents
30:500,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600,601,602,603,604,605,606,607,608,609,610,611,612,613,614,615,616,617,618,619,620,621,622,623,624,625,626,627,628,629,630,631,632,633,634,635,636,637,638,639,640,641,642,643,644,645,646,647,648,649,650,651,652,653,654,655,656,657,658,659,660,661,662,663,664,665,666,667,668,669,670,671,672,673,674,675,676,677,678,679,680,681,682,683,684,685,686,687,688,689,690,691,692,693,694,695,696,697,698,699,700,701,702,703,704,705,706,707,708,709,710,711,712,713,714,715,716,717,718,719,720,721,722,723,724,725,726,727,728,729,730,731,732,733,734,735,736,737,738,739,740,741,742,743,744,745,746,747,748,749,750,751,752,753,754,755,756,757,758,759,760,761,762,763,764,765,766,767,768,769,770,771,772,773,774,775,776,777,778,779,780,781,782,783,784,785,786,787,788,789,790,791,792,793,794,795,796,797,798,799,800,801,802,803,804,805,806,807,808,809,810,811,812,813,814,815,816,817,818,819,820,821,822,823,824,825,826,827,828,829,830,831,832,833,834,835,836,837,838,839,840,841,842,843,844,845,846,847,848,849,850,851,852,853,854,855,856,857,858,859,860,861,862,863,864,865,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,919,920,921,922,923,924,925,926,927,928,929,930,931,932,933,934,935,936,937,938,939,940,941,942,943,944,945,946,947,948,949,950,951,952,953,954,955,956,957,958,959,960,961,962,963,964,965,966,967,968,969,970,971,972,973,974,975,976,977,978,979,980,981,982,983,984,985,986,987,988,989,990,991,992,993,994,995,996,997,998,999

Two_events_alternating_with_intersection

This example is a variation of the model Stochastic_SIR_two_events_alternating. Instead of having two alternating events in which neither of the two events have common agents with the other, we are introducing a model in which the alternating events may have a few agents in common to both of them.

This example has been introduced to deal with situations where an infected agent may belong to more than one event.


Generate_policy.py

 1from episimmer.policy import lockdown_policy
 2
 3
 4def generate_policy():
 5	policy_list=[]
 6
 7	def lockdown_fn(time_step):
 8		return False
 9
10	policy_list.append(lockdown_policy.FullLockdown(lockdown_fn))
11
12	return policy_list

UserModel.py

 1import episimmer.model as model
 2
 3
 4def event_contribute_fn(agent,event_info,location,current_time_step):
 5	if agent.state=='Infected':
 6		return 1
 7	return 0
 8
 9
10def event_receive_fn(agent,ambient_infection,event_info,location,current_time_step):
11	beta=0.001
12	return ambient_infection*beta
13
14
15class UserModel(model.StochasticModel):
16	def __init__(self):
17		individual_types=['Susceptible','Infected','Recovered']
18		infected_states=['Infected']
19		state_proportion={
20							'Susceptible':0.99,
21							'Infected':0.01,
22							'Recovered':0
23						}
24		model.StochasticModel.__init__(self,individual_types,infected_states,state_proportion)
25		self.set_transition('Susceptible', 'Infected', self.p_infection())
26		self.set_transition('Infected', 'Recovered', self.p_standard(0.1))
27
28
29		self.set_event_contribution_fn(event_contribute_fn)
30		self.set_event_receive_fn(event_receive_fn)
31
32		self.name='Stochastic SIR'

agents.txt

  11000
  2Agent Index
  30
  41
  52
  63
  74
  85
  96
 107
 118
 129
 1310
 1411
 1512
 1613
 1714
 1815
 1916
 2017
 2118
 2219
 2320
 2421
 2522
 2623
 2724
 2825
 2926
 3027
 3128
 3229
 3330
 3431
 3532
 3633
 3734
 3835
 3936
 4037
 4138
 4239
 4340
 4441
 4542
 4643
 4744
 4845
 4946
 5047
 5148
 5249
 5350
 5451
 5552
 5653
 5754
 5855
 5956
 6057
 6158
 6259
 6360
 6461
 6562
 6663
 6764
 6865
 6966
 7067
 7168
 7269
 7370
 7471
 7572
 7673
 7774
 7875
 7976
 8077
 8178
 8279
 8380
 8481
 8582
 8683
 8784
 8885
 8986
 9087
 9188
 9289
 9390
 9491
 9592
 9693
 9794
 9895
 9996
10097
10198
10299
103100
104101
105102
106103
107104
108105
109106
110107
111108
112109
113110
114111
115112
116113
117114
118115
119116
120117
121118
122119
123120
124121
125122
126123
127124
128125
129126
130127
131128
132129
133130
134131
135132
136133
137134
138135
139136
140137
141138
142139
143140
144141
145142
146143
147144
148145
149146
150147
151148
152149
153150
154151
155152
156153
157154
158155
159156
160157
161158
162159
163160
164161
165162
166163
167164
168165
169166
170167
171168
172169
173170
174171
175172
176173
177174
178175
179176
180177
181178
182179
183180
184181
185182
186183
187184
188185
189186
190187
191188
192189
193190
194191
195192
196193
197194
198195
199196
200197

config.txt

 1Random Seed <3>
 2Number of worlds <1>
 3Number of Days <100>
 4Agent Parameter Keys <Agent Index>
 5Agent list filename <agents.txt>
 6Interaction Info Keys <>
 7Interaction Files list filename <>
 8Probabilistic Interaction Files list filename <>
 9Location Parameter Keys <Location Index>
10Location list filename <locations.txt>
11Event Parameter Keys <Location Index:Agents>
12Event Files list filename <event_files_list.txt>
13One Time Event filename <>

event_files_list.txt

1<first_event.txt>
2<second_event.txt>

first_event.txt

11
2Location Index:Agents
30:0,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,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271,272,273,274,275,276,277,278,279,280,281,282,283,284,285,286,287,288,289,290,291,292,293,294,295,296,297,298,299,300,301,302,303,304,305,306,307,308,309,310,311,312,313,314,315,316,317,318,319,320,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,337,338,339,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,356,357,358,359,360,361,362,363,364,365,366,367,368,369,370,371,372,373,374,375,376,377,378,379,380,381,382,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,399,400,401,402,403,404,405,406,407,408,409,410,411,412,413,414,415,416,417,418,419,420,421,422,423,424,425,426,427,428,429,430,431,432,433,434,435,436,437,438,439,440,441,442,443,444,445,446,447,448,449,450,451,452,453,454,455,456,457,458,459,460,461,462,463,464,465,466,467,468,469,470,471,472,473,474,475,476,477,478,479,480,481,482,483,484,485,486,487,488,489,490,491,492,493,494,495,496,497,498,499,500,501,502,503,504

generate_files.py

 1import sys
 2
 3import numpy as np
 4
 5
 6def write_agents(filename,n):
 7	header='Agent Index'
 8
 9	f=open(filename,'w')
10	f.write(str(n)+'\n')
11	f.write(header+'\n')
12
13	for i in range(n):
14		f.write(str(i)+'\n')
15
16def write_events(filename,start_agent_index, end_agent_index):
17	info_dict={}
18	#ID enumerates from 0 to n-1
19	header='Location Index:Agents'
20	no_agents=end_agent_index-start_agent_index
21
22	f=open(filename,'w')
23	f.write(str(1)+'\n')
24	f.write(header+'\n')
25
26	line=str(0)+':'
27	for i in range(start_agent_index,end_agent_index):
28		line+=str(i)
29		if i!=end_agent_index-1:
30			line+=','
31
32	f.write(line)
33
34number_of_agents=int(sys.argv[1])
35write_agents('agents.txt',number_of_agents)
36write_events('first_event.txt',0,int(number_of_agents*0.505))
37write_events('second_event.txt',int(number_of_agents*0.495),number_of_agents)

locations.txt

11
2Location Index
30

second_event.txt

11
2Location Index:Agents
30:495,496,497,498,499,500,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600,601,602,603,604,605,606,607,608,609,610,611,612,613,614,615,616,617,618,619,620,621,622,623,624,625,626,627,628,629,630,631,632,633,634,635,636,637,638,639,640,641,642,643,644,645,646,647,648,649,650,651,652,653,654,655,656,657,658,659,660,661,662,663,664,665,666,667,668,669,670,671,672,673,674,675,676,677,678,679,680,681,682,683,684,685,686,687,688,689,690,691,692,693,694,695,696,697,698,699,700,701,702,703,704,705,706,707,708,709,710,711,712,713,714,715,716,717,718,719,720,721,722,723,724,725,726,727,728,729,730,731,732,733,734,735,736,737,738,739,740,741,742,743,744,745,746,747,748,749,750,751,752,753,754,755,756,757,758,759,760,761,762,763,764,765,766,767,768,769,770,771,772,773,774,775,776,777,778,779,780,781,782,783,784,785,786,787,788,789,790,791,792,793,794,795,796,797,798,799,800,801,802,803,804,805,806,807,808,809,810,811,812,813,814,815,816,817,818,819,820,821,822,823,824,825,826,827,828,829,830,831,832,833,834,835,836,837,838,839,840,841,842,843,844,845,846,847,848,849,850,851,852,853,854,855,856,857,858,859,860,861,862,863,864,865,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,919,920,921,922,923,924,925,926,927,928,929,930,931,932,933,934,935,936,937,938,939,940,941,942,943,944,945,946,947,948,949,950,951,952,953,954,955,956,957,958,959,960,961,962,963,964,965,966,967,968,969,970,971,972,973,974,975,976,977,978,979,980,981,982,983,984,985,986,987,988,989,990,991,992,993,994,995,996,997,998,999

Two_independent_events_in_two_locations

This example helps in visualizing disease spread through two events having no common agents in two locations.

It is another variation of multiple events occurring in more than one locations.


Generate_policy.py

 1from episimmer.policy import lockdown_policy
 2
 3
 4def generate_policy():
 5	policy_list=[]
 6
 7	def lockdown_fn(time_step):
 8		return False
 9
10	policy_list.append(lockdown_policy.FullLockdown(lockdown_fn))
11
12	return policy_list

UserModel.py

 1import episimmer.model as model
 2
 3
 4def event_contribute_fn(agent,event_info,location,current_time_step):
 5	if agent.state=='Infected':
 6		return 1
 7	return 0
 8
 9
10def event_receive_fn(agent,ambient_infection,event_info,location,current_time_step):
11	beta=0.001
12	return ambient_infection*beta
13
14
15class UserModel(model.StochasticModel):
16	def __init__(self):
17		individual_types=['Susceptible','Infected','Recovered']
18		infected_states=['Infected']
19		state_proportion={
20							'Susceptible':0.99,
21							'Infected':0.01,
22							'Recovered':0
23						}
24		model.StochasticModel.__init__(self,individual_types,infected_states,state_proportion)
25		self.set_transition('Susceptible', 'Infected', self.p_infection())
26		self.set_transition('Infected', 'Recovered', self.p_standard(0.2))
27
28
29		self.set_event_contribution_fn(event_contribute_fn)
30		self.set_event_receive_fn(event_receive_fn)
31
32		self.name='Stochastic SIR'

agents.txt

  11000
  2Agent Index
  30
  41
  52
  63
  74
  85
  96
 107
 118
 129
 1310
 1411
 1512
 1613
 1714
 1815
 1916
 2017
 2118
 2219
 2320
 2421
 2522
 2623
 2724
 2825
 2926
 3027
 3128
 3229
 3330
 3431
 3532
 3633
 3734
 3835
 3936
 4037
 4138
 4239
 4340
 4441
 4542
 4643
 4744
 4845
 4946
 5047
 5148
 5249
 5350
 5451
 5552
 5653
 5754
 5855
 5956
 6057
 6158
 6259
 6360
 6461
 6562
 6663
 6764
 6865
 6966
 7067
 7168
 7269
 7370
 7471
 7572
 7673
 7774
 7875
 7976
 8077
 8178
 8279
 8380
 8481
 8582
 8683
 8784
 8885
 8986
 9087
 9188
 9289
 9390
 9491
 9592
 9693
 9794
 9895
 9996
10097
10198
10299
103100
104101
105102
106103
107104
108105
109106
110107
111108
112109
113110
114111
115112
116113
117114
118115
119116
120117
121118
122119
123120
124121
125122
126123
127124
128125
129126
130127
131128
132129
133130
134131
135132
136133
137134
138135
139136
140137
141138
142139
143140
144141
145142
146143
147144
148145
149146
150147
151148
152149
153150
154151
155152
156153
157154
158155
159156
160157
161158
162159
163160
164161
165162
166163
167164
168165
169166
170167
171168
172169
173170
174171
175172
176173
177174
178175
179176
180177
181178
182179
183180
184181
185182
186183
187184
188185
189186
190187
191188
192189
193190
194191
195192
196193
197194
198195
199196
200197

config.txt

 1Random Seed <3>
 2Number of worlds <1>
 3Number of Days <30>
 4Agent Parameter Keys <Agent Index>
 5Agent list filename <agents.txt>
 6Interaction Info Keys <>
 7Interaction Files list filename <>
 8Probabilistic Interaction Files list filename <>
 9Location Parameter Keys <Location Index>
10Location list filename <locations.txt>
11Event Parameter Keys <Location Index:Agents>
12Event Files list filename <event_files_list.txt>
13One Time Event filename <>

event_files_list.txt

1<two_events.txt>

generate_files.py

 1import sys
 2
 3import numpy as np
 4
 5
 6def write_agents(filename,n):
 7	header='Agent Index'
 8
 9	f=open(filename,'w')
10	f.write(str(n)+'\n')
11	f.write(header+'\n')
12
13	for i in range(n):
14		f.write(str(i)+'\n')
15
16def write_events(filename,start_agent_index, end_agent_index):
17	info_dict={}
18	#ID enumerates from 0 to n-1
19	header='Location Index:Agents'
20
21	f=open(filename,'w')
22	f.write(str(2)+'\n')
23	f.write(header+'\n')
24
25	line=str(0)+':'	#location index 0
26	for i in range(start_agent_index,int(end_agent_index/2)):
27		line+=str(i)
28		if i!=int(end_agent_index/2)-1:
29			line+=','
30	f.write(line+'\n')
31	line=str(1)+':'	#location index 1
32	for i in range(int(end_agent_index/2),end_agent_index):
33		line+=str(i)
34		if i!=end_agent_index-1:
35			line+=','
36
37	f.write(line)
38
39number_of_agents=int(sys.argv[1])
40write_agents('agents.txt',number_of_agents)
41write_events('two_events.txt',0,number_of_agents)

locations.txt

12
2Location Index
30
41

two_events.txt

12
2Location Index:Agents
30:0,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,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271,272,273,274,275,276,277,278,279,280,281,282,283,284,285,286,287,288,289,290,291,292,293,294,295,296,297,298,299,300,301,302,303,304,305,306,307,308,309,310,311,312,313,314,315,316,317,318,319,320,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,337,338,339,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,356,357,358,359,360,361,362,363,364,365,366,367,368,369,370,371,372,373,374,375,376,377,378,379,380,381,382,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,399,400,401,402,403,404,405,406,407,408,409,410,411,412,413,414,415,416,417,418,419,420,421,422,423,424,425,426,427,428,429,430,431,432,433,434,435,436,437,438,439,440,441,442,443,444,445,446,447,448,449,450,451,452,453,454,455,456,457,458,459,460,461,462,463,464,465,466,467,468,469,470,471,472,473,474,475,476,477,478,479,480,481,482,483,484,485,486,487,488,489,490,491,492,493,494,495,496,497,498,499
41:500,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600,601,602,603,604,605,606,607,608,609,610,611,612,613,614,615,616,617,618,619,620,621,622,623,624,625,626,627,628,629,630,631,632,633,634,635,636,637,638,639,640,641,642,643,644,645,646,647,648,649,650,651,652,653,654,655,656,657,658,659,660,661,662,663,664,665,666,667,668,669,670,671,672,673,674,675,676,677,678,679,680,681,682,683,684,685,686,687,688,689,690,691,692,693,694,695,696,697,698,699,700,701,702,703,704,705,706,707,708,709,710,711,712,713,714,715,716,717,718,719,720,721,722,723,724,725,726,727,728,729,730,731,732,733,734,735,736,737,738,739,740,741,742,743,744,745,746,747,748,749,750,751,752,753,754,755,756,757,758,759,760,761,762,763,764,765,766,767,768,769,770,771,772,773,774,775,776,777,778,779,780,781,782,783,784,785,786,787,788,789,790,791,792,793,794,795,796,797,798,799,800,801,802,803,804,805,806,807,808,809,810,811,812,813,814,815,816,817,818,819,820,821,822,823,824,825,826,827,828,829,830,831,832,833,834,835,836,837,838,839,840,841,842,843,844,845,846,847,848,849,850,851,852,853,854,855,856,857,858,859,860,861,862,863,864,865,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,919,920,921,922,923,924,925,926,927,928,929,930,931,932,933,934,935,936,937,938,939,940,941,942,943,944,945,946,947,948,949,950,951,952,953,954,955,956,957,958,959,960,961,962,963,964,965,966,967,968,969,970,971,972,973,974,975,976,977,978,979,980,981,982,983,984,985,986,987,988,989,990,991,992,993,994,995,996,997,998,999

Miscellaneous

The examples under this directory showcase additional functionality of Episimmer like External Prevalence, List of Lists and Custom Distributions for Scheduled disease models.

We also include examples that showcase the level of complexity and creativity that the user can harness with Episimmer.

To run an example :

            cd examples/Miscellaneous
            python ../../episimmer/main.py 3D_Cellular_Automaton

3D_Cellular_Automaton

This example is built over the Scheduled SEYAR model.

This is a creative example of modelling interactions between the agents as a cellular automaton. For a nice visualization of the interactions, use the view_interaction_graph python file in the Scripts/Visualization directory.


Generate_policy.py

 1from episimmer.policy import lockdown_policy
 2
 3
 4def generate_policy():
 5	policy_list=[]
 6
 7	def lockdown_fn(time_step):
 8		return False
 9
10	policy_list.append(lockdown_policy.FullLockdown(lockdown_fn))
11
12	return policy_list

UserModel.py

 1import episimmer.model as model
 2
 3
 4def probability_of_infection_fn(p_infected_states_list, contact_agent, c_dict, current_time_step):
 5	if contact_agent.state in ['Exposed', 'Symptomatic', 'Asymptomatic']:
 6		return 0.5
 7	return 0
 8
 9class UserModel(model.ScheduledModel):
10	def __init__(self):
11		model.ScheduledModel.__init__(self)
12		self.insert_state('Susceptible', None, None, self.p_infection({'Exposed':1},probability_of_infection_fn,[0.3, 0.1]),False,0.90)
13		self.insert_state('Exposed', 5, 2, self.scheduled({'Symptomatic':0.3,'Asymptomatic':0.7}),False,0.02)
14		self.insert_state('Symptomatic', 30, 5, self.scheduled({'Recovered':1}),True,0.03)
15		self.insert_state('Asymptomatic', 25, 3, self.scheduled({'Recovered':1}),True,0.05)
16		self.insert_state('Recovered', 100, 0, self.scheduled({'Recovered': 1}),False,0)

agents.txt

  1800
  2Agent Index
  30
  41
  52
  63
  74
  85
  96
 107
 118
 129
 1310
 1411
 1512
 1613
 1714
 1815
 1916
 2017
 2118
 2219
 2320
 2421
 2522
 2623
 2724
 2825
 2926
 3027
 3128
 3229
 3330
 3431
 3532
 3633
 3734
 3835
 3936
 4037
 4138
 4239
 4340
 4441
 4542
 4643
 4744
 4845
 4946
 5047
 5148
 5249
 5350
 5451
 5552
 5653
 5754
 5855
 5956
 6057
 6158
 6259
 6360
 6461
 6562
 6663
 6764
 6865
 6966
 7067
 7168
 7269
 7370
 7471
 7572
 7673
 7774
 7875
 7976
 8077
 8178
 8279
 8380
 8481
 8582
 8683
 8784
 8885
 8986
 9087
 9188
 9289
 9390
 9491
 9592
 9693
 9794
 9895
 9996
10097
10198
10299
103100
104101
105102
106103
107104
108105
109106
110107
111108
112109
113110
114111
115112
116113
117114
118115
119116
120117
121118
122119
123120
124121
125122
126123
127124
128125
129126
130127
131128
132129
133130
134131
135132
136133
137134
138135
139136
140137
141138
142139
143140
144141
145142
146143
147144
148145
149146
150147
151148
152149
153150
154151
155152
156153
157154
158155
159156
160157
161158
162159
163160
164161
165162
166163
167164
168165
169166
170167
171168
172169
173170
174171
175172
176173
177174
178175
179176
180177
181178
182179
183180
184181
185182
186183
187184
188185
189186
190187
191188
192189
193190
194191
195192
196193
197194
198195
199196
200197

config.txt

 1Random Seed <>
 2Number of worlds <2>
 3Number of Days <60>
 4Agent Parameter Keys <Agent Index>
 5Agent list filename <agents.txt>
 6Interaction Info Keys <Agent Index:Interacting Agent Index>
 7Interaction Files list filename <interactions_files_list.txt>
 8Probabilistic Interaction Files list filename <>
 9Location Parameter Keys <Location Index>
10Location list filename <locations.txt>
11Event Parameter Keys <>
12Event Files list filename <>
13One Time Event filename <>

generate_files.py

 1import sys
 2
 3
 4def write_agents(filename,n):
 5	header='Agent Index'
 6
 7	f=open(filename,'w')
 8	f.write(str(n)+'\n')
 9	f.write(header+'\n')
10
11	for i in range(1, n + 1):
12		f.write(str(i-1)+'\n')
13
14def write_interactions(filename, n, k):
15	header = 'Agent Index:Interacting Agent Index'
16
17	f = open(filename, 'w')
18	# k*n*(n - 1)
19	f.write(str(2*(k*2*n*(n - 1) + n*n*(k-1)))+'\n')
20	f.write(header+'\n')
21
22	for l in range(k):
23		for i in range(n*n):
24			if l != k-1:
25				f.write(str(i+l*n*n) + ':' + str(i +(l+1)*n*n) + '\n')
26				f.write(str(i+(l+1)*n*n) + ':' + str(i +l*n*n) + '\n')
27
28			if i<n*n-n:
29				f.write(str(i+l*n*n) + ':' + str(i+l*n*n+n) + '\n')
30				f.write(str(i+l*n*n+n) + ':' + str(i+l*n*n) + '\n')
31
32			if (i+1) % n != 0:
33				f.write(str(i+l*n*n) + ':' + str(i+l*n*n+1) + '\n')
34				f.write(str(i+l*n*n+1) + ':' + str(i+l*n*n) + '\n')
35
36	f.close()
37
38# n x n x k agents
39n = int(sys.argv[1])
40k = int(sys.argv[2])
41
42no_of_agents = k*n*n
43write_agents('agents.txt', no_of_agents)
44write_interactions('interactions.txt', n, k)

interactions.txt

  13840
  2Agent Index:Interacting Agent Index
  30:400
  4400:0
  50:20
  620:0
  70:1
  81:0
  91:401
 10401:1
 111:21
 1221:1
 131:2
 142:1
 152:402
 16402:2
 172:22
 1822:2
 192:3
 203:2
 213:403
 22403:3
 233:23
 2423:3
 253:4
 264:3
 274:404
 28404:4
 294:24
 3024:4
 314:5
 325:4
 335:405
 34405:5
 355:25
 3625:5
 375:6
 386:5
 396:406
 40406:6
 416:26
 4226:6
 436:7
 447:6
 457:407
 46407:7
 477:27
 4827:7
 497:8
 508:7
 518:408
 52408:8
 538:28
 5428:8
 558:9
 569:8
 579:409
 58409:9
 599:29
 6029:9
 619:10
 6210:9
 6310:410
 64410:10
 6510:30
 6630:10
 6710:11
 6811:10
 6911:411
 70411:11
 7111:31
 7231:11
 7311:12
 7412:11
 7512:412
 76412:12
 7712:32
 7832:12
 7912:13
 8013:12
 8113:413
 82413:13
 8313:33
 8433:13
 8513:14
 8614:13
 8714:414
 88414:14
 8914:34
 9034:14
 9114:15
 9215:14
 9315:415
 94415:15
 9515:35
 9635:15
 9715:16
 9816:15
 9916:416
100416:16
10116:36
10236:16
10316:17
10417:16
10517:417
106417:17
10717:37
10837:17
10917:18
11018:17
11118:418
112418:18
11318:38
11438:18
11518:19
11619:18
11719:419
118419:19
11919:39
12039:19
12120:420
122420:20
12320:40
12440:20
12520:21
12621:20
12721:421
128421:21
12921:41
13041:21
13121:22
13222:21
13322:422
134422:22
13522:42
13642:22
13722:23
13823:22
13923:423
140423:23
14123:43
14243:23
14323:24
14424:23
14524:424
146424:24
14724:44
14844:24
14924:25
15025:24
15125:425
152425:25
15325:45
15445:25
15525:26
15626:25
15726:426
158426:26
15926:46
16046:26
16126:27
16227:26
16327:427
164427:27
16527:47
16647:27
16727:28
16828:27
16928:428
170428:28
17128:48
17248:28
17328:29
17429:28
17529:429
176429:29
17729:49
17849:29
17929:30
18030:29
18130:430
182430:30
18330:50
18450:30
18530:31
18631:30
18731:431
188431:31
18931:51
19051:31
19131:32
19232:31
19332:432
194432:32
19532:52
19652:32
19732:33
19833:32
19933:433
200433:33

interactions_files_list.txt

1<interactions.txt>

locations.txt

11
2Location Index
30

Complex Stochastic Model

This is an example of how creative a user can get with respect to the disease model he/she would want to use. As you can see from the UserModel.py despite the presence of many states, Episimmer has the ability to build complex models without any effort.


Generate_policy.py

 1from episimmer.policy import lockdown_policy
 2
 3
 4def generate_policy():
 5	policy_list=[]
 6
 7	def lockdown_fn(time_step):
 8		return False
 9
10	policy_list.append(lockdown_policy.FullLockdown(lockdown_fn))
11
12	return policy_list

UserModel.py

 1import episimmer.model as model
 2
 3
 4class UserModel(model.StochasticModel):
 5	def __init__(self):
 6
 7		beta=0.05
 8		delta=0.05
 9		sigma=0.3
10		beta1=0.3
11		k0=0.2
12		mu=0.2
13		kt=0.3
14		kt1=0.3
15		kt2=0.3
16		gamma1=0.3
17		gamma2=0.3
18		gamma3=0.3
19
20		individual_types=['S','A','I','P','R','E','XS','XA','XI','XE']
21		infected_states=[]
22		state_proportion={
23							'S':1
24						}
25		model.StochasticModel.__init__(self,individual_types,infected_states,state_proportion)
26		self.set_transition('S','A',self.p_standard(beta))
27		self.set_transition('A','I',self.p_standard(sigma))
28		self.set_transition('XS','XA',self.p_standard(beta1*beta))
29		self.set_transition('XA','XI',self.p_standard(sigma))
30		self.set_transition('S','XS',self.p_standard(k0))
31		self.set_transition('XS','S',self.p_standard(mu))
32		self.set_transition('A','XA',self.p_standard(k0))
33		self.set_transition('XA','A',self.p_standard(mu))
34		self.set_transition('E','XE',self.p_standard(k0))
35		self.set_transition('XE','E',self.p_standard(mu))
36		self.set_transition('I','XI',self.p_standard(k0))
37		self.set_transition('XI','I',self.p_standard(mu))
38		self.set_transition('S','E',self.p_standard(delta))
39		self.set_transition('XS','XE',self.p_standard(beta1*delta))
40		self.set_transition('I','P',self.p_standard(kt))
41		self.set_transition('XI','P',self.p_standard(kt))
42		self.set_transition('A','P',self.p_standard(kt2))
43		self.set_transition('XA','P',self.p_standard(kt2))
44		self.set_transition('E','P',self.p_standard(kt1))
45		self.set_transition('XE','P',self.p_standard(kt1))
46		self.set_transition('P','R',self.p_standard(gamma3))
47		self.set_transition('I','R',self.p_standard(gamma2))
48		self.set_transition('XI','R',self.p_standard(gamma2))
49		self.set_transition('E','R',self.p_standard(gamma1))
50		self.set_transition('XE','R',self.p_standard(gamma1))
51
52
53		self.name='Probablistic Lockdown Model'

agents.txt

  11300
  2Agent Index
  30
  41
  52
  63
  74
  85
  96
 107
 118
 129
 1310
 1411
 1512
 1613
 1714
 1815
 1916
 2017
 2118
 2219
 2320
 2421
 2522
 2623
 2724
 2825
 2926
 3027
 3128
 3229
 3330
 3431
 3532
 3633
 3734
 3835
 3936
 4037
 4138
 4239
 4340
 4441
 4542
 4643
 4744
 4845
 4946
 5047
 5148
 5249
 5350
 5451
 5552
 5653
 5754
 5855
 5956
 6057
 6158
 6259
 6360
 6461
 6562
 6663
 6764
 6865
 6966
 7067
 7168
 7269
 7370
 7471
 7572
 7673
 7774
 7875
 7976
 8077
 8178
 8279
 8380
 8481
 8582
 8683
 8784
 8885
 8986
 9087
 9188
 9289
 9390
 9491
 9592
 9693
 9794
 9895
 9996
10097
10198
10299
103100
104101
105102
106103
107104
108105
109106
110107
111108
112109
113110
114111
115112
116113
117114
118115
119116
120117
121118
122119
123120
124121
125122
126123
127124
128125
129126
130127
131128
132129
133130
134131
135132
136133
137134
138135
139136
140137
141138
142139
143140
144141
145142
146143
147144
148145
149146
150147
151148
152149
153150
154151
155152
156153
157154
158155
159156
160157
161158
162159
163160
164161
165162
166163
167164
168165
169166
170167
171168
172169
173170
174171
175172
176173
177174
178175
179176
180177
181178
182179
183180
184181
185182
186183
187184
188185
189186
190187
191188
192189
193190
194191
195192
196193
197194
198195
199196
200197

config.txt

 1Random Seed <3>
 2Number of worlds <1>
 3Number of Days <30>
 4Agent Parameter Keys <Agent Index>
 5Agent list filename <agents.txt>
 6Interaction Info Keys <>
 7Interaction Files list filename <>
 8Probabilistic Interaction Files list filename <>
 9Location Parameter Keys <Location Index>
10Location list filename <locations.txt>
11Event Parameter Keys <Location Index:Agents>
12Event Files list filename <>
13One Time Event filename <>

locations.txt

11
2Location Index
30

List_Of_Lists

Episimmer can handle a list of File lists in the config file and run them concurrently. This is to provide the ability to simulate timetable-like simulation environments. For example, Student Timetables for each class are different but the classes are conducted at the same time.

Thus, Events, Interactions and Probabilistic Interactions can pass multiple file_lists in the config file as shown in this example.


Generate_policy.py

 1from episimmer.policy import lockdown_policy
 2
 3
 4def generate_policy():
 5	policy_list=[]
 6
 7	def lockdown_fn(time_step):
 8		return False
 9
10	policy_list.append(lockdown_policy.FullLockdown(lockdown_fn))
11
12	return policy_list

UserModel.py

 1import math
 2
 3import episimmer.model as model
 4
 5
 6def probability_of_infection_fn(p_infected_states_list,contact_agent,c_dict,current_time_step):
 7
 8	p_inf_symp,p_inf_asymp=p_infected_states_list[0],p_infected_states_list[1]
 9	#EXAMPLE 1
10	if contact_agent.state=='Symptomatic':
11		return math.tanh(float(c_dict['Time Interval']))*p_inf_symp
12	elif contact_agent.state=='Asymptomatic':
13		return math.tanh(float(c_dict['Time Interval']))*p_inf_asymp
14	else:
15		return 0
16
17	#Example 2
18	if contact_agent.state=='Symptomatic':
19		return math.tanh(float(c_dict['Time Interval'])*float(c_dict['Intensity']))*p_inf_symp
20	elif contact_agent.state=='Asymptomatic':
21		return math.tanh(float(c_dict['Time Interval'])*float(c_dict['Intensity']))*p_inf_asymp
22	else:
23		return 0
24
25def event_contribute_fn(agent,event_info,location,current_time_step):
26	#Example 1
27	if agent.state=='Symptomatic':
28		return 1
29	elif agent.state=='Asymptomatic':
30		return 0.3
31	else:
32		return 0
33
34	#Example 2
35	susceptibility=1
36	if agent.info['HLA Type']=='A':
37		susceptibility=0.9
38
39	if agent.state=='Symptomatic':
40		return math.tanh(float(event_info['Time Interval']))*(1-location.info['Ventilation'])*susceptibility
41	elif agent.state=='Asymptomatic':
42		return 0.3*math.tanh(float(event_info['Time Interval']))*(1-location.info['Ventilation'])*susceptibility
43
44def event_receive_fn(agent,ambient_infection,event_info,location,current_time_step):
45	p=math.tanh(ambient_infection*0.3)
46	return p
47
48
49
50
51class UserModel(model.StochasticModel):
52	def __init__(self):
53		individual_types=['Susceptible','Exposed','Asymptomatic','Symptomatic','Recovered']
54		infected_states=['Asymptomatic','Symptomatic']
55		state_proportion={
56							'Susceptible':0.99,
57							'Exposed':0.01,
58							'Recovered':0,
59							'Asymptomatic':0,
60							'Symptomatic':0
61						}
62		model.StochasticModel.__init__(self,individual_types,infected_states,state_proportion)
63		self.set_transition('Susceptible', 'Exposed', self.p_infection(probability_of_infection_fn,[0.3,0.1]))
64		self.set_transition('Exposed', 'Symptomatic', self.p_standard(0.15))
65		self.set_transition('Exposed', 'Asymptomatic', self.p_standard(0.2))
66		self.set_transition('Symptomatic', 'Recovered', self.p_standard(0.2))
67		self.set_transition('Asymptomatic', 'Recovered', self.p_standard(0.2))
68
69		self.set_event_contribution_fn(event_contribute_fn)
70		self.set_event_receive_fn(event_receive_fn)

agents.csv

  1Agent Index,Type,Residence,HLA Type
  20,Staff,Dorm B,C
  31,Student,Teacher Dorm,C
  42,Visitor,Dorm B,A
  53,Student,Teacher Dorm,C
  64,Visitor,Dorm A,A
  75,Administration,Dorm A,B
  86,Teacher,Teacher Dorm,C
  97,Teacher,Teacher Dorm,C
 108,Visitor,Dorm B,C
 119,Visitor,Dorm B,C
 1210,Visitor,Outside,C
 1311,Administration,Dorm A,C
 1412,Student,Outside,A
 1513,Visitor,Outside,B
 1614,Administration,Dorm A,B
 1715,Student,Outside,C
 1816,Student,Teacher Dorm,A
 1917,Student,Dorm A,C
 2018,Teacher,Teacher Dorm,A
 2119,Visitor,Dorm A,B
 2220,Student,Dorm A,A
 2321,Administration,Outside,C
 2422,Visitor,Dorm B,A
 2523,Staff,Dorm A,B
 2624,Visitor,Dorm B,A
 2725,Staff,Teacher Dorm,C
 2826,Teacher,Teacher Dorm,B
 2927,Student,Teacher Dorm,A
 3028,Teacher,Outside,C
 3129,Administration,Outside,A
 3230,Administration,Dorm B,A
 3331,Teacher,Dorm B,A
 3432,Teacher,Outside,A
 3533,Teacher,Dorm A,C
 3634,Staff,Outside,B
 3735,Student,Dorm B,C
 3836,Visitor,Outside,C
 3937,Staff,Dorm A,C
 4038,Staff,Teacher Dorm,B
 4139,Student,Dorm A,C
 4240,Administration,Outside,C
 4341,Teacher,Teacher Dorm,A
 4442,Visitor,Dorm A,C
 4543,Administration,Teacher Dorm,C
 4644,Administration,Dorm A,B
 4745,Administration,Dorm B,C
 4846,Student,Dorm A,B
 4947,Visitor,Dorm B,B
 5048,Staff,Dorm A,A
 5149,Student,Outside,B
 5250,Visitor,Dorm B,C
 5351,Student,Teacher Dorm,B
 5452,Teacher,Teacher Dorm,B
 5553,Student,Outside,A
 5654,Administration,Dorm A,A
 5755,Teacher,Outside,C
 5856,Teacher,Dorm A,A
 5957,Visitor,Dorm A,A
 6058,Visitor,Dorm A,B
 6159,Staff,Dorm A,A
 6260,Staff,Dorm A,A
 6361,Teacher,Teacher Dorm,B
 6462,Teacher,Dorm B,C
 6563,Staff,Dorm A,B
 6664,Visitor,Dorm B,C
 6765,Staff,Outside,C
 6866,Administration,Dorm A,B
 6967,Administration,Outside,A
 7068,Teacher,Teacher Dorm,B
 7169,Student,Outside,A
 7270,Staff,Dorm B,C
 7371,Visitor,Outside,A
 7472,Staff,Dorm B,A
 7573,Student,Outside,B
 7674,Administration,Outside,C
 7775,Teacher,Dorm B,A
 7876,Administration,Outside,A
 7977,Teacher,Teacher Dorm,C
 8078,Teacher,Teacher Dorm,B
 8179,Staff,Outside,A
 8280,Student,Dorm A,C
 8381,Visitor,Outside,B
 8482,Administration,Outside,C
 8583,Teacher,Dorm B,C
 8684,Staff,Teacher Dorm,C
 8785,Student,Dorm B,B
 8886,Teacher,Dorm B,C
 8987,Teacher,Dorm A,A
 9088,Staff,Teacher Dorm,B
 9189,Visitor,Dorm B,C
 9290,Administration,Teacher Dorm,B
 9391,Visitor,Dorm B,C
 9492,Student,Teacher Dorm,C
 9593,Visitor,Teacher Dorm,B
 9694,Administration,Outside,B
 9795,Administration,Teacher Dorm,C
 9896,Administration,Dorm B,A
 9997,Staff,Dorm B,C
10098,Visitor,Teacher Dorm,B
10199,Teacher,Dorm B,B

agents.txt

  1100
  2Agent Index:Type:Residence:HLA Type
  30:Visitor:Outside:B
  41:Visitor:Teacher Dorm:C
  52:Visitor:Outside:C
  63:Staff:Teacher Dorm:A
  74:Student:Dorm A:A
  85:Visitor:Dorm A:B
  96:Administration:Teacher Dorm:C
 107:Staff:Teacher Dorm:C
 118:Staff:Outside:A
 129:Teacher:Dorm B:B
 1310:Visitor:Teacher Dorm:C
 1411:Administration:Outside:B
 1512:Visitor:Outside:C
 1613:Staff:Outside:B
 1714:Staff:Dorm A:B
 1815:Visitor:Teacher Dorm:B
 1916:Staff:Outside:A
 2017:Staff:Dorm A:B
 2118:Teacher:Dorm B:C
 2219:Staff:Dorm A:A
 2320:Visitor:Outside:B
 2421:Student:Teacher Dorm:B
 2522:Teacher:Teacher Dorm:C
 2623:Staff:Dorm A:C
 2724:Visitor:Dorm B:B
 2825:Visitor:Outside:C
 2926:Visitor:Outside:B
 3027:Staff:Outside:C
 3128:Teacher:Dorm A:C
 3229:Student:Dorm A:B
 3330:Staff:Dorm A:A
 3431:Student:Teacher Dorm:C
 3532:Administration:Teacher Dorm:A
 3633:Teacher:Dorm A:A
 3734:Administration:Dorm A:C
 3835:Teacher:Dorm B:B
 3936:Student:Dorm A:A
 4037:Administration:Dorm A:A
 4138:Teacher:Outside:B
 4239:Teacher:Dorm B:B
 4340:Administration:Teacher Dorm:A
 4441:Staff:Teacher Dorm:A
 4542:Teacher:Outside:B
 4643:Administration:Teacher Dorm:B
 4744:Teacher:Outside:C
 4845:Visitor:Outside:A
 4946:Visitor:Teacher Dorm:A
 5047:Administration:Teacher Dorm:A
 5148:Staff:Dorm A:A
 5249:Student:Outside:B
 5350:Staff:Teacher Dorm:B
 5451:Administration:Outside:C
 5552:Student:Dorm B:C
 5653:Administration:Dorm A:C
 5754:Administration:Outside:A
 5855:Administration:Outside:C
 5956:Administration:Dorm A:C
 6057:Visitor:Outside:B
 6158:Teacher:Outside:A
 6259:Staff:Outside:A
 6360:Administration:Teacher Dorm:A
 6461:Student:Teacher Dorm:A
 6562:Student:Dorm B:A
 6663:Teacher:Dorm A:C
 6764:Staff:Dorm A:A
 6865:Student:Teacher Dorm:C
 6966:Teacher:Outside:C
 7067:Staff:Dorm B:B
 7168:Administration:Teacher Dorm:B
 7269:Teacher:Teacher Dorm:C
 7370:Administration:Teacher Dorm:C
 7471:Visitor:Outside:B
 7572:Visitor:Teacher Dorm:C
 7673:Visitor:Teacher Dorm:C
 7774:Administration:Dorm A:C
 7875:Student:Outside:C
 7976:Visitor:Outside:C
 8077:Student:Teacher Dorm:A
 8178:Teacher:Dorm A:B
 8279:Visitor:Dorm B:C
 8380:Administration:Outside:C
 8481:Student:Dorm B:A
 8582:Visitor:Dorm B:B
 8683:Administration:Outside:A
 8784:Student:Teacher Dorm:A
 8885:Student:Dorm A:C
 8986:Staff:Dorm B:A
 9087:Administration:Teacher Dorm:B
 9188:Administration:Dorm A:A
 9289:Teacher:Dorm A:C
 9390:Administration:Dorm A:B
 9491:Student:Outside:C
 9592:Student:Dorm A:B
 9693:Teacher:Teacher Dorm:C
 9794:Student:Outside:C
 9895:Administration:Teacher Dorm:C
 9996:Staff:Outside:B
10097:Staff:Dorm A:C
10198:Teacher:Outside:A
10299:Administration:Dorm A:B

config.txt

 1Random Seed <3>
 2Number of worlds <3>
 3Number of Days <30>
 4Agent Parameter Keys <Agent Index:Type:Residence:HLA Type>
 5Agent list filename <agents.csv>
 6Interaction Info Keys <Agent Index:Interacting Agent Index:Time Interval:Intensity>
 7Interaction Files list filename <interaction_files_list.txt,interaction_files_list2.txt>
 8Probabilistic Interaction Files list filename <>
 9Location Parameter Keys <Location Index:Type:Ventilation:Roomsize:Capacity>
10Location list filename <locations.txt>
11Event Parameter Keys <Location Index:Agents:Time Interval>
12Event Files list filename <event_files_list.txt,event_files_list2.txt>
13One Time Event filename <>

even_contacts.csv

 1Agent Index,Interacting Agent Index,Time Interval,Intensity
 267,66,9.857117310137038,0.5920888806387263
 339,40,2.9606587904019332,0.28799857726311495
 419,48,9.933376750841031,0.5563869797724015
 547,14,2.707792838677613,0.11910322049310873
 697,93,7.330200583028975,0.05479876188162769
 736,52,5.8053943720215395,0.5087501005692888
 816,29,2.9259700624959297,0.7450077742936179
 924,76,6.615452592843672,0.23066023231585764
1098,1,0.6129732778252273,0.03079626452546913
1152,51,4.991234253861199,0.11029211445761467
1249,64,4.281211334785262,0.09369780403627248
1376,15,3.110100778578777,0.16882508544803732
144,82,5.018950780821032,0.4528425446162895
1525,23,1.523435869691594,0.8698275706188255
1669,26,5.982815427997005,0.8195210582557968
176,69,6.002756213947941,0.47565948855915063
1851,92,0.9693831534702857,0.8545362381598459
194,54,8.926690297564479,0.19650516555917197
2096,37,1.0761711632578574,0.2856646294271543
2156,11,6.206036904245246,0.025636240561556556
2263,45,9.243970250499935,0.8459046432706034
2318,80,7.21308647170134,0.18639074663509203
2422,25,8.566766221711488,0.9194158046579632
2546,78,9.436676144535742,0.3066038278097547
2655,33,0.36786224695660175,0.46598870340260434
2780,31,4.295593090845587,0.7887243574197714
2874,96,9.079412546074366,0.2008470536485456
2993,11,1.811367363309666,0.24854787128323197
3017,45,1.3031037142786772,0.736713001093112
3154,77,6.689236468914333,0.18914544406995604
3248,55,6.561686523837922,0.8415382745176084
3395,24,2.1199045466842223,0.3191748832651885
340,43,6.361037571365211,0.054785174673453896
350,86,0.05530006267194132,0.44722966677561227
3667,8,5.108232528265227,0.0780720907027247
376,57,9.073223985113284,0.6305218263588744
3816,8,6.875884563883529,0.7889755826254277
3935,48,3.63455049866231,0.23653026160724466
4093,72,2.726782980498262,0.7473684674491506
4143,65,0.5285308238378339,0.8079994482515851
4230,84,5.435250398044084,0.22794249938945577
4368,66,5.812705194521447,0.3987768568223644
4437,30,5.462713140719986,0.2651939540942704
4517,49,9.554281145866424,0.2854383038592877
463,1,7.129363264331846,0.6332198675617925
4734,66,3.7040828036302886,0.15835840507645926
4839,53,8.70713280127657,0.7521303893855847
4985,42,2.9065301405226784,0.4061131567948121
504,71,7.566520295016451,0.4702871038447024
5125,72,3.3524932671715546,0.991241688877458

even_events.txt

 110
 2Location Index:Agents:Time Interval
 31:63,91,41,97,7,44,73,88,6,36,22:45
 45:70,76,47:60
 51:50,91,48,78:10
 69:60,55,98,50,0,11,22,13,92,54,33,84,14:60
 75:7,76,83,54,90,94,79,2,75,34,7,96,50,10,23,54,94,15,41,87,6:30
 82:44,90,20,90,40,99,25,95,5,3,31,31,50,31,4,48,40,80,6:10
 91:99,53,83,90,63,45,12,82,28,96,68:10
102:61,99,34,2,53,88,77,16,90,28,43,63,62,88,42:30
113:93,29,68,43,29,0,67,49,9,92:10
126:91,31,55,9,57,71,39,25,76,76,17,6,18,34,27,4,75,4,62,29,6:60

event_files_list.txt

1<monday_events.txt>
2<tuesday_events.txt>
3<wednesday_events.txt>
4<thursday_events.txt>
5<friday_events.txt>
6<saturday_events.txt>
7<sunday_events.txt>

event_files_list2.txt

1<odd_events.txt>
2<even_events.txt>

friday_contacts.csv

  1Agent Index,Interacting Agent Index,Time Interval,Intensity
  296,57,5.004142877127,0.42191921620925354
  354,27,5.641672551963007,0.7462919078948316
  425,8,1.794290991869778,0.8194479950290448
  548,12,0.22317783046829742,0.5930024147218874
  632,1,2.0332990080122935,0.9049495038090604
  779,4,5.349489905495666,0.25834688605446654
  816,19,7.482148590293117,0.8597260125619213
  91,84,1.643656099054901,0.6492400176694979
 1091,92,7.539420185381803,0.1572574957436378
 110,18,0.412793980070838,0.12359152155948494
 1227,4,2.1036845816262373,0.7556071327228134
 1344,93,0.5338106410878762,0.3250995579281485
 147,85,2.700768270414009,0.6396363196460858
 1525,54,7.851908992747192,0.03235332764508547
 1686,18,4.264343699418963,0.03294294008400289
 1747,49,2.2001671472930973,0.8547969093028639
 1888,57,9.21067656780389,0.9149669418045047
 1991,60,5.954707715564772,0.5719792018299477
 2070,13,8.590870958001473,0.3467306495161502
 2139,25,3.0242832181735766,0.4138264196643887
 2231,32,4.446511361608556,0.3307555630717903
 2372,16,7.152478159718685,0.4051997279355414
 2451,56,5.126758363544265,0.03510071951222604
 2557,69,1.8038913841447546,0.6695529982166318
 2650,34,6.781050924626727,0.00925049088045582
 279,57,2.0483981637076076,0.8150216743517682
 282,46,1.9695147002286972,0.8236731954676536
 2976,10,3.2367032040028865,0.189359530938495
 3093,40,3.5290802325675985,0.5770031224285761
 3113,51,8.366286124001043,0.7531077788790762
 323,43,4.667816904834296,0.5663977961774596
 3328,87,4.033038804641689,0.523226854909037
 3495,61,4.099665005428983,0.382169865819883
 3511,58,5.760839569829173,0.5331949513335849
 3618,26,0.09758072728262124,0.7763890421115288
 3713,8,3.3584379922185317,0.1863867865578278
 3860,60,7.177857666160996,0.10434104385849963
 3965,96,1.1312776613884845,0.9674134933532024
 406,33,5.839416802331847,0.378146491269558
 4148,43,7.271644108335251,0.8995373336774743
 4284,81,0.43165651762144375,0.3493858177036441
 4317,78,4.34280471192559,0.2029239277672824
 4458,12,3.017355257636595,0.08158660374123372
 4523,76,2.964865343386526,0.0690704096811312
 4648,35,5.776276020339678,0.893577319760597
 4773,2,1.7577645470923775,0.06759772321371171
 4837,96,1.933497529060112,0.38664529916662904
 4955,16,9.506699244782125,0.5224209433841157
 5021,89,3.9832543315545896,0.21727916670097103
 5130,43,9.439600407370815,0.4025782968889513
 524,94,4.0558134618401365,0.4412080905758925
 5383,87,0.5577932147347009,0.46357822403968507
 5464,17,5.698770885091612,0.3799729422257563
 5582,6,7.314244632540017,0.9379001142886053
 5651,47,4.972927027027878,0.7498405462605637
 5746,21,3.7018950508852324,0.5939738834476441
 5819,24,9.129329003202235,0.3757168235721946
 5978,68,9.318254737275796,0.30123710713292373
 6065,48,2.7578489748122936,0.7651692440439245
 6185,96,4.750884998198361,0.30555530537592257
 6244,59,3.7588664444315434,0.029012995900403737
 6342,53,7.965520525420933,0.500322500665823
 6434,89,8.137472839811998,0.10683445931853242
 6531,74,7.154376619192167,0.020288324506276934
 6614,87,5.458581884838476,0.4920008942367613
 6780,69,8.248995001589027,0.23526849665722827
 6850,21,2.5306642194391116,0.3794406316118146
 6961,45,5.298710794959918,0.37907685807994806
 7085,24,8.321777043104493,0.536579378508093
 7162,76,7.7095256085339345,0.3829852909795268
 7297,68,6.720884566803925,0.3390071114792286
 7360,77,4.533234610599038,0.8113433047634149
 7426,10,8.06790434062078,0.30299925326446464
 7547,43,8.69852562934309,0.7895856290622782
 7678,27,3.6823345284575018,0.6433166905984297
 7782,95,2.9028972238732917,0.5743434116842108
 7848,50,1.2885001947678354,0.5845643239525443
 7924,92,5.10702514748865,0.8295933418361403
 804,70,3.697077445626795,0.7706536847343546
 8119,48,9.705052235091756,0.270603140864078
 8211,35,1.6398273857230894,0.5619636810964064
 8364,82,8.60868600219238,0.5136674086504184
 8424,73,4.747910218034176,0.9698540725625405
 8577,39,9.537053731100741,0.3184912393594964
 8626,65,6.623026331783141,0.12464013667280971
 8718,6,3.118879056544123,0.1687671012080162
 8825,88,1.661248992411558,0.0027643427331558446
 8930,16,1.7496507474499778,0.7533736018848727
 9014,68,4.7877230911941435,0.8567674787579299
 9190,35,4.017104747627666,0.3475651824665301
 9250,90,7.885812663252305,0.15224668925837392
 9388,69,3.527703312016046,0.321127267891277
 9460,76,4.367915897127837,0.855080625730378
 9565,1,1.2124336273196634,0.09352156937936174
 9641,44,2.1441067147164086,0.8308344029216161
 9775,37,5.23272398959814,0.12124510374511377
 9887,47,4.538318227134673,0.9102798004594629
 9965,93,8.049689874685107,0.6156585039063263
10027,58,0.3047661250962619,0.7169403094641904
10183,16,9.20113436803063,0.07680089025478865
10252,32,3.3875605244645546,0.44228488826006074
1035,90,7.7095709383023046,0.9799160115631094
10452,97,3.6345203156375074,0.7827122469716974
10512,58,4.838114696803647,0.05473584699724787
10610,72,0.508058948403507,0.9765336364302032
10717,50,4.027819358150032,0.24275873502950995
10814,97,9.524236590404163,0.11350964370743688
10911,77,3.527122966633823,0.5955015777009192
11091,45,4.772816223394329,0.7847202464900873
11178,67,6.20973216289181,0.8563825326861786
1120,64,0.9431439754563342,0.5482371426367199
11358,16,6.549678084867544,0.7318436530470492
1147,1,8.399829627881095,0.4050885728277188
11592,79,2.5015507201515397,0.6365583371748141
11688,12,9.988248273349624,0.91778648665744
11736,78,3.5159152629245307,0.2713837465739497
11851,55,9.375528856307408,0.3026126573046497
11992,16,4.027980101435947,0.9242330260173324
1203,39,7.560986956014491,0.3032799651405086
12169,93,8.318737374058491,0.9468290390539934
12256,19,8.769740801633382,0.7910807429615233
1233,78,4.85867456393448,0.9293999905478831
12443,34,7.62621241841282,0.4909205436131492
12538,70,0.8485749761563488,0.8174025274111226
12697,21,1.4620852192773992,0.28112583098770594
12778,0,3.6170753191985927,0.08955589947833242
1284,75,6.741010108321763,0.042069505873642
12985,91,9.104591257308506,0.6706786433254306
13077,47,7.373105749484914,0.342128451024016
13197,25,7.551534579609695,0.8037059903606372
1320,65,0.18652005163854013,0.5596295475108785
13374,32,3.8660598542307167,0.36416943608251073
13432,42,2.979184547336715,0.8546082155458167
13558,37,7.356194239909315,0.6748553130671284
1366,4,9.441521880256872,0.6546753816907176

friday_contacts.txt

  1135
  2Agent Index:Interacting Agent Index:Time Interval:Intensity
  310:88:6.688619668606895:0.9667447062422788
  49:95:0.9007299229441801:0.29413754832944883
  531:65:2.3104869981567724:0.13629109371609527
  676:96:3.014786047555358:0.06339801582240967
  751:45:3.131052149585477:0.4445434382525858
  889:8:1.9427263725803523:0.8808337927621033
  910:58:2.495396084901178:0.3683191418222923
 1021:6:9.164811448710253:0.9149064054528824
 1120:94:9.073726154746812:0.09172186189747888
 1211:35:5.811227020170672:0.04277875290311006
 1381:67:7.382044703884041:0.7562618254548581
 1435:88:5.427284912563087:0.4919887871599472
 1564:98:3.2931497408328347:0.20795695942795245
 1621:60:5.309981205719868:0.011521792726691515
 1796:55:9.656859364978201:0.3703774321272413
 1856:15:9.416354213552863:0.6794383500051776
 1926:84:1.984408867513613:0.29733391878026927
 2020:92:4.853416282497795:0.7638596564144793
 2174:36:4.155107158450942:0.3304639571662785
 2298:80:5.883730603507602:0.7125416288385673
 2348:58:4.237992321318459:0.2184722842877974
 2463:11:9.4185033672319:0.6937998477526771
 2593:84:0.07677001757306234:0.48147174789615876
 264:14:3.9106702580659745:0.8198449581478692
 2720:25:9.759725526106168:0.7121362469200376
 288:40:9.859266700927066:0.9002242531813217
 297:48:5.9862020774776905:0.2562517464656725
 3023:54:1.687746631438165:0.5900449712604049
 3150:10:7.664351665510184:0.34811947944265953
 3228:46:5.972242241867672:0.8446013225231795
 3348:84:0.4610657004284924:0.6920856877392875
 3422:80:5.797512189699676:0.5749543208902808
 3515:69:0.6755755530815644:0.16837016924547443
 3689:21:3.7647209748264734:0.022369240867610274
 3795:99:7.419111728757224:0.6755793454767197
 3846:1:6.0869705981206765:0.9392659049557766
 3996:62:0.38005028756432413:0.9685916051859171
 4075:35:1.5759150731503702:0.7930309701559252
 4183:18:6.419755471582778:0.8909924833495784
 4263:5:4.374873831058975:0.14767216650642556
 4377:36:1.1436741940145367:0.027032871240488587
 4431:27:0.03543073074623537:0.26791737345013567
 4593:58:8.600159028547823:0.5089371541057991
 4637:83:9.525552257972498:0.7630639782440107
 4712:71:0.1838245228022528:0.16301999982715865
 484:28:7.201106455933197:0.639241011778947
 4939:55:2.1450605439606854:0.0072084624135791975
 5076:28:0.8317688391569544:0.11354085521055068
 5192:75:8.891200749890123:0.40037278495757134
 5263:67:0.6057359831130937:0.49096137048602173
 531:78:2.175748319238159:0.1973094235179783
 5444:90:6.603685950367471:0.07742541911225254
 5543:48:5.313085158201147:0.0031820058422277198
 5640:66:5.140130492045794:0.3522022574851984
 5773:47:7.622359504852094:0.3803414058582355
 5844:6:9.90535715069833:0.7067631788482184
 5982:71:8.438586749469684:0.05817509423223455
 6027:89:6.191647064682342:0.4954437234413782
 6140:16:2.7203192040973834:0.20918796475319368
 6272:94:1.0722333108247561:0.29041196859888474
 6371:3:4.911064356203861:0.40762232519762864
 6496:13:6.0216102844761465:0.18221116663426262
 6587:44:8.942071102975323:0.6762865235784432
 6681:87:5.828205005560443:0.43654291147178037
 6767:0:9.558161218422207:0.9782982086424898
 6826:15:2.747686471657702:0.5841505638191209
 6960:64:3.1877027193758387:0.7852519193645222
 7028:21:8.89719398196214:0.7796779703774409
 7137:27:6.148709351415107:0.11498229333292553
 7211:64:2.588199198086797:0.9232497898570643
 7394:60:4.584180815888526:0.6663030600822625
 7496:14:0.50361178946847:0.6276123660867005
 7560:21:6.304111960148045:0.40129177112848724
 7672:1:7.946241811259695:0.7384589147638106
 7716:72:8.280083142609529:0.4050472195277236
 789:11:9.83701917013762:0.5098460996889553
 7972:29:2.7846659029729883:0.040863074669492905
 800:87:2.5247982332670693:0.1763267929861304
 819:42:4.288106193000074:0.2738502204725093
 8283:42:0.7506400165327698:0.7642430599819986
 8312:76:9.9768333694983:0.2717578760733744
 8420:49:5.381409836273989:0.6346301712804985
 8516:16:3.6726867565695507:0.5582714052891703
 863:85:1.3686976214395152:0.29712675725144
 8774:15:3.4809262245707284:0.08676173861125958
 8899:0:6.3566236770104645:0.7076734815700955
 8992:2:1.2152547236516253:0.06654621024479845
 9062:39:1.2779870965308293:0.45103199912883984
 910:67:0.001817668070662748:0.29057807898622035
 9268:31:7.533477004492588:0.9192380824068297
 9312:95:3.6035444861225017:0.6605518577198357
 9480:59:7.992128919597919:0.4588233013708509
 9592:9:5.942982815932124:0.8525527661682476
 9654:49:2.5528781753994645:0.1674153560281869
 9767:56:2.4068751851152905:0.06936911168175486
 9899:22:3.5335711374409917:0.39379603080655945
 9991:95:3.9199908183515664:0.25378177050876816
10073:18:3.503121031888783:0.7584130737841819
10168:46:1.4189787199600157:0.019877623645405795
10244:23:4.212711155988669:0.30143615210535746
10347:39:0.5087911598281225:0.5893668330016113
10448:92:2.3542849120881657:0.9451616102571446
1058:54:6.903186150983789:0.2695255667504325
10614:84:9.462171277620177:0.060500538799988846
10791:25:3.697664572724438:0.4079539487067759
10888:55:7.346264967721757:0.552949376315497
10952:88:9.665066927538911:0.7401975800017172
11018:7:4.4697307603688285:0.3782737394491341
11190:32:2.916400428655871:0.536697768154158
1122:74:8.317196407757693:0.2955317179537563
11365:73:8.914697419270194:0.8930540458434777
11420:21:4.219761483887274:0.2632063077194766
11575:97:6.310357238443305:0.14546059647798926
11626:69:5.469932282412852:0.1777212237813397
11722:31:8.687063973633554:0.02966055949862567
11887:78:3.4690077115478637:0.5578236892580205
11962:47:7.198318314161049:0.8276001292402286
12074:98:2.3265643497552024:0.22498444445538013
12151:72:4.797553032172871:0.13299317181491055
12236:76:5.369674743302922:0.6308887356663198
12381:59:5.147324117443669:0.8496019187336087
12455:82:5.933758031306022:0.4066184094819313
12554:6:2.448195518938933:0.0869846065164368
12631:97:6.658117713557282:0.4701995171802008
12744:26:5.384133256347262:0.2881262392733547
12866:93:4.77688056130655:0.02994329042677224
12991:19:2.565625338887955:0.888807228949255
13040:4:4.003688953910921:0.9128964821711357
13194:91:7.023901631427076:0.6382076850534217
13217:52:9.229885545120888:0.3200856999256
13382:5:6.528401052084762:0.747569444766493
13420:29:3.094567113936595:0.6996607131893888
13585:19:3.4859677673907297:0.4504028250467983
13612:62:2.279581910720033:0.31311123094403015
13796:66:7.081217549271823:0.7148731929250536

friday_events.txt

 110
 2Location Index:Agents:Time Interval
 32:45,66,63,77,71,80,50,14,92,19:60
 47:42,17,26,76,4,4,1,42,29,78,2,24,24,48,35,10,52,57,1,94,11:30
 59:19,99:10
 65:1,74,5,46,18,27,43,60,17,29,70,4,92,94,37,63,96,33,11,81:60
 74:43,29,49,74,40,99,3,48,31,96,93,69:10
 81:24,57,37,92,20,6,28,94,2,95,88,16,81:45
 91:71,65,42,66,49,79,32,50,16,43,55,67,32,92,81,91,87,76,82,4:30
100:68,57,48,79,3,26,63,25,29,21,44,35,37,56,85,55,39,6,40,97:30
119:74,26,10,55,59,41,64,38,46,76,70,33,17,31:60
120:55,16,79,60,40,54:60

generate_agents.py

 1import random
 2
 3import numpy as np
 4
 5
 6def write_to_file(filename,n):
 7	info_dict={}
 8	#ID enumerates from 0 to n-1
 9	header='Agent Index:Type:Residence:HLA Type'
10	info_dict['Type']=['Student','Teacher','Administration','Staff','Visitor']
11	info_dict['Residence']=['Dorm A','Dorm B','Outside','Teacher Dorm']
12	info_dict['HLA Type']=['A','B','C']
13
14	f=open(filename,'w')
15	f.write(str(n)+'\n')
16	f.write(header+'\n')
17
18	for i in range(n):
19		f.write(str(i))
20		for j in info_dict.keys():
21			f.write(':'+random.choice(info_dict[j]))
22		f.write('\n')
23
24
25write_to_file('agents.txt',100)

generate_agents_csv.py

 1import random
 2from csv import DictWriter
 3
 4with open('agents.csv', 'w', newline='') as file:
 5    fieldnames = ['Agent Index','Type','Residence','HLA Type']
 6    writer = DictWriter(file, fieldnames=fieldnames)
 7    writer.writeheader()
 8    for i in range(100):
 9        info_dict={}
10        info_dict['Agent Index']=i
11        info_dict['Type']=random.choice(['Student','Teacher','Administration','Staff','Visitor'])
12        info_dict['Residence']=random.choice(['Dorm A','Dorm B','Outside','Teacher Dorm'])
13        info_dict['HLA Type']=random.choice(['A','B','C'])
14        writer.writerow(info_dict)

generate_contacts.py

 1import random
 2
 3import numpy as np
 4
 5
 6def write_to_file(filename,n,no_contacts):
 7	info_dict={}
 8	#ID enumerates from 0 to n-1
 9	header='Agent Index:Interacting Agent Index:Time Interval:Intensity'
10
11	f=open(filename,'w')
12	f.write(str(no_contacts)+'\n')
13	f.write(header+'\n')
14
15	for i in range(no_contacts):
16		agent=random.randint(0,n-1)
17		contact_agent=random.randint(0,n-1)
18		time=random.random()*10
19		intensity=random.random()
20		f.write(str(agent)+':'+str(contact_agent)+':'+str(time)+':'+str(intensity)+'\n')
21
22
23write_to_file('monday_contacts.txt',100,300)
24write_to_file('tuesday_contacts.txt',100,100)
25write_to_file('wednesday_contacts.txt',100,500)
26write_to_file('thursday_contacts.txt',100,200)
27write_to_file('friday_contacts.txt',100,135)
28write_to_file('saturday_contacts.txt',100,50)
29write_to_file('sunday_contacts.txt',100,70)

generate_events.py

 1import random
 2
 3import numpy as np
 4
 5
 6def write_to_file(filename,no_locations,no_agents):
 7	info_dict={}
 8	#ID enumerates from 0 to n-1
 9	header='Location Index:Agents:Time Interval'
10	n=random.randint(10,20)
11	f=open(filename,'w')
12	f.write(str(n)+'\n')
13	f.write(header+'\n')
14
15	for i in range(n):
16		line=str(random.randint(0,no_locations-1))+':'
17		for i in range(random.randint(0,20)):
18			line+=str(random.randint(0,no_agents-1))+','
19		line+=str(random.randint(0,no_agents-1))
20		line+=':'+str(random.choice([10,30,45,60]))+'\n'
21
22		f.write(line)
23
24write_to_file('monday_events.txt',10,100)
25write_to_file('tuesday_events.txt',10,100)
26write_to_file('wednesday_events.txt',10,100)
27write_to_file('thursday_events.txt',10,100)
28write_to_file('friday_events.txt',10,100)
29write_to_file('saturday_events.txt',15,100)
30write_to_file('sunday_events.txt',2,100)

generate_interactions.py

 1import csv
 2import random
 3
 4
 5def write_interactions(filename,n,no_contacts):
 6	with open(filename, 'w', newline='') as file:
 7		fieldnames = ['Agent Index', 'Interacting Agent Index', 'Time Interval', 'Intensity']
 8		writer = csv.DictWriter(file, fieldnames=fieldnames)
 9		writer.writeheader()
10		for i in range(no_contacts):
11			agent=random.randint(0,n-1)
12			contact_agent=random.randint(0,n-1)
13			time=random.random()*10
14			intensity=random.random()
15			writer.writerow({'Agent Index':agent, 'Interacting Agent Index':contact_agent, 'Time Interval':time, 'Intensity':intensity})
16
17
18write_interactions('monday_contacts.csv',100,300)
19write_interactions('tuesday_contacts.csv',100,100)
20write_interactions('wednesday_contacts.csv',100,500)
21write_interactions('thursday_contacts.csv',100,200)
22write_interactions('friday_contacts.csv',100,135)
23write_interactions('saturday_contacts.csv',100,50)
24write_interactions('sunday_contacts.csv',100,70)

generate_locations.py

 1import random
 2
 3import numpy as np
 4
 5
 6def write_to_file(filename,n):
 7	info_dict={}
 8	#ID enumerates from 0 to n-1
 9	header='Location Index:Type:Ventilation:Roomsize:Capacity'
10
11	f=open(filename,'w')
12	f.write(str(n)+'\n')
13	f.write(header+'\n')
14
15	for i in range(n):
16		f.write(str(i))
17		f.write(':'+random.choice(['Open Air','Lab','Classroom','Cafeteria','Library']))
18		f.write(':'+str(random.random()))
19		f.write(':'+str(random.randint(10,20)))
20		f.write(':'+str(random.randint(30,40)))
21		f.write('\n')
22
23
24write_to_file('locations.txt',10)

interaction_files_list.txt

1<monday_contacts.csv>
2<tuesday_contacts.csv>
3<wednesday_contacts.csv>
4<thursday_contacts.csv>
5<friday_contacts.csv>
6<saturday_contacts.csv>
7<sunday_contacts.csv>

interaction_files_list2.txt

1<odd_contacts.csv>
2<even_contacts.csv>

locations.txt

 110
 2Location Index:Type:Ventilation:Roomsize:Capacity
 30:Lab:0.17931671057168175:14:33
 41:Open Air:0.29934348486313356:17:34
 52:Open Air:0.8567996764630795:19:36
 63:Lab:0.15045983775394045:13:31
 74:Open Air:0.37538590106059433:18:38
 85:Library:0.12777319682254162:14:40
 96:Open Air:0.5840889324453068:13:34
107:Cafeteria:0.9846490323043516:16:34
118:Classroom:0.7226268679741341:20:33
129:Open Air:0.25595540385626603:12:38

monday_contacts.csv

  1Agent Index,Interacting Agent Index,Time Interval,Intensity
  253,50,6.513987164288512,0.009841241328195971
  375,41,9.148192540295673,0.24346079227118766
  448,15,7.767801788987083,0.7136052498759755
  552,88,1.5827087482234237,0.20764631674966094
  691,29,2.7343235816879474,0.14895783199367685
  738,8,4.334045729516742,0.6439094471011881
  829,63,4.210981817246595,0.2554432621369428
  927,36,8.47635840100173,0.3832054559612531
 1061,26,9.548384089998105,0.6427227428081111
 1159,75,0.19282581475098315,0.6828452816536151
 1243,36,2.766678550264544,0.09873500692734027
 1325,65,3.1770527299851494,0.3435712193957915
 148,40,8.102382721566547,0.09587949195147027
 1594,25,8.241622912147497,0.5730417318280656
 1659,47,7.699772353241968,0.39279197145264855
 1789,56,0.5541668883448503,0.06333660535403263
 1817,97,0.39998863659011175,0.7631024669772002
 1921,24,9.481067041452134,0.383204002416655
 2089,60,6.957525839570176,0.30328744337885094
 2152,38,2.3412395878589987,0.16383796788949623
 2228,0,6.141151899527708,0.7962272950902385
 2386,66,0.2603884125232203,0.7358136231991173
 2491,84,3.6123649897326304,0.7799712779618293
 2510,8,8.663266709710413,0.12171387351501184
 2661,29,1.6262042324661152,0.10065614499197328
 2750,21,4.841685610806538,0.7543211044433643
 2836,87,3.452267039247221,0.24586831246758334
 2981,82,8.650432434700082,0.06323310864576226
 3092,22,5.715589643104055,0.31823996685111133
 3173,35,6.284157263259199,0.11694633297875623
 3210,84,8.999192526045253,0.6437786483355039
 3341,24,3.329425451169008,0.5970435365473865
 3483,28,6.085727947739475,0.16747815697677937
 3591,92,2.3851917083174436,0.7073630889864982
 3643,70,8.455754235213357,0.10182165120349396
 375,83,6.174698872178428,0.941209396024936
 3859,14,2.291049580905622,0.5455844456290104
 3913,2,9.46944893647284,0.7369595962496633
 4058,44,3.57900560392034,0.6837125615283298
 4125,93,5.116785984157063,0.13994535890464188
 4262,46,7.148574887294899,0.5405338300800007
 4322,90,1.0063834871966304,0.4877659103098638
 4499,46,0.8665745698758154,0.10833600628847495
 4538,43,0.7143250674023671,0.23448581373131705
 464,16,8.1451375328301,0.16790513318785627
 474,92,4.96476895002348,0.8104031815415705
 4898,4,5.911646782174485,0.7988305382316447
 4965,93,2.6847021765065024,0.287871730729368
 507,54,9.222677019633089,0.537725039535849
 5129,68,2.9028843779458393,0.3334779206701901
 5281,42,9.099960055312769,0.344508935524367
 5396,3,1.8276294599828247,0.5879862401519191
 5412,69,7.444276394152981,0.14065410813768553
 5553,24,3.8426989168155936,0.553110116244658
 5632,53,2.8024046447519813,0.14749352841808105
 5731,26,1.8300810567986148,0.2511953179826105
 5852,63,8.181614960177079,0.5342722919206799
 5943,79,3.6303269687559436,0.041962863257867467
 6032,67,6.808129891567074,0.9655803746876441
 6188,7,6.529327196638947,0.8705529513644207
 6224,22,2.343935060531636,0.9962011342143507
 6352,76,9.903506135903946,0.24535465759316943
 6434,71,3.440764716127096,0.8830014936240537
 6590,8,4.9723666216465015,0.8660633726701565
 662,16,3.981201904138718,0.5462666429394176
 6751,73,9.173840400289956,0.865539433334778
 6829,47,3.148978965476934,0.008528755768497653
 6949,17,4.411053661515005,0.29462045868329656
 7094,20,2.99799449269492,0.008094047003058158
 7114,89,6.932501717103873,0.47267759190124015
 7271,63,2.4410782836620495,0.8450391983408515
 7365,41,8.452847533443084,0.2344428882511541
 7493,89,5.446234835932727,0.330607083902015
 7575,74,7.1764769352007916,0.025050360616053924
 764,20,5.261301134184475,0.8635716467281545
 7750,54,9.317619443580812,0.648110436821533
 7874,16,0.9372646530940454,0.9950542940364594
 7987,38,7.183818262108614,0.13361402344750717
 8014,30,9.169442123777605,0.16886440853265938
 8188,71,3.3102347294712953,0.5561612966102644
 8285,33,7.070634425610756,0.2863648970197845
 8389,46,9.177775831868844,0.07552739773663264
 843,94,8.183009216900762,0.4620521108586507
 8534,24,2.1401199464054477,0.5509220560673987
 8672,6,1.7324077130068205,0.8059066985821882
 8779,34,0.44615888882443167,0.36544912453839706
 8880,10,8.963528390783331,0.6351811175877636
 8950,9,7.047409633314041,0.41897643552173114
 9018,41,8.56145461013509,0.43182853230932194
 9114,83,7.53361659631241,0.217323186288224
 9286,35,8.89767842506425,0.9536791563015704
 9382,4,8.12157962871083,0.37018509361329277
 9497,31,8.648762210396342,0.34765263360451615
 957,99,8.776027691582023,0.25878808302839884
 9618,83,6.269859483863993,0.3125403759007429
 9744,77,4.464382164004213,0.13901033013312758
 9815,84,8.98611873951888,0.5071629988483005
 9971,12,4.984748548530953,0.40055692578644464
10055,15,2.5012472920711772,0.5476296836584915
10129,20,1.323833021883356,0.28336173169726786
10218,29,0.1507888595102047,0.07317326091711773
10387,31,5.74536343344707,0.4686744188513029
10416,46,3.6391719351673633,0.0794946256761716
10547,6,4.142412582685995,0.12319743144062067
10644,62,4.543247941899508,0.247526152958766
10737,3,8.042882111482527,0.7441702016120487
10816,62,5.768476020179256,0.47664663572590715
10962,70,1.8980155315166736,0.23647147445571282
11022,5,8.046646738605578,0.6345913535526976
1112,30,5.274857202949921,0.3008106462729032
11225,77,1.2803466196095459,0.36112700934738684
11325,88,0.27025905784243576,0.33565355291757737
11499,62,8.168023992027726,0.10124829380096845
11526,41,1.8811304853591704,0.9029155005956867
11626,17,8.589612826175477,0.9213970386212076
11777,47,7.831043375818597,0.4247028116988881
11835,17,4.152762492180637,0.4745679027732439
11971,70,6.160068068019173,0.6521567323522888
12010,93,4.425380020352634,0.7054440482566736
12116,28,3.311087652028042,0.9166201071677543
12285,31,6.45496925102327,0.22055188410179216
12359,85,3.2656053850868405,0.4212341556171103
12437,1,2.483329632428263,0.2826638966987185
12593,70,3.188395899451053,0.21875828829817812
12676,73,7.711950568255208,0.5022244747840047
12756,50,2.785621560145656,0.9185163236605833
12824,30,9.29755591451815,0.4328965887063524
12943,79,6.304758039767384,0.8186748853057808
13043,42,5.542757737114167,0.19833513133534986
13116,68,3.102059433024935,0.11092284566460309
13255,22,4.48744700920494,0.8547061529638681
13324,45,9.16283607437596,0.5803737376495258
13455,49,9.957213997749054,0.18841253768327848
13598,92,5.763243882706385,0.9134748899042435
13679,45,2.0356604853285454,0.9602500660221783
13742,49,5.046691251349574,0.12302780997543783
13819,8,8.395827945704132,0.5118220858973469
13986,67,3.3253137878628913,0.31971277856462366
14088,59,2.9664952022095536,0.19401296630828513
14122,68,0.3384038872996886,0.20935264425984557
14229,80,6.115713782624931,0.7495259112078474
14328,91,9.320314287253098,0.16028074257299518
14453,20,0.14522197751418386,0.6035801190491846
1459,3,7.584164121549164,0.15831465204436646
14631,88,2.730702741829185,0.29430232215069896
14752,61,0.15088073664091484,0.8229746138822506
14827,9,4.728286397295321,0.2628311922872978
14933,86,7.614042631030896,0.6361740132693546
15088,96,7.931938114936079,0.8622558475628161
15182,59,7.5582925932469145,0.618105304402339
15269,92,6.098154553251156,0.8344150383601279
15323,50,2.771872594923157,0.5233656747968031
15432,79,2.9523425703149506,0.05141448060184706
15543,96,5.495483582006947,0.6075736888332405
15647,49,8.948174139790332,0.703515789046357
15747,82,7.79232272382948,0.28713868588623237
1583,55,2.1197005987232687,0.8710215637843753
15917,16,7.636187145481843,0.4463501376184047
16066,17,5.96216082558347,0.1156295679843291
16188,40,3.8833354969600564,0.7827144296503963
16296,65,2.7887703424127586,0.00308759494866484
16362,32,2.018292224720104,0.5025080299253926
16455,54,1.7003344426926126,0.08895997472318506
16560,57,9.673556267275426,0.6050642601172523
16667,52,4.877761334010176,0.9199827916724133
16763,13,1.7776983995884343,0.460048381662998
16882,12,2.3935471506408144,0.8012083235883181
16966,32,0.11754795261362139,0.37092099189472627
1703,11,6.846716842391126,0.5511448261403317
17198,78,8.156000887373777,0.07543486878681582
17256,15,7.6584173143233,0.11395001805719251
17382,67,2.510812196657246,0.2697436040624521
17466,88,5.850870985161633,0.5194042053397994
17578,22,5.318050188652826,0.3741489531161384
17617,17,5.682766690116123,0.20102723484565566
17784,58,4.600053324359877,0.8665601602485907
17851,83,7.905940738999307,0.23155308931227125
17938,92,6.330499459552722,0.3949879347311296
18017,51,2.305887472499214,0.8529892916573967
18193,49,5.043004483856393,0.6064709004839419
18269,95,0.2476376406695313,0.17395004518990098
1838,41,2.59984936498891,0.42830518585779387
18464,74,7.659173451036309,0.7110193229540483
18549,67,4.430934873881354,0.6036641096307729
18646,56,8.343715010160377,0.46405645321798394
18793,84,8.20735245970513,0.9654588716041783
18852,36,4.071777045509133,0.09514425913775437
18956,13,9.263991384633917,0.7514734590438714
19029,74,6.844402733610884,0.9869675256906077
19140,54,4.596949606037163,0.051095680266435295
19254,52,9.074772108375173,0.8012517742676243
19320,9,5.9595745038121715,0.6852065620945298
19425,43,9.578013720201213,0.33143069568800143
19553,94,8.883872807719479,0.143434155051809
19637,86,1.0007570551447964,0.3335433501456836
19790,12,8.867737588204768,0.7987419668276835
19876,26,4.114199161021061,0.2052471840848128
19984,37,6.40601059783028,0.29110876156895105
20071,36,3.164557443444541,0.3836278225803993

monday_contacts.txt

  1300
  2Agent Index:Interacting Agent Index:Time Interval:Intensity
  332:91:3.901351436822462:0.7339762595213493
  478:90:3.5626711544249745:0.6746469145132054
  55:85:3.045488921169931:0.039540230198430115
  686:81:3.35308756346429:0.3633954339845933
  711:89:6.326551736128173:0.6289266025075126
  841:89:9.329187350891646:0.6353349553288311
  920:71:0.38645434909083676:0.04041798989591305
 1092:68:5.889425651825421:0.3950396909932594
 112:47:6.557852441820289:0.7245690803250271
 1299:32:8.402723639687704:0.0029308245084296303
 133:33:3.5133963523940634:0.5984631970990983
 1459:72:5.370053020778495:0.531313701010571
 1594:59:5.361572617932277:0.9886697867090888
 1621:82:9.786681409791774:0.644945666368522
 1748:42:5.011982887515333:0.051662026866201693
 1862:94:3.2808909541391196:0.9379521953670432
 1970:28:3.856798574421678:0.2557608578207182
 206:59:5.678890997712748:0.3530777753051588
 2137:67:9.131898601767697:0.858499260774226
 2252:74:9.986369997027031:0.3156120836947629
 2331:94:1.507816879463777:0.750555105240906
 2499:93:2.121959362802376:0.09703892296171557
 2537:94:5.400780286788532:0.4299044759629851
 2615:81:4.75977897522104:0.3232455011774399
 2751:63:8.55510185721477:0.31288557896015257
 284:59:5.9222428832641425:0.12157485621270103
 2943:73:6.795602865846028:0.06744185332954145
 3059:1:2.7021747467696375:0.050538725122540984
 3160:93:2.943901539081496:0.4982339562937653
 323:84:4.133634564366487:0.3075102931608772
 3373:44:8.134038990032534:0.8418295238039117
 3417:86:0.542806560857374:0.7588119151895625
 3585:77:0.2859974668290466:0.7241059456194887
 3614:16:5.329831905451478:0.9195203828276385
 371:90:2.211130035725443:0.23639098557775062
 388:70:1.5406578056068143:0.4262130830791522
 3941:0:1.1579089653984453:0.7851213807119591
 4050:37:4.484956048115092:0.3060348403762886
 4189:88:8.043811518556971:0.4727074037001201
 4258:95:0.8868990689387879:0.3467640517252304
 433:86:6.190128446233331:0.8176423375406843
 4419:22:6.298136491836642:0.5649230836250814
 4564:54:4.536312531879237:0.7989489195824466
 461:61:7.833473806936388:0.650092667048976
 4743:76:3.44149914401369:0.8746721680294639
 4826:4:6.373337730771791:0.17592940756741804
 4960:35:9.934829550819842:0.5345586622312622
 5016:51:1.5764360886713513:0.6770030520140922
 5191:75:9.528950938813134:0.6204530683653462
 5239:42:7.840684207317652:0.6089954987487575
 5361:65:3.319567445374041:0.5478018921036643
 5452:46:4.646705033209998:0.537254045209896
 5595:50:1.7647409730344588:0.02688151759300872
 5651:35:4.156824965180649:0.7123780511350246
 5775:78:3.9226537983258227:0.596842377897293
 5874:58:7.563226282263413:0.8062241896776831
 597:84:0.7120251049265447:0.9302238734157992
 6047:95:8.024189071209314:0.2387216724542346
 6157:28:6.2859322129180475:0.1556546337774144
 6270:30:2.530642559415648:0.25633238312842377
 6388:16:9.06713427487879:0.41516872075378486
 6432:35:8.09237307848392:0.5857892642742539
 6517:65:7.8134917233836285:0.28104998118729463
 6658:79:6.223781312011015:0.012229676686173363
 6790:90:4.692384410823149:0.46217556562178697
 6871:62:9.08294852508194:0.7287708959264037
 6933:20:1.542102652267403:0.8389929454049759
 7090:74:4.633437833538752:0.65537480210047
 7197:11:8.325837108492266:0.08894675467827051
 7210:72:6.557672074227439:0.8651050525879831
 732:73:4.872758588552571:0.09357856657833297
 7457:65:6.828660337659751:0.48495229529925665
 7595:47:0.7466953354057215:0.6603079823678228
 7692:49:2.0077342778968554:0.9189494309774255
 7782:53:0.24061611784117698:0.9198471939191474
 7864:6:0.5767175723374529:0.5800677289768271
 7956:50:2.8103728644720705:0.7661027286936849
 8088:65:5.495737535254017:0.13475930874418607
 8139:26:4.520441829762211:0.7752928037603906
 8262:15:2.527874839657712:0.1705345466390138
 8375:37:6.949647409442933:0.5105509864259511
 844:20:2.97399456614634:0.11289483289257596
 8541:6:4.273511532203043:0.09718585800915025
 864:46:7.362236247628521:0.04058096586641702
 8743:36:8.117474485572878:0.14526881403519276
 8856:47:3.855901848144012:0.06033216610055803
 8982:62:7.36834872994402:0.7504447501739113
 9034:37:6.940059348353467:0.9688323772735252
 9180:84:1.746381666139043:0.7823637521600265
 9211:48:7.364223469449296:0.36985754872005294
 9324:63:8.322818469697424:0.26920941824660416
 9495:93:8.565298534711246:0.36630815362030034
 9555:98:8.261077047953284:0.24720488756898507
 9667:32:8.928969126003851:0.2768960055237545
 9761:35:8.836832665518946:0.8525592430588332
 984:79:9.86527008653734:0.5241984425341051
 9915:84:7.895868992916919:0.9243365521462359
1004:44:8.716228021549393:0.9307245519590631
10196:55:6.888764694183994:0.0792443519258833
10272:90:7.406214716467515:0.8859191527012792
10316:14:4.69851133682884:0.19881286599667536
10461:63:3.380324616991465:0.8268422238613041
10552:16:0.19216831328206507:0.8647705352734371
10645:84:1.2697886559236449:0.6513461320262995
10750:83:6.159864427212866:0.23346664207112955
10869:30:3.4770888522834897:0.36611239444780763
10970:90:3.5286680285590846:0.061422783069107645
11093:39:0.9637079127853909:0.807360297039483
11159:97:7.043532289504258:0.12207223530271005
11243:84:2.227673296719175:0.8300830010185617
11347:42:1.833397217400502:0.21499046911985964
11476:1:7.8677237896729535:0.1308918842693122
11536:55:1.3055580188425742:0.7277279779721338
11662:0:0.6371814138898102:0.739520928356319
1179:66:3.6931844772562252:0.49433217498267423
1185:88:1.486445418424901:0.7994315842241301
11967:44:4.389739626245813:0.7501063883906391
12087:66:1.5283456139385265:0.933656123136008
12123:48:6.137030114523152:0.9235785663451955
12255:39:5.593904911357448:0.7918698321362837
1236:98:8.573685590443334:0.6643971331641266
12458:40:9.370090787366754:0.16062179115642827
1259:7:5.99552450577316:0.22398865033159399
12678:78:1.6985126182973498:0.23431129397478678
12727:36:1.7553777448861463:0.9571656933455291
12810:2:3.340403747124703:0.266154426065234
12920:32:9.04965093388158:0.7998074320401931
13062:43:4.48824832171709:0.19692009534109944
13166:68:1.044013500391131:0.17518002535790944
13281:91:2.032022113548353:0.590068376259575
13379:5:3.6678672963264725:0.8583172648269328
13488:25:2.7906016247631857:0.3417441357034283
13548:22:8.274301104789616:0.6180500643903922
13637:34:4.895008043767715:0.470617322501378
13765:98:3.9939963178189073:0.7597707393883737
1388:99:4.344354090436447:0.08000834895567921
13933:14:2.721637241356134:0.5469317967238905
14097:61:4.480139087307686:0.9370228932878472
14120:89:5.052620560783816:0.2537641232093184
14277:4:7.5548012755079155:0.7647336265540196
14334:53:2.3637671040815222:0.8631258102243161
14497:97:1.1517561038645152:0.6080198126602016
14547:4:4.764917096374596:0.5152616692151232
14656:7:0.7673797837521523:0.05295581093999868
14712:65:5.820115979848362:0.6738384932399847
14822:33:8.160077472113436:0.35575801582167244
1490:24:2.5976244236881127:0.07228477664392474
15097:67:1.3349001353042622:0.5467070433629635
1514:12:5.412935866383392:0.11638905261774857
15295:64:4.328183987891099:0.5038839316589997
15391:91:1.8006275689774043:0.7069818589813456
15433:64:9.979922860196544:0.1730588104192059
15582:14:5.625659929969839:0.427124084779392
15680:66:0.12556782560516622:0.6318204731180151
15784:81:8.965005435252678:0.1329683648749237
1587:7:2.7621652564272834:0.22081572672352956
15960:97:1.6189519082706272:0.5054371256483898
16061:47:1.001552280836816:0.44870613684494454
16112:28:1.7394787076567975:0.15123469338547757
16292:66:1.9575307012529986:0.5143410029855222
16335:60:5.974833467758106:0.18060226652566203
16419:47:2.4143782472302853:0.7229634935521948
16532:33:4.084222023013261:0.8052825167982911
16661:42:3.880567198086904:0.33785485991760156
1679:7:4.797609189111243:0.6557842812818759
16860:17:6.786175767301016:0.855473866429063
16987:80:6.840555606112167:0.10932325733796955
17014:84:5.475907747014465:0.23291755605347986
17191:29:9.17560043418257:0.17718783157595752
17228:78:3.4425085921579193:0.8242337800670188
17360:34:7.2394297827991005:0.8755428155410877
17454:64:2.2671905891345414:0.7334964590961794
17567:84:5.948336450041793:0.3098471787427216
17611:56:6.700839762851763:0.3207358083318562
17738:77:0.9674523146234348:0.6023850656632548
1789:44:4.69793570668195:0.5029890933381677
17947:20:5.319830568980307:0.38707577261884796
18026:86:4.7817534968627555:0.2976309298220806
18141:47:0.20291653431164902:0.4554712242013542
18217:64:7.3452775056010955:0.6483550983905965
1838:2:2.016021005062094:0.47350242384381125
18427:52:5.803404417975604:0.9532995101175942
18529:20:9.704176176125863:0.08789736542495086
18650:87:3.1885515636171515:0.9367769520102764
18793:29:2.0395613845066887:0.4946398943812982
18876:97:9.019353389326039:0.1445289893279038
18999:46:6.582281848173897:0.5425316978102004
19086:6:1.6825724869426617:0.22432772872032958
19190:29:7.500546164660645:0.30905885655729015
19216:78:2.424664767871816:0.18813093908551015
19387:61:3.2116382773342567:0.8869057054380951
19427:0:6.159493456473577:0.2276835244003813
19590:78:7.329164728333016:0.26167298307249465
19676:42:6.930905362346148:0.9096883575644671
19746:6:8.782850221647784:0.3169474488876317
19862:40:1.370250262759245:0.5553566618394318
19981:15:5.902292977530621:0.0556777547804056
20032:33:2.3285018362586083:0.22805846655926876

monday_events.txt

 117
 2Location Index:Agents:Time Interval
 35:27,68:10
 49:34:60
 56:12,16,55,23,59,24,96,9,94,63,65,23,13,86,49,98,78,41,89,45:10
 64:51,26,83,88,43,59,17,67,21,9,26,54,85:45
 72:56,69,37,67,50,3,28:30
 80:57,30,66,27,37,58,42,82,47,90,86,89,86,75:30
 92:99,59,82,38,38,31,61,23,10,70,62,47,66:10
104:69,24,63,26,87,28,36,91,28,86,80:10
111:49,78,77,56,26,26,92,38,47,64,54,45,46,74,46,8,86,50,55,76:30
122:91,9,88,70,2,19,72,0,43,88,15,26,93,81:60
137:77,62,88,76,28,37,29,92,97,55,2,19:30
145:4:30
158:74,3,31,48,6,32,63,79,99,32,95,1,50,16,29,7,99:10
167:89,75,36,95,17,40,58,64,53,11,69,70,34,21,12,53,26,23,38:45
178:4,8,42,46,82,18,58,38,33,76:45
187:97,93,67,45,10,4,89,55,43,42,86,65,28,77,44,63:60
192:46,18,6,75,17,6,15,69,22,75,58,36:10

odd_contacts.csv

  1Agent Index,Interacting Agent Index,Time Interval,Intensity
  266,0,1.8172369246500197,0.006012368176620986
  374,92,4.063473307316592,0.44764113765276414
  410,28,2.5078058170016004,0.9556666937503718
  528,6,5.0663925880424,0.030157397136076347
  614,34,0.9023473288248696,0.40762532229169424
  782,17,4.409706397800109,0.8581145623573369
  843,2,4.156581552776811,0.2765556802005179
  962,27,1.2914385251065508,0.009513514017428504
 1039,15,4.862643162759489,0.3406184083074584
 1137,61,6.003686928238557,0.7615036747316247
 1226,25,0.75888883318599,0.7458770745925443
 1331,38,6.903844182398593,0.9278421364738013
 1478,11,3.956008580201522,0.6503839273684523
 1590,48,6.769446426997564,0.10888629056775989
 1685,91,0.7232151612815041,0.5467854056064144
 1748,61,2.2328510614263974,0.44718384957966695
 1878,96,0.7063783545238811,0.8896588296914104
 196,48,9.293321418971457,0.8244605077577327
 2059,60,1.346910814314961,0.1075512883150157
 2191,18,4.159645334446736,0.9035452588829113
 2249,29,6.086884750360499,0.3383082213819574
 2349,65,6.530330988330888,0.6544708521532662
 2422,21,2.359281478670309,0.6932914366816318
 2536,11,0.6214541407681629,0.277228132146625
 2668,35,1.384050140411951,0.9858517993039427
 2727,3,8.941691191907072,0.8676675804245452
 2821,20,1.805147298856169,0.8465608015601254
 2984,86,2.4225104203737757,0.43038948235552
 3026,63,6.483320436344188,0.6967437250929029
 3129,96,0.8799624974435949,0.49727731725706925
 3214,27,9.114149895145916,0.3607316314698501
 3356,94,3.436609544657556,0.03583350304170885
 3492,83,7.224940852275099,0.796582912719368
 3536,14,1.9585817639216085,0.5523849902001531
 3631,13,4.484949871338362,0.26768807176332765
 3723,83,0.015340968768530194,0.10036970882600071
 3856,88,9.644090451403999,0.4768964287882195
 3949,31,7.09441961853263,0.06924208901127449
 4093,71,1.9071767620603308,0.1034237044014571
 4147,60,7.971199482192748,0.18391554416077116
 4226,87,4.1078464708973215,0.27716258035987584
 434,84,1.187407367890705,0.591748889516374
 4440,49,1.5983463783361906,0.7862069123228235
 4535,37,9.477098230814514,0.6785201377250942
 4655,46,4.4392432669147865,0.8755928204327293
 4778,45,3.267941991588039,0.8380363457231991
 4854,81,7.164718663466019,0.1620363873309948
 495,92,5.380116701363553,0.20282298378753127
 5052,93,8.344482466024907,0.8636854730280744
 5162,23,6.701569229007836,0.5040441233693438
 5273,98,8.118088212815017,0.28909432113979583
 5358,27,1.8661553338044412,0.950297468551335
 5466,1,6.492082007243933,0.46419110664867524
 5539,48,5.019406802332588,0.8247073034288753
 5614,50,1.4376340264666165,0.5119841394352085
 5799,26,1.8385790775577826,0.3252535154166645
 5856,24,3.81520574287756,0.9493833892557094
 5912,85,4.590511092408569,0.8830225997371698
 6086,49,2.256171992717796,0.23012674462476623
 6188,49,4.176669994920607,0.29142550506828013
 6278,12,7.834379855411703,0.7857791594264615
 6332,25,5.98743219341273,0.6017363643492531
 6422,64,6.920059245930357,0.40418357976938335
 6561,67,7.614317747527228,0.1194139638185292
 6649,48,5.287355461807298,0.6925352138956495
 6792,33,1.0903989744713527,0.7393398513964201
 6867,19,3.4874417270160754,0.7594694251871744
 6919,47,0.16504452846147655,0.6950781665506448
 7023,53,3.9361428532544496,0.2553940611426446
 7123,35,3.5450049204356415,0.24938808055450234
 7290,68,8.123188697688832,0.5077132957074547
 7345,38,8.489594860937716,0.8518278364060441
 7431,98,0.7355476804641636,0.4276085779375872
 7594,67,6.91245915282636,0.2578313271797378
 7669,66,1.4941880378682837,0.48289983567784056
 7730,14,8.822005482549379,0.6672125252010723
 7894,45,6.8878032268713305,0.4353270629542777
 7992,56,9.772394909616143,0.6595689986069757
 8098,37,7.6484985184170124,0.3917151822749264
 8170,59,3.702798635248433,0.061744383601446184
 8224,86,0.9885849505381816,0.46973558683739525
 8320,2,0.04912805020394151,0.6576301400716553
 8490,77,7.622215907800679,0.45040666331175994
 8563,97,2.5762955502800877,0.06689564467549869
 8640,22,3.184498179260392,0.4423936808955783
 8723,85,3.913729685022269,0.9982090099271226
 8819,45,2.038237218553247,0.8103181976684201
 8960,1,9.762520396551164,0.5486821038416273
 900,29,7.192738832418542,0.6131583807313137
 9184,17,8.749307528435297,0.5225577012900724
 9283,48,7.086116913452992,0.9900778680704334
 9374,40,2.2821555707866126,0.35018334993217504
 943,13,0.36995864315547355,0.11846637314579411
 9550,78,3.941694960962491,0.6034833071010233
 9637,56,1.2302019767572725,0.4601094370224549
 9725,82,8.558629082547203,0.18125777696742207
 9856,50,5.666529201636958,0.34450397914279596
 9946,23,6.008069289249349,0.8728988105709846
1002,52,1.7097510664836613,0.13851074831486443
1017,78,5.960466354795643,0.397621705031562

odd_events.txt

 117
 2Location Index:Agents:Time Interval
 35:27,68:10
 49:34:60
 56:12,16,55,23,59,24,96,9,94,63,65,23,13,86,49,98,78,41,89,45:10
 64:51,26,83,88,43,59,17,67,21,9,26,54,85:45
 72:56,69,37,67,50,3,28:30
 80:57,30,66,27,37,58,42,82,47,90,86,89,86,75:30
 92:99,59,82,38,38,31,61,23,10,70,62,47,66:10
104:69,24,63,26,87,28,36,91,28,86,80:10
111:49,78,77,56,26,26,92,38,47,64,54,45,46,74,46,8,86,50,55,76:30
122:91,9,88,70,2,19,72,0,43,88,15,26,93,81:60
137:77,62,88,76,28,37,29,92,97,55,2,19:30
145:4:30
158:74,3,31,48,6,32,63,79,99,32,95,1,50,16,29,7,99:10
167:89,75,36,95,17,40,58,64,53,11,69,70,34,21,12,53,26,23,38:45
178:4,8,42,46,82,18,58,38,33,76:45
187:97,93,67,45,10,4,89,55,43,42,86,65,28,77,44,63:60
192:46,18,6,75,17,6,15,69,22,75,58,36:10

saturday_contacts.csv

 1Agent Index,Interacting Agent Index,Time Interval,Intensity
 267,66,9.857117310137038,0.5920888806387263
 339,40,2.9606587904019332,0.28799857726311495
 419,48,9.933376750841031,0.5563869797724015
 547,14,2.707792838677613,0.11910322049310873
 697,93,7.330200583028975,0.05479876188162769
 736,52,5.8053943720215395,0.5087501005692888
 816,29,2.9259700624959297,0.7450077742936179
 924,76,6.615452592843672,0.23066023231585764
1098,1,0.6129732778252273,0.03079626452546913
1152,51,4.991234253861199,0.11029211445761467
1249,64,4.281211334785262,0.09369780403627248
1376,15,3.110100778578777,0.16882508544803732
144,82,5.018950780821032,0.4528425446162895
1525,23,1.523435869691594,0.8698275706188255
1669,26,5.982815427997005,0.8195210582557968
176,69,6.002756213947941,0.47565948855915063
1851,92,0.9693831534702857,0.8545362381598459
194,54,8.926690297564479,0.19650516555917197
2096,37,1.0761711632578574,0.2856646294271543
2156,11,6.206036904245246,0.025636240561556556
2263,45,9.243970250499935,0.8459046432706034
2318,80,7.21308647170134,0.18639074663509203
2422,25,8.566766221711488,0.9194158046579632
2546,78,9.436676144535742,0.3066038278097547
2655,33,0.36786224695660175,0.46598870340260434
2780,31,4.295593090845587,0.7887243574197714
2874,96,9.079412546074366,0.2008470536485456
2993,11,1.811367363309666,0.24854787128323197
3017,45,1.3031037142786772,0.736713001093112
3154,77,6.689236468914333,0.18914544406995604
3248,55,6.561686523837922,0.8415382745176084
3395,24,2.1199045466842223,0.3191748832651885
340,43,6.361037571365211,0.054785174673453896
350,86,0.05530006267194132,0.44722966677561227
3667,8,5.108232528265227,0.0780720907027247
376,57,9.073223985113284,0.6305218263588744
3816,8,6.875884563883529,0.7889755826254277
3935,48,3.63455049866231,0.23653026160724466
4093,72,2.726782980498262,0.7473684674491506
4143,65,0.5285308238378339,0.8079994482515851
4230,84,5.435250398044084,0.22794249938945577
4368,66,5.812705194521447,0.3987768568223644
4437,30,5.462713140719986,0.2651939540942704
4517,49,9.554281145866424,0.2854383038592877
463,1,7.129363264331846,0.6332198675617925
4734,66,3.7040828036302886,0.15835840507645926
4839,53,8.70713280127657,0.7521303893855847
4985,42,2.9065301405226784,0.4061131567948121
504,71,7.566520295016451,0.4702871038447024
5125,72,3.3524932671715546,0.991241688877458

saturday_contacts.txt

 150
 2Agent Index:Interacting Agent Index:Time Interval:Intensity
 378:67:6.687995944426314:0.4033605962521598
 460:25:9.766242543855506:0.06792652175390823
 518:90:3.76439853374662:0.9833305943472379
 64:19:6.506721718246754:0.47110824328789613
 773:26:2.5400982744608336:0.40140270897106645
 868:57:0.7095173223023121:0.2328466079907241
 957:54:1.545474789816078:0.6593172582955799
1090:25:7.843174009450287:0.8268544568417224
1128:52:1.3914812455190517:0.8024812081343093
129:71:1.5518951054968155:0.9318507773242553
1339:28:8.476359135606552:0.7763246795933149
1449:50:4.7211099258761555:0.2950133516599971
1552:12:1.6886708754449598:0.27197127175998526
1619:20:5.6781326401719046:0.9590963962294797
1722:77:1.530950907625851:0.3754295473613327
1889:88:5.658452775120387:0.0803874959012173
194:12:7.636759575481204:0.2831880696193816
2058:57:8.601430915297016:0.5434659477112249
214:32:6.147275128372893:0.856773362268219
2275:95:3.3575411423184542:0.46747804925146763
2348:73:4.294729247064641:0.050670872480034546
2487:31:0.20788603769580694:0.06469788200264015
2550:44:2.983096090063986:0.02735893758806829
2612:73:3.5332686474645323:0.6308187130898412
2759:18:6.507883109382785:0.8679178454556692
2890:76:0.6431511136089729:0.38181470878945245
2993:55:0.688031974008203:0.02165710753326533
3093:54:0.5174288624109147:0.4172063304023521
3190:55:2.351244324988293:0.20155062301576254
326:69:3.204281646873234:0.6853704116954752
3337:45:4.207020809561934:0.5062926163922263
3450:85:3.3126767901315013:0.11439025603353281
3518:98:0.5483540344431337:0.5831224256744627
363:20:8.466441890639738:0.15531801936817402
3770:84:4.252674278698835:0.1021412687119303
3884:96:9.65755023003075:0.9104362499713785
3985:30:4.477617210548132:0.2798872009598208
4027:81:3.4726517979202596:0.6867846228811487
4133:5:9.418615513088076:0.3089650238414625
4282:19:5.969411859418942:0.9201045742327656
4316:63:4.806229721717362:0.9196419859150736
4429:41:7.958618332948535:0.44643319464470743
4532:85:7.863072004177757:0.8397192112109673
4664:63:2.8034310396456483:0.5005219190796429
4722:53:8.636229353574626:0.5573464209207643
4820:81:1.3492272749291145:0.5759296391255372
4972:1:3.170961659254469:0.864395776604293
5051:5:6.983939525485372:0.3998399286929163
516:11:2.828084537368467:0.7569874076404247
5284:6:3.225352755378524:0.13692972894786104

saturday_events.txt

 110
 2Location Index:Agents:Time Interval
 31:63,91,41,97,7,44,73,88,6,36,22:45
 45:70,76,47:60
 51:50,91,48,78:10
 69:60,55,98,50,0,11,22,13,92,54,33,84,14:60
 75:7,76,83,54,90,94,79,2,75,34,7,96,50,10,23,54,94,15,41,87,6:30
 82:44,90,20,90,40,99,25,95,5,3,31,31,50,31,4,48,40,80,6:10
 91:99,53,83,90,63,45,12,82,28,96,68:10
102:61,99,34,2,53,88,77,16,90,28,43,63,62,88,42:30
113:93,29,68,43,29,0,67,49,9,92:10
126:91,31,55,9,57,71,39,25,76,76,17,6,18,34,27,4,75,4,62,29,6:60

sunday_contacts.csv

 1Agent Index,Interacting Agent Index,Time Interval,Intensity
 288,99,8.486887539457896,0.6304214594796798
 322,98,3.2976061937586563,0.781281314136626
 475,99,4.430757248996154,0.1192555052707921
 51,16,7.048835094335958,0.13157790618351306
 664,56,4.655156331391267,0.6998835788082481
 752,23,0.40055384199715993,0.75098379425079
 857,7,1.5925582330513355,0.18543205571638421
 948,53,6.490406524470783,0.2868193033569312
1029,51,4.493661262409669,0.5815858845665998
1143,75,0.6573777627777944,0.48978674189411686
1250,69,1.5519768951778778,0.054714720400359296
1383,70,9.975574102080033,0.29285241977157617
1450,61,3.8682067678943124,0.4261808134423466
1575,33,6.740529736522591,0.2455572388334618
1664,22,5.975520317563916,0.339408352827008
1712,25,8.123063683302792,0.5784864212678281
1826,1,1.4395665451710782,0.9527690571698493
1914,60,1.4430820158919855,0.39247712631007536
202,85,3.8006454199690043,0.2921826762943228
2167,47,4.673025133711266,0.8086927544736627
2290,80,0.6743678721890989,0.8176138774275091
230,56,8.047433934786856,0.2559808833574637
2495,81,5.215697774477086,0.9006825144319155
2530,35,3.990730095641025,0.5069325770991455
2639,65,2.3811238779362887,0.30447260187846537
2770,7,7.576691410586301,0.09327402375535143
2898,41,2.769033142970916,0.052943430372137
2940,9,1.53999525068522,0.3637708934017183
3025,26,7.337572932448316,0.9914045891898488
3185,24,0.6183737562734581,0.12280394449800236
3292,64,2.7937380809337697,0.38492439656092525
3354,3,0.358907903107174,0.6108859228588672
3488,13,5.20066638591457,0.6428277196598772
3558,14,5.132696666075683,0.7770071741679037
3696,37,8.951072527951148,0.15909392193657212
3719,5,2.667024065530701,0.16760141110060367
3838,65,4.776675413849936,0.6358673983241082
3933,43,9.388244029403698,0.2677659863381495
4074,3,1.920978437228692,0.8181512011809285
414,22,1.1168095443666715,0.49875323614048606
4233,78,5.247483529457279,0.1808059413598897
4327,55,1.4802711152787895,0.2644792206222256
4413,47,9.879205440524398,0.8262467807502241
4591,41,6.006774424396097,0.36409489715815657
4691,18,6.618327483739249,0.808798335582276
4728,70,1.2853107381027506,0.07098388830301883
4859,30,7.047303701965818,0.6403449892486467
4938,14,6.185026335954712,0.299405530751356
5090,4,8.716153438777326,0.8234338404902319
5131,81,2.4693304094766266,0.08279562712445887
5272,3,5.256897773525066,0.6592241405225215
536,20,6.098476239562825,0.7645209043837615
5486,36,0.08937541961729134,0.35642021687049374
5575,94,8.854515849420165,0.9606419685383933
5654,98,4.638295722864876,0.5073037465495944
5798,46,2.1629311222063374,0.27936623481924505
5856,65,4.647708874943114,0.3714395293129583
5976,77,5.891978882816718,0.22901678369513967
608,24,7.3415194739594805,0.16260056535985934
616,95,7.261061146157749,0.521374883996052
623,57,8.603304779092946,0.5139482482796789
638,9,7.012907842879529,0.4997630558711238
6466,69,7.715026519996071,0.8236282668323782
6587,9,4.079938354014608,0.4660587190357144
6664,48,0.8764088012451265,0.2749338760438347
6775,12,7.643239456414168,0.6320420632107933
6844,35,8.966995279467467,0.24014856201649082
6913,30,7.402636843700636,0.022401560118258
7057,73,2.820428173846705,0.943722059836342
7161,73,9.41610911071566,0.5783995362749058

sunday_contacts.txt

 170
 2Agent Index:Interacting Agent Index:Time Interval:Intensity
 329:74:9.16372608230145:0.796954964751048
 46:51:7.883900864399966:0.4086674799106108
 580:96:0.14815771583060466:0.9598774863311844
 674:97:4.308374781710823:0.5469594486352
 751:13:9.042079023826053:0.4951854351944386
 880:59:1.194192610139505:0.1806780778265884
 929:52:8.298008123594673:0.6055655082754013
1011:99:7.398529511198307:0.8423463023583696
1194:96:0.8114992155173495:0.6185711886621139
1232:66:2.3703816553952883:0.35420962128864475
1339:99:3.855243189079789:0.19683280636170353
1414:20:6.993801240807475:0.9924238391700014
1569:5:5.368207898395178:0.3296239694354882
1622:82:5.141505384517688:0.6680939851970867
1716:14:4.381681285284316:0.13324126477503573
1863:73:1.1377617766820813:0.016765931895245334
1953:42:4.331827823657975:0.560247114997433
2074:72:8.487044883624892:0.44857507061224955
2148:53:8.142210501452041:0.22185756589964178
2239:80:0.919320244588725:0.0066855429075109996
233:21:9.289809772081991:0.48205140669390023
2468:46:4.536474019847931:0.6855403269937351
2558:90:0.8335888281998161:0.5829499953459416
265:56:8.623750119046413:0.6850571684408665
2737:46:2.19563994708889:0.32831432045342446
2843:16:6.54823708272073:0.7241818732660742
2955:95:1.356326584676878:0.8593548177807079
3033:51:5.72041717661566:0.524825828129498
3156:97:0.05304038966948088:0.9396784738557239
3239:25:1.6057401908444169:0.7729036122188875
3375:49:5.1930718546095:0.6210496845686397
3450:72:6.400159461397456:0.4083531569308648
3516:36:3.095902490181952:0.7697749975800223
3698:36:8.736666708714022:0.9269722338361613
3725:4:0.1996745353487972:0.3912838723392581
3854:37:4.379634943637777:0.14566373998141358
3992:55:0.019798603565377437:0.7045448754207068
4036:91:1.6904254816989417:0.9488514792773272
4175:0:9.344337089059099:0.31555189896437286
4298:93:5.920573213081997:0.0028759470703639822
4373:27:6.323996215279141:0.9268743088920766
4410:26:0.3335853333487415:0.22327795239905257
4583:6:1.8792327407608012:0.5844054293798739
4680:39:8.666561745531057:0.6341570680368916
4785:64:8.279808342659074:0.10714932227380469
4851:80:2.597488396875214:0.0753952752053868
4936:39:5.6836065070360675:0.6191528017058452
5072:11:4.7881710302403455:0.7655770299526184
5146:90:1.0209935816785076:0.3288165509174008
5244:3:3.9645570905388516:0.9433763441413141
5320:19:4.608574167399386:0.879494666634502
545:30:3.2439699423921597:0.1099899352310858
5582:95:2.2446524075665786:0.3730883570466935
5636:47:7.523082303216631:0.46842401692247715
5767:80:0.46591410875939654:0.43019339282451874
5886:1:4.153321745378494:0.8744248883962594
5932:87:3.740524247725736:0.3904419258374895
604:88:7.107645004605604:0.971958195970546
6180:46:6.087211809269826:0.5332140334707597
6220:16:9.743912977300749:0.06325827742806112
6311:68:3.451500943176198:0.1235586691736077
647:86:1.3489846728692534:0.9380271839281606
6598:76:2.3319468321605408:0.23635317254322508
6659:48:0.5527503420919422:0.9217009076588242
6745:94:8.674582793785653:0.6210440386455588
6824:38:1.587140836439298:0.7617430249347842
6966:36:1.1370077466599082:0.7580769247367519
7092:66:5.149056575604316:0.20909269304442213
7196:32:7.470321654585279:0.14446721285379327
7257:32:5.236089542116535:0.012270130984272543

sunday_events.txt

 111
 2Location Index:Agents:Time Interval
 31:0,91,50,25,99,16,48,67,28,96,50,4,80:10
 40:74,4,62,93,73,44,56:60
 50:7,21,89,8,27,80,40,21,5,85,48,40,47,44,77,28,83:30
 60:45,2,58,75,53,99,82,23,42,63,9:45
 70:70,79,66,53,46,99,73,66,31,61,49,14,21,54,55,37,57,23,72:45
 80:17,13,47,80,92,35,39,66,86,75,83,14,25,97,65,21,33:30
 91:53,69,20,0,61,11,55,39,69,35,58:45
101:80,7,55:30
111:49,34,43,54,73,35,38,82,39,50,66,41,90,93,3,96,90,40,83:45
121:8,63,58,69,43,4,78,97,20,14,9,74,37,29,12,58,29,63:45
130:21,39,32,72,31,7,55,40,76,38,75,69:45

thursday_contacts.csv

  1Agent Index,Interacting Agent Index,Time Interval,Intensity
  29,72,2.914227778302505,0.6826991464281399
  34,23,1.7626573477813823,0.1867575121778262
  496,10,6.188166718934582,0.5343467721947005
  50,58,7.089036604140549,0.10775487424959562
  69,11,9.67302895627405,0.8980069940395575
  793,82,3.5711730462818903,0.8470185341812573
  844,20,7.492920372324567,0.8767819235925547
  981,59,8.877288545955315,0.5726311240333285
 1013,58,7.855807841441584,0.943416360883798
 1155,41,8.615477261049776,0.28432691622917616
 123,25,4.451749865199233,0.8913642362995232
 1311,22,2.9730546580604997,0.29981855155001325
 1476,71,3.8844120704576577,0.7286341972286404
 1548,36,1.5232199132644864,0.5145761295979717
 1698,22,2.718914273776586,0.7076840108883607
 1726,15,2.1845358786259785,0.7831605938784265
 1888,80,7.478995841823769,0.6409935415627314
 1941,71,4.602269400448483,0.9921185937661067
 209,72,3.4198736933186646,0.9166824813396153
 2157,54,5.300520828275738,0.6892351426205671
 2254,56,5.816201895124036,0.8659727417260997
 2384,47,4.094474084211179,0.3997958008433463
 2415,45,7.993018008393561,0.8704458892221738
 2517,51,6.13897007916667,0.9648374061250926
 2621,97,1.8012852087460351,0.36901019639081134
 2769,22,2.416538351050921,0.9864639695301223
 2874,60,4.362163305391271,0.3712260589076263
 2994,87,9.872530116893952,0.38401371533485174
 3072,19,6.7283068678525755,0.32881118325285585
 3122,29,6.68050847751975,0.9697631261691214
 3261,46,4.930428144808266,0.4172336148672652
 3356,7,8.72630136004489,0.21157918158984157
 348,23,2.9498170927352128,0.6137918778944923
 3516,3,6.210064056150158,0.5153153524864713
 3634,15,1.3792770232659568,0.9517064711431299
 3767,94,9.48326600196943,0.9458851803129598
 3839,8,4.438852003317232,0.5900555758968664
 3988,92,0.024873423364663028,0.024753883423453193
 4091,41,4.98413218316343,0.847102271146868
 4146,92,2.681589592840341,0.35983462243833575
 4233,27,5.404912374265333,0.6721719225515167
 4326,88,4.635528942368791,0.9482013513281706
 4483,78,6.094650214477303,0.7149120805237638
 458,38,3.792069398035318,0.057350140158731966
 4669,26,5.28691302773999,0.003072222774669897
 4770,4,2.9854952898326124,0.23203797932624926
 4867,69,0.6928829210410559,0.07763575576610571
 4940,84,2.5102336158353697,0.8960826689678371
 5033,31,3.977974273644035,0.5884174903951659
 5111,54,0.08465506592757133,0.6803844913904717
 5213,81,1.5661540838375687,0.34374535391176464
 5370,32,4.390982356838365,0.4622252382126143
 5480,11,6.4996703453849864,0.915809779678598
 5560,1,2.0111652888340013,0.9496414908132494
 5672,5,1.3238998665651902,0.49677849650953776
 5776,76,0.21973026748088764,0.9611826411513842
 5826,19,6.599848837190305,0.6225975506807934
 5997,84,7.907613923056919,0.1741259596155258
 6010,47,7.94232102985182,0.417089659665809
 6168,95,8.71933405152487,0.4730314036714953
 6287,7,2.273143230465149,0.941884830527986
 6378,95,0.7959663612567724,0.7807901682100586
 6443,64,8.268799497585611,0.9771738202667778
 6569,39,5.785017466876434,0.7661568652822905
 6683,23,2.157365752619306,0.6391250192403155
 671,39,7.83307894998671,0.7311494293277346
 6845,70,2.623901876474808,0.2777724331353346
 6916,60,4.989352872396161,0.10707498471394494
 7011,17,2.729649547935531,0.8204342446345623
 7180,77,6.588965105333038,0.2867543980568842
 7246,98,6.693191757579374,0.40880065076358685
 7391,65,2.903597713934033,0.3931442047883065
 7498,47,3.8489534597418995,0.41097128089722157
 7512,3,6.854179151003045,0.04163972350503187
 7686,28,2.9960330864729148,0.8641050432288885
 7772,76,2.990552826012225,0.22519385952105397
 7880,4,5.530859821727081,0.38228882244996387
 7995,84,0.7199327596161764,0.036165290628866864
 8042,47,3.9865585053480834,0.6858625250509734
 8198,3,2.5758390391803863,0.4244230074059112
 8217,63,4.812652214934011,0.3686661931997619
 8314,78,2.6316982476663964,0.05211874976005215
 8422,94,0.6972111448385587,0.48403632622951254
 8542,43,9.515787037107701,0.009831527561575903
 8662,88,0.007127490780595158,0.2768895268006344
 8767,71,0.6313198403195397,0.041723659955730574
 8866,25,2.2595588525399313,0.3722392929544631
 8958,46,0.41879041384945803,0.08989144881754885
 9058,95,7.9549707494999815,0.2616410486899894
 9126,90,8.137043823209007,0.5491274799034928
 9234,25,3.5311620347403028,0.22867874954885714
 9353,2,3.3618329417577018,0.6602261848682114
 9448,86,1.9010065638418583,0.5222332913436765
 9513,69,5.81815018391909,0.9740220343398174
 9628,24,7.023058277512709,0.7600614904391981
 9772,63,5.96743005840613,0.7802621400177376
 9819,14,4.847806924816364,0.0602715099349338
 994,90,5.268067740613599,0.10222213350582032
10036,27,1.8701202916050896,0.8153445538596785
10163,39,3.7330060909108207,0.49651367627585763
10298,22,3.562740173389175,0.584405499328503
10363,58,2.1213512446978147,0.36973486712719394
10444,99,9.011727052172976,0.10133689707492555
10517,96,6.0744716926653926,0.7885691635402455
10668,5,7.739478589670432,0.44061535046167766
10792,84,2.1120488722262367,0.74843764299737
10842,47,3.1066401119398446,0.11698435709564625
10924,22,2.9126818485457227,0.3062502402593752
11070,75,7.2640730025786295,0.629716149201804
11131,18,7.330169099939212,0.8053978568791952
11293,4,6.636463080011932,0.9417900029895555
11339,36,7.258963395972463,0.5027535711183595
11467,8,8.3118070759105,0.40722458815879303
11558,18,3.6859792198408057,0.02514212638286395
11619,67,6.436887485383876,0.5813921401237467
11755,20,6.006766646751819,0.766861522605022
11856,37,4.369580401099724,0.7545066063955993
11976,1,3.090850736286833,0.9860410422879425
12020,2,2.2122538751064735,0.3612336038689087
12134,12,6.975430024529682,0.624613234003694
12232,96,3.050587676311365,0.28375970412714413
12375,41,7.85166045809857,0.5441072252205454
12440,17,4.941838509462828,0.6923794762394322
12596,10,5.122349273134413,0.1602343210968591
12622,0,0.29742176804522846,0.07935201348428711
12738,75,8.115305318521397,0.1872478777553287
12855,58,9.866422364691775,0.799434072835278
1297,49,0.1231596065458973,0.006019103130803227
1307,66,0.32837469341490233,0.09775416603535003
13111,90,1.9215277216415894,0.3608638863999387
13295,58,1.6549052827063115,0.7388836894644241
13355,89,3.4918943509555342,0.501100680228859
13433,47,2.063003195825238,0.6254691951767559
13514,17,0.2866509121548366,0.5602100703307697
13673,44,8.314534585649568,0.6427245865074744
13764,8,6.914977634415856,0.5303422875831179
13892,29,4.618361545030978,0.4025247887701302
13978,52,8.394118930513107,0.8428192212566906
1408,9,7.154540591525763,0.7681419593535012
14116,78,5.870375376288676,0.2516987688916821
14245,15,7.22290052422495,0.5789335840015365
14330,70,0.9304791318675509,0.4358317276440241
14449,58,3.6431043294920187,0.04814527874300567
14558,7,9.247696072347372,0.6255585831106495
14657,37,1.2072493171597976,0.3312372284986912
14755,53,5.920168404176785,0.021570225426554734
14893,95,9.270889095454812,0.990510265653494
14981,21,0.0194679340984949,0.25879309573438447
15014,68,7.476177081485364,0.5803638849832051
15148,12,5.871094693209179,0.016679144323287654
15231,68,4.764475343220857,0.5689332577292193
15372,42,5.742546755802016,0.63520652056623
1542,77,4.337892096324857,0.6947518771064183
15549,70,2.689481916031582,0.2346540171653292
1564,73,7.586705427025796,0.9864978247869635
1570,55,7.520409724267434,0.5196642784240297
15855,29,6.569064747805761,0.8986552476757952
15996,39,0.4746965956888305,0.981056242780302
16083,27,4.201419237470898,0.11884356937492535
16149,43,2.002194361076721,0.21120283217260039
16211,18,7.816131132470934,0.8352094974903228
16375,78,1.7360727049404534,0.5661042498991689
16466,18,4.324707202155118,0.9011730389581124
16544,62,5.963336327035632,0.590330831248187
16686,5,5.694819517099006,0.9624636894458778
16786,32,8.635331937347214,0.42298712237986
16859,37,9.119485006460856,0.04608631468556046
16965,55,8.96179606900532,0.03603698154347401
17053,57,3.169648036370525,0.3497514597548387
17133,32,5.0467562135871615,0.6017709305141903
17231,84,2.7072533056392634,0.47866019548591976
17382,10,5.102039222186429,0.11077315602194338
17420,59,0.4262601008151967,0.8410589832717688
17577,61,6.402821803711511,0.3226962865941335
17672,79,5.309314703913507,0.047961724848451626
1770,47,8.776170972386415,0.032613562673203145
17873,53,0.4579456252085079,0.22056235957099768
17964,43,1.5696490819412223,0.0337971025431677
18068,96,5.0651056351305845,0.0023909162306597898
18148,77,6.4972649113014285,0.1609880879803035
18289,79,5.287643091155157,0.9218511948809394
18346,65,9.890000965899008,0.2799321359444805
18487,9,7.147425047713284,0.6823879887739884
18583,53,8.643393817035033,0.12893600630222457
18632,9,4.919093266911232,0.6053801243752489
18789,5,0.18834847867871263,0.08013066781696387
1883,97,2.8701443642449354,0.40692134454910356
18950,62,6.655688252252143,0.5996512305554584
19052,18,4.281205400374355,0.6759452861604844
19176,71,8.61244360242969,0.5435611879375963
1925,17,7.416150191560677,0.6566592232635489
19341,7,8.476104785876835,0.7795940299564589
19419,20,1.5760014696603353,0.4746578912950198
19580,32,4.164773840970143,0.6471675445446147
19676,23,1.057749908595711,0.17445219531009748
19712,24,6.31441926298651,0.029933610271667965
19871,48,0.1112348878803271,0.7676168247170366
1995,41,5.523272358997677,0.8850282091920424
20076,40,1.2565672000595307,0.5671999232754229

thursday_contacts.txt

  1200
  2Agent Index:Interacting Agent Index:Time Interval:Intensity
  39:80:7.0382921246333705:0.9556820598269046
  444:69:8.573011972540401:0.07924998376906311
  510:57:1.5325958641775272:0.3093902519850843
  642:10:8.701123888970558:0.962585163449696
  792:17:6.157994099854182:0.7080803028223787
  830:59:9.725783500251366:0.7314558080633391
  975:50:3.8058557518124214:0.3168807779694327
 1040:62:6.43557676676667:0.9763099081805485
 1192:27:0.04439101149650737:0.417023535886784
 129:96:4.064443587754805:0.3627068026184982
 1357:97:2.9937333519214326:0.04831281631023343
 1415:10:5.893399813507008:0.47319793911862373
 154:58:2.189181419606845:0.6803283844589387
 1671:62:1.7525285905496146:0.13896567010484562
 1779:36:8.506352552863355:0.8691976202423097
 1876:53:6.137904467285217:0.07106840002404269
 1984:36:2.560188707141876:0.7771950084819546
 2052:43:7.668274637265973:0.7312993690534784
 2154:93:7.939847618469336:0.7776433290453468
 2281:68:5.384535911579822:0.23525255976832482
 2393:16:9.920757993127333:0.8934543441881765
 241:72:7.758134739731689:0.24703891010135515
 2594:31:4.736159938253104:0.279716657877369
 2611:91:6.604975713945529:0.2980626079316899
 2722:89:7.307471438634465:0.8331314885020186
 2866:92:5.074020217973926:0.5867164552992925
 2946:20:7.872054213346798:0.07697026703119414
 3068:84:0.014172442899552662:0.3614765333867669
 3182:9:1.0094025461973999:0.7513051533741296
 3288:35:8.916625728448652:0.13212679832443874
 333:61:8.879634677276655:0.16048328962110692
 3430:63:0.889562352523886:0.14175368432296465
 3560:41:4.057982037703882:0.9460153048461237
 3627:8:3.4522820993929315:0.263099965041526
 3776:33:5.350168457592791:0.4817138552741015
 381:85:6.03291472992156:0.7362304926092693
 3947:46:5.151177915023272:0.524784652285693
 4043:80:6.3260521909884115:0.20238179959236602
 4146:6:1.4188793789888487:0.9554001282463949
 4268:2:8.760839211072776:0.5522656652793739
 4371:87:9.866051901497453:0.050298054713874385
 4490:11:5.444448491136552:0.9347109216145608
 4517:22:3.1981154659531565:0.21362937499069423
 4655:24:0.31133364718463397:0.9904127541387862
 4739:36:6.652772458814239:0.32511126196824647
 4851:17:0.1908445268782133:0.7776073952742899
 4938:27:4.9287219964583775:0.6766708526045345
 5043:68:2.345297470120279:0.4888662207402883
 5152:77:6.2704802068309515:0.9727888002522699
 5257:65:0.31410385209842073:0.5678620629870902
 5358:9:4.5043887132533875:0.9529991526026419
 5432:91:8.856779214806078:0.6205084549405729
 5536:9:2.99684211320568:0.20084350883099966
 5652:42:2.234391573182888:0.7936651279874264
 5766:97:5.497317602861229:0.8037936396717074
 5843:75:8.631273282189033:0.6467101601379966
 5991:93:5.899984231792686:0.5589976222351022
 6089:98:3.4357223028901385:0.28650955658054356
 6132:69:7.035480596894519:0.715682876100546
 6236:47:0.702440123848932:0.37014161233455
 6397:35:7.795073444954294:0.690234242431429
 6449:26:8.188641044378683:0.2854457891281498
 6523:48:5.8860192391972745:0.9858892118609247
 6694:66:4.8331558942120045:0.9392247213322765
 671:28:3.940617896767412:0.8119157936104054
 6894:9:9.511243180423108:0.4866582339311317
 6916:13:1.3706419546146398:0.4606816198641699
 704:94:6.079250764705122:0.664159392552753
 718:95:9.367600455819955:0.28978090388795374
 7287:94:0.009281959133973228:0.9533789826774827
 7358:89:1.9742256941383884:0.12038943184213302
 7484:58:8.2927498262796:0.6289705093238441
 7596:78:6.145813134167143:0.8797391678218863
 7615:29:7.304166478831061:0.37660257369721994
 7733:10:8.415998407750381:0.3884970977718254
 7844:83:1.5842806601754167:0.8979250123521796
 790:89:2.301629122139719:0.07010399854914007
 8056:69:2.2033530452009864:0.0386290184572774
 8139:21:8.365740266584353:0.8769992573517463
 8235:8:0.6039725358473025:0.7231100758772858
 8316:29:1.1869583871524414:0.7934164894804442
 8413:60:1.1083952560802401:0.8160926988887836
 850:76:7.296924179379242:0.04145973049986551
 8696:10:7.083416807339589:0.31052447378674664
 8767:95:7.3778033130326035:0.4699849766808416
 8814:60:6.545948462503307:0.28553558881248886
 8943:46:9.73653464036593:0.08518557315885533
 9039:55:8.001834086567442:0.1449534039528918
 9196:29:3.3347114644129827:0.4751405480035604
 921:3:3.9843061077162076:0.2904432377787004
 9322:86:0.7737914282516112:0.9949485827235354
 9439:54:9.44229177563296:0.7555177614543236
 9513:8:2.9093184369975322:0.4074161100925633
 9690:56:6.3954756331314115:0.3630477505326515
 9795:59:7.741332185095796:0.0686127194562044
 9863:6:7.329546037754219:0.047602827898245326
 9957:55:2.2058024651955788:0.5420130616536876
10045:64:7.972444005640122:0.9346612569555631
10117:96:0.5028192989338531:0.602861775981457
10219:47:1.1593911790613642:0.3294905796595542
1035:73:5.053371460984918:0.43453735386468306
10447:14:1.671267644260136:0.7617381750767552
1055:17:3.8521114646242918:0.9027839801336598
10630:95:8.155368057480747:0.3039655272261964
10742:0:5.301894475432239:0.12825534758882506
10859:93:0.867332721346481:0.8543727044000994
10961:24:4.545866060225478:0.29454914795747555
11085:51:7.265989073625477:0.9771268329383078
11119:63:4.114022700622767:0.40193113111336387
11245:47:1.0866634685103327:0.6439994336060687
11336:54:3.3080183883197356:0.05478430344551444
11427:43:4.491839482154164:0.34138799298187006
11596:83:3.2537132537203695:0.4690103280088781
1163:17:8.210480957200954:0.6785354918047558
11760:0:8.166288756067337:0.009825187110891531
11880:57:3.6405957600181194:0.9731578767400095
1194:12:5.167714502627886:0.08442010394327959
12036:60:1.5436074012458656:0.38231602955762645
12113:81:7.487919848355968:0.7720185857814735
12286:81:9.832572756034889:0.932466012208083
12385:43:2.3720109674290333:0.8201010230106307
12432:21:9.953311147163454:0.011674606541613675
12541:94:0.5708653782110851:0.8171371735366577
12680:62:7.826269089129624:0.8054818446439931
12759:42:3.4752456682963286:0.16962944629105137
12835:30:8.950010240117711:0.7321501698872532
12936:68:8.049175109984219:0.8751769192948862
13090:78:8.313662977740753:0.021380973721606078
1314:60:0.3863981340857503:0.64324289181507
13292:5:1.5821836994859562:0.6832838495910474
13392:35:5.759253574243678:0.6722529014859097
13463:52:0.3248004646469238:0.889428065406194
13576:58:4.657899334607473:0.1269797853566087
13620:23:2.030506718629682:0.623571833876037
13767:56:5.721392098935411:0.9740022252292175
13839:71:2.3800650310864215:0.39527668002658867
13957:68:8.743679973789662:0.11559725358582273
1409:57:4.426655660307315:0.3831574189336966
14190:35:4.500662171278994:0.6457649176495883
14211:15:3.610230581472095:0.7749786563954427
14378:30:3.537127278785983:0.672334116297062
14494:51:8.461216862609769:0.5454202707832448
14575:26:7.878760507607612:0.23953114774140905
14662:21:8.03728326258731:0.7317362756887453
14741:28:9.881900293689839:0.5158710625716576
14855:59:5.187576120008606:0.09037421440274218
14966:30:0.2822708894510517:0.8239935690953065
15014:86:2.4350591158958035:0.0451732234158444
15110:13:7.540167443077943:0.9128796041719606
15211:11:2.5872234084376977:0.2745810085653637
15363:18:5.8349459811306135:0.2628000302629594
1548:70:7.389502622983511:0.33781675668735134
15594:92:9.716335252977252:0.7560749193156806
15646:6:6.697843308826012:0.3071889852788805
15714:56:3.0115810056757883:0.019309987557965647
15843:59:7.70335287625792:0.07801146422444183
15913:19:7.1531177132632635:0.46172693965817924
16032:58:0.0947302768753655:0.4435550454724231
16165:41:7.846459075221219:0.20486103557339408
16279:30:4.855795600531242:0.6324741482930949
16394:72:9.192984245755726:0.47308851194268364
1641:19:2.5189273919855326:0.5697138720443463
16543:89:5.623253504764232:0.3205680634577276
16623:49:5.996101075819311:0.3092468469691083
16724:77:1.1575274845932815:0.29449933851511156
16897:14:1.542998906358647:0.5324160705560573
16924:34:2.8547843066335075:0.8823443962826881
17088:94:3.3126621067162567:0.36194029301617625
17159:89:8.775881914064165:0.8253261132282622
1726:80:3.9288893586194327:0.10275972449442927
17371:59:1.6479602486244127:0.04174936740649626
17455:54:1.5015663207731555:0.06830746730647275
17552:2:0.9008968763444658:0.4046997291491362
17653:73:1.8688136024961355:0.5830614775602793
17736:8:3.9728441806543637:0.135649600130743
17864:44:3.9868053958346583:0.12018302290146932
17920:81:2.3295936709442913:0.16782594204362378
18070:98:2.4625686349731533:0.7447068575679722
18183:68:3.0500910480749255:0.18871352909901662
18212:36:1.3232525955055607:0.6301253264588437
18324:4:8.511899833302598:0.03323414664925628
18450:77:7.491775365021729:0.2614312397444818
18577:8:8.606105243413465:0.6596871488477454
18641:11:3.3624084193448764:0.5842044609543943
18798:13:5.435720234282897:0.07937243127913918
18821:65:0.5322387729059574:0.38013044360335524
18911:81:1.473579773422019:0.4182034100396437
19071:6:4.054832359579801:0.994191633021709
19191:44:3.9765231844593063:0.6317211275561101
19293:14:5.805280716375303:0.662059365871648
19386:69:3.1533754603139252:0.6050328383845425
19436:22:4.280692953835742:0.7771808522245846
19576:78:7.500105794724697:0.5285135775933644
19678:73:9.218428037446689:0.6502891286543955
19777:24:9.141627497458963:0.6764185110368829
19899:20:2.9402718121860625:0.94933964891294
19951:60:5.440972736761095:0.08167094302929112
20053:46:1.4756695868875869:0.5147498179121255

thursday_events.txt

 112
 2Location Index:Agents:Time Interval
 34:77,31,38,72,99:10
 45:82,32,83,3,34,99,17,14,16,63,9,71,30,4,55,33,74:10
 59:69,63:60
 60:1,33:10
 72:56,84,16,7,32,61,16,91,4,82,78,62,61,56:30
 89:51,93,72,82,73,58,39,80,29,12,42,49,30,47,58,71,20:10
 98:44,68,84,13,76,11,20,3,0,46,15:10
102:64,53,99,84,91,79,25,20,4,11,60,53,56,28,77,81,9,8:30
113:13,99,8,72,12,60,21,51,23,21,40,7,60,15,54,93,62,25:60
129:57,86,23,14,99,44,86,56,38,57,6,1,71:30
136:56,53,13,83,76:30
144:48,44,36,38,69,60,52,96,56:60

tuesday_contacts.csv

  1Agent Index,Interacting Agent Index,Time Interval,Intensity
  266,0,1.8172369246500197,0.006012368176620986
  374,92,4.063473307316592,0.44764113765276414
  410,28,2.5078058170016004,0.9556666937503718
  528,6,5.0663925880424,0.030157397136076347
  614,34,0.9023473288248696,0.40762532229169424
  782,17,4.409706397800109,0.8581145623573369
  843,2,4.156581552776811,0.2765556802005179
  962,27,1.2914385251065508,0.009513514017428504
 1039,15,4.862643162759489,0.3406184083074584
 1137,61,6.003686928238557,0.7615036747316247
 1226,25,0.75888883318599,0.7458770745925443
 1331,38,6.903844182398593,0.9278421364738013
 1478,11,3.956008580201522,0.6503839273684523
 1590,48,6.769446426997564,0.10888629056775989
 1685,91,0.7232151612815041,0.5467854056064144
 1748,61,2.2328510614263974,0.44718384957966695
 1878,96,0.7063783545238811,0.8896588296914104
 196,48,9.293321418971457,0.8244605077577327
 2059,60,1.346910814314961,0.1075512883150157
 2191,18,4.159645334446736,0.9035452588829113
 2249,29,6.086884750360499,0.3383082213819574
 2349,65,6.530330988330888,0.6544708521532662
 2422,21,2.359281478670309,0.6932914366816318
 2536,11,0.6214541407681629,0.277228132146625
 2668,35,1.384050140411951,0.9858517993039427
 2727,3,8.941691191907072,0.8676675804245452
 2821,20,1.805147298856169,0.8465608015601254
 2984,86,2.4225104203737757,0.43038948235552
 3026,63,6.483320436344188,0.6967437250929029
 3129,96,0.8799624974435949,0.49727731725706925
 3214,27,9.114149895145916,0.3607316314698501
 3356,94,3.436609544657556,0.03583350304170885
 3492,83,7.224940852275099,0.796582912719368
 3536,14,1.9585817639216085,0.5523849902001531
 3631,13,4.484949871338362,0.26768807176332765
 3723,83,0.015340968768530194,0.10036970882600071
 3856,88,9.644090451403999,0.4768964287882195
 3949,31,7.09441961853263,0.06924208901127449
 4093,71,1.9071767620603308,0.1034237044014571
 4147,60,7.971199482192748,0.18391554416077116
 4226,87,4.1078464708973215,0.27716258035987584
 434,84,1.187407367890705,0.591748889516374
 4440,49,1.5983463783361906,0.7862069123228235
 4535,37,9.477098230814514,0.6785201377250942
 4655,46,4.4392432669147865,0.8755928204327293
 4778,45,3.267941991588039,0.8380363457231991
 4854,81,7.164718663466019,0.1620363873309948
 495,92,5.380116701363553,0.20282298378753127
 5052,93,8.344482466024907,0.8636854730280744
 5162,23,6.701569229007836,0.5040441233693438
 5273,98,8.118088212815017,0.28909432113979583
 5358,27,1.8661553338044412,0.950297468551335
 5466,1,6.492082007243933,0.46419110664867524
 5539,48,5.019406802332588,0.8247073034288753
 5614,50,1.4376340264666165,0.5119841394352085
 5799,26,1.8385790775577826,0.3252535154166645
 5856,24,3.81520574287756,0.9493833892557094
 5912,85,4.590511092408569,0.8830225997371698
 6086,49,2.256171992717796,0.23012674462476623
 6188,49,4.176669994920607,0.29142550506828013
 6278,12,7.834379855411703,0.7857791594264615
 6332,25,5.98743219341273,0.6017363643492531
 6422,64,6.920059245930357,0.40418357976938335
 6561,67,7.614317747527228,0.1194139638185292
 6649,48,5.287355461807298,0.6925352138956495
 6792,33,1.0903989744713527,0.7393398513964201
 6867,19,3.4874417270160754,0.7594694251871744
 6919,47,0.16504452846147655,0.6950781665506448
 7023,53,3.9361428532544496,0.2553940611426446
 7123,35,3.5450049204356415,0.24938808055450234
 7290,68,8.123188697688832,0.5077132957074547
 7345,38,8.489594860937716,0.8518278364060441
 7431,98,0.7355476804641636,0.4276085779375872
 7594,67,6.91245915282636,0.2578313271797378
 7669,66,1.4941880378682837,0.48289983567784056
 7730,14,8.822005482549379,0.6672125252010723
 7894,45,6.8878032268713305,0.4353270629542777
 7992,56,9.772394909616143,0.6595689986069757
 8098,37,7.6484985184170124,0.3917151822749264
 8170,59,3.702798635248433,0.061744383601446184
 8224,86,0.9885849505381816,0.46973558683739525
 8320,2,0.04912805020394151,0.6576301400716553
 8490,77,7.622215907800679,0.45040666331175994
 8563,97,2.5762955502800877,0.06689564467549869
 8640,22,3.184498179260392,0.4423936808955783
 8723,85,3.913729685022269,0.9982090099271226
 8819,45,2.038237218553247,0.8103181976684201
 8960,1,9.762520396551164,0.5486821038416273
 900,29,7.192738832418542,0.6131583807313137
 9184,17,8.749307528435297,0.5225577012900724
 9283,48,7.086116913452992,0.9900778680704334
 9374,40,2.2821555707866126,0.35018334993217504
 943,13,0.36995864315547355,0.11846637314579411
 9550,78,3.941694960962491,0.6034833071010233
 9637,56,1.2302019767572725,0.4601094370224549
 9725,82,8.558629082547203,0.18125777696742207
 9856,50,5.666529201636958,0.34450397914279596
 9946,23,6.008069289249349,0.8728988105709846
1002,52,1.7097510664836613,0.13851074831486443
1017,78,5.960466354795643,0.397621705031562

tuesday_contacts.txt

  1100
  2Agent Index:Interacting Agent Index:Time Interval:Intensity
  332:45:6.213436231456636:0.3731609728338897
  489:81:4.579771459232793:0.11434815810612176
  50:16:3.242934650368129:0.3141918044148243
  615:82:7.975466857130672:0.6128656081719708
  712:29:1.371000381482833:0.3302304647764601
  814:7:7.821227878776517:0.02845995074557328
  985:83:6.395632457075665:0.7751395265422735
 1076:14:3.5755744413957458:0.5574299399414683
 115:62:9.58634391552728:0.7052359820907551
 1233:45:0.7076539116973712:0.29372417115115146
 1346:38:6.129146387692819:0.2609382873034033
 1425:66:7.924473535575229:0.5101208649146122
 1525:30:2.2435787778590233:0.34060744129158593
 1634:60:4.927953728053525:0.6700587895933668
 1747:5:2.684771776287241:0.2574115092392507
 1889:58:9.625734441309854:0.5968114997896796
 193:61:5.220803442701763:0.8620230034643891
 2029:91:2.4686173240322318:0.6230867759670403
 212:95:1.5754431658870482:0.6105753814387738
 2299:4:7.691047725707579:0.3413757611023611
 2378:93:2.9318192055348415:0.4648065055530436
 2451:24:8.197221547880316:0.9718876331351113
 2592:27:9.198396797255626:0.16543165396821713
 2660:99:1.9852917319237706:0.6754749253049644
 2747:60:2.926189356051805:0.9833964216145247
 2862:53:8.777231457375235:0.7284431458587418
 297:93:9.19597804582149:0.36088453244829266
 3018:16:6.90568418912085:0.47964664098450793
 3139:75:8.829446299574954:0.8566338306237319
 3279:27:0.30209164979904113:0.9162862348077758
 3341:47:2.8150099179100363:0.2202297658034008
 3434:87:5.121262434689546:0.34522516985978635
 3552:69:8.376611116331295:0.9721430380048826
 3631:7:8.568390078953934:0.2609747271152305
 3790:39:3.3323074765201985:0.3738473348752833
 388:48:9.61161080916259:0.11255940822682353
 3929:42:1.046490193853703:0.9703762943992277
 408:52:1.3703006046548538:0.06626361915074641
 4175:91:1.4840408750275702:0.6152611616346282
 4237:26:7.825349435322081:0.8239794472248464
 4322:84:4.940400200673159:0.7619456896388551
 4459:90:5.784623371260322:0.10666187082198009
 4521:86:0.3471548050285156:0.6173979174975259
 4642:90:8.178704998755766:0.4609972690917916
 4729:95:4.8406036225093:0.09106867309864752
 4853:58:2.9237402820948066:0.8880798506295625
 4964:21:9.633445470500215:0.3795317805234453
 5062:36:1.3372576343073461:0.9333367878739499
 5140:29:6.759730185924982:0.40384662674309035
 5220:56:0.9484204437096111:0.2700243168712728
 5391:13:5.593847444401174:0.14251730023029452
 548:38:0.8118455773477451:0.15534571880671544
 559:58:1.9613155867738086:0.9964979966329512
 5628:44:8.039543224362301:0.92149645738936
 5788:93:6.612640065946129:0.7475311567942813
 5840:19:7.620144079622059:0.3182416084415045
 5957:79:4.092781780687574:0.7267655904498955
 6011:49:5.677218509537134:0.620710266950606
 6187:9:0.5998969632207896:0.9462038643902423
 6279:52:0.3517405280543384:0.4570039635821589
 6398:32:3.0513911846409467:0.11192808504123763
 6448:26:2.144916542978387:0.7649703267181862
 6519:60:2.5378878697564122:0.5125815380642406
 6682:21:6.355984386247059:0.7538837278153913
 6776:82:9.092557531602177:0.74210496101346
 6818:7:9.409297527034369:0.9147893913873082
 6919:22:1.2673823917478577:0.3677686846010142
 706:64:4.108843727499912:0.9996670729666973
 7159:39:3.968592643367236:0.6153826071593608
 7231:3:4.102429735302982:0.8091549649634372
 7375:67:6.408176908148027:0.4632439420199308
 7434:51:3.29285916399488:0.07362754325129339
 7596:44:0.8606828956909396:0.6380526760438952
 7632:55:7.632667913997516:0.8151815459035505
 7792:96:9.988069711163364:0.4201982040837776
 7876:55:2.7540455819170298:0.2728983302205812
 7971:69:0.2404635910591657:0.7019088464354047
 8083:7:3.7833428461767804:0.5059053649402946
 8154:81:3.347201881226524:0.6078784506485931
 8278:11:2.377145199017725:0.7250049576896354
 8328:25:0.6506573295260609:0.36397213695897845
 8471:55:5.388066989872032:0.7128044897824171
 8592:36:3.198366280780307:0.22223364625950692
 8687:38:1.1459230613858307:0.7737585259260796
 8730:20:4.088682224830098:0.9133713693060721
 8861:96:0.8000325343560455:0.9509401081347084
 8964:96:4.276249476121806:0.5545140479374902
 9030:46:5.864776032398824:0.9878159000860662
 9141:70:5.026586660801719:0.2196825484242737
 925:2:9.153538434547116:0.6408688000252408
 9394:57:1.5258929617167616:0.3422495707436871
 943:89:7.383070659810189:0.502938336341504
 9597:34:9.399292391381532:0.24970335740592198
 9616:30:3.8929316804406353:0.22739535842351322
 9769:8:2.1316090927287434:0.49286696627785687
 9874:15:8.485630359109985:0.11702412916620186
 9927:7:2.1637920715821535:0.18835559198252183
10069:82:7.987112691829116:0.8388020770869082
10166:3:4.0359322253773:0.8073362451987808
10264:21:0.4793067219400504:0.8144255386406495

tuesday_events.txt

 114
 2Location Index:Agents:Time Interval
 31:73,50,39,25,14,89,73,35,67,97,80,81,13,65,3,41,71,33,10,93,72:10
 42:44,5,88:45
 56:46,48,82,17,74,98,75,50,71,66,80,62,54,30,16,4,88,9:10
 61:36,65:30
 74:94,43,78,9,76:10
 83:84,73,44,97,4,70,95,77,74,99,18,6:30
 95:16,28,88,88,12,5,62,65,83,26,8,40,11,10,6,21,59,21,5,80:10
107:69,18,55,49,68,69,16:45
110:97,73:10
123:39,36,99,78,15,63,48,86,67,48,73,31,41:45
133:86,56:45
149:79,20,8,63,28:10
151:49,81,39,95,54,48,86,62,97,20:60
163:5,68,87,94,53,83,0,53,65,99:45

wednesday_contacts.csv

  1Agent Index,Interacting Agent Index,Time Interval,Intensity
  261,65,4.328046668612032,0.985927575919051
  384,10,7.620089774123224,0.6894406168171453
  485,1,0.49660140501557426,0.17113663902996323
  566,61,5.911171322512088,0.8477257541038907
  635,91,8.445849141778336,0.18743157653601095
  725,36,3.6993149390935107,0.19610294657542104
  820,52,7.652041015033962,0.593720732276105
  938,37,8.776325054105284,0.44489657060726107
 1039,14,7.182823185974644,0.5994661734860806
 1156,84,6.1841616156809724,0.5447149497146385
 1241,12,3.2364163292005967,0.053084247009199115
 1370,51,1.0121018670684523,0.9439448340792216
 1496,31,2.3861925565270967,0.2077179825704527
 1530,15,2.7503704544016703,0.6584814644942648
 1691,57,7.701924871045484,0.5625320422657776
 1772,88,7.966795926989233,0.765764986379312
 1849,98,9.395141283755242,0.4936464057057941
 1945,21,2.554777957118036,0.19138996793090324
 2013,75,2.0523722473181785,0.1172558789366045
 2149,11,4.510140468018347,0.6685610259751634
 2267,76,0.0892268472350799,0.7595045810121461
 2379,81,6.905425986319638,0.28652218091888504
 2492,41,8.965797259331046,0.1111830483334203
 2557,88,1.6077903602598542,0.23666508265851227
 2694,18,2.9623650828995207,0.8286818654503474
 277,43,3.5320340020252647,0.4900135259408406
 2870,23,6.9623452942853215,0.5989422292851269
 2946,90,1.2278281431609717,0.9809655525147104
 3088,82,3.6256539203044325,0.652968150803639
 3158,98,5.840166797355345,0.08341004682389153
 3246,92,1.9089385990892749,0.7922878921350877
 3348,4,6.5047384781314985,0.8623586866547435
 3497,17,4.859962975118499,0.26880367017223195
 3552,54,4.117961501993132,0.5779175887357123
 3644,44,6.3947200819473515,0.5191303061352239
 3717,20,8.77562936067531,0.5443645239302862
 3883,2,9.291858605237366,0.0553401914041618
 3996,38,4.392063292685494,0.7924637198155704
 4091,89,0.8634506601414438,0.8852301102932261
 4165,12,1.506487876908037,0.7230459861844032
 4273,9,6.040549612355375,0.48445441990887483
 4366,80,7.6930935709725325,0.35808034570668446
 4421,23,0.6893080651209738,0.6919562246517463
 4526,73,9.453648282840796,0.6472476848303975
 4680,15,0.9429433783029362,0.7874479617653929
 4767,30,9.713077959999799,0.10013524617085334
 4873,93,4.430791012289528,0.642167550276483
 4993,69,3.5884355542121726,0.30318563816332755
 5089,37,4.286112169752502,0.5006202264717081
 5191,69,0.7687621918845333,0.07230042085270683
 5262,81,6.654205605701176,0.045457620301632806
 539,55,5.672536509959393,0.8385270018459005
 5468,51,0.24483441268529527,0.25713405068918527
 5514,99,7.621207045483196,0.8167099553391018
 5676,4,7.024219118326971,0.9943720801149437
 5749,69,1.3221231617256168,0.5328342003072312
 5866,43,4.887747382953863,0.20394253573112664
 5994,98,7.4126996949549815,0.29367037924723427
 6037,99,6.286106627722551,0.2619126643141313
 6163,6,0.832812218767901,0.9470207041963251
 6276,70,1.342204503326736,0.2937613524203415
 6398,37,6.626794154267101,0.9018444572054648
 6461,39,8.09451181666891,0.1964693047685787
 6542,99,3.3919911278057735,0.29072383449269557
 6644,45,1.2717686725097233,0.20486822969594776
 6750,69,7.69505963695207,0.6525106814545318
 683,59,7.885329446684147,0.06484688289840057
 6967,70,3.253587218808436,0.11322294635609997
 7027,59,1.3979048716689257,0.888610582901755
 7116,15,9.725008138989033,0.6695882206932914
 7214,97,7.050542723813264,0.2280615100325062
 7371,3,3.099115781837357,0.4945560296945123
 7479,10,0.873045716297951,0.062218995783478004
 7572,32,3.837300145160926,0.34717495460382664
 7681,40,1.2811957884594871,0.20557462707871643
 7764,5,7.560186810066449,0.038954161433137124
 7844,51,7.547289644141214,0.6010275473664155
 7923,21,4.476984832575663,0.5376453780892193
 8034,32,9.401593609226843,0.02609028242161371
 8188,73,5.109582358750917,0.2502588811398663
 8250,20,0.2841553213291781,0.7347148282160669
 8353,49,0.7949851053601231,0.6723526724414021
 8411,59,3.1526743438539437,0.038438264425936564
 8517,92,4.954915369342104,0.5765202209730164
 8697,11,0.7430553059434564,0.07048154609904489
 8797,74,2.2559935402409836,0.19891247729586103
 8872,34,7.1045669560761215,0.7861633793033821
 8926,12,7.775725464106991,0.731181169906113
 9033,97,1.8568769510888994,0.5079134227431802
 9168,75,3.630914775760127,0.20061235101170882
 9216,94,1.2526813019006278,0.14847667968699463
 9357,67,8.877938195945346,0.9337752911284403
 9465,73,2.7637284496203307,0.841993871379342
 9543,6,6.325645938549286,0.7258209512232121
 9622,17,7.307170412248213,0.5234005003613431
 9773,51,3.13037572001468,0.6477820575490124
 9893,32,5.505042987502752,0.35835921674752025
 9999,78,2.6454288356693367,0.3164982894755156
10057,92,9.812289350517588,0.5623329686119016
1011,37,2.0648879347633176,0.24980254796571322
10235,16,1.891855439278518,0.3822843921947797
10322,8,7.762475116667491,0.17771103329866533
10438,11,0.5324183508455382,0.034949273885693244
10576,77,4.261420288493316,0.37360747330332966
10681,41,7.164236487952083,0.7101325593900163
10766,43,0.8935357969412583,0.8657665711676644
10876,50,3.428200761017467,0.25890478593172395
10999,46,0.8468548979927304,0.3191644147119663
1109,22,5.089410865355925,0.1669946263236376
11186,65,6.166238548237065,0.6861667846158687
1125,40,9.952574759084564,0.5740822008793284
11331,61,6.196867190769683,0.5013408241986123
1141,31,9.786293451410323,0.7493047221140382
11532,57,5.955203040682413,0.5154476797308712
11653,16,7.899925691111145,0.6717976199569338
11744,89,2.2887770907730607,0.5437877431298486
11874,3,6.927331092250767,0.7711408817356543
11943,85,0.3502160717277869,0.25177275481441486
12050,68,3.191663096305529,0.7859630170530432
12131,90,2.466720863401598,0.4172613934183278
12270,65,5.890885485744323,0.7187113099960679
12399,17,4.516599984695651,0.1336996859828995
12413,53,8.345028778119513,0.42274493851882244
12570,81,4.843046108814995,0.29882949899115174
12633,96,5.086940545320671,0.5693637966446243
12771,54,8.642047367290424,0.8744982799729936
12817,61,2.340219219631605,0.31956414897879293
12926,57,6.074845384645643,0.5409699197771384
13069,21,2.1294574890971907,0.2709643921783146
13149,55,2.800586970486286,0.9267876256478454
13226,42,2.044916946626083,0.16778512659495093
13314,32,4.404038389281584,0.45118631201309967
13423,73,4.896898976924822,0.6552105197229967
13514,40,7.208749458944464,0.4052460999354285
13674,34,5.2590702640617675,0.3484693657371496
13757,4,2.284649090331927,0.9101126726234063
13897,45,5.31945308320389,0.9879016506375161
13999,6,1.7667532909232442,0.981717913265498
14014,21,6.949122932005802,0.3766728232278491
14115,83,7.233802451412097,0.33188304141952363
14227,53,9.16598064470289,0.5799604444665396
14395,61,7.772594985484835,0.23932845465875385
14450,1,9.12755457213107,0.7933504476682264
14549,71,3.751756909835703,0.7044445200349657
14699,0,0.9529698943986609,0.1734518386196756
14717,9,8.368977669400305,0.6747855066510295
14838,8,7.922329631466242,0.17003065570665266
14963,66,0.08248394411642601,0.025204125415014267
15018,14,0.35037893477147697,0.2570432890998742
15120,12,1.1093342026532693,0.8637866257748087
15248,9,1.4385408523522425,0.6011023785605366
15327,82,0.8959795585527275,0.8263894883421955
15449,29,9.912928347878655,0.1687802962067968
15570,31,4.826779819867998,0.7976424167280071
15611,94,5.4073162992369515,0.9911025818470419
15712,15,0.18557679011843575,0.34219655525217973
15835,91,8.388443772655819,0.6190861620759786
15937,41,7.3793540838599405,0.27457526357482476
16081,21,9.990002615945281,0.15798023159047025
1612,68,4.7421748908980526,0.7041157877982428
16246,9,3.4582306462648438,0.0982649453911274
16312,35,5.7297343030678425,0.8156908469788527
16421,80,3.1452009426140846,0.36813466433394093
16584,77,0.8745670685564488,0.462304690992159
16673,79,5.466148061501178,0.03678380515291757
16782,11,4.212045965447891,0.5243474989886192
16821,28,8.780982456238265,0.9291271311944286
16912,39,7.352457920431851,0.31530648470158695
17042,22,6.701632453253513,0.4388446954693722
17147,66,7.604844544393275,0.8250566829750561
17215,70,7.194567032478998,0.8641595346076059
17324,97,2.7169131094048824,0.4711799178846521
17421,18,5.221192538365581,0.8151971747381243
17584,4,6.8823319278684565,0.550435690861847
17675,75,0.8186212924814562,0.23191936021034265
17771,19,1.6874259567261274,0.6506780037830153
17873,47,3.334031924182553,0.39297451944792383
17929,79,9.355379226552895,0.9853684666915478
1804,11,1.570152606523092,0.3513192118111663
18163,37,0.041291099445380786,0.4773016708317034
18221,20,6.483665285102375,0.10154344154574824
18319,84,9.518422615895078,0.4711081541121517
18483,74,6.048261008286692,0.4656840049930332
1857,56,9.5918004379995,0.7993214229516233
18622,97,2.6271345433182547,0.735793220201614
18775,9,9.04822832573235,0.24573275248001913
18893,26,9.969699154601656,0.30249560798448794
18991,19,1.105952908729575,0.7445486552483508
19047,38,4.32787900607325,0.6363361898649607
19131,21,2.801506738243793,0.47238990052666696
19234,34,6.227871652666583,0.7127394795977807
19315,36,3.9270782124055383,0.20733096743112944
19429,23,6.319658248786027,0.45740263269721837
19558,26,4.676403660977934,0.7337944076762869
19683,27,2.901365627284349,0.7166612123493752
19728,73,6.9471069326973245,0.22598254492640868
19857,62,3.6176705454479565,0.25728408216306686
19969,25,1.594419559468615,0.39618628353300334
2003,56,6.452354020091264,0.5262731669374942

wednesday_contacts.txt

  1500
  2Agent Index:Interacting Agent Index:Time Interval:Intensity
  335:35:7.326649613582364:0.01880486356965283
  435:53:7.365575713168727:0.07226775243298234
  555:76:1.7425302606537474:0.4079740971798641
  630:95:4.307720149563242:0.5889349769548973
  798:69:6.544728451402593:0.48025388395194957
  86:88:5.072512252507798:0.8389958044296311
  945:47:3.8194943780736357:0.06756325928583062
 1060:36:3.4337954746207435:0.780608576755907
 1128:58:3.9573951790562067:0.8814937045907152
 1246:4:3.762262794683556:0.16848724165974238
 1397:11:8.693414441617387:0.7460650092914961
 1492:75:0.660206718405888:0.07335924898540769
 1546:82:3.8637328951746017:0.5951215759777483
 1628:22:9.800867101130882:0.20271952020628436
 1737:49:7.060494204085794:0.5366861962135869
 1830:86:0.33597015028233757:0.10758491189019004
 1946:77:1.2885169728264612:0.10729300794480534
 2010:50:5.187607731001368:0.6703832544752654
 2174:34:8.93544026576964:0.04549012455350221
 2273:68:9.591015242175292:0.6962332597341828
 2310:44:0.5823210493669018:0.9689789406714906
 2433:32:8.436879771291043:0.021557896227508477
 2522:11:3.438680750408264:0.5398584734054681
 2691:60:7.210324988424461:0.8787960159091067
 2736:78:6.454046898476056:0.18222360148833006
 2844:28:0.883667185292053:0.922569686376188
 2964:47:8.689647085944292:0.1418009831093382
 3062:89:2.7679253812446216:0.6435851301783628
 3178:1:3.352951970635684:0.4754766055188496
 3269:62:8.345007894678666:0.23798159130601404
 3350:92:4.481913480277774:0.006233696946746248
 3498:26:1.1338952630227828:0.673962261965644
 3537:99:1.0643710496145387:0.5908347291714198
 3628:4:9.920590767349442:0.6963377903623542
 3718:50:1.3809350166002898:0.9872588601452001
 3824:49:2.094116142874566:0.5748045544228527
 3925:42:5.693608169443762:0.2879191230183471
 4054:42:2.4086948504552073:0.02547746034366105
 4151:2:4.451408189223509:0.6032579558452265
 4260:20:9.005811670608857:0.9856136917050264
 4365:67:3.19976980590579:0.9186950562480023
 443:47:7.181260983583534:0.3040250437725214
 4568:57:0.7383565151524951:0.723133921333527
 4655:66:8.367449475616333:0.07980719114975277
 479:11:9.97517977101612:0.6127447997868063
 4831:33:9.975729093568951:0.1045218021830403
 4983:27:6.640381396448985:0.15661340183018102
 5095:37:0.726266659582897:0.8758271106350278
 5117:27:3.731549646431953:0.3229035252474013
 5286:73:9.8942767252751:0.3990519563823193
 533:78:8.720720998194327:0.264559175826406
 5474:46:5.4153651996120225:0.4173530824931695
 5595:95:9.484928224637814:0.022785741619000488
 5682:9:9.340319131198878:0.7952612413547455
 578:42:2.475879993476423:0.3886327787838908
 5882:97:9.866336760171512:0.7188202155620746
 5956:34:4.302447425405743:0.28633873882974836
 6081:45:3.724740927783703:0.9167028205119899
 6125:29:9.199922961967527:0.835041826144438
 6294:68:3.8825993503747194:0.1168420663032067
 6394:13:0.42404086307323285:0.7521313232183118
 6449:11:8.607236167340723:0.6186404850761289
 6520:25:2.005728328797962:0.05980946246418717
 6659:91:2.961636869772523:0.1292205857836043
 6752:74:5.743776860036771:0.9984405022263465
 6875:72:8.15665662213246:0.8856720647622587
 6952:74:7.689955305723457:0.24021318982090323
 7059:44:1.6743181640329041:0.1378869655341155
 7172:12:7.638936582230792:0.8289049815374233
 7216:20:5.910006486116654:0.8403350173657851
 7380:0:9.524612020268266:0.9890454406593926
 7446:85:0.1978619520777969:0.7542955579200908
 7594:45:8.182315486473957:0.5539970521800692
 7626:68:2.410142904138397:0.831822112439275
 7712:59:4.111959521312285:0.2511690380469713
 7816:41:8.11653477037407:0.4864135139348226
 797:6:8.41408841840117:0.5166597024174876
 8082:88:7.539262351768925:0.4934590077378854
 8123:87:2.0191699791040407:0.4650993959348293
 8214:42:7.959803809049787:0.3859274394432979
 8372:39:4.988558132860267:0.9719137961462334
 8436:87:7.904796353087814:0.9033328489705758
 8549:41:6.441286834271189:0.8596066636809503
 8626:45:1.5494084880416248:0.21286592285078343
 8769:84:2.68713252804031:0.6352927537106948
 8892:50:8.125056564396175:0.964640333194231
 8925:50:5.745327231004454:0.4996238922147982
 9048:58:9.430548312366577:0.9662240771532448
 9151:7:1.5407008662168198:0.43018447051424324
 9294:85:0.33708865480739925:0.3999028227241679
 938:42:0.4676328396476981:0.24681536908527746
 943:54:2.082373656993525:0.8211009673756547
 9547:5:4.176150167437918:0.0068115940272549524
 9613:18:1.9920879889202947:0.4530248033751796
 9775:58:4.656733076780746:0.11008410284813352
 9887:66:5.736523536915983:0.714940200457393
 990:99:5.146933211148694:0.14934608064069932
10014:37:8.826800764399827:0.36862157844671417
10144:89:8.617130159606878:0.629612083711045
10276:62:3.808269227488712:0.720616750357066
10385:88:6.012459883150846:0.16207079061869079
10470:45:8.460933196001442:0.03484670155649383
10591:61:9.052509705425388:0.8533345550696678
10672:53:7.626567323195205:0.6547255311759907
10714:87:6.123814961834867:0.10799512631697394
10847:38:9.703366381545296:0.7861481672561152
10950:2:6.921877657912186:0.0901922793109946
11055:69:8.194239438728719:0.25190470736562665
11198:56:2.4951109730602985:0.313928578913919
1124:36:2.5502983171221585:0.13611513898232153
11379:69:3.7285925099089035:0.17979490568657208
11452:95:8.298231631001554:0.2418250870038332
11554:74:0.683477780477264:0.12947423620560494
11688:35:1.449078957263129:0.9971706032369194
11742:6:0.35682089991305177:0.8220981329520314
1186:81:5.059336042688641:0.06759370944002929
11941:79:9.740240133624962:0.3483763795581215
12019:82:6.050535299281256:0.2265648321824162
12146:47:1.6596588569359982:0.1808366243887748
12218:26:1.7194269810771157:0.469856221060189
12340:25:4.586799772966139:0.011566746615992107
12444:85:7.874474589247804:0.21940431108028746
12521:86:2.022571555919419:0.0267482489112576
12655:1:2.4888121465990034:0.6949916683725545
1276:65:2.0048251474987087:0.6007769598222094
12846:99:5.203358357806579:0.49351952534458354
12916:89:7.784970962656438:0.3795554828381028
13083:56:4.564802235334828:0.30456464371028225
13119:79:1.6659490128697307:0.09406007012891293
13277:23:8.95317196939301:0.861612362884061
13394:93:5.5446862725779695:0.6345596358727227
13417:81:0.8694353708834501:0.8610458639123718
13542:77:1.0046753749712778:0.8361913703426427
13680:82:7.898528087560851:0.7837288261770342
13799:67:5.6795968227766185:0.37214616970155145
13857:36:2.7938124820144363:0.10872997346449254
13945:73:5.180491151160156:0.183795261793106
14010:7:7.565100574481845:0.033325877812489635
14179:38:3.158002500478579:0.8762332523999679
14246:13:0.8163960575888862:0.11687793448566342
14321:98:6.981821368222011:0.6207591025489955
14473:8:2.3297846497396932:0.38686431622259887
14578:63:0.4436434330479888:0.3894958140703567
14634:59:7.191388054443503:0.20095769579977418
14773:30:6.053525772644528:0.5967585140005333
14841:40:1.3838754859326574:0.502405241786681
14949:60:8.295110054329713:0.4305993322400177
15083:63:0.48547541285623885:0.32805016959748434
15193:31:3.6848854616150293:0.35643612817628656
15212:78:0.2273456842385202:0.953077640082888
15330:89:7.153927919430508:0.43586809846112506
15456:81:0.09816756643055147:0.6295484364565437
15583:7:7.4085537764271745:0.033305634133947604
15692:42:9.988928688371795:0.2761232871677961
15770:88:6.140537017964541:0.9795273172673395
1582:90:6.461894038111831:0.1185444682840926
15972:46:9.953506502098817:0.15329163492922593
16023:90:1.9471840933452211:0.7386518914419935
16110:35:6.373387939809772:0.7171440826931259
16262:22:0.5596942604876298:0.1432896719544473
16338:92:0.9481383578775293:0.7677431462939046
16474:22:0.24856782036149716:0.42812724703916316
16514:83:8.576386817177024:0.9396215064528413
16699:2:9.30095330632649:0.5066561439508125
16763:22:6.403955394913:0.1571691479302042
16878:87:8.344142685105586:0.2861576111801998
16971:55:1.4476785659120595:0.33708688327676783
17036:87:0.21348728262420402:0.28711138205567277
1714:65:5.67218610317065:0.36711320844191897
1722:81:9.67653850599029:0.03156219872649857
17361:88:5.724543360415383:0.7932661225893052
17453:59:9.185083874031697:0.026215655980081132
1757:40:2.8312580779681875:0.49196082108715233
17676:96:2.7315283363582776:0.6519656627078148
17786:93:8.443020347066351:0.1248034896150344
17820:95:3.9697649231974808:0.04606324434996534
17973:11:2.5528837643963884:0.6948268362453378
18050:68:5.756463265683402:0.995685718348466
18141:92:6.3336884749824645:0.1621356000106734
18243:18:9.664694397742583:0.8045465791810523
1832:39:3.9394795994181777:0.5867371111778215
1841:82:4.841485437297484:0.49371708023469907
18565:53:2.7498717037820644:0.20583454120465094
18673:90:1.121137779062057:0.7937686270961586
18753:87:6.2353544374513845:0.015946094567476976
18844:63:7.393381816549878:0.3472456996800237
18915:90:6.9611182251442685:0.8039647151078758
19088:27:8.01133506522802:0.4130507216742557
19154:87:0.23852744551902894:0.6264091805644847
19221:16:1.081879835206111:0.7790590360105223
19322:69:4.123929864290275:0.9702498443951281
1949:97:3.0488474948409316:0.677209238072471
19567:83:4.86032668987452:0.27054126955750546
19662:20:7.499374514038265:0.003010254325323869
19724:69:0.3027367484925514:0.42734474246664456
19890:30:8.329167767245044:0.13749033066927274
19984:33:5.994927378398588:0.3756720097493309
2009:76:7.402293740792216:0.05790492058061891

wednesday_events.txt

 120
 2Location Index:Agents:Time Interval
 31:24,85,69,73,76,29:10
 44:92,10,68,85,96,4,99,56,54,56,52,41,36:45
 58:2,72,22:10
 61:63,20,94,35,35,18,15,1,36,26,38,35,12:10
 74:97,40,12,26,17,84,60,87,99,44,79,15,53:60
 80:39,60,6,4:45
 95:35,14,24,51,29,41,21,65:30
109:78,8,6,51,18,2,4,53,31,50:30
116:67,97,1,68,59,78,59:60
126:49,61,22,82:30
130:0,79,83,18,77,31,7:60
143:83,15,51,85,22,78,61,33,22,26,17,28,38,58,69,5,36,5,58:60
152:49,60,2:10
169:16,37,29,82,95,68,71,14,12,92,2,11,62,12,9,4,77:60
170:28,88:30
183:72,38,92,9,71,10,41,15,58,85,76,13,48,87,71,18,73,86:45
195:4,56,3:45
205:6,12,70,86,41,36,70,49,14,78,38,15,67,75,32,24,5,60:30
211:23,55:10
226:21,25,65,44,7,57,44,89,54,37,46,93,50,24:45

Scheduled_SEYAR_custom_distribution

This example builds over the basic Scheduled SEYAR model by introducing the concept of custom distributions.

Custom distribution provides flexibility in terms of scheduling changes in state for user defined distributions.

In real life scenarios, not all distributions are symmetric about a mean (not all are Normal distributions). Thus, for Scheduled models, Custom distributions provide flexibility in terms of scheduling changes in state for user defined distributions.

It helps us understand that there may exist a population in which, for instance, there is a greater chance of a person recovering in x number of days and a lower chance of them recovering in y or z number of days. We are essentially including a likelihood factor with respect to the duration of recovery. This is in comparison to stating that the person essentially recovers in x days with a variation of 1 day.

This way, the user has the liberty of customising the distribution in the number of time steps to represent the population under consideration in the best possible way.

More on custom distributions in Tutorial 2.1.


Generate_policy.py

 1from episimmer.policy import lockdown_policy
 2
 3
 4def generate_policy():
 5	policy_list=[]
 6
 7	def lockdown_fn(time_step):
 8		return False
 9
10	policy_list.append(lockdown_policy.FullLockdown(lockdown_fn))
11
12	return policy_list

UserModel.py

 1import random
 2
 3import episimmer.model as model
 4
 5
 6def event_contribute_fn(agent,event_info,location,current_time_step):
 7	if agent.state=='Symptomatic':
 8		return 1
 9	elif agent.state=='Asymptomatic':
10		return 0.6
11	return 0
12
13def event_receive_fn(agent,ambient_infection,event_info,location,current_time_step):
14	beta=0.001
15	return ambient_infection*beta
16
17def fn1(current_time_step):
18	r=random.random()
19	if r<0.2:
20		return 2
21	elif r<0.8:
22		return 3
23	else:
24		return 4
25
26
27class UserModel(model.ScheduledModel):
28	def __init__(self):
29		model.ScheduledModel.__init__(self)
30		self.insert_state('Susceptible',None, None,self.p_infection({'Exposed':1}),False,0.95)
31		self.insert_state('Exposed',5,2,self.scheduled({'Symptomatic':0.3,'Asymptomatic':0.7}),False,0.02)
32		self.insert_state('Symptomatic',11,5,self.scheduled({'Recovered':1}),True,0.02)
33		self.insert_state('Asymptomatic',6,3,self.scheduled({'Recovered':1}),True,0.01)
34		self.insert_state_custom('Recovered',fn1,self.scheduled({'Recovered':1}),False,0)
35
36		self.set_event_contribution_fn(event_contribute_fn)
37		self.set_event_receive_fn(event_receive_fn)

agents.txt

  11000
  2Agent Index
  30
  41
  52
  63
  74
  85
  96
 107
 118
 129
 1310
 1411
 1512
 1613
 1714
 1815
 1916
 2017
 2118
 2219
 2320
 2421
 2522
 2623
 2724
 2825
 2926
 3027
 3128
 3229
 3330
 3431
 3532
 3633
 3734
 3835
 3936
 4037
 4138
 4239
 4340
 4441
 4542
 4643
 4744
 4845
 4946
 5047
 5148
 5249
 5350
 5451
 5552
 5653
 5754
 5855
 5956
 6057
 6158
 6259
 6360
 6461
 6562
 6663
 6764
 6865
 6966
 7067
 7168
 7269
 7370
 7471
 7572
 7673
 7774
 7875
 7976
 8077
 8178
 8279
 8380
 8481
 8582
 8683
 8784
 8885
 8986
 9087
 9188
 9289
 9390
 9491
 9592
 9693
 9794
 9895
 9996
10097
10198
10299
103100
104101
105102
106103
107104
108105
109106
110107
111108
112109
113110
114111
115112
116113
117114
118115
119116
120117
121118
122119
123120
124121
125122
126123
127124
128125
129126
130127
131128
132129
133130
134131
135132
136133
137134
138135
139136
140137
141138
142139
143140
144141
145142
146143
147144
148145
149146
150147
151148
152149
153150
154151
155152
156153
157154
158155
159156
160157
161158
162159
163160
164161
165162
166163
167164
168165
169166
170167
171168
172169
173170
174171
175172
176173
177174
178175
179176
180177
181178
182179
183180
184181
185182
186183
187184
188185
189186
190187
191188
192189
193190
194191
195192
196193
197194
198195
199196
200197

config.txt

 1Random Seed <3>
 2Number of worlds <10>
 3Number of Days <30>
 4Agent Parameter Keys <Agent Index>
 5Agent list filename <agents.txt>
 6Interaction Info Keys <>
 7Interaction Files list filename <>
 8Probabilistic Interaction Files list filename <>
 9Location Parameter Keys <Location Index>
10Location list filename <locations.txt>
11Event Parameter Keys <Location Index:Agents>
12Event Files list filename <event_files_list.txt>
13One Time Event filename <>

event_files_list.txt

1<one_event.txt>

generate_files.py

 1import sys
 2
 3import numpy as np
 4
 5
 6def write_agents(filename,n):
 7	header='Agent Index'
 8
 9	f=open(filename,'w')
10	f.write(str(n)+'\n')
11	f.write(header+'\n')
12
13	for i in range(n):
14		f.write(str(i)+'\n')
15
16def write_events(filename,no_locations,no_agents):
17	info_dict={}
18	#ID enumerates from 0 to n-1
19	header='Location Index:Agents'
20
21	f=open(filename,'w')
22	f.write(str(1)+'\n')
23	f.write(header+'\n')
24
25	line=str(0)+':'
26	for i in range(no_agents):
27		line+=str(i)
28		if i!=no_agents-1:
29			line+=','
30
31	f.write(line)
32
33number_of_agents=int(sys.argv[1])
34write_agents('agents.txt',number_of_agents)
35write_events('one_event.txt',1,number_of_agents)

locations.txt

11
2Location Index
30

one_event.txt

11
2Location Index:Agents
30:0,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,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271,272,273,274,275,276,277,278,279,280,281,282,283,284,285,286,287,288,289,290,291,292,293,294,295,296,297,298,299,300,301,302,303,304,305,306,307,308,309,310,311,312,313,314,315,316,317,318,319,320,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,337,338,339,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,356,357,358,359,360,361,362,363,364,365,366,367,368,369,370,371,372,373,374,375,376,377,378,379,380,381,382,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,399,400,401,402,403,404,405,406,407,408,409,410,411,412,413,414,415,416,417,418,419,420,421,422,423,424,425,426,427,428,429,430,431,432,433,434,435,436,437,438,439,440,441,442,443,444,445,446,447,448,449,450,451,452,453,454,455,456,457,458,459,460,461,462,463,464,465,466,467,468,469,470,471,472,473,474,475,476,477,478,479,480,481,482,483,484,485,486,487,488,489,490,491,492,493,494,495,496,497,498,499,500,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600,601,602,603,604,605,606,607,608,609,610,611,612,613,614,615,616,617,618,619,620,621,622,623,624,625,626,627,628,629,630,631,632,633,634,635,636,637,638,639,640,641,642,643,644,645,646,647,648,649,650,651,652,653,654,655,656,657,658,659,660,661,662,663,664,665,666,667,668,669,670,671,672,673,674,675,676,677,678,679,680,681,682,683,684,685,686,687,688,689,690,691,692,693,694,695,696,697,698,699,700,701,702,703,704,705,706,707,708,709,710,711,712,713,714,715,716,717,718,719,720,721,722,723,724,725,726,727,728,729,730,731,732,733,734,735,736,737,738,739,740,741,742,743,744,745,746,747,748,749,750,751,752,753,754,755,756,757,758,759,760,761,762,763,764,765,766,767,768,769,770,771,772,773,774,775,776,777,778,779,780,781,782,783,784,785,786,787,788,789,790,791,792,793,794,795,796,797,798,799,800,801,802,803,804,805,806,807,808,809,810,811,812,813,814,815,816,817,818,819,820,821,822,823,824,825,826,827,828,829,830,831,832,833,834,835,836,837,838,839,840,841,842,843,844,845,846,847,848,849,850,851,852,853,854,855,856,857,858,859,860,861,862,863,864,865,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,919,920,921,922,923,924,925,926,927,928,929,930,931,932,933,934,935,936,937,938,939,940,941,942,943,944,945,946,947,948,949,950,951,952,953,954,955,956,957,958,959,960,961,962,963,964,965,966,967,968,969,970,971,972,973,974,975,976,977,978,979,980,981,982,983,984,985,986,987,988,989,990,991,992,993,994,995,996,997,998,999

Scheduled_SIR_External_Prevalence

This example builds over the basic Scheduled SIR model by introducing the concept of external prevalence.

Disease spread is contained using policies and restrictions that are enforced by the government or university management. However, it is not certain that all agents will comply with the enforced rules and standards.

Episimmer uses this example to study disease transmission involving such exceptions, i.e., creates simulations which are influenced by scenarios such as agents not following lockdown norms, not getting vaccinated, not getting tested, etc.

Hence, the students are associated with a “Compliance” factor which will determine their susceptibility to disease outside the defined simulation environment.


Generate_policy.py

 1from episimmer.policy import lockdown_policy
 2
 3
 4def generate_policy():
 5	policy_list=[]
 6
 7	def lockdown_fn(time_step):
 8		return False
 9
10	policy_list.append(lockdown_policy.FullLockdown(lockdown_fn))
11
12	return policy_list

UserModel.py

 1import episimmer.model as model
 2
 3
 4def external_prevalence(agent, current_time_step):
 5	if(agent.info['Compliance'] == 'High'):
 6		return 0.1
 7	elif(agent.info['Compliance'] == 'Medium'):
 8		return 0.2
 9	elif(agent.info['Compliance'] == 'Low'):
10		return 0.35
11
12class UserModel(model.ScheduledModel):
13	def __init__(self):
14		model.ScheduledModel.__init__(self)
15		self.insert_state('Susceptible',None, None,self.p_infection({'Infected':1}),False,0.99)
16		self.insert_state('Infected',6,3,self.scheduled({'Recovered':1}),True,0.01)
17		self.insert_state('Recovered',0, 0,self.scheduled({'Recovered':1}),False,0)
18
19		self.set_external_prevalence_fn(external_prevalence)

agents.txt

  11000
  2Agent Index:Compliance
  30:High
  41:Medium
  52:High
  63:Low
  74:High
  85:High
  96:Medium
 107:Low
 118:High
 129:Medium
 1310:Low
 1411:High
 1512:Low
 1613:High
 1714:Low
 1815:Low
 1916:Low
 2017:Medium
 2118:Low
 2219:High
 2320:High
 2421:Low
 2522:High
 2623:Low
 2724:High
 2825:Low
 2926:Low
 3027:Low
 3128:High
 3229:Low
 3330:Medium
 3431:High
 3532:High
 3633:Low
 3734:Low
 3835:Low
 3936:High
 4037:High
 4138:Low
 4239:Low
 4340:Medium
 4441:Low
 4542:High
 4643:Medium
 4744:Low
 4845:Low
 4946:High
 5047:Low
 5148:High
 5249:High
 5350:Medium
 5451:High
 5552:Medium
 5653:High
 5754:Low
 5855:Low
 5956:Low
 6057:Low
 6158:Medium
 6259:Medium
 6360:Medium
 6461:Low
 6562:High
 6663:Medium
 6764:Medium
 6865:Low
 6966:Low
 7067:High
 7168:Low
 7269:High
 7370:Medium
 7471:High
 7572:Medium
 7673:High
 7774:Low
 7875:Medium
 7976:Low
 8077:Low
 8178:High
 8279:High
 8380:Low
 8481:Medium
 8582:High
 8683:Medium
 8784:High
 8885:High
 8986:Low
 9087:Medium
 9188:High
 9289:High
 9390:Medium
 9491:Low
 9592:Low
 9693:High
 9794:Medium
 9895:Low
 9996:Low
10097:Low
10198:Medium
10299:High
103100:Low
104101:Medium
105102:High
106103:High
107104:High
108105:Medium
109106:Medium
110107:Medium
111108:High
112109:High
113110:High
114111:Medium
115112:High
116113:Low
117114:High
118115:Medium
119116:Low
120117:Low
121118:High
122119:Low
123120:High
124121:High
125122:Low
126123:Low
127124:Medium
128125:Medium
129126:Medium
130127:High
131128:High
132129:Medium
133130:High
134131:Low
135132:Low
136133:High
137134:Low
138135:High
139136:High
140137:Medium
141138:Medium
142139:High
143140:Medium
144141:Medium
145142:High
146143:Medium
147144:Low
148145:High
149146:Medium
150147:Medium
151148:Low
152149:Low
153150:Low
154151:Medium
155152:High
156153:High
157154:High
158155:Medium
159156:Low
160157:High
161158:Medium
162159:Medium
163160:Low
164161:Low
165162:Medium
166163:Low
167164:Low
168165:Low
169166:Medium
170167:High
171168:Low
172169:Medium
173170:Medium
174171:Low
175172:Low
176173:Low
177174:Low
178175:Low
179176:Medium
180177:Low
181178:Medium
182179:High
183180:Medium
184181:Low
185182:Medium
186183:Low
187184:Medium
188185:High
189186:Medium
190187:Low
191188:High
192189:Medium
193190:Low
194191:Low
195192:Medium
196193:Low
197194:High
198195:Medium
199196:High
200197:Medium

config.txt

 1Random Seed <>
 2Number of worlds <10>
 3Number of Days <50>
 4Agent Parameter Keys <Agent Index:Compliance>
 5Agent list filename <agents.txt>
 6Interaction Info Keys <>
 7Interaction Files list filename <>
 8Probabilistic Interaction Files list filename <>
 9Location Parameter Keys <>
10Location list filename <>
11Event Parameter Keys <>
12Event Files list filename <>
13One Time Event filename <>

generate_files.py

 1import random
 2import sys
 3
 4import numpy as np
 5
 6
 7def write_agents(filename,n):
 8	info_dict={}
 9	#ID enumerates from 0 to n-1
10	header='Agent Index:Compliance'
11	info_dict['Compliance']=['High','Low','Medium']
12
13	f=open(filename,'w')
14	f.write(str(n)+'\n')
15	f.write(header+'\n')
16
17	for i in range(n):
18		f.write(str(i))
19		for j in info_dict.keys():
20			f.write(':'+random.choice(info_dict[j]))
21		f.write('\n')
22
23number_of_agents=int(sys.argv[1])
24write_agents('agents.txt',number_of_agents)

Stochastic_SEYAR_External_Prevalence

The implementation is similar to that of Scheduled_SIR_External_Prevalence except we use a Stochastic model and here, instead of compliance, we take into account the student’s place of residence.


Generate_policy.py

 1from episimmer.policy import lockdown_policy
 2
 3
 4def generate_policy():
 5	policy_list=[]
 6
 7	def lockdown_fn(time_step):
 8		return False
 9
10	policy_list.append(lockdown_policy.FullLockdown(lockdown_fn))
11
12	return policy_list

UserModel.py

 1import episimmer.model as model
 2
 3
 4def event_contribute_fn(agent,event_info,location,current_time_step):
 5	if agent.state=='Symptomatic':
 6		return 1
 7	elif agent.state=='Asymptomatic':
 8		return 0.5
 9	return 0
10
11def event_receive_fn(agent,ambient_infection,event_info,location,current_time_step):
12	#Example 1
13	beta=0.001
14	return ambient_infection*beta
15
16# Returns additional probability of an agent getting infected by external prevalence of the disease
17def external_prevalence(agent, current_time_step):
18	if(agent.info['Residence'] == 'Outside'):
19		return 0.2
20	return 0.0
21
22
23class UserModel(model.StochasticModel):
24	def __init__(self):
25		individual_types=['Susceptible','Exposed','Asymptomatic','Symptomatic','Recovered']
26		infected_states=['Asymptomatic','Symptomatic']
27		state_proportion={
28							'Susceptible':0.99,
29							'Exposed':0,
30							'Recovered':0,
31							'Asymptomatic':0,
32							'Symptomatic':0.01
33						}
34		model.StochasticModel.__init__(self,individual_types,infected_states,state_proportion)
35		self.set_transition('Susceptible', 'Exposed', self.p_infection())
36		self.set_transition('Exposed', 'Symptomatic', self.p_standard(0.15))
37		self.set_transition('Exposed', 'Asymptomatic', self.p_standard(0.2))
38		self.set_transition('Symptomatic', 'Recovered', self.p_standard(0.1))
39		self.set_transition('Asymptomatic', 'Recovered', self.p_standard(0.1))
40
41		self.set_event_contribution_fn(event_contribute_fn)
42		self.set_event_receive_fn(event_receive_fn)
43		self.set_external_prevalence_fn(external_prevalence)

agents.txt

  11000
  2Agent Index:Residence
  30:Teacher Dorm
  41:Dorm B
  52:Outside
  63:Teacher Dorm
  74:Dorm A
  85:Teacher Dorm
  96:Dorm B
 107:Teacher Dorm
 118:Teacher Dorm
 129:Dorm A
 1310:Outside
 1411:Dorm B
 1512:Dorm A
 1613:Dorm A
 1714:Outside
 1815:Teacher Dorm
 1916:Outside
 2017:Dorm B
 2118:Outside
 2219:Teacher Dorm
 2320:Outside
 2421:Teacher Dorm
 2522:Dorm A
 2623:Teacher Dorm
 2724:Outside
 2825:Dorm A
 2926:Dorm A
 3027:Dorm B
 3128:Teacher Dorm
 3229:Dorm B
 3330:Dorm A
 3431:Dorm B
 3532:Teacher Dorm
 3633:Dorm A
 3734:Dorm B
 3835:Dorm B
 3936:Dorm A
 4037:Outside
 4138:Dorm A
 4239:Dorm B
 4340:Dorm B
 4441:Dorm B
 4542:Dorm A
 4643:Teacher Dorm
 4744:Teacher Dorm
 4845:Dorm A
 4946:Dorm A
 5047:Teacher Dorm
 5148:Dorm B
 5249:Outside
 5350:Outside
 5451:Dorm B
 5552:Dorm B
 5653:Dorm B
 5754:Dorm B
 5855:Dorm A
 5956:Dorm A
 6057:Outside
 6158:Outside
 6259:Teacher Dorm
 6360:Teacher Dorm
 6461:Dorm B
 6562:Dorm B
 6663:Dorm A
 6764:Outside
 6865:Dorm B
 6966:Outside
 7067:Teacher Dorm
 7168:Dorm B
 7269:Outside
 7370:Dorm B
 7471:Teacher Dorm
 7572:Teacher Dorm
 7673:Dorm B
 7774:Dorm A
 7875:Teacher Dorm
 7976:Outside
 8077:Outside
 8178:Outside
 8279:Dorm A
 8380:Dorm A
 8481:Dorm B
 8582:Dorm A
 8683:Outside
 8784:Dorm B
 8885:Outside
 8986:Outside
 9087:Dorm A
 9188:Teacher Dorm
 9289:Outside
 9390:Outside
 9491:Outside
 9592:Teacher Dorm
 9693:Outside
 9794:Dorm B
 9895:Dorm A
 9996:Dorm A
10097:Teacher Dorm
10198:Teacher Dorm
10299:Outside
103100:Outside
104101:Outside
105102:Dorm A
106103:Teacher Dorm
107104:Teacher Dorm
108105:Dorm A
109106:Outside
110107:Teacher Dorm
111108:Teacher Dorm
112109:Dorm A
113110:Outside
114111:Dorm A
115112:Dorm A
116113:Dorm B
117114:Teacher Dorm
118115:Outside
119116:Dorm A
120117:Dorm A
121118:Dorm B
122119:Dorm A
123120:Teacher Dorm
124121:Dorm A
125122:Outside
126123:Dorm B
127124:Dorm B
128125:Dorm B
129126:Outside
130127:Dorm A
131128:Dorm A
132129:Dorm B
133130:Dorm A
134131:Dorm B
135132:Dorm A
136133:Outside
137134:Dorm B
138135:Outside
139136:Dorm B
140137:Teacher Dorm
141138:Outside
142139:Dorm B
143140:Dorm B
144141:Dorm A
145142:Teacher Dorm
146143:Dorm A
147144:Dorm B
148145:Teacher Dorm
149146:Outside
150147:Teacher Dorm
151148:Dorm B
152149:Dorm A
153150:Dorm B
154151:Outside
155152:Dorm B
156153:Outside
157154:Outside
158155:Dorm A
159156:Teacher Dorm
160157:Teacher Dorm
161158:Dorm A
162159:Dorm A
163160:Teacher Dorm
164161:Teacher Dorm
165162:Dorm B
166163:Outside
167164:Dorm A
168165:Teacher Dorm
169166:Dorm A
170167:Outside
171168:Dorm A
172169:Dorm A
173170:Dorm B
174171:Dorm B
175172:Dorm B
176173:Outside
177174:Dorm A
178175:Teacher Dorm
179176:Dorm B
180177:Outside
181178:Teacher Dorm
182179:Outside
183180:Outside
184181:Outside
185182:Dorm B
186183:Teacher Dorm
187184:Teacher Dorm
188185:Outside
189186:Outside
190187:Dorm B
191188:Teacher Dorm
192189:Outside
193190:Outside
194191:Dorm B
195192:Teacher Dorm
196193:Dorm B
197194:Dorm A
198195:Dorm A
199196:Dorm A
200197:Outside

config.txt

 1Random Seed <>
 2Number of worlds <10>
 3Number of Days <50>
 4Agent Parameter Keys <Agent Index:Residence>
 5Agent list filename <agents.txt>
 6Interaction Info Keys <>
 7Interaction Files list filename <>
 8Probabilistic Interaction Files list filename <>
 9Location Parameter Keys <Location Index>
10Location list filename <locations.txt>
11Event Parameter Keys <Location Index:Agents>
12Event Files list filename <event_files_list.txt>
13One Time Event filename <>

event_files_list.txt

1<one_event.txt>

generate_files.py

 1import random
 2import sys
 3
 4import numpy as np
 5
 6
 7def write_agents(filename,n):
 8	info_dict={}
 9	#ID enumerates from 0 to n-1
10	header='Agent Index:Residence'
11	info_dict['Residence']=['Dorm A','Dorm B','Outside','Teacher Dorm']
12
13	f=open(filename,'w')
14	f.write(str(n)+'\n')
15	f.write(header+'\n')
16
17	for i in range(n):
18		f.write(str(i))
19		for j in info_dict.keys():
20			f.write(':'+random.choice(info_dict[j]))
21		f.write('\n')
22
23
24def write_events(filename,no_locations,no_agents):
25	info_dict={}
26	#ID enumerates from 0 to n-1
27	header='Location Index:Agents'
28
29	f=open(filename,'w')
30	f.write(str(1)+'\n')
31	f.write(header+'\n')
32
33	line=str(0)+':'
34	for i in range(no_agents):
35		line+=str(i)
36		if i!=no_agents-1:
37			line+=','
38
39	f.write(line)
40
41number_of_agents=int(sys.argv[1])
42write_agents('agents.txt',number_of_agents)
43write_events('one_event.txt',1,number_of_agents)

locations.txt

11
2Location Index
30

one_event.txt

11
2Location Index:Agents
30:0,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,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271,272,273,274,275,276,277,278,279,280,281,282,283,284,285,286,287,288,289,290,291,292,293,294,295,296,297,298,299,300,301,302,303,304,305,306,307,308,309,310,311,312,313,314,315,316,317,318,319,320,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,337,338,339,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,356,357,358,359,360,361,362,363,364,365,366,367,368,369,370,371,372,373,374,375,376,377,378,379,380,381,382,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,399,400,401,402,403,404,405,406,407,408,409,410,411,412,413,414,415,416,417,418,419,420,421,422,423,424,425,426,427,428,429,430,431,432,433,434,435,436,437,438,439,440,441,442,443,444,445,446,447,448,449,450,451,452,453,454,455,456,457,458,459,460,461,462,463,464,465,466,467,468,469,470,471,472,473,474,475,476,477,478,479,480,481,482,483,484,485,486,487,488,489,490,491,492,493,494,495,496,497,498,499,500,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600,601,602,603,604,605,606,607,608,609,610,611,612,613,614,615,616,617,618,619,620,621,622,623,624,625,626,627,628,629,630,631,632,633,634,635,636,637,638,639,640,641,642,643,644,645,646,647,648,649,650,651,652,653,654,655,656,657,658,659,660,661,662,663,664,665,666,667,668,669,670,671,672,673,674,675,676,677,678,679,680,681,682,683,684,685,686,687,688,689,690,691,692,693,694,695,696,697,698,699,700,701,702,703,704,705,706,707,708,709,710,711,712,713,714,715,716,717,718,719,720,721,722,723,724,725,726,727,728,729,730,731,732,733,734,735,736,737,738,739,740,741,742,743,744,745,746,747,748,749,750,751,752,753,754,755,756,757,758,759,760,761,762,763,764,765,766,767,768,769,770,771,772,773,774,775,776,777,778,779,780,781,782,783,784,785,786,787,788,789,790,791,792,793,794,795,796,797,798,799,800,801,802,803,804,805,806,807,808,809,810,811,812,813,814,815,816,817,818,819,820,821,822,823,824,825,826,827,828,829,830,831,832,833,834,835,836,837,838,839,840,841,842,843,844,845,846,847,848,849,850,851,852,853,854,855,856,857,858,859,860,861,862,863,864,865,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,919,920,921,922,923,924,925,926,927,928,929,930,931,932,933,934,935,936,937,938,939,940,941,942,943,944,945,946,947,948,949,950,951,952,953,954,955,956,957,958,959,960,961,962,963,964,965,966,967,968,969,970,971,972,973,974,975,976,977,978,979,980,981,982,983,984,985,986,987,988,989,990,991,992,993,994,995,996,997,998,999

Policy

This subdirectory in Episimmer showcases the mitigation policies that can be enforced. Policies here refer to any kind of method to control the spread of the epidemic.

Current policies in Episimmer include :

  1. Lockdown Policy

  2. Testing Policy

  3. Vaccination Policy

  4. Contact Tracing Policy

For more information on these examples refer to Tutorial 3

To run an example :

            cd examples/Policy
            python ../../episimmer/main.py Sample_Campus

Contact_Tracing1

This example showcases the first kind of Contact Tracing policy in Episimmer. It first performs testing on random agents and then trace their contacts to lock them down. You can run multiple contact tracing policies concurrently for different types of agents. Since we want mitigation of disease spread, we implement a lockdown policy with contact tracing enabled to not only lock down the contacts of the positive agents but even the positive agents themselves.


Generate_policy.py

 1import random
 2
 3from episimmer.policy import (contact_tracing_policy, lockdown_policy,
 4                              testing_policy)
 5
 6
 7def agents_per_step_fn(cur_time_step):
 8    return 7
 9
10def generate_policy():
11    policy_list=[]
12    Normal_Test = testing_policy.TestPolicy(agents_per_step_fn)
13    Normal_Test.add_machine('Simple_Machine', 200, 0.0, 0.0, 0, 50, 5, 2)
14    Normal_Test.set_register_agent_testtube_func(Normal_Test.random_testing())
15
16    # Num of timesteps to store agents
17    CT_object = contact_tracing_policy.CTPolicy(7, 'Type', ['Teacher'])
18    CT_object2 = contact_tracing_policy.CTPolicy(3, 'Type', ['Student'])
19
20    # do lockdown function, Num of days to lockdown based on test result, Contact tracing boolean
21    Lockdown_object = lockdown_policy.TestingBasedLockdown(lambda x:True, 2, True)
22    policy_list.append(Normal_Test)
23    policy_list.append(CT_object)
24    policy_list.append(CT_object2)
25    policy_list.append(Lockdown_object)
26
27    return policy_list

UserModel.py

 1import episimmer.model as model
 2
 3
 4def event_contribute_fn(agent,event_info,location,current_time_step):
 5	if agent.state=='Infected':
 6		return 1
 7	return 0
 8
 9
10def event_receive_fn(agent,ambient_infection,event_info,location,current_time_step):
11	beta=0.01
12	return ambient_infection*beta
13
14
15def probability_of_infection_fn(p_infected_states_list,contact_agent,c_dict,current_time_step):
16	if contact_agent.state=='Infected':
17		return 0.01
18	return 0
19
20
21class UserModel(model.StochasticModel):
22	def __init__(self):
23		individual_types=['Susceptible','Infected','Recovered']
24		infected_states=['Infected']
25		state_proportion={
26							'Susceptible':0.7,
27							'Infected':0.3,
28							'Recovered':0
29						}
30		model.StochasticModel.__init__(self,individual_types,infected_states,state_proportion)
31		self.set_transition('Susceptible', 'Infected', self.p_infection(probability_of_infection_fn, None))
32		self.set_transition('Infected', 'Recovered', self.p_standard(0.2))
33
34		self.set_event_contribution_fn(event_contribute_fn)
35		self.set_event_receive_fn(event_receive_fn)
36
37		self.name='Contact_Tracing1'

agents.txt

  1100
  2Agent Index:Type
  30:Student
  41:Teacher
  52:Student
  63:Student
  74:Student
  85:Teacher
  96:Student
 107:Student
 118:Teacher
 129:Teacher
 1310:Teacher
 1411:Teacher
 1512:Teacher
 1613:Teacher
 1714:Student
 1815:Student
 1916:Teacher
 2017:Student
 2118:Teacher
 2219:Student
 2320:Student
 2421:Student
 2522:Teacher
 2623:Student
 2724:Teacher
 2825:Student
 2926:Student
 3027:Teacher
 3128:Teacher
 3229:Teacher
 3330:Student
 3431:Teacher
 3532:Student
 3633:Student
 3734:Teacher
 3835:Teacher
 3936:Teacher
 4037:Student
 4138:Student
 4239:Teacher
 4340:Teacher
 4441:Teacher
 4542:Student
 4643:Student
 4744:Student
 4845:Student
 4946:Teacher
 5047:Teacher
 5148:Teacher
 5249:Student
 5350:Student
 5451:Student
 5552:Student
 5653:Teacher
 5754:Student
 5855:Teacher
 5956:Teacher
 6057:Student
 6158:Student
 6259:Teacher
 6360:Teacher
 6461:Teacher
 6562:Student
 6663:Teacher
 6764:Student
 6865:Student
 6966:Teacher
 7067:Student
 7168:Student
 7269:Student
 7370:Teacher
 7471:Teacher
 7572:Teacher
 7673:Teacher
 7774:Teacher
 7875:Student
 7976:Student
 8077:Student
 8178:Teacher
 8279:Student
 8380:Teacher
 8481:Teacher
 8582:Student
 8683:Teacher
 8784:Student
 8885:Student
 8986:Student
 9087:Teacher
 9188:Teacher
 9289:Teacher
 9390:Teacher
 9491:Teacher
 9592:Student
 9693:Teacher
 9794:Student
 9895:Teacher
 9996:Student
10097:Student
10198:Student
10299:Student

config.txt

 1Random Seed <3>
 2Number of worlds <10>
 3Number of Days <30>
 4Agent Parameter Keys <Agent Index:Type>
 5Agent list filename <agents.txt>
 6Interaction Info Keys <Agent Index:Interacting Agent Index>
 7Interaction Files list filename <interaction_files_list.txt>
 8Probabilistic Interaction Files list filename <>
 9Location Parameter Keys <Location Index>
10Location list filename <locations.txt>
11Event Parameter Keys <Location Index:Agents>
12Event Files list filename <event_files_list.txt>
13One Time Event filename <>

empty_event.txt

10
2Location Index:Agents

empty_interactions.txt

10
2Agent Index:Interacting Agent Index

event_files_list.txt

1<one_event.txt>
2<empty_event.txt>

generate_agents.py

 1import random
 2
 3import numpy as np
 4
 5
 6def write_to_file(filename,n):
 7	info_dict={}
 8	#ID enumerates from 0 to n-1
 9	header='Agent Index:Type'
10	info_dict['Type']=['Student','Teacher']
11
12	f=open(filename,'w')
13	f.write(str(n)+'\n')
14	f.write(header+'\n')
15
16	for i in range(n):
17		f.write(str(i))
18		for j in info_dict.keys():
19			f.write(':'+random.choice(info_dict[j]))
20		f.write('\n')
21
22
23write_to_file('agents.txt',100)

generate_agents_csv.py

 1import random
 2from csv import DictWriter
 3
 4with open('agents.csv', 'w', newline='') as file:
 5    fieldnames = ['Agent Index','Type']
 6    writer = DictWriter(file, fieldnames=fieldnames)
 7    writer.writeheader()
 8    for i in range(100):
 9        info_dict={}
10        info_dict['Agent Index']=i
11        info_dict['Type']=random.choice(['Student','Teacher'])
12        writer.writerow(info_dict)

generate_events.py

 1import random
 2
 3import numpy as np
 4
 5
 6def write_to_file(filename,no_locations,no_agents):
 7	info_dict={}
 8	#ID enumerates from 0 to n-1
 9	header='Location Index:Agents'
10	n=random.randint(10,20)
11	f=open(filename,'w')
12	f.write(str(n)+'\n')
13	f.write(header+'\n')
14
15	for i in range(n):
16		line=str(random.randint(0,no_locations-1))+':'
17		for i in range(random.randint(0,20)):
18			line+=str(random.randint(0,no_agents-1))+','
19		line+=str(random.randint(0,no_agents-1))
20		line+='\n'
21
22		f.write(line)
23
24write_to_file('one_event.txt',10,100)

generate_interactions.py

 1import random
 2import sys
 3
 4import numpy as np
 5
 6
 7def write_to_file(filename,n,no_contacts):
 8	#ID enumerates from 0 to n-1
 9	header='Agent Index:Interacting Agent Index'
10
11	f=open(filename,'w')
12	f.write(str(no_contacts)+'\n')
13	f.write(header+'\n')
14
15	for i in range(no_contacts):
16		agent=random.randint(0,n-1)
17		contact_agent=random.randint(0,n-1)
18		f.write(str(agent)+':'+str(contact_agent)+'\n')
19
20
21n = int(sys.argv[1])
22num_interactions = int(sys.argv[2])
23write_to_file('simple_interactions.txt',n,num_interactions)

generate_locations.py

 1import random
 2
 3import numpy as np
 4
 5
 6def write_to_file(filename,n):
 7	info_dict={}
 8	#ID enumerates from 0 to n-1
 9	header='Location Index'
10
11	f=open(filename,'w')
12	f.write(str(n)+'\n')
13	f.write(header+'\n')
14
15	for i in range(n):
16		f.write(str(i))
17		f.write('\n')
18
19
20write_to_file('locations.txt',10)

interaction_files_list.txt

1<empty_interactions.txt>
2<simple_interactions.txt>

locations.txt

 110
 2Location Index
 30
 41
 52
 63
 74
 85
 96
107
118
129

one_event.txt

 118
 2Location Index:Agents
 33:58,27,92,6,81,24,44,27,26,98,18,5,50,3,82,42
 43:99,45,24,34,95,56,37,66,30,97,89,80,78,19,77,67,72,51,93
 55:36,91,60,80,47,72,13
 63:24,90,23,4,18,53,53,59,15,82,29,42,62,26,11,4,45,95
 76:21,92,48,59,5,54,33,4,88,6,40,26,21,94,23,41,14,11
 80:14,65
 94:19,39,63,32,30,99,21,28,71,81,92,13,73,36,31,32,1
109:71,22,40,35,26
114:75
127:90,81,17,68,56
136:92,78,8,59,70,5,78,82,61,10,65,81,65,86
146:59,63,75,53,32,91,98,51,97,6,61,18,78
159:97
164:64
173:81,52,83,12
187:88,85,82,89,2,22,42,2,23,0,12,56,87
195:49,87,26,99,44,91,24,59,70,3,98,82,3,39,79
206:5,26,81,33,75,51,11,42,22,41,31,15,88,0

simple_interactions.txt

  15000
  2Agent Index:Interacting Agent Index
  351:77
  412:91
  574:5
  698:50
  736:55
  873:58
  986:69
 1074:39
 1192:35
 1298:54
 1327:25
 140:31
 1531:74
 1675:50
 1784:38
 1896:43
 1991:70
 2074:41
 2160:92
 2290:86
 2386:73
 2411:7
 2564:73
 2665:78
 2753:26
 2854:23
 2927:77
 3086:46
 3141:73
 3232:66
 3314:9
 3468:70
 3546:79
 3654:22
 3768:50
 3814:61
 3972:42
 4042:3
 4179:97
 4273:38
 4328:60
 4410:59
 4538:3
 4636:32
 4720:9
 4897:89
 4982:42
 5078:79
 5184:81
 5254:98
 5311:87
 5416:32
 5566:10
 5623:16
 5771:20
 5843:18
 5968:9
 6056:44
 6119:15
 6279:11
 6370:27
 6415:89
 6575:7
 6654:81
 6726:25
 6878:10
 6954:58
 7041:52
 7130:91
 7213:30
 7367:98
 7431:22
 7561:82
 7655:35
 7716:24
 7836:43
 7972:85
 8031:21
 8191:21
 8295:98
 837:49
 8431:55
 8553:93
 8635:55
 870:80
 8874:80
 8916:69
 9053:95
 9135:12
 922:36
 9348:3
 9474:3
 9510:23
 9612:84
 9796:72
 9894:60
 9988:15
10094:49
10197:32
10280:41
10354:55
10453:15
10558:69
10674:47
10747:7
10877:10
10945:38
11027:85
11182:94
11293:10
11343:23
11469:55
11575:84
11658:14
11719:93
11810:0
11923:92
12097:36
12134:32
12267:76
12318:88
12427:30
12561:28
12659:43
12737:85
12827:63
12946:76
13073:66
13110:0
1325:76
13322:95
13462:75
13522:62
13649:21
13730:9
13875:97
13970:6
14097:39
14145:73
14258:15
1430:77
14494:30
1459:27
14612:89
14739:73
14865:20
14973:87
1505:72
15161:42
15292:60
15356:90
15486:12
15522:80
1561:96
15793:74
15818:66
1597:89
16014:1
16147:23
16272:77
16358:32
16437:31
16546:46
16679:76
16773:32
1689:53
16994:30
17059:56
1715:12
17299:76
1733:54
1743:85
17519:78
17678:11
17765:81
17851:48
17983:61
18016:39
18136:6
18291:87
18320:2
18429:69
18523:53
18693:74
18723:81
18862:18
18947:10
19037:4
1916:57
19217:31
19392:27
19478:2
19510:75
1965:85
19742:65
19851:88
19916:3
20035:93

Contact_Tracing2

This example showcases the second kind of Contact Tracing policy in Episimmer. It first performs testing on random agents and then trace their contacts. The traced contacts are then tested for potential lock down, unlike the first kind where they are directly lock down. Only if the contacts test positive are they lock down for a fixed period of time. Once again, You can run multiple contact tracing policies concurrently for different types of agents.


Generate_policy.py

 1from episimmer.policy import (contact_tracing_policy, lockdown_policy,
 2                              testing_policy)
 3
 4
 5def agents_per_step_fn(cur_time_step):
 6    return 2
 7
 8def generate_policy():
 9    policy_list=[]
10    Normal_Test1 = testing_policy.TestPolicy(agents_per_step_fn)
11    Normal_Test1.add_machine('Simple_Machine', 200, 0.0, 0.0, 0, 50, 2, 2)
12    Normal_Test1.set_register_agent_testtube_func(Normal_Test1.random_testing())
13
14    Normal_Test2 = testing_policy.TestPolicy(agents_per_step_fn)
15    Normal_Test2.add_machine('Simple_Machine', 200, 0.0, 0.0, 0, 50, 2, 2)
16    Normal_Test2.set_register_agent_testtube_func(Normal_Test2.contact_testing())
17
18    # Num of timesteps to store agents
19    CT_object = contact_tracing_policy.CTPolicy(7)
20
21
22    # do lockdown function, Num of days to lockdown based on test result, Contact tracing boolean
23    Lockdown_object = lockdown_policy.TestingBasedLockdown(lambda x: True, 2)
24    policy_list.append(Normal_Test1)
25    policy_list.append(Normal_Test2)
26    policy_list.append(CT_object)
27    policy_list.append(Lockdown_object)
28
29    return policy_list

UserModel.py

 1import episimmer.model as model
 2
 3
 4def event_contribute_fn(agent,event_info,location,current_time_step):
 5	if agent.state=='Infected':
 6		return 1
 7	return 0
 8
 9
10def event_receive_fn(agent,ambient_infection,event_info,location,current_time_step):
11	beta=0.01
12	return ambient_infection*beta
13
14
15def probability_of_infection_fn(p_infected_states_list,contact_agent,c_dict,current_time_step):
16	if contact_agent.state=='Infected':
17		return 0.01
18	return 0
19
20
21class UserModel(model.StochasticModel):
22	def __init__(self):
23		individual_types=['Susceptible','Infected','Recovered']
24		infected_states=['Infected']
25		state_proportion={
26							'Susceptible':0.1,
27							'Infected':0.9,
28							'Recovered':0
29						}
30		model.StochasticModel.__init__(self,individual_types,infected_states,state_proportion)
31		self.set_transition('Susceptible', 'Infected', self.p_infection(probability_of_infection_fn, None))
32		self.set_transition('Infected', 'Recovered', self.p_standard(0.2))
33
34		self.set_event_contribution_fn(event_contribute_fn)
35		self.set_event_receive_fn(event_receive_fn)
36
37		self.name='Contact_Tracing2'

agents.txt

  1100
  2Agent Index:Type
  30:Student
  41:Teacher
  52:Student
  63:Student
  74:Student
  85:Teacher
  96:Student
 107:Student
 118:Teacher
 129:Teacher
 1310:Teacher
 1411:Teacher
 1512:Teacher
 1613:Teacher
 1714:Student
 1815:Student
 1916:Teacher
 2017:Student
 2118:Teacher
 2219:Student
 2320:Student
 2421:Student
 2522:Teacher
 2623:Student
 2724:Teacher
 2825:Student
 2926:Student
 3027:Teacher
 3128:Teacher
 3229:Teacher
 3330:Student
 3431:Teacher
 3532:Student
 3633:Student
 3734:Teacher
 3835:Teacher
 3936:Teacher
 4037:Student
 4138:Student
 4239:Teacher
 4340:Teacher
 4441:Teacher
 4542:Student
 4643:Student
 4744:Student
 4845:Student
 4946:Teacher
 5047:Teacher
 5148:Teacher
 5249:Student
 5350:Student
 5451:Student
 5552:Student
 5653:Teacher
 5754:Student
 5855:Teacher
 5956:Teacher
 6057:Student
 6158:Student
 6259:Teacher
 6360:Teacher
 6461:Teacher
 6562:Student
 6663:Teacher
 6764:Student
 6865:Student
 6966:Teacher
 7067:Student
 7168:Student
 7269:Student
 7370:Teacher
 7471:Teacher
 7572:Teacher
 7673:Teacher
 7774:Teacher
 7875:Student
 7976:Student
 8077:Student
 8178:Teacher
 8279:Student
 8380:Teacher
 8481:Teacher
 8582:Student
 8683:Teacher
 8784:Student
 8885:Student
 8986:Student
 9087:Teacher
 9188:Teacher
 9289:Teacher
 9390:Teacher
 9491:Teacher
 9592:Student
 9693:Teacher
 9794:Student
 9895:Teacher
 9996:Student
10097:Student
10198:Student
10299:Student

config.txt

 1Random Seed <>
 2Number of worlds <1>
 3Number of Days <30>
 4Agent Parameter Keys <Agent Index:Type>
 5Agent list filename <agents.txt>
 6Interaction Info Keys <>
 7Interaction Files list filename <>
 8Probabilistic Interaction Files list filename <>
 9Location Parameter Keys <Location Index>
10Location list filename <locations.txt>
11Event Parameter Keys <Location Index:Agents>
12Event Files list filename <event_files_list.txt>
13One Time Event filename <>

event_files_list.txt

1<one_event.txt>

locations.txt

 110
 2Location Index
 30
 41
 52
 63
 74
 85
 96
107
118
129

one_event.txt

 115
 2Location Index:Agents
 34:29,92,49,38,74,60,54,43,20,84,1,35,15,29,95,98,10
 42:51,89,60,39
 59:26,43,14,82,77,36,47,99,71
 60:68,66,3,3,74,12,5,63,13
 74:55,20,64,3,49,18
 82:44,84,73,99,57,7,18,67,53,7,91,57,33,83,96,77
 92:28,77,65,26,83,63,3,67,33,52,57,48,83,78,33
106:32,8,92,16,93,87,86,55,92,61,14,80,98
117:90,31,37,91,93,19,3,67,8,6,71,63,84,11,71,39,24,69,24
128:72,62,74,51,49,7,94,46,83,41,45,88,19,70,4
139:81,84,82,76,32,39,31,62,10,97,62
148:1,67,9
153:93,98,11,42,96,80,85,8,37,48,9,69,70,39,31,92,98,31
166:97,60,55,30,50,42,36,36,37,36,5,23,62,45
176:2,89,12,55,98,19,89,8,86,65

Event Lockdown

This example showcases the event based lockdown with Episimmer. Events are lockdown or restricted from occurring during the simulation. The events attributes are defined in the event files, and we use them in the policy to decide whether to run the event or not. In the generate_policy file, a simple event lockdown procedure is implemented by restricting events that are ‘Low Priority’.


Generate_policy.py

 1from episimmer.policy import lockdown_policy, testing_policy
 2
 3
 4def generate_policy():
 5	policy_list=[]
 6
 7	event_lockdown = lockdown_policy.EventLockdown('Type', ['Low Priority'], lambda x: True)
 8	policy_list.append(event_lockdown)
 9
10	return policy_list

UserModel.py

 1import episimmer.model as model
 2
 3
 4def event_contribute_fn(agent,event_info,location,current_time_step):
 5	if agent.state=='Infected':
 6		return 1
 7	return 0
 8
 9
10def event_receive_fn(agent,ambient_infection,event_info,location,current_time_step):
11	beta=0.1
12	return ambient_infection*beta
13
14
15class UserModel(model.StochasticModel):
16	def __init__(self):
17		individual_types=['Susceptible','Infected','Recovered']
18		infected_states=['Infected']
19		state_proportion={
20							'Susceptible':0.6,
21							'Infected':0.4,
22							'Recovered':0
23						}
24		model.StochasticModel.__init__(self,individual_types,infected_states,state_proportion)
25		self.set_transition('Susceptible', 'Infected', self.p_infection())
26		self.set_transition('Infected', 'Recovered', self.p_standard(0.2))
27
28
29		self.set_event_contribution_fn(event_contribute_fn)
30		self.set_event_receive_fn(event_receive_fn)
31
32		self.name='Stochastic SIR'

agents.txt

 110
 2Agent Index
 30
 41
 52
 63
 74
 85
 96
107
118
129

config.txt

 1Random Seed <3>
 2Number of worlds <1>
 3Number of Days <30>
 4Agent Parameter Keys <Agent Index>
 5Agent list filename <agents.txt>
 6Interaction Info Keys <>
 7Interaction Files list filename <>
 8Probabilistic Interaction Files list filename <>
 9Location Parameter Keys <Location Index>
10Location list filename <locations.txt>
11Event Parameter Keys <Location Index:Agents:Type>
12Event Files list filename <event_files_list.txt>
13One Time Event filename <>

event_files_list.txt

1<one_event.txt>
2<two_event.txt>
3<three_event.txt>
4<four_event.txt>

four_event.txt

11
2Location Index:Agents:Type
30:7,8,9:High Priority

locations.txt

11
2Location Index
30

one_event.txt

11
2Location Index:Agents:Type
30:0,1,2,3,4,5,6,7,8,9:Low Priority

three_event.txt

11
2Location Index:Agents:Type
30:0,1,2,3:High Priority

two_event.txt

11
2Location Index:Agents:Type
30:0,1,2,3,4:Low Priority

Pool Testing

This example showcases the flexibility of Testing available to the user with Episimmer. In the generate_policy file, there is both the Normal testing and Group testing variants. Since we want some mitigation of disease spread, we pair this policy with the lockdown policy by restricting agents that have tested Positive.

More on Testing Policy can be found in Tutorial 3


Generate_policy.py

 1import random
 2
 3from episimmer.policy import lockdown_policy, testing_policy
 4
 5
 6def generate_policy():
 7	policy_list=[]
 8
 9	# Normal Testing
10	# Normal_Test = testing_policy.TestPolicy(lambda x:120)
11	# Normal_Test.add_machine('Simple_Machine', 200, 0.0, 0.0, 0, 60, 5, 2)
12	# Normal_Test.set_register_agent_testtube_func(Normal_Test.random_testing(1,1))
13	# policy_list.append(Normal_Test)
14
15	# Group/Pool Testing
16	Pool_Testing = testing_policy.TestPolicy(lambda x:150)
17	Pool_Testing.add_machine('Simple_Machine', 200, 0.0, 0.0, 0, 50, 3, 3)
18	Pool_Testing.set_register_agent_testtube_func(Pool_Testing.random_testing(5,2))
19	policy_list.append(Pool_Testing)
20
21	ATP = lockdown_policy.TestingBasedLockdown(lambda x:random.random()<0.95,10)
22	policy_list.append(ATP)
23
24	return policy_list

UserModel.py

 1import episimmer.model as model
 2
 3
 4def event_contribute_fn(agent,event_info,location,current_time_step):
 5	if agent.state=='Infected':
 6		return 1
 7	return 0
 8
 9
10def event_receive_fn(agent,ambient_infection,event_info,location,current_time_step):
11	beta=0.001
12	return ambient_infection*beta
13
14
15class UserModel(model.StochasticModel):
16	def __init__(self):
17		individual_types=['Susceptible','Infected','Recovered']
18		infected_states=['Infected']
19		state_proportion={
20							'Susceptible':0.99,
21							'Infected':0.01,
22							'Recovered':0
23						}
24		model.StochasticModel.__init__(self,individual_types,infected_states,state_proportion)
25		self.set_transition('Susceptible', 'Infected', self.p_infection())
26		self.set_transition('Infected', 'Recovered', self.p_standard(0.2))
27
28
29		self.set_event_contribution_fn(event_contribute_fn)
30		self.set_event_receive_fn(event_receive_fn)
31
32		self.name='Stochastic SIR'

agents.txt

  11000
  2Agent Index
  30
  41
  52
  63
  74
  85
  96
 107
 118
 129
 1310
 1411
 1512
 1613
 1714
 1815
 1916
 2017
 2118
 2219
 2320
 2421
 2522
 2623
 2724
 2825
 2926
 3027
 3128
 3229
 3330
 3431
 3532
 3633
 3734
 3835
 3936
 4037
 4138
 4239
 4340
 4441
 4542
 4643
 4744
 4845
 4946
 5047
 5148
 5249
 5350
 5451
 5552
 5653
 5754
 5855
 5956
 6057
 6158
 6259
 6360
 6461
 6562
 6663
 6764
 6865
 6966
 7067
 7168
 7269
 7370
 7471
 7572
 7673
 7774
 7875
 7976
 8077
 8178
 8279
 8380
 8481
 8582
 8683
 8784
 8885
 8986
 9087
 9188
 9289
 9390
 9491
 9592
 9693
 9794
 9895
 9996
10097
10198
10299
103100
104101
105102
106103
107104
108105
109106
110107
111108
112109
113110
114111
115112
116113
117114
118115
119116
120117
121118
122119
123120
124121
125122
126123
127124
128125
129126
130127
131128
132129
133130
134131
135132
136133
137134
138135
139136
140137
141138
142139
143140
144141
145142
146143
147144
148145
149146
150147
151148
152149
153150
154151
155152
156153
157154
158155
159156
160157
161158
162159
163160
164161
165162
166163
167164
168165
169166
170167
171168
172169
173170
174171
175172
176173
177174
178175
179176
180177
181178
182179
183180
184181
185182
186183
187184
188185
189186
190187
191188
192189
193190
194191
195192
196193
197194
198195
199196
200197

config.txt

 1Random Seed <3>
 2Number of worlds <1>
 3Number of Days <30>
 4Agent Parameter Keys <Agent Index>
 5Agent list filename <agents.txt>
 6Interaction Info Keys <>
 7Interaction Files list filename <>
 8Probabilistic Interaction Files list filename <>
 9Location Parameter Keys <Location Index>
10Location list filename <locations.txt>
11Event Parameter Keys <Location Index:Agents>
12Event Files list filename <event_files_list.txt>
13One Time Event filename <>

event_files_list.txt

1<one_event.txt>

generate_files.py

 1import sys
 2
 3import numpy as np
 4
 5
 6def write_agents(filename,n):
 7	header='Agent Index'
 8
 9	f=open(filename,'w')
10	f.write(str(n)+'\n')
11	f.write(header+'\n')
12
13	for i in range(n):
14		f.write(str(i)+'\n')
15
16def write_events(filename,no_locations,no_agents):
17	info_dict={}
18	#ID enumerates from 0 to n-1
19	header='Location Index:Agents'
20
21	f=open(filename,'w')
22	f.write(str(1)+'\n')
23	f.write(header+'\n')
24
25	line=str(0)+':'
26	for i in range(no_agents):
27		line+=str(i)
28		if i!=no_agents-1:
29			line+=','
30
31	f.write(line)
32
33number_of_agents=int(sys.argv[1])
34write_agents('agents.txt',number_of_agents)
35write_events('one_event.txt',1,number_of_agents)

locations.txt

11
2Location Index
30

one_event.txt

11
2Location Index:Agents
30:0,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,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271,272,273,274,275,276,277,278,279,280,281,282,283,284,285,286,287,288,289,290,291,292,293,294,295,296,297,298,299,300,301,302,303,304,305,306,307,308,309,310,311,312,313,314,315,316,317,318,319,320,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,337,338,339,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,356,357,358,359,360,361,362,363,364,365,366,367,368,369,370,371,372,373,374,375,376,377,378,379,380,381,382,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,399,400,401,402,403,404,405,406,407,408,409,410,411,412,413,414,415,416,417,418,419,420,421,422,423,424,425,426,427,428,429,430,431,432,433,434,435,436,437,438,439,440,441,442,443,444,445,446,447,448,449,450,451,452,453,454,455,456,457,458,459,460,461,462,463,464,465,466,467,468,469,470,471,472,473,474,475,476,477,478,479,480,481,482,483,484,485,486,487,488,489,490,491,492,493,494,495,496,497,498,499,500,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600,601,602,603,604,605,606,607,608,609,610,611,612,613,614,615,616,617,618,619,620,621,622,623,624,625,626,627,628,629,630,631,632,633,634,635,636,637,638,639,640,641,642,643,644,645,646,647,648,649,650,651,652,653,654,655,656,657,658,659,660,661,662,663,664,665,666,667,668,669,670,671,672,673,674,675,676,677,678,679,680,681,682,683,684,685,686,687,688,689,690,691,692,693,694,695,696,697,698,699,700,701,702,703,704,705,706,707,708,709,710,711,712,713,714,715,716,717,718,719,720,721,722,723,724,725,726,727,728,729,730,731,732,733,734,735,736,737,738,739,740,741,742,743,744,745,746,747,748,749,750,751,752,753,754,755,756,757,758,759,760,761,762,763,764,765,766,767,768,769,770,771,772,773,774,775,776,777,778,779,780,781,782,783,784,785,786,787,788,789,790,791,792,793,794,795,796,797,798,799,800,801,802,803,804,805,806,807,808,809,810,811,812,813,814,815,816,817,818,819,820,821,822,823,824,825,826,827,828,829,830,831,832,833,834,835,836,837,838,839,840,841,842,843,844,845,846,847,848,849,850,851,852,853,854,855,856,857,858,859,860,861,862,863,864,865,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,919,920,921,922,923,924,925,926,927,928,929,930,931,932,933,934,935,936,937,938,939,940,941,942,943,944,945,946,947,948,949,950,951,952,953,954,955,956,957,958,959,960,961,962,963,964,965,966,967,968,969,970,971,972,973,974,975,976,977,978,979,980,981,982,983,984,985,986,987,988,989,990,991,992,993,994,995,996,997,998,999

Sample Campus

This example shows the user how a college environment can be simulated in Epsimmer. In this environment a college can strategise different lockdown policies to finally implement. Several policies can be imposed such as the number of days classes are to be conducted. In this example used here, you can see various policies that can be imposed such as monday_online only, monday_wednesday_online. This mostly involves combination of various policy based lockdowns within the campus.


Generate_policy.py

  1from episimmer.policy import lockdown_policy
  2
  3
  4def monday_online():
  5	#This function ensures classes are online on Monday
  6	policy_list=[]
  7
  8	def lockdown_fn(time_step):
  9		if time_step%7 in [0]:
 10			return True
 11		return False
 12
 13	policy_list.append(lockdown_policy.FullLockdown(lockdown_fn))
 14
 15	return policy_list
 16
 17def tuesday_thursday_online():
 18	#This function ensures classes are online on Tuesday and Thursday
 19	policy_list=[]
 20
 21	def lockdown_fn(time_step):
 22		if time_step%7 in [1,3]:
 23			return True
 24		return False
 25
 26	policy_list.append(lockdown_policy.FullLockdown(lockdown_fn))
 27
 28	return policy_list
 29
 30def monday_tuesday_online():
 31	#This function ensures classes are online on Monday and Tuesday
 32	policy_list=[]
 33
 34	def lockdown_fn(time_step):
 35		if time_step%7 in [1,3]:
 36			return True
 37		return False
 38
 39	policy_list.append(lockdown_policy.FullLockdown(lockdown_fn))
 40
 41	return policy_list
 42
 43def monday_no_grade1():
 44	#This function ensures that there are no grade 1 students on Monday
 45	policy_list=[]
 46
 47	def lockdown_fn(time_step):
 48		if time_step%7 in [0]:
 49			return True
 50		return False
 51
 52	policy_list.append(lockdown_policy.AgentLockdown('Grade',['Grade 1'],lockdown_fn))
 53
 54	return policy_list
 55
 56def wednesday_no_grade1_grade2():
 57	#This function ensures that there are no grade 2 students on Wednesday
 58	policy_list=[]
 59
 60	def lockdown_fn(time_step):
 61		if time_step%7 in [2]:
 62			return True
 63		return False
 64
 65	policy_list.append(lockdown_policy.AgentLockdown('Grade',['Grade 1','Grade 2'],lockdown_fn))
 66
 67	return policy_list
 68
 69def mw_no_grade1_tf_no_grade3():
 70	#This function ensures that there are no grade 1 students on Monday,Wednesday and grade 3 students on tuesday,friday
 71	policy_list=[]
 72
 73	def lockdown_mw(time_step):
 74		if time_step%7 in [0,2]:
 75			return True
 76		return False
 77
 78	def lockdown_tf(time_step):
 79		if time_step%7 in [1,4]:
 80			return True
 81		return False
 82
 83	policy_list.append(lockdown_policy.AgentLockdown('Grade',['Grade 1'],lockdown_mw))
 84	policy_list.append(lockdown_policy.AgentLockdown('Grade',['Grade 3'],lockdown_tf))
 85
 86	return policy_list
 87
 88def mt_no_grade2_wednesday_online():
 89	#This function ensures that there are no grade 1 students on Monday,tuesday and wednesday is online
 90	policy_list=[]
 91
 92	def lockdown_mt(time_step):
 93		if time_step%7 in [0,1]:
 94			return True
 95		return False
 96
 97	def lockdown_wednesday(time_step):
 98		if time_step%7 in [2]:
 99			return True
100		return False
101
102	policy_list.append(lockdown_policy.AgentLockdown('Grade',['Grade 1'],lockdown_mt))
103	policy_list.append(lockdown_policy.FullLockdown(lockdown_wednesday))
104
105	return policy_list
106
107
108def generate_policy():
109	#return monday_online()
110	return tuesday_thursday_online()
111	#return monday_tuesday_online()
112	#return monday_no_grade1()
113	#return wednesday_no_grade1_grade2()
114	#return mw_no_grade1_tf_no_grade3()
115	return mt_no_grade2_wednesday_online()

UserModel.py

 1import math
 2
 3import episimmer.model as model
 4
 5#User defined functions
 6
 7def event_contribute_fn(agent,event_info,location,current_time_step):
 8	#Example 1
 9	if agent.state=='Symptomatic':
10		return 0.7
11	elif agent.state=='Asymptomatic':
12		return 0.3
13	else:
14		return 0
15
16def event_receive_fn(agent,ambient_infection,event_info,location,current_time_step):
17	p=math.tanh(ambient_infection*0.3)
18	return p
19
20
21
22
23class UserModel(model.StochasticModel):
24	def __init__(self):
25		individual_types=['Susceptible','Exposed','Asymptomatic','Symptomatic','Recovered']
26		infected_states=['Asymptomatic','Symptomatic']
27		state_proportion={
28							'Susceptible':0.99,
29							'Exposed':0.01,
30							'Recovered':0,
31							'Asymptomatic':0,
32							'Symptomatic':0
33						}
34		model.StochasticModel.__init__(self,individual_types,infected_states,state_proportion)
35		self.set_transition('Susceptible', 'Exposed', self.p_infection())
36		self.set_transition('Exposed', 'Symptomatic', self.p_standard(0.15))
37		self.set_transition('Exposed', 'Asymptomatic', self.p_standard(0.2))
38		self.set_transition('Symptomatic', 'Recovered', self.p_standard(0.2))
39		self.set_transition('Asymptomatic', 'Recovered', self.p_standard(0.2))
40
41		self.set_event_contribution_fn(event_contribute_fn)
42		self.set_event_receive_fn(event_receive_fn)

agents.txt

  1315
  2Agent Index:Type:Grade
  30:Student:Grade 1
  41:Student:Grade 1
  52:Student:Grade 1
  63:Student:Grade 1
  74:Student:Grade 1
  85:Student:Grade 1
  96:Student:Grade 1
 107:Student:Grade 1
 118:Student:Grade 1
 129:Student:Grade 1
 1310:Student:Grade 1
 1411:Student:Grade 1
 1512:Student:Grade 1
 1613:Student:Grade 1
 1714:Student:Grade 1
 1815:Student:Grade 1
 1916:Student:Grade 1
 2017:Student:Grade 1
 2118:Student:Grade 1
 2219:Student:Grade 1
 2320:Student:Grade 1
 2421:Student:Grade 1
 2522:Student:Grade 1
 2623:Student:Grade 1
 2724:Student:Grade 1
 2825:Student:Grade 1
 2926:Student:Grade 1
 3027:Student:Grade 1
 3128:Student:Grade 1
 3229:Student:Grade 1
 3330:Student:Grade 1
 3431:Student:Grade 1
 3532:Student:Grade 1
 3633:Student:Grade 1
 3734:Student:Grade 1
 3835:Student:Grade 1
 3936:Student:Grade 1
 4037:Student:Grade 1
 4138:Student:Grade 1
 4239:Student:Grade 1
 4340:Student:Grade 1
 4441:Student:Grade 1
 4542:Student:Grade 1
 4643:Student:Grade 1
 4744:Student:Grade 1
 4845:Student:Grade 1
 4946:Student:Grade 1
 5047:Student:Grade 1
 5148:Student:Grade 1
 5249:Student:Grade 1
 5350:Student:Grade 1
 5451:Student:Grade 1
 5552:Student:Grade 1
 5653:Student:Grade 1
 5754:Student:Grade 1
 5855:Student:Grade 1
 5956:Student:Grade 1
 6057:Student:Grade 1
 6158:Student:Grade 1
 6259:Student:Grade 1
 6360:Student:Grade 1
 6461:Student:Grade 1
 6562:Student:Grade 1
 6663:Student:Grade 1
 6764:Student:Grade 1
 6865:Student:Grade 1
 6966:Student:Grade 1
 7067:Student:Grade 1
 7168:Student:Grade 1
 7269:Student:Grade 1
 7370:Student:Grade 1
 7471:Student:Grade 1
 7572:Student:Grade 1
 7673:Student:Grade 1
 7774:Student:Grade 1
 7875:Student:Grade 1
 7976:Student:Grade 1
 8077:Student:Grade 1
 8178:Student:Grade 1
 8279:Student:Grade 1
 8380:Student:Grade 1
 8481:Student:Grade 1
 8582:Student:Grade 1
 8683:Student:Grade 1
 8784:Student:Grade 1
 8885:Student:Grade 1
 8986:Student:Grade 1
 9087:Student:Grade 1
 9188:Student:Grade 1
 9289:Student:Grade 1
 9390:Student:Grade 1
 9491:Student:Grade 1
 9592:Student:Grade 1
 9693:Student:Grade 1
 9794:Student:Grade 1
 9895:Student:Grade 1
 9996:Student:Grade 1
10097:Student:Grade 1
10198:Student:Grade 1
10299:Student:Grade 1
103100:Student:Grade 2
104101:Student:Grade 2
105102:Student:Grade 2
106103:Student:Grade 2
107104:Student:Grade 2
108105:Student:Grade 2
109106:Student:Grade 2
110107:Student:Grade 2
111108:Student:Grade 2
112109:Student:Grade 2
113110:Student:Grade 2
114111:Student:Grade 2
115112:Student:Grade 2
116113:Student:Grade 2
117114:Student:Grade 2
118115:Student:Grade 2
119116:Student:Grade 2
120117:Student:Grade 2
121118:Student:Grade 2
122119:Student:Grade 2
123120:Student:Grade 2
124121:Student:Grade 2
125122:Student:Grade 2
126123:Student:Grade 2
127124:Student:Grade 2
128125:Student:Grade 2
129126:Student:Grade 2
130127:Student:Grade 2
131128:Student:Grade 2
132129:Student:Grade 2
133130:Student:Grade 2
134131:Student:Grade 2
135132:Student:Grade 2
136133:Student:Grade 2
137134:Student:Grade 2
138135:Student:Grade 2
139136:Student:Grade 2
140137:Student:Grade 2
141138:Student:Grade 2
142139:Student:Grade 2
143140:Student:Grade 2
144141:Student:Grade 2
145142:Student:Grade 2
146143:Student:Grade 2
147144:Student:Grade 2
148145:Student:Grade 2
149146:Student:Grade 2
150147:Student:Grade 2
151148:Student:Grade 2
152149:Student:Grade 2
153150:Student:Grade 2
154151:Student:Grade 2
155152:Student:Grade 2
156153:Student:Grade 2
157154:Student:Grade 2
158155:Student:Grade 2
159156:Student:Grade 2
160157:Student:Grade 2
161158:Student:Grade 2
162159:Student:Grade 2
163160:Student:Grade 2
164161:Student:Grade 2
165162:Student:Grade 2
166163:Student:Grade 2
167164:Student:Grade 2
168165:Student:Grade 2
169166:Student:Grade 2
170167:Student:Grade 2
171168:Student:Grade 2
172169:Student:Grade 2
173170:Student:Grade 2
174171:Student:Grade 2
175172:Student:Grade 2
176173:Student:Grade 2
177174:Student:Grade 2
178175:Student:Grade 2
179176:Student:Grade 2
180177:Student:Grade 2
181178:Student:Grade 2
182179:Student:Grade 2
183180:Student:Grade 2
184181:Student:Grade 2
185182:Student:Grade 2
186183:Student:Grade 2
187184:Student:Grade 2
188185:Student:Grade 2
189186:Student:Grade 2
190187:Student:Grade 2
191188:Student:Grade 2
192189:Student:Grade 2
193190:Student:Grade 2
194191:Student:Grade 2
195192:Student:Grade 2
196193:Student:Grade 2
197194:Student:Grade 2
198195:Student:Grade 2
199196:Student:Grade 2
200197:Student:Grade 2

config.txt

 1Random Seed <3>
 2Number of worlds <1>
 3Number of Days <30>
 4Agent Parameter Keys <Agent Index:Type:Grade>
 5Agent list filename <agents.txt>
 6Interaction Info Keys <>
 7Interaction Files list filename <>
 8Probabilistic Interaction Files list filename <>
 9Location Parameter Keys <Location Index>
10Location list filename <locations.txt>
11Event Parameter Keys <Location Index:Agents>
12Event Files list filename <event_files_list.txt>
13One Time Event filename <>

event_files_list.txt

1<monday.txt>
2<tuesday.txt>
3<wednesday.txt>
4<thursday.txt>
5<friday.txt>
6<saturday.txt>
7<sunday.txt>

friday.txt

13
2Location Index:Agents
30:1,2,4,7,8,9,15,16,17,18,20,21,22,23,24,26,30,33,37,43,49,55,57,59,62,63,65,66,70,74,78,79,81,82,84,85,86,91,92,304
41:103,110,115,116,118,119,121,124,126,127,128,130,132,134,135,137,138,139,140,143,145,147,150,152,160,162,163,166,168,170,171,172,173,174,175,177,181,184,187,190,191,198,309
52:207,210,215,217,218,219,220,221,222,224,225,231,232,240,242,245,250,252,253,255,260,262,263,264,265,266,268,269,271,272,273,275,276,279,280,284,286,293,297,298,314

generate_files.py

 1import random
 2from itertools import combinations
 3
 4import numpy as np
 5
 6
 7def write_to_file():
 8	info_dict={}
 9	#ID enumerates from 0 to n-1
10	header='Agent Index:Type:Grade'
11
12	f=open('locations.txt','w')
13	f.write(str(3)+'\n')
14	f.write('Location Index'+'\n')
15	for i in range(3):
16		f.write(str(i)+'\n')
17
18	f=open('agents.txt','w')
19	f.write(str(315)+'\n')
20	f.write(header+'\n')
21
22	classes=[]
23	for i in range(15):
24		classes.append([])
25
26	for i in range(300):
27		f.write(str(i))
28		grade=int(i/100 )+ 1
29		f.write(':Student:Grade '+str(grade))
30		class_list=random.choice(list(combinations([5*(grade-1),5*(grade-1)+1,5*(grade-1)+2,5*(grade-1)+3,5*(grade-1)+4],random.choice([1,2,3]))))
31		for j in class_list:
32			classes[j].append(i)
33		f.write('\n')
34
35	for i in range(15):
36		f.write(str(i + 300))
37		grade=int(i/5 )+ 1
38		f.write(':Teacher:Grade '+str(grade))
39		classes[i].append(300+i)
40		f.write('\n')
41
42	event_header='Location Index:Agents'
43	for filename in ['saturday.txt','sunday.txt']:
44		f=open(filename,'w')
45		f.write(str(0)+'\n')
46		f.write(event_header+'\n')
47	for index,filename in enumerate(['monday.txt','tuesday.txt','wednesday.txt','thursday.txt','friday.txt']):
48		f=open(filename,'w')
49		f.write(str(3)+'\n')
50		f.write(event_header+'\n')
51		for j in range(3):
52			line=str(j)+':'
53			for agent_index in classes[index+5*j]:
54				line+=str(agent_index)+','
55			f.write(line[:-1]+'\n')
56
57
58write_to_file()

locations.txt

13
2Location Index
30
41
52

monday.txt

13
2Location Index:Agents
30:2,4,10,11,12,14,15,19,20,23,25,27,33,34,35,36,42,44,46,48,49,55,60,62,64,69,72,77,81,83,84,87,98,300
41:103,104,106,112,113,116,117,119,120,123,124,125,126,130,131,132,133,134,136,137,142,143,144,145,146,147,149,150,151,153,154,159,160,165,166,167,170,181,183,186,187,189,199,305
52:203,204,207,210,212,213,219,220,221,222,223,225,226,228,232,233,235,237,239,247,252,253,254,258,270,274,278,280,281,283,285,286,288,290,294,299,310

saturday.txt

10
2Location Index:Agents

sunday.txt

10
2Location Index:Agents

thursday.txt

13
2Location Index:Agents
30:0,5,8,13,17,19,31,33,34,36,39,42,45,47,48,53,54,55,56,58,61,68,69,71,74,76,78,79,80,81,83,86,88,89,90,93,94,95,96,97,303
41:100,101,103,107,108,109,113,119,120,121,123,128,132,135,137,141,143,145,150,164,165,167,170,171,173,175,179,180,182,184,185,186,187,188,189,191,192,193,194,195,196,197,308
52:205,206,209,211,215,217,220,223,228,236,237,243,244,245,246,248,251,254,255,257,259,260,265,266,273,276,282,284,285,287,291,293,294,296,313

tuesday.txt

13
2Location Index:Agents
30:0,2,3,4,5,6,7,8,10,13,15,16,21,27,28,29,30,31,32,35,37,38,40,47,52,60,65,70,71,72,76,77,79,85,87,93,94,95,98,301
41:100,101,102,105,107,108,109,113,114,116,117,118,120,122,124,126,138,142,148,154,156,157,158,161,162,166,168,169,174,175,180,181,182,184,190,192,193,196,306
52:201,203,206,208,209,212,213,214,216,223,226,227,228,229,230,232,235,236,237,241,242,243,250,256,258,261,262,265,272,277,278,282,284,289,290,291,293,311

wednesday.txt

13
2Location Index:Agents
30:0,7,9,10,12,14,17,19,20,24,25,27,30,31,35,36,39,41,42,43,44,45,47,48,49,50,51,54,56,62,63,66,67,70,71,73,75,78,83,84,85,86,89,91,92,95,98,99,302
41:101,105,107,110,111,112,117,122,123,128,129,130,131,134,140,146,147,148,152,154,155,157,158,161,162,163,165,168,171,174,176,178,179,180,185,188,190,191,192,194,195,199,307
52:200,201,202,205,207,208,211,212,215,216,217,226,227,229,230,234,236,238,241,242,243,244,246,247,249,250,251,253,254,255,257,258,262,263,266,267,268,269,271,274,275,277,280,282,283,285,286,287,292,295,296,299,312

Symptomatic Testing

This example shows the use of the Symptomatic Testing. It gives the agents of the simulation a chance to test themselves as they develop visible conditions of having the disease. Be sure to set the symptomatic states in the UserModel.py file for this to work. It will be ignored if the correct states are not passed.

This example shows this use case with the SEYAR model representing the Susceptible, Exposed, Symptomatic, Asymptomatic and Recovered states. Our symptomatic state is “Symptomatic” state in the disease model. In the testing policy, while registering the agent to a testtube, you can set the only_symptomatic parameter to true. This will choose only the agents that are part of the symptomatic states for testing.

Be careful while using this method because you should not pass the disease states that do not represent agents with visible symptoms. For example, asymptomatic agents do not show any symptoms of the disease and must not be passed in this list.


Generate_policy.py

 1import random
 2
 3from episimmer.policy import lockdown_policy, testing_policy
 4
 5
 6def generate_policy():
 7	policy_list=[]
 8
 9	# Testing only symptomatic agents.
10	Normal_Testing = testing_policy.TestPolicy(lambda x:5)
11	Normal_Testing.add_machine('Simple_Machine', 200, 0.0, 0.0, 0, 50, 3, 1)
12	Normal_Testing.set_register_agent_testtube_func(Normal_Testing.random_testing(only_symptomatic=True))
13	policy_list.append(Normal_Testing)
14
15	ATP = lockdown_policy.TestingBasedLockdown(lambda x:random.random()<0.95,10)
16	policy_list.append(ATP)
17
18	return policy_list

UserModel.py

 1import episimmer.model as model
 2
 3
 4def event_contribute_fn(agent,event_info,location,current_time_step):
 5	if agent.state=='Symptomatic':
 6		return 1
 7	elif agent.state=='Asymptomatic':
 8		return 0.5
 9	return 0
10
11def event_receive_fn(agent,ambient_infection,event_info,location,current_time_step):
12	#Example 1
13	beta=0.001
14	return ambient_infection*beta
15
16
17class UserModel(model.StochasticModel):
18	def __init__(self):
19		individual_types=['Susceptible','Exposed','Asymptomatic','Symptomatic','Recovered']
20		infected_states=['Asymptomatic','Symptomatic']
21		state_proportion={
22							'Susceptible':0.99,
23							'Exposed':0,
24							'Recovered':0,
25							'Asymptomatic':0,
26							'Symptomatic':0.01
27						}
28		model.StochasticModel.__init__(self,individual_types,infected_states,state_proportion)
29		self.set_transition('Susceptible', 'Exposed', self.p_infection())
30		self.set_transition('Exposed', 'Symptomatic', self.p_standard(0.15))
31		self.set_transition('Exposed', 'Asymptomatic', self.p_standard(0.2))
32		self.set_transition('Symptomatic', 'Recovered', self.p_standard(0.1))
33		self.set_transition('Asymptomatic', 'Recovered', self.p_standard(0.1))
34
35		self.set_event_contribution_fn(event_contribute_fn)
36		self.set_event_receive_fn(event_receive_fn)
37		self.set_symptomatic_states(['Symptomatic'])

agents.txt

  11000
  2Agent Index
  30
  41
  52
  63
  74
  85
  96
 107
 118
 129
 1310
 1411
 1512
 1613
 1714
 1815
 1916
 2017
 2118
 2219
 2320
 2421
 2522
 2623
 2724
 2825
 2926
 3027
 3128
 3229
 3330
 3431
 3532
 3633
 3734
 3835
 3936
 4037
 4138
 4239
 4340
 4441
 4542
 4643
 4744
 4845
 4946
 5047
 5148
 5249
 5350
 5451
 5552
 5653
 5754
 5855
 5956
 6057
 6158
 6259
 6360
 6461
 6562
 6663
 6764
 6865
 6966
 7067
 7168
 7269
 7370
 7471
 7572
 7673
 7774
 7875
 7976
 8077
 8178
 8279
 8380
 8481
 8582
 8683
 8784
 8885
 8986
 9087
 9188
 9289
 9390
 9491
 9592
 9693
 9794
 9895
 9996
10097
10198
10299
103100
104101
105102
106103
107104
108105
109106
110107
111108
112109
113110
114111
115112
116113
117114
118115
119116
120117
121118
122119
123120
124121
125122
126123
127124
128125
129126
130127
131128
132129
133130
134131
135132
136133
137134
138135
139136
140137
141138
142139
143140
144141
145142
146143
147144
148145
149146
150147
151148
152149
153150
154151
155152
156153
157154
158155
159156
160157
161158
162159
163160
164161
165162
166163
167164
168165
169166
170167
171168
172169
173170
174171
175172
176173
177174
178175
179176
180177
181178
182179
183180
184181
185182
186183
187184
188185
189186
190187
191188
192189
193190
194191
195192
196193
197194
198195
199196
200197

config.txt

 1Random Seed <3>
 2Number of worlds <3>
 3Number of Days <30>
 4Agent Parameter Keys <Agent Index>
 5Agent list filename <agents.txt>
 6Interaction Info Keys <>
 7Interaction Files list filename <>
 8Probabilistic Interaction Files list filename <>
 9Location Parameter Keys <Location Index>
10Location list filename <locations.txt>
11Event Parameter Keys <Location Index:Agents>
12Event Files list filename <event_files_list.txt>
13One Time Event filename <>

event_files_list.txt

1<one_event.txt>

generate_files.py

 1import sys
 2
 3import numpy as np
 4
 5
 6def write_agents(filename,n):
 7	header='Agent Index'
 8
 9	f=open(filename,'w')
10	f.write(str(n)+'\n')
11	f.write(header+'\n')
12
13	for i in range(n):
14		f.write(str(i)+'\n')
15
16def write_events(filename,no_locations,no_agents):
17	info_dict={}
18	#ID enumerates from 0 to n-1
19	header='Location Index:Agents'
20
21	f=open(filename,'w')
22	f.write(str(1)+'\n')
23	f.write(header+'\n')
24
25	line=str(0)+':'
26	for i in range(no_agents):
27		line+=str(i)
28		if i!=no_agents-1:
29			line+=','
30
31	f.write(line)
32
33number_of_agents=int(sys.argv[1])
34write_agents('agents.txt',number_of_agents)
35write_events('one_event.txt',1,number_of_agents)

locations.txt

11
2Location Index
30

one_event.txt

11
2Location Index:Agents
30:0,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,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271,272,273,274,275,276,277,278,279,280,281,282,283,284,285,286,287,288,289,290,291,292,293,294,295,296,297,298,299,300,301,302,303,304,305,306,307,308,309,310,311,312,313,314,315,316,317,318,319,320,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,337,338,339,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,356,357,358,359,360,361,362,363,364,365,366,367,368,369,370,371,372,373,374,375,376,377,378,379,380,381,382,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,399,400,401,402,403,404,405,406,407,408,409,410,411,412,413,414,415,416,417,418,419,420,421,422,423,424,425,426,427,428,429,430,431,432,433,434,435,436,437,438,439,440,441,442,443,444,445,446,447,448,449,450,451,452,453,454,455,456,457,458,459,460,461,462,463,464,465,466,467,468,469,470,471,472,473,474,475,476,477,478,479,480,481,482,483,484,485,486,487,488,489,490,491,492,493,494,495,496,497,498,499,500,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600,601,602,603,604,605,606,607,608,609,610,611,612,613,614,615,616,617,618,619,620,621,622,623,624,625,626,627,628,629,630,631,632,633,634,635,636,637,638,639,640,641,642,643,644,645,646,647,648,649,650,651,652,653,654,655,656,657,658,659,660,661,662,663,664,665,666,667,668,669,670,671,672,673,674,675,676,677,678,679,680,681,682,683,684,685,686,687,688,689,690,691,692,693,694,695,696,697,698,699,700,701,702,703,704,705,706,707,708,709,710,711,712,713,714,715,716,717,718,719,720,721,722,723,724,725,726,727,728,729,730,731,732,733,734,735,736,737,738,739,740,741,742,743,744,745,746,747,748,749,750,751,752,753,754,755,756,757,758,759,760,761,762,763,764,765,766,767,768,769,770,771,772,773,774,775,776,777,778,779,780,781,782,783,784,785,786,787,788,789,790,791,792,793,794,795,796,797,798,799,800,801,802,803,804,805,806,807,808,809,810,811,812,813,814,815,816,817,818,819,820,821,822,823,824,825,826,827,828,829,830,831,832,833,834,835,836,837,838,839,840,841,842,843,844,845,846,847,848,849,850,851,852,853,854,855,856,857,858,859,860,861,862,863,864,865,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,919,920,921,922,923,924,925,926,927,928,929,930,931,932,933,934,935,936,937,938,939,940,941,942,943,944,945,946,947,948,949,950,951,952,953,954,955,956,957,958,959,960,961,962,963,964,965,966,967,968,969,970,971,972,973,974,975,976,977,978,979,980,981,982,983,984,985,986,987,988,989,990,991,992,993,994,995,996,997,998,999

Vaccination

This example showcases the flexibility of Vaccination available to the user with Episimmer. In the generate_policy file, we see we can implement vaccination by single dose or multi dose vaccination.

More on Vaccination Policy can be found in Tutorial 3


Generate_policy.py

 1from episimmer.policy import vaccination_policy
 2
 3
 4def agents_per_step_fn(time_step):
 5
 6	n=100
 7
 8	return n
 9
10def generate_policy():
11	policy_list=[]
12
13	# Single Dose Vaccination
14	vp1= vaccination_policy.VaccinationPolicy(agents_per_step_fn)
15	vaccines1 = {
16		'cov_single_dose': {'cost': 40, 'count': 20, 'efficacy': 0.9, 'decay': 40},
17		'cov_single_dose2': {'cost': 50, 'count': 15, 'efficacy': 0.5, 'decay': 30},
18	}
19	vp1.add_vaccines(vaccines1, 'Single')
20	vp1.set_register_agent_vaccine_func(vp1.random_vaccination())
21
22	# Multi Dose Vaccination
23	vp2= vaccination_policy.VaccinationPolicy(agents_per_step_fn)
24	vaccines2 = {
25		'cov_multi_dose': {'cost': 40, 'count': 25, 'efficacy': 0.4, 'decay': [15, 14, 8], 'dose': 3, 'interval': [3, 2]},
26		'cov_multi_dose2': {'cost': 30, 'count': 40, 'efficacy': 0.7, 'decay': [20, 25, 17, 5], 'dose': 4, 'interval': [12, 26, 14]},
27		'cov_multi_dose3': {'cost': 30, 'count': 15, 'efficacy': 0.7, 'decay': [8], 'dose': 1, 'interval': []}
28	}
29	vp2.add_vaccines(vaccines2, 'Multi')
30	vp2.set_register_agent_vaccine_func(vp2.multi_dose_vaccination())
31
32
33	policy_list.append(vp1)
34	policy_list.append(vp2)
35
36	return policy_list

UserModel.py

 1import episimmer.model as model
 2
 3
 4def event_contribute_fn(agent,event_info,location,current_time_step):
 5	if agent.state=='Infected':
 6		return 1
 7	return 0
 8
 9
10def event_receive_fn(agent,ambient_infection,event_info,location,current_time_step):
11	beta=0.001
12	return ambient_infection*beta
13
14
15class UserModel(model.StochasticModel):
16	def __init__(self):
17		individual_types=['Susceptible','Infected','Recovered']
18		infected_states=['Infected']
19		state_proportion={
20							'Susceptible':0.99,
21							'Infected':0.01,
22							'Recovered':0
23						}
24		model.StochasticModel.__init__(self,individual_types,infected_states,state_proportion)
25		self.set_transition('Susceptible', 'Infected', self.p_infection())
26		self.set_transition('Infected', 'Recovered', self.p_standard(0.2))
27
28
29		self.set_event_contribution_fn(event_contribute_fn)
30		self.set_event_receive_fn(event_receive_fn)
31
32		self.name='Stochastic SIR'

agents.csv

  1Agent Index
  20
  31
  42
  53
  64
  75
  86
  97
 108
 119
 1210
 1311
 1412
 1513
 1614
 1715
 1816
 1917
 2018
 2119
 2220
 2321
 2422
 2523
 2624
 2725
 2826
 2927
 3028
 3129
 3230
 3331
 3432
 3533
 3634
 3735
 3836
 3937
 4038
 4139
 4240
 4341
 4442
 4543
 4644
 4745
 4846
 4947
 5048
 5149
 5250
 5351
 5452
 5553
 5654
 5755
 5856
 5957
 6058
 6159
 6260
 6361
 6462
 6563
 6664
 6765
 6866
 6967
 7068
 7169
 7270
 7371
 7472
 7573
 7674
 7775
 7876
 7977
 8078
 8179
 8280
 8381
 8482
 8583
 8684
 8785
 8886
 8987
 9088
 9189
 9290
 9391
 9492
 9593
 9694
 9795
 9896
 9997
10098
10199
102100
103101
104102
105103
106104
107105
108106
109107
110108
111109
112110
113111
114112
115113
116114
117115
118116
119117
120118
121119
122120
123121
124122
125123
126124
127125
128126
129127
130128
131129
132130
133131
134132
135133
136134
137135
138136
139137
140138
141139
142140
143141
144142
145143
146144
147145
148146
149147
150148
151149
152150
153151
154152
155153
156154
157155
158156
159157
160158
161159
162160
163161
164162
165163
166164
167165
168166
169167
170168
171169
172170
173171
174172
175173
176174
177175
178176
179177
180178
181179
182180
183181
184182
185183
186184
187185
188186
189187
190188
191189
192190
193191
194192
195193
196194
197195
198196
199197
200198

agents.txt

  11000
  2Agent Index
  30
  41
  52
  63
  74
  85
  96
 107
 118
 129
 1310
 1411
 1512
 1613
 1714
 1815
 1916
 2017
 2118
 2219
 2320
 2421
 2522
 2623
 2724
 2825
 2926
 3027
 3128
 3229
 3330
 3431
 3532
 3633
 3734
 3835
 3936
 4037
 4138
 4239
 4340
 4441
 4542
 4643
 4744
 4845
 4946
 5047
 5148
 5249
 5350
 5451
 5552
 5653
 5754
 5855
 5956
 6057
 6158
 6259
 6360
 6461
 6562
 6663
 6764
 6865
 6966
 7067
 7168
 7269
 7370
 7471
 7572
 7673
 7774
 7875
 7976
 8077
 8178
 8279
 8380
 8481
 8582
 8683
 8784
 8885
 8986
 9087
 9188
 9289
 9390
 9491
 9592
 9693
 9794
 9895
 9996
10097
10198
10299
103100
104101
105102
106103
107104
108105
109106
110107
111108
112109
113110
114111
115112
116113
117114
118115
119116
120117
121118
122119
123120
124121
125122
126123
127124
128125
129126
130127
131128
132129
133130
134131
135132
136133
137134
138135
139136
140137
141138
142139
143140
144141
145142
146143
147144
148145
149146
150147
151148
152149
153150
154151
155152
156153
157154
158155
159156
160157
161158
162159
163160
164161
165162
166163
167164
168165
169166
170167
171168
172169
173170
174171
175172
176173
177174
178175
179176
180177
181178
182179
183180
184181
185182
186183
187184
188185
189186
190187
191188
192189
193190
194191
195192
196193
197194
198195
199196
200197

config.txt

 1Random Seed <3>
 2Number of worlds <1>
 3Number of Days <30>
 4Agent Parameter Keys <Agent Index>
 5Agent list filename <agents.csv>
 6Interaction Info Keys <>
 7Interaction Files list filename <>
 8Probabilistic Interaction Files list filename <>
 9Location Parameter Keys <Location Index>
10Location list filename <locations.txt>
11Event Parameter Keys <Location Index:Agents>
12Event Files list filename <event_files_list.txt>
13One Time Event filename <>

event_files_list.txt

1<one_event.txt>

generate_files.py

 1import sys
 2
 3import numpy as np
 4
 5
 6def write_agents(filename,n):
 7	header='Agent Index'
 8
 9	f=open(filename,'w')
10	f.write(str(n)+'\n')
11	f.write(header+'\n')
12
13	for i in range(n):
14		f.write(str(i)+'\n')
15
16def write_events(filename,no_locations,no_agents):
17	info_dict={}
18	#ID enumerates from 0 to n-1
19	header='Location Index:Agents'
20
21	f=open(filename,'w')
22	f.write(str(1)+'\n')
23	f.write(header+'\n')
24
25	line=str(0)+':'
26	for i in range(no_agents):
27		line+=str(i)
28		if i!=no_agents-1:
29			line+=','
30
31	f.write(line)
32
33number_of_agents=int(sys.argv[1])
34write_agents('agents.txt',number_of_agents)
35write_events('one_event.txt',1,number_of_agents)

generate_files_csv.py

1from csv import DictWriter
2
3with open('agents.csv', 'w', newline='') as file:
4    fieldnames = ['Agent Index']
5    writer = DictWriter(file, fieldnames=fieldnames)
6
7    writer.writeheader()
8    for i in range(1000):
9    	writer.writerow({'Agent Index': i})

generate_interactions.py

 1from csv import DictWriter
 2
 3with open('interactions.csv', 'w', newline='') as file:
 4    fieldnames = ['Agent Index','Interacting Agent']
 5    writer = DictWriter(file, fieldnames=fieldnames)
 6
 7    writer.writeheader()
 8    for i in range(1000):
 9    	if i!=10:
10    		writer.writerow({'Agent Index': i,'Interacting Agent':i+1})

locations.txt

11
2Location Index
30

one_event.txt

11
2Location Index:Agents
30:0,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,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271,272,273,274,275,276,277,278,279,280,281,282,283,284,285,286,287,288,289,290,291,292,293,294,295,296,297,298,299,300,301,302,303,304,305,306,307,308,309,310,311,312,313,314,315,316,317,318,319,320,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,337,338,339,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,356,357,358,359,360,361,362,363,364,365,366,367,368,369,370,371,372,373,374,375,376,377,378,379,380,381,382,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,399,400,401,402,403,404,405,406,407,408,409,410,411,412,413,414,415,416,417,418,419,420,421,422,423,424,425,426,427,428,429,430,431,432,433,434,435,436,437,438,439,440,441,442,443,444,445,446,447,448,449,450,451,452,453,454,455,456,457,458,459,460,461,462,463,464,465,466,467,468,469,470,471,472,473,474,475,476,477,478,479,480,481,482,483,484,485,486,487,488,489,490,491,492,493,494,495,496,497,498,499,500,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600,601,602,603,604,605,606,607,608,609,610,611,612,613,614,615,616,617,618,619,620,621,622,623,624,625,626,627,628,629,630,631,632,633,634,635,636,637,638,639,640,641,642,643,644,645,646,647,648,649,650,651,652,653,654,655,656,657,658,659,660,661,662,663,664,665,666,667,668,669,670,671,672,673,674,675,676,677,678,679,680,681,682,683,684,685,686,687,688,689,690,691,692,693,694,695,696,697,698,699,700,701,702,703,704,705,706,707,708,709,710,711,712,713,714,715,716,717,718,719,720,721,722,723,724,725,726,727,728,729,730,731,732,733,734,735,736,737,738,739,740,741,742,743,744,745,746,747,748,749,750,751,752,753,754,755,756,757,758,759,760,761,762,763,764,765,766,767,768,769,770,771,772,773,774,775,776,777,778,779,780,781,782,783,784,785,786,787,788,789,790,791,792,793,794,795,796,797,798,799,800,801,802,803,804,805,806,807,808,809,810,811,812,813,814,815,816,817,818,819,820,821,822,823,824,825,826,827,828,829,830,831,832,833,834,835,836,837,838,839,840,841,842,843,844,845,846,847,848,849,850,851,852,853,854,855,856,857,858,859,860,861,862,863,864,865,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,919,920,921,922,923,924,925,926,927,928,929,930,931,932,933,934,935,936,937,938,939,940,941,942,943,944,945,946,947,948,949,950,951,952,953,954,955,956,957,958,959,960,961,962,963,964,965,966,967,968,969,970,971,972,973,974,975,976,977,978,979,980,981,982,983,984,985,986,987,988,989,990,991,992,993,994,995,996,997,998,999

Vulnerability_Detection

Vulnerabilities in Episimmer refers to the weakest links in the simulation environment. These vulnerabilities can arise from agents, locations, events and interactions. We shall specifically focus on agent based vulnerabilities.

Agent based vulnerabilities can be broadly classified into two groups :

  1. Vulnerable agents : Agents who are most likely to reach a certain disease state. For example ‘agents most likely to die’ or ‘agents most likely to get infected’ or ‘agents most likely to be hospitalised’.

  2. Agent vulnerability : Agents on removal or constrained for a duration of time from the ecosystem, lead to the largest reduction in risk or size of the epidemic. This is an optimization problem using a cost function that can encode priorities.

To run an example :

            cd examples/Policy
            python ../../episimmer/main.py Simple_Vulnerable_Agents -vul

Bandit_Algos_Agent_Vulnerability

An example of finding Agent vulnerabilities in the system. We first select an agent for removal based on either epsilon greedy or the UCB1 algorithm, then we run the simulation.


Generate_policy.py

 1from episimmer.policy import lockdown_policy
 2
 3
 4def generate_policy():
 5	policy_list=[]
 6
 7	def lockdown_fn(time_step):
 8		return False
 9
10	policy_list.append(lockdown_policy.FullLockdown(lockdown_fn))
11
12	return policy_list

UserModel.py

 1import episimmer.model as model
 2
 3
 4def event_contribute_fn(agent,event_info,location,current_time_step):
 5	if agent.state=='Infected':
 6		return 1
 7	return 0
 8
 9
10def event_receive_fn(agent,ambient_infection,event_info,location,current_time_step):
11	beta=0.001
12	return ambient_infection*beta
13
14
15class UserModel(model.StochasticModel):
16	def __init__(self):
17		individual_types=['Susceptible','Infected','Recovered']
18		infected_states=['Infected']
19		state_proportion={
20							'Susceptible':0.99,
21							'Infected':0.01,
22							'Recovered':0
23						}
24		model.StochasticModel.__init__(self,individual_types,infected_states,state_proportion)
25		self.set_transition('Susceptible', 'Infected', self.p_infection())
26		self.set_transition('Infected', 'Recovered', self.p_standard(0.2))
27
28
29		self.set_event_contribution_fn(event_contribute_fn)
30		self.set_event_receive_fn(event_receive_fn)
31
32		self.name='Stochastic SIR'

agents.csv

  1Agent Index
  20
  31
  42
  53
  64
  75
  86
  97
 108
 119
 1210
 1311
 1412
 1513
 1614
 1715
 1816
 1917
 2018
 2119
 2220
 2321
 2422
 2523
 2624
 2725
 2826
 2927
 3028
 3129
 3230
 3331
 3432
 3533
 3634
 3735
 3836
 3937
 4038
 4139
 4240
 4341
 4442
 4543
 4644
 4745
 4846
 4947
 5048
 5149
 5250
 5351
 5452
 5553
 5654
 5755
 5856
 5957
 6058
 6159
 6260
 6361
 6462
 6563
 6664
 6765
 6866
 6967
 7068
 7169
 7270
 7371
 7472
 7573
 7674
 7775
 7876
 7977
 8078
 8179
 8280
 8381
 8482
 8583
 8684
 8785
 8886
 8987
 9088
 9189
 9290
 9391
 9492
 9593
 9694
 9795
 9896
 9997
10098
10199

config.txt

 1Random Seed <3>
 2Number of worlds <1>
 3Number of Days <30>
 4Agent Parameter Keys <Agent Index>
 5Agent list filename <agents.csv>
 6Interaction Info Keys <>
 7Interaction Files list filename <>
 8Probabilistic Interaction Files list filename <>
 9Location Parameter Keys <Location Index>
10Location list filename <locations.txt>
11Event Parameter Keys <Location Index:Agents>
12Event Files list filename <event_files_list.txt>
13One Time Event filename <>

event_files_list.txt

1<one_event.txt>

generate_files.py

 1import sys
 2
 3import numpy as np
 4
 5
 6def write_agents(filename,n):
 7	header='Agent Index'
 8
 9	f=open(filename,'w')
10	f.write(str(n)+'\n')
11	f.write(header+'\n')
12
13	for i in range(n):
14		f.write(str(i)+'\n')
15
16def write_events(filename,no_locations,no_agents):
17	info_dict={}
18	#ID enumerates from 0 to n-1
19	header='Location Index:Agents'
20
21	f=open(filename,'w')
22	f.write(str(1)+'\n')
23	f.write(header+'\n')
24
25	line=str(0)+':'
26	for i in range(no_agents):
27		line+=str(i)
28		if i!=no_agents-1:
29			line+=','
30
31	f.write(line)
32
33number_of_agents=int(sys.argv[1])
34write_agents('agents.txt',number_of_agents)
35write_events('one_event.txt',1,number_of_agents)

generate_files_csv.py

1from csv import DictWriter
2
3with open('agents.csv', 'w', newline='') as file:
4    fieldnames = ['Agent Index']
5    writer = DictWriter(file, fieldnames=fieldnames)
6
7    writer.writeheader()
8    for i in range(1000):
9    	writer.writerow({'Agent Index': i})

generate_interactions.py

 1from csv import DictWriter
 2
 3with open('interactions.csv', 'w', newline='') as file:
 4    fieldnames = ['Agent Index','Interacting Agent']
 5    writer = DictWriter(file, fieldnames=fieldnames)
 6
 7    writer.writeheader()
 8    for i in range(1000):
 9    	if i!=10:
10    		writer.writerow({'Agent Index': i,'Interacting Agent':i+1})

locations.txt

11
2Location Index
30

one_event.txt

11
2Location Index:Agents
30:0,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,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271,272,273,274,275,276,277,278,279,280,281,282,283,284,285,286,287,288,289,290,291,292,293,294,295,296,297,298,299,300,301,302,303,304,305,306,307,308,309,310,311,312,313,314,315,316,317,318,319,320,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,337,338,339,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,356,357,358,359,360,361,362,363,364,365,366,367,368,369,370,371,372,373,374,375,376,377,378,379,380,381,382,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,399,400,401,402,403,404,405,406,407,408,409,410,411,412,413,414,415,416,417,418,419,420,421,422,423,424,425,426,427,428,429,430,431,432,433,434,435,436,437,438,439,440,441,442,443,444,445,446,447,448,449,450,451,452,453,454,455,456,457,458,459,460,461,462,463,464,465,466,467,468,469,470,471,472,473,474,475,476,477,478,479,480,481,482,483,484,485,486,487,488,489,490,491,492,493,494,495,496,497,498,499,500,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600,601,602,603,604,605,606,607,608,609,610,611,612,613,614,615,616,617,618,619,620,621,622,623,624,625,626,627,628,629,630,631,632,633,634,635,636,637,638,639,640,641,642,643,644,645,646,647,648,649,650,651,652,653,654,655,656,657,658,659,660,661,662,663,664,665,666,667,668,669,670,671,672,673,674,675,676,677,678,679,680,681,682,683,684,685,686,687,688,689,690,691,692,693,694,695,696,697,698,699,700,701,702,703,704,705,706,707,708,709,710,711,712,713,714,715,716,717,718,719,720,721,722,723,724,725,726,727,728,729,730,731,732,733,734,735,736,737,738,739,740,741,742,743,744,745,746,747,748,749,750,751,752,753,754,755,756,757,758,759,760,761,762,763,764,765,766,767,768,769,770,771,772,773,774,775,776,777,778,779,780,781,782,783,784,785,786,787,788,789,790,791,792,793,794,795,796,797,798,799,800,801,802,803,804,805,806,807,808,809,810,811,812,813,814,815,816,817,818,819,820,821,822,823,824,825,826,827,828,829,830,831,832,833,834,835,836,837,838,839,840,841,842,843,844,845,846,847,848,849,850,851,852,853,854,855,856,857,858,859,860,861,862,863,864,865,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,919,920,921,922,923,924,925,926,927,928,929,930,931,932,933,934,935,936,937,938,939,940,941,942,943,944,945,946,947,948,949,950,951,952,953,954,955,956,957,958,959,960,961,962,963,964,965,966,967,968,969,970,971,972,973,974,975,976,977,978,979,980,981,982,983,984,985,986,987,988,989,990,991,992,993,994,995,996,997,998,999

parameter.json

1{
2    "states":["Infected","Recovered"],
3    "num_runs":100,
4    "mode":"UCB"
5}

vd_config.txt

1VD Target <Agent>
2VD Algorithm <BanditAlgos>
3Algorithm Parameter File <parameter.json>
4Pre Processing <>
5Post Processing <>
6Output Mode <Default>

Chunk_Agent_Vulnerability

An example of finding Agent vulnerabilities in the system. We first randomly select an agent, remove him from the environment and run the simulation. For higher stability, chunks of the entire simulation are considered instead of the entire simulation. The score of the agent is based on the severity of outbreak after the agent’s removal.


Generate_policy.py

 1from episimmer.policy import lockdown_policy
 2
 3
 4def generate_policy():
 5	policy_list=[]
 6
 7	def lockdown_fn(time_step):
 8		return False
 9
10	policy_list.append(lockdown_policy.FullLockdown(lockdown_fn))
11
12	return policy_list

UserModel.py

 1import episimmer.model as model
 2
 3
 4def event_contribute_fn(agent,event_info,location,current_time_step):
 5	if agent.state=='Infected':
 6		return 1
 7	return 0
 8
 9
10def event_receive_fn(agent,ambient_infection,event_info,location,current_time_step):
11	beta=0.001
12	return ambient_infection*beta
13
14
15class UserModel(model.StochasticModel):
16	def __init__(self):
17		individual_types=['Susceptible','Infected','Recovered']
18		infected_states=['Infected']
19		state_proportion={
20							'Susceptible':0.99,
21							'Infected':0.01,
22							'Recovered':0
23						}
24		model.StochasticModel.__init__(self,individual_types,infected_states,state_proportion)
25		self.set_transition('Susceptible', 'Infected', self.p_infection())
26		self.set_transition('Infected', 'Recovered', self.p_standard(0.2))
27
28
29		self.set_event_contribution_fn(event_contribute_fn)
30		self.set_event_receive_fn(event_receive_fn)
31
32		self.name='Stochastic SIR'

agents.csv

  1Agent Index
  20
  31
  42
  53
  64
  75
  86
  97
 108
 119
 1210
 1311
 1412
 1513
 1614
 1715
 1816
 1917
 2018
 2119
 2220
 2321
 2422
 2523
 2624
 2725
 2826
 2927
 3028
 3129
 3230
 3331
 3432
 3533
 3634
 3735
 3836
 3937
 4038
 4139
 4240
 4341
 4442
 4543
 4644
 4745
 4846
 4947
 5048
 5149
 5250
 5351
 5452
 5553
 5654
 5755
 5856
 5957
 6058
 6159
 6260
 6361
 6462
 6563
 6664
 6765
 6866
 6967
 7068
 7169
 7270
 7371
 7472
 7573
 7674
 7775
 7876
 7977
 8078
 8179
 8280
 8381
 8482
 8583
 8684
 8785
 8886
 8987
 9088
 9189
 9290
 9391
 9492
 9593
 9694
 9795
 9896
 9997
10098
10199

config.txt

 1Random Seed <3>
 2Number of worlds <1>
 3Number of Days <30>
 4Agent Parameter Keys <Agent Index>
 5Agent list filename <agents.csv>
 6Interaction Info Keys <>
 7Interaction Files list filename <>
 8Probabilistic Interaction Files list filename <>
 9Location Parameter Keys <Location Index>
10Location list filename <locations.txt>
11Event Parameter Keys <Location Index:Agents>
12Event Files list filename <event_files_list.txt>
13One Time Event filename <>

event_files_list.txt

1<one_event.txt>

generate_files.py

 1import sys
 2
 3import numpy as np
 4
 5
 6def write_agents(filename,n):
 7	header='Agent Index'
 8
 9	f=open(filename,'w')
10	f.write(str(n)+'\n')
11	f.write(header+'\n')
12
13	for i in range(n):
14		f.write(str(i)+'\n')
15
16def write_events(filename,no_locations,no_agents):
17	info_dict={}
18	#ID enumerates from 0 to n-1
19	header='Location Index:Agents'
20
21	f=open(filename,'w')
22	f.write(str(1)+'\n')
23	f.write(header+'\n')
24
25	line=str(0)+':'
26	for i in range(no_agents):
27		line+=str(i)
28		if i!=no_agents-1:
29			line+=','
30
31	f.write(line)
32
33number_of_agents=int(sys.argv[1])
34write_agents('agents.txt',number_of_agents)
35write_events('one_event.txt',1,number_of_agents)

generate_files_csv.py

1from csv import DictWriter
2
3with open('agents.csv', 'w', newline='') as file:
4    fieldnames = ['Agent Index']
5    writer = DictWriter(file, fieldnames=fieldnames)
6
7    writer.writeheader()
8    for i in range(1000):
9    	writer.writerow({'Agent Index': i})

generate_interactions.py

 1from csv import DictWriter
 2
 3with open('interactions.csv', 'w', newline='') as file:
 4    fieldnames = ['Agent Index','Interacting Agent']
 5    writer = DictWriter(file, fieldnames=fieldnames)
 6
 7    writer.writeheader()
 8    for i in range(1000):
 9    	if i!=10:
10    		writer.writerow({'Agent Index': i,'Interacting Agent':i+1})

locations.txt

11
2Location Index
30

one_event.txt

11
2Location Index:Agents
30:0,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,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271,272,273,274,275,276,277,278,279,280,281,282,283,284,285,286,287,288,289,290,291,292,293,294,295,296,297,298,299,300,301,302,303,304,305,306,307,308,309,310,311,312,313,314,315,316,317,318,319,320,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,337,338,339,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,356,357,358,359,360,361,362,363,364,365,366,367,368,369,370,371,372,373,374,375,376,377,378,379,380,381,382,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,399,400,401,402,403,404,405,406,407,408,409,410,411,412,413,414,415,416,417,418,419,420,421,422,423,424,425,426,427,428,429,430,431,432,433,434,435,436,437,438,439,440,441,442,443,444,445,446,447,448,449,450,451,452,453,454,455,456,457,458,459,460,461,462,463,464,465,466,467,468,469,470,471,472,473,474,475,476,477,478,479,480,481,482,483,484,485,486,487,488,489,490,491,492,493,494,495,496,497,498,499,500,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600,601,602,603,604,605,606,607,608,609,610,611,612,613,614,615,616,617,618,619,620,621,622,623,624,625,626,627,628,629,630,631,632,633,634,635,636,637,638,639,640,641,642,643,644,645,646,647,648,649,650,651,652,653,654,655,656,657,658,659,660,661,662,663,664,665,666,667,668,669,670,671,672,673,674,675,676,677,678,679,680,681,682,683,684,685,686,687,688,689,690,691,692,693,694,695,696,697,698,699,700,701,702,703,704,705,706,707,708,709,710,711,712,713,714,715,716,717,718,719,720,721,722,723,724,725,726,727,728,729,730,731,732,733,734,735,736,737,738,739,740,741,742,743,744,745,746,747,748,749,750,751,752,753,754,755,756,757,758,759,760,761,762,763,764,765,766,767,768,769,770,771,772,773,774,775,776,777,778,779,780,781,782,783,784,785,786,787,788,789,790,791,792,793,794,795,796,797,798,799,800,801,802,803,804,805,806,807,808,809,810,811,812,813,814,815,816,817,818,819,820,821,822,823,824,825,826,827,828,829,830,831,832,833,834,835,836,837,838,839,840,841,842,843,844,845,846,847,848,849,850,851,852,853,854,855,856,857,858,859,860,861,862,863,864,865,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,919,920,921,922,923,924,925,926,927,928,929,930,931,932,933,934,935,936,937,938,939,940,941,942,943,944,945,946,947,948,949,950,951,952,953,954,955,956,957,958,959,960,961,962,963,964,965,966,967,968,969,970,971,972,973,974,975,976,977,978,979,980,981,982,983,984,985,986,987,988,989,990,991,992,993,994,995,996,997,998,999

parameter.json

1{
2    "states":["Infected","Recovered"],
3    "num_runs":100,
4    "num_agents_to_remove":1,
5    "chunk_len_range":[1,30]
6}

vd_config.txt

1VD Target <Agent>
2VD Algorithm <ChunkAgentVulnerability>
3Algorithm Parameter File <parameter.json>
4Pre Processing <>
5Post Processing <>
6Output Mode <Default>

Complex Graph

Showcases the Agent Vulnerability functionality with a complex graph.

Complex


Generate_policy.py

1
2def generate_policy():
3	policy_list=[]
4
5	return policy_list

UserModel.py

 1import episimmer.model as model
 2
 3
 4def probability_of_infection_fn(p_infected_states_list,contact_agent,c_dict,current_time_step):
 5	if contact_agent.state=='Infected':
 6		return 0.2
 7	return 0
 8
 9class UserModel(model.StochasticModel):
10	def __init__(self):
11		individual_types=['Susceptible','Infected','Recovered']
12		infected_states=['Infected']
13		state_proportion={
14							'Susceptible':0.8,
15							'Infected':0.2,
16							'Recovered':0
17						}
18		model.StochasticModel.__init__(self,individual_types,infected_states,state_proportion)
19		self.set_transition('Susceptible', 'Infected', self.p_infection(probability_of_infection_fn,None))
20		self.set_transition('Infected', 'Recovered', self.p_standard(0.02))
21
22
23		self.name='Stochastic SIR on complete graph'

agents.txt

 113
 2Agent Index
 30
 41
 52
 63
 74
 85
 96
107
118
129
1310
1411
1512

config.txt

 1Random Seed <3>
 2Number of worlds <1>
 3Number of Days <30>
 4Agent Parameter Keys <Agent Index>
 5Agent list filename <agents.txt>
 6Interaction Info Keys <Agent Index:Interacting Agent Index>
 7Interaction Files list filename <interaction_files_list.txt>
 8Probabilistic Interaction Files list filename <>
 9Location Parameter Keys <Location Index>
10Location list filename <locations.txt>
11Event Parameter Keys <>
12Event Files list filename <>
13One Time Event filename <>

interaction_files_list.txt

1<interactions_list.txt>

interactions_list.txt

 150
 2Agent Index:Interacting Agent Index
 30:1
 41:0
 50:2
 62:0
 70:3
 83:0
 91:2
102:1
111:3
123:1
132:3
143:2
150:4
164:0
170:5
185:0
190:6
206:0
210:7
227:0
234:5
245:4
254:6
266:4
274:7
287:4
295:6
306:5
315:7
327:5
336:7
347:6
356:8
368:6
377:8
388:7
398:9
409:8
419:10
4210:9
439:11
4411:9
459:12
4612:9
4710:11
4811:10
4910:12
5012:10
5111:12
5212:11

locations.txt

11
2Location Index
30

parameter.json

1{
2    "states":["Infected","Recovered"],
3    "num_runs":100,
4    "num_agents_to_remove":1
5}

vd_config.txt

1VD Target <Agent>
2VD Algorithm <SimpleAgentVulnerability>
3Algorithm Parameter File <parameter.json>
4Pre Processing <>
5Post Processing <>
6Output Mode <Default>

Early_Vulnerable_Agents

An example of finding Vulnerable agents in the system. We run the simulation multiple times and score the agent based on the number of times he was infected and also given a higher score if he was infected earlier.


Generate_policy.py

 1from episimmer.policy import lockdown_policy
 2
 3
 4def generate_policy():
 5	policy_list=[]
 6
 7	def lockdown_fn(time_step):
 8		return False
 9
10	policy_list.append(lockdown_policy.FullLockdown(lockdown_fn))
11
12	return policy_list

UserModel.py

 1import episimmer.model as model
 2
 3
 4def event_contribute_fn(agent,event_info,location,current_time_step):
 5	if agent.state=='Infected':
 6		return 1
 7	return 0
 8
 9
10def event_receive_fn(agent,ambient_infection,event_info,location,current_time_step):
11	beta=0.001
12	return ambient_infection*beta
13
14
15class UserModel(model.StochasticModel):
16	def __init__(self):
17		individual_types=['Susceptible','Infected','Recovered']
18		infected_states=['Infected']
19		state_proportion={
20							'Susceptible':0.99,
21							'Infected':0.01,
22							'Recovered':0
23						}
24		model.StochasticModel.__init__(self,individual_types,infected_states,state_proportion)
25		self.set_transition('Susceptible', 'Infected', self.p_infection())
26		self.set_transition('Infected', 'Recovered', self.p_standard(0.2))
27
28
29		self.set_event_contribution_fn(event_contribute_fn)
30		self.set_event_receive_fn(event_receive_fn)
31
32		self.name='Stochastic SIR'

agents.csv

  1Agent Index
  20
  31
  42
  53
  64
  75
  86
  97
 108
 119
 1210
 1311
 1412
 1513
 1614
 1715
 1816
 1917
 2018
 2119
 2220
 2321
 2422
 2523
 2624
 2725
 2826
 2927
 3028
 3129
 3230
 3331
 3432
 3533
 3634
 3735
 3836
 3937
 4038
 4139
 4240
 4341
 4442
 4543
 4644
 4745
 4846
 4947
 5048
 5149
 5250
 5351
 5452
 5553
 5654
 5755
 5856
 5957
 6058
 6159
 6260
 6361
 6462
 6563
 6664
 6765
 6866
 6967
 7068
 7169
 7270
 7371
 7472
 7573
 7674
 7775
 7876
 7977
 8078
 8179
 8280
 8381
 8482
 8583
 8684
 8785
 8886
 8987
 9088
 9189
 9290
 9391
 9492
 9593
 9694
 9795
 9896
 9997
10098
10199

config.txt

 1Random Seed <3>
 2Number of worlds <1>
 3Number of Days <30>
 4Agent Parameter Keys <Agent Index>
 5Agent list filename <agents.csv>
 6Interaction Info Keys <>
 7Interaction Files list filename <>
 8Probabilistic Interaction Files list filename <>
 9Location Parameter Keys <Location Index>
10Location list filename <locations.txt>
11Event Parameter Keys <Location Index:Agents>
12Event Files list filename <event_files_list.txt>
13One Time Event filename <>

event_files_list.txt

1<one_event.txt>

generate_files.py

 1import sys
 2
 3import numpy as np
 4
 5
 6def write_agents(filename,n):
 7	header='Agent Index'
 8
 9	f=open(filename,'w')
10	f.write(str(n)+'\n')
11	f.write(header+'\n')
12
13	for i in range(n):
14		f.write(str(i)+'\n')
15
16def write_events(filename,no_locations,no_agents):
17	info_dict={}
18	#ID enumerates from 0 to n-1
19	header='Location Index:Agents'
20
21	f=open(filename,'w')
22	f.write(str(1)+'\n')
23	f.write(header+'\n')
24
25	line=str(0)+':'
26	for i in range(no_agents):
27		line+=str(i)
28		if i!=no_agents-1:
29			line+=','
30
31	f.write(line)
32
33number_of_agents=int(sys.argv[1])
34write_agents('agents.txt',number_of_agents)
35write_events('one_event.txt',1,number_of_agents)

generate_files_csv.py

1from csv import DictWriter
2
3with open('agents.csv', 'w', newline='') as file:
4    fieldnames = ['Agent Index']
5    writer = DictWriter(file, fieldnames=fieldnames)
6
7    writer.writeheader()
8    for i in range(1000):
9    	writer.writerow({'Agent Index': i})

generate_interactions.py

 1from csv import DictWriter
 2
 3with open('interactions.csv', 'w', newline='') as file:
 4    fieldnames = ['Agent Index','Interacting Agent']
 5    writer = DictWriter(file, fieldnames=fieldnames)
 6
 7    writer.writeheader()
 8    for i in range(1000):
 9    	if i!=10:
10    		writer.writerow({'Agent Index': i,'Interacting Agent':i+1})

locations.txt

11
2Location Index
30

one_event.txt

11
2Location Index:Agents
30:0,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,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271,272,273,274,275,276,277,278,279,280,281,282,283,284,285,286,287,288,289,290,291,292,293,294,295,296,297,298,299,300,301,302,303,304,305,306,307,308,309,310,311,312,313,314,315,316,317,318,319,320,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,337,338,339,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,356,357,358,359,360,361,362,363,364,365,366,367,368,369,370,371,372,373,374,375,376,377,378,379,380,381,382,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,399,400,401,402,403,404,405,406,407,408,409,410,411,412,413,414,415,416,417,418,419,420,421,422,423,424,425,426,427,428,429,430,431,432,433,434,435,436,437,438,439,440,441,442,443,444,445,446,447,448,449,450,451,452,453,454,455,456,457,458,459,460,461,462,463,464,465,466,467,468,469,470,471,472,473,474,475,476,477,478,479,480,481,482,483,484,485,486,487,488,489,490,491,492,493,494,495,496,497,498,499,500,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600,601,602,603,604,605,606,607,608,609,610,611,612,613,614,615,616,617,618,619,620,621,622,623,624,625,626,627,628,629,630,631,632,633,634,635,636,637,638,639,640,641,642,643,644,645,646,647,648,649,650,651,652,653,654,655,656,657,658,659,660,661,662,663,664,665,666,667,668,669,670,671,672,673,674,675,676,677,678,679,680,681,682,683,684,685,686,687,688,689,690,691,692,693,694,695,696,697,698,699,700,701,702,703,704,705,706,707,708,709,710,711,712,713,714,715,716,717,718,719,720,721,722,723,724,725,726,727,728,729,730,731,732,733,734,735,736,737,738,739,740,741,742,743,744,745,746,747,748,749,750,751,752,753,754,755,756,757,758,759,760,761,762,763,764,765,766,767,768,769,770,771,772,773,774,775,776,777,778,779,780,781,782,783,784,785,786,787,788,789,790,791,792,793,794,795,796,797,798,799,800,801,802,803,804,805,806,807,808,809,810,811,812,813,814,815,816,817,818,819,820,821,822,823,824,825,826,827,828,829,830,831,832,833,834,835,836,837,838,839,840,841,842,843,844,845,846,847,848,849,850,851,852,853,854,855,856,857,858,859,860,861,862,863,864,865,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,919,920,921,922,923,924,925,926,927,928,929,930,931,932,933,934,935,936,937,938,939,940,941,942,943,944,945,946,947,948,949,950,951,952,953,954,955,956,957,958,959,960,961,962,963,964,965,966,967,968,969,970,971,972,973,974,975,976,977,978,979,980,981,982,983,984,985,986,987,988,989,990,991,992,993,994,995,996,997,998,999

parameter.json

1{
2    "states":["Infected","Recovered"],
3    "num_runs":100
4}

vd_config.txt

1VD Target <Agent>
2VD Algorithm <EarlyVulnerableAgent>
3Algorithm Parameter File <parameter.json>
4Pre Processing <>
5Post Processing <>
6Output Mode <Default>

Multi_Cycle_Graph

Showcases the Agent Vulnerability functionality with the multi cycle graph.

MultiCycle


Generate_policy.py

1
2def generate_policy():
3	policy_list=[]
4
5	return policy_list

UserModel.py

 1import episimmer.model as model
 2
 3
 4def probability_of_infection_fn(p_infected_states_list,contact_agent,c_dict,current_time_step):
 5	if contact_agent.state=='Infected':
 6		return 0.4
 7	return 0
 8
 9class UserModel(model.StochasticModel):
10	def __init__(self):
11		individual_types=['Susceptible','Infected','Recovered']
12		infected_states=['Infected']
13		state_proportion={
14							'Susceptible':0.9,
15							'Infected':0.1,
16							'Recovered':0
17						}
18		model.StochasticModel.__init__(self,individual_types,infected_states,state_proportion)
19		self.set_transition('Susceptible', 'Infected', self.p_infection(probability_of_infection_fn,None))
20		self.set_transition('Infected', 'Recovered', self.p_standard(0.2))
21
22
23		self.name='Stochastic SIR on complete graph'

agents.txt

  1100
  2Agent Index
  30
  41
  52
  63
  74
  85
  96
 107
 118
 129
 1310
 1411
 1512
 1613
 1714
 1815
 1916
 2017
 2118
 2219
 2320
 2421
 2522
 2623
 2724
 2825
 2926
 3027
 3128
 3229
 3330
 3431
 3532
 3633
 3734
 3835
 3936
 4037
 4138
 4239
 4340
 4441
 4542
 4643
 4744
 4845
 4946
 5047
 5148
 5249
 5350
 5451
 5552
 5653
 5754
 5855
 5956
 6057
 6158
 6259
 6360
 6461
 6562
 6663
 6764
 6865
 6966
 7067
 7168
 7269
 7370
 7471
 7572
 7673
 7774
 7875
 7976
 8077
 8178
 8279
 8380
 8481
 8582
 8683
 8784
 8885
 8986
 9087
 9188
 9289
 9390
 9491
 9592
 9693
 9794
 9895
 9996
10097
10198
10299

config.txt

 1Random Seed <3>
 2Number of worlds <1>
 3Number of Days <10>
 4Agent Parameter Keys <Agent Index>
 5Agent list filename <agents.txt>
 6Interaction Info Keys <Agent Index:Interacting Agent Index>
 7Interaction Files list filename <interaction_files_list.txt>
 8Probabilistic Interaction Files list filename <>
 9Location Parameter Keys <Location Index>
10Location list filename <locations.txt>
11Event Parameter Keys <>
12Event Files list filename <>
13One Time Event filename <>

generate_rings.py

 1import csv
 2
 3
 4def write_interactions(filename,no_agents,num_rings):
 5	agent_set=set()
 6
 7	if no_agents%num_rings!=0:
 8		raise ValueError('Number of agents is not divisible by number of rings')
 9	num_ring_agents = no_agents//num_rings
10
11	for ring in range(num_rings):
12		for agent_index in range(num_ring_agents):
13			agent_set.add((agent_index + ring*num_ring_agents, (agent_index+1)%num_ring_agents+ ring*num_ring_agents))
14			agent_set.add(((agent_index+1)%num_ring_agents+ ring*num_ring_agents, agent_index + ring*num_ring_agents))
15
16		agent_set.add((ring*num_ring_agents,((ring+1)*num_ring_agents)%no_agents))
17		agent_set.add((((ring+1)*num_ring_agents)%no_agents, ring*num_ring_agents))
18
19	with open(filename, 'w', newline='') as file:
20		fieldnames = ['Agent Index','Interacting Agent Index']
21		writer = csv.DictWriter(file, fieldnames=fieldnames)
22		writer.writeheader()
23		for x,y in agent_set:
24			writer.writerow({'Agent Index':x,'Interacting Agent Index':y})
25
26
27
28
29write_interactions('interactions_list.csv', 30, 3)

interaction_files_list.txt

1<interactions_list.csv>

interactions_list.csv

 1Agent Index,Interacting Agent Index
 227,26
 329,28
 410,11
 522,23
 60,20
 75,6
 828,29
 99,8
1023,22
112,1
1214,13
138,9
1415,16
1520,29
1618,19
170,10
1817,16
1926,25
201,2
2116,17
229,0
2311,10
246,7
2513,12
2619,18
2721,20
2812,13
2920,21
307,6
3120,0
3225,26
3316,15
3424,23
353,4
3610,0
3719,10
3828,27
3927,28
4022,21
413,2
425,4
434,5
4410,19
4518,17
4620,10
472,3
4814,15
498,7
5012,11
511,0
5215,14
5311,12
5423,24
556,5
560,1
5717,18
5826,27
5913,14
6021,22
6125,24
6229,20
6324,25
6410,20
654,3
660,9
677,8

locations.txt

11
2Location Index
30

parameter.json

1{
2    "states":["Infected","Recovered"],
3    "num_runs":100,
4    "num_agents_to_remove":1,
5    "chunk_len_range":[1,30]
6}

vd_config.txt

1VD Target <Agent>
2VD Algorithm <ChunkAgentVulnerability>
3Algorithm Parameter File <parameter.json>
4Pre Processing <>
5Post Processing <>
6Output Mode <Default>

Simple_Agent_Vulnerability

An example of finding Agent vulnerabilities in the system. We first randomly select an agent, remove him from the environment and run the simulation. The score of the agent is based on the severity of outbreak after the agent’s removal.


Generate_policy.py

 1from episimmer.policy import lockdown_policy
 2
 3
 4def generate_policy():
 5	policy_list=[]
 6
 7	def lockdown_fn(time_step):
 8		return False
 9
10	policy_list.append(lockdown_policy.FullLockdown(lockdown_fn))
11
12	return policy_list

UserModel.py

 1import episimmer.model as model
 2
 3
 4def event_contribute_fn(agent,event_info,location,current_time_step):
 5	if agent.state=='Infected':
 6		return 1
 7	return 0
 8
 9
10def event_receive_fn(agent,ambient_infection,event_info,location,current_time_step):
11	beta=0.001
12	return ambient_infection*beta
13
14
15class UserModel(model.StochasticModel):
16	def __init__(self):
17		individual_types=['Susceptible','Infected','Recovered']
18		infected_states=['Infected']
19		state_proportion={
20							'Susceptible':0.99,
21							'Infected':0.01,
22							'Recovered':0
23						}
24		model.StochasticModel.__init__(self,individual_types,infected_states,state_proportion)
25		self.set_transition('Susceptible', 'Infected', self.p_infection())
26		self.set_transition('Infected', 'Recovered', self.p_standard(0.2))
27
28
29		self.set_event_contribution_fn(event_contribute_fn)
30		self.set_event_receive_fn(event_receive_fn)
31
32		self.name='Stochastic SIR'

agents.csv

  1Agent Index
  20
  31
  42
  53
  64
  75
  86
  97
 108
 119
 1210
 1311
 1412
 1513
 1614
 1715
 1816
 1917
 2018
 2119
 2220
 2321
 2422
 2523
 2624
 2725
 2826
 2927
 3028
 3129
 3230
 3331
 3432
 3533
 3634
 3735
 3836
 3937
 4038
 4139
 4240
 4341
 4442
 4543
 4644
 4745
 4846
 4947
 5048
 5149
 5250
 5351
 5452
 5553
 5654
 5755
 5856
 5957
 6058
 6159
 6260
 6361
 6462
 6563
 6664
 6765
 6866
 6967
 7068
 7169
 7270
 7371
 7472
 7573
 7674
 7775
 7876
 7977
 8078
 8179
 8280
 8381
 8482
 8583
 8684
 8785
 8886
 8987
 9088
 9189
 9290
 9391
 9492
 9593
 9694
 9795
 9896
 9997
10098
10199

config.txt

 1Random Seed <3>
 2Number of worlds <1>
 3Number of Days <30>
 4Agent Parameter Keys <Agent Index>
 5Agent list filename <agents.csv>
 6Interaction Info Keys <>
 7Interaction Files list filename <>
 8Probabilistic Interaction Files list filename <>
 9Location Parameter Keys <Location Index>
10Location list filename <locations.txt>
11Event Parameter Keys <Location Index:Agents>
12Event Files list filename <event_files_list.txt>
13One Time Event filename <>

event_files_list.txt

1<one_event.txt>

generate_files.py

 1import sys
 2
 3import numpy as np
 4
 5
 6def write_agents(filename,n):
 7	header='Agent Index'
 8
 9	f=open(filename,'w')
10	f.write(str(n)+'\n')
11	f.write(header+'\n')
12
13	for i in range(n):
14		f.write(str(i)+'\n')
15
16def write_events(filename,no_locations,no_agents):
17	info_dict={}
18	#ID enumerates from 0 to n-1
19	header='Location Index:Agents'
20
21	f=open(filename,'w')
22	f.write(str(1)+'\n')
23	f.write(header+'\n')
24
25	line=str(0)+':'
26	for i in range(no_agents):
27		line+=str(i)
28		if i!=no_agents-1:
29			line+=','
30
31	f.write(line)
32
33number_of_agents=int(sys.argv[1])
34write_agents('agents.txt',number_of_agents)
35write_events('one_event.txt',1,number_of_agents)

generate_files_csv.py

1from csv import DictWriter
2
3with open('agents.csv', 'w', newline='') as file:
4    fieldnames = ['Agent Index']
5    writer = DictWriter(file, fieldnames=fieldnames)
6
7    writer.writeheader()
8    for i in range(1000):
9    	writer.writerow({'Agent Index': i})

generate_interactions.py

 1from csv import DictWriter
 2
 3with open('interactions.csv', 'w', newline='') as file:
 4    fieldnames = ['Agent Index','Interacting Agent']
 5    writer = DictWriter(file, fieldnames=fieldnames)
 6
 7    writer.writeheader()
 8    for i in range(1000):
 9    	if i!=10:
10    		writer.writerow({'Agent Index': i,'Interacting Agent':i+1})

locations.txt

11
2Location Index
30

one_event.txt

11
2Location Index:Agents
30:0,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,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271,272,273,274,275,276,277,278,279,280,281,282,283,284,285,286,287,288,289,290,291,292,293,294,295,296,297,298,299,300,301,302,303,304,305,306,307,308,309,310,311,312,313,314,315,316,317,318,319,320,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,337,338,339,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,356,357,358,359,360,361,362,363,364,365,366,367,368,369,370,371,372,373,374,375,376,377,378,379,380,381,382,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,399,400,401,402,403,404,405,406,407,408,409,410,411,412,413,414,415,416,417,418,419,420,421,422,423,424,425,426,427,428,429,430,431,432,433,434,435,436,437,438,439,440,441,442,443,444,445,446,447,448,449,450,451,452,453,454,455,456,457,458,459,460,461,462,463,464,465,466,467,468,469,470,471,472,473,474,475,476,477,478,479,480,481,482,483,484,485,486,487,488,489,490,491,492,493,494,495,496,497,498,499,500,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600,601,602,603,604,605,606,607,608,609,610,611,612,613,614,615,616,617,618,619,620,621,622,623,624,625,626,627,628,629,630,631,632,633,634,635,636,637,638,639,640,641,642,643,644,645,646,647,648,649,650,651,652,653,654,655,656,657,658,659,660,661,662,663,664,665,666,667,668,669,670,671,672,673,674,675,676,677,678,679,680,681,682,683,684,685,686,687,688,689,690,691,692,693,694,695,696,697,698,699,700,701,702,703,704,705,706,707,708,709,710,711,712,713,714,715,716,717,718,719,720,721,722,723,724,725,726,727,728,729,730,731,732,733,734,735,736,737,738,739,740,741,742,743,744,745,746,747,748,749,750,751,752,753,754,755,756,757,758,759,760,761,762,763,764,765,766,767,768,769,770,771,772,773,774,775,776,777,778,779,780,781,782,783,784,785,786,787,788,789,790,791,792,793,794,795,796,797,798,799,800,801,802,803,804,805,806,807,808,809,810,811,812,813,814,815,816,817,818,819,820,821,822,823,824,825,826,827,828,829,830,831,832,833,834,835,836,837,838,839,840,841,842,843,844,845,846,847,848,849,850,851,852,853,854,855,856,857,858,859,860,861,862,863,864,865,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,919,920,921,922,923,924,925,926,927,928,929,930,931,932,933,934,935,936,937,938,939,940,941,942,943,944,945,946,947,948,949,950,951,952,953,954,955,956,957,958,959,960,961,962,963,964,965,966,967,968,969,970,971,972,973,974,975,976,977,978,979,980,981,982,983,984,985,986,987,988,989,990,991,992,993,994,995,996,997,998,999

parameter.json

1{
2    "states":["Infected","Recovered"],
3    "num_runs":100,
4    "num_agents_to_remove":1
5}

vd_config.txt

1VD Target <Agent>
2VD Algorithm <SimpleAgentVulnerability>
3Algorithm Parameter File <parameter.json>
4Pre Processing <>
5Post Processing <>
6Output Mode <Default>

Simple Event Vulnerability

An example of finding Event vulnerabilities in the system. We first randomly select an event, put the rest of the events under lockdown and run the simulation with only that event. The score of the event is based on the severity of outbreak.


Generate_policy.py

 1from episimmer.policy import lockdown_policy
 2
 3
 4def generate_policy():
 5	policy_list=[]
 6
 7	def lockdown_fn(time_step):
 8		return False
 9
10	policy_list.append(lockdown_policy.FullLockdown(lockdown_fn))
11
12	return policy_list

UserModel.py

 1import episimmer.model as model
 2
 3
 4def event_contribute_fn(agent, event_info, location, current_time_step):
 5    if agent.state == 'Infected':
 6        return 1
 7    return 0
 8
 9
10def event_receive_fn(agent, ambient_infection, event_info, location, current_time_step):
11    beta = 0.3
12    return ambient_infection * beta
13
14
15def probability_of_infection_fn(p_infected_states_list, contact_agent, c_dict, current_time_step):
16    if contact_agent.state == 'Infected':
17        return 0.001
18    return 0
19
20
21class UserModel(model.StochasticModel):
22    def __init__(self):
23        individual_types = ['Susceptible', 'Infected', 'Recovered']
24        infected_states = ['Infected']
25        state_proportion = {
26            'Susceptible': 0.8,
27            'Infected': 0.2,
28            'Recovered': 0
29        }
30        model.StochasticModel.__init__(self, individual_types, infected_states, state_proportion)
31        self.set_transition('Susceptible', 'Infected', self.p_infection(probability_of_infection_fn, None))
32        self.set_transition('Infected', 'Recovered', self.p_standard(0.2))
33
34        self.set_event_contribution_fn(event_contribute_fn)
35        self.set_event_receive_fn(event_receive_fn)
36
37        self.name = 'Stochastic SIR'

agents.txt

 120
 2Agent Index
 30
 41
 52
 63
 74
 85
 96
107
118
129
1310
1411
1512
1613
1714
1815
1916
2017
2118
2219

config.txt

 1Random Seed <3>
 2Number of worlds <1>
 3Number of Days <30>
 4Agent Parameter Keys <Agent Index>
 5Agent list filename <agents.txt>
 6Interaction Info Keys <Agent Index:Interacting Agent Index>
 7Interaction Files list filename <interactions_files_list.txt>
 8Probabilistic Interaction Files list filename <>
 9Location Parameter Keys <Location Index>
10Location list filename <locations.txt>
11Event Parameter Keys <Id:Location Index:Agents>
12Event Files list filename <event_files_list.txt>
13One Time Event filename <one_time_event.txt>

event_files_list.txt

1<one_event.txt>
2<two_event.txt>
3<three_event.txt>
4<four_event.txt>
5<five_event.txt>
6<six_event.txt>

five_event.txt

12
2Id:Location Index:Agents
36:2:2,5,7,0
47:2:14,16,4,11,10,12,6

four_event.txt

12
2Id:Location Index:Agents
34:1:12,17,9,7,19,11,4,1,13,3,16,2,8,10
45:0:14,2,9,10,4,19,3,18,11,13,15,16,7,5,6,17,0

generate_files.py

 1import sys
 2from csv import DictWriter
 3from random import randint, sample
 4
 5
 6def write_agents(filename, no_agents):
 7    header = 'Agent Index'
 8
 9    with open(filename, 'w') as f:
10        f.write(f'{no_agents}\n')
11        f.write(f'{header}\n')
12
13        for i in range(no_agents):
14            f.write(f'{i}\n')
15
16
17def write_locations(filename, no_locations):
18    header = 'Location Index'
19
20    with open(filename, 'w') as f:
21        f.write(f'{no_locations}\n')
22        f.write(f'{header}\n')
23
24        for i in range(no_locations):
25            f.write(f'{i}\n')
26
27
28def write_interactions(filename, no_agents, no_interactions):
29    with open(filename, 'w', newline='') as file:
30        fieldnames = ['Agent Index', 'Interacting Agent Index']
31        writer = DictWriter(file, fieldnames=fieldnames)
32
33        writer.writeheader()
34        for i in range(no_interactions):
35            agent = randint(0, no_agents - 1)
36            contact_agent = randint(0, no_agents - 1)
37            if agent != contact_agent:
38                writer.writerow({'Agent Index': agent, 'Interacting Agent Index': contact_agent})
39                writer.writerow({'Agent Index': contact_agent, 'Interacting Agent Index': agent})
40
41
42def write_events(files, no_locations, no_agents):
43    header = 'Id:Location Index:Agents'
44
45    event_id = 0
46    for file in files:
47        with open(file, 'w') as f:
48            n = randint(1, 3)
49            f.write(f'{n}\n')
50            f.write(f'{header}\n')
51
52            for _ in range(n):
53                line = f'{event_id}:'
54                event_id += 1
55                line += f'{randint(0, no_locations - 1)}:'
56                line += ','.join(str(agent) for agent in sample(range(no_agents), randint(1, 20)))
57                f.write(line + '\n')
58
59
60def main():
61    no_agents, no_locations = int(sys.argv[1]), int(sys.argv[2])
62    event_files = ['one_event.txt', 'two_event.txt', 'three_event.txt', 'four_event.txt', 'five_event.txt',
63                   'six_event.txt']
64
65    write_agents('agents.txt', no_agents)
66    write_locations('locations.txt', no_locations)
67    write_interactions('interactions.csv', no_agents, 100)
68    write_events(event_files, no_locations, no_agents)
69
70
71if __name__ == '__main__':
72    main()

interactions.csv

  1Agent Index,Interacting Agent Index
  21,2
  32,1
  415,14
  514,15
  618,19
  719,18
  811,19
  919,11
 1014,1
 111,14
 1217,10
 1310,17
 140,11
 1511,0
 166,7
 177,6
 189,6
 196,9
 2015,10
 2110,15
 225,17
 2317,5
 2414,5
 255,14
 265,12
 2712,5
 281,18
 2918,1
 3011,10
 3110,11
 326,2
 332,6
 349,18
 3518,9
 360,7
 377,0
 3819,17
 3917,19
 407,19
 4119,7
 4219,17
 4317,19
 4410,9
 459,10
 4610,11
 4711,10
 4811,16
 4916,11
 509,6
 516,9
 5214,2
 532,14
 545,16
 5516,5
 561,16
 5716,1
 5818,4
 594,18
 6013,3
 613,13
 6210,3
 633,10
 6419,16
 6516,19
 6614,8
 678,14
 688,9
 699,8
 7010,1
 711,10
 7213,19
 7319,13
 746,0
 750,6
 760,16
 7716,0
 784,19
 7919,4
 808,4
 814,8
 825,15
 8315,5
 846,18
 8518,6
 862,5
 875,2
 885,15
 8915,5
 9013,19
 9119,13
 9217,15
 9315,17
 949,17
 9517,9
 968,19
 9719,8
 988,18
 9918,8
1000,3
1013,0
1028,9
1039,8
1045,7
1057,5
10613,8
1078,13
1080,9
1099,0
11012,4
1114,12
11218,1
1131,18
1141,18
11518,1
11612,3
1173,12
1182,4
1194,2
1206,0
1210,6
1220,1
1231,0
1242,18
12518,2
12613,10
12710,13
1284,2
1292,4
1306,2
1312,6
1326,2
1332,6
13412,5
1355,12
13610,9
1379,10
1382,17
13917,2
14014,9
1419,14
1423,11
14311,3
1447,19
14519,7
1460,17
14717,0
14818,9
1499,18
1508,0
1510,8
1521,16
15316,1
1543,5
1555,3
1562,4
1574,2
15818,8
1598,18
16014,18
16118,14
1628,10
16310,8
16415,11
16511,15
16611,18
16718,11
16810,0
1690,10
1707,5
1715,7
17212,4
1734,12
1746,10
17510,6
1765,19
17719,5
1784,9
1799,4
1803,8
1818,3
18213,11
18311,13
1842,13
18513,2
18618,6
1876,18
18814,0
1890,14
1902,6
1916,2
19215,3
1933,15
1941,14
19514,1

interactions_files_list.txt

1<interactions.csv>

locations.txt

13
2Location Index
30
41
52

one_event.txt

11
2Id:Location Index:Agents
30:0:2,5,18,16,13,17,11,15,12,14

one_time_event.txt

11
2Time Step:Id:Location Index:Agents
31,3:10:0:0,2,16

parameter.json

1{
2    "states":["Infected","Recovered"],
3    "num_runs":1000,
4    "event_identifier":"Id"
5}

six_event.txt

12
2Id:Location Index:Agents
38:1:7,9,5,10,11,12,8,13,0,1,17,2,4,3,18,14,6,15,16
49:0:0

three_event.txt

12
2Id:Location Index:Agents
32:1:6,5,11,7,0,2,16
43:2:18,9,13,7,15,2,16,4,1

two_event.txt

11
2Id:Location Index:Agents
31:2:18,5,3,12,7,2,9,1,0,13,19,16,15,8,6,17,14

vd_config.txt

1VD Target <Event>
2VD Algorithm <SimpleEventVulnerability>
3Algorithm Parameter File <parameter.json>
4Pre Processing <>
5Post Processing <>
6Output Mode <Default>

Simple_Vulnerable_Agents

An example of finding Vulnerable agents in the system. We run the simulation multiple times and score the agent based on the number of times he was infected.


Generate_policy.py

 1from episimmer.policy import lockdown_policy
 2
 3
 4def generate_policy():
 5	policy_list=[]
 6
 7	def lockdown_fn(time_step):
 8		return False
 9
10	policy_list.append(lockdown_policy.FullLockdown(lockdown_fn))
11
12	return policy_list

UserModel.py

 1import episimmer.model as model
 2
 3
 4def event_contribute_fn(agent,event_info,location,current_time_step):
 5	if agent.state=='Infected':
 6		return 1
 7	return 0
 8
 9
10def event_receive_fn(agent,ambient_infection,event_info,location,current_time_step):
11	beta=0.001
12	return ambient_infection*beta
13
14
15class UserModel(model.StochasticModel):
16	def __init__(self):
17		individual_types=['Susceptible','Infected','Recovered']
18		infected_states=['Infected']
19		state_proportion={
20							'Susceptible':0.99,
21							'Infected':0.01,
22							'Recovered':0
23						}
24		model.StochasticModel.__init__(self,individual_types,infected_states,state_proportion)
25		self.set_transition('Susceptible', 'Infected', self.p_infection())
26		self.set_transition('Infected', 'Recovered', self.p_standard(0.2))
27
28
29		self.set_event_contribution_fn(event_contribute_fn)
30		self.set_event_receive_fn(event_receive_fn)
31
32		self.name='Stochastic SIR'

agents.csv

  1Agent Index
  20
  31
  42
  53
  64
  75
  86
  97
 108
 119
 1210
 1311
 1412
 1513
 1614
 1715
 1816
 1917
 2018
 2119
 2220
 2321
 2422
 2523
 2624
 2725
 2826
 2927
 3028
 3129
 3230
 3331
 3432
 3533
 3634
 3735
 3836
 3937
 4038
 4139
 4240
 4341
 4442
 4543
 4644
 4745
 4846
 4947
 5048
 5149
 5250
 5351
 5452
 5553
 5654
 5755
 5856
 5957
 6058
 6159
 6260
 6361
 6462
 6563
 6664
 6765
 6866
 6967
 7068
 7169
 7270
 7371
 7472
 7573
 7674
 7775
 7876
 7977
 8078
 8179
 8280
 8381
 8482
 8583
 8684
 8785
 8886
 8987
 9088
 9189
 9290
 9391
 9492
 9593
 9694
 9795
 9896
 9997
10098
10199

config.txt

 1Random Seed <3>
 2Number of worlds <1>
 3Number of Days <30>
 4Agent Parameter Keys <Agent Index>
 5Agent list filename <agents.csv>
 6Interaction Info Keys <>
 7Interaction Files list filename <>
 8Probabilistic Interaction Files list filename <>
 9Location Parameter Keys <Location Index>
10Location list filename <locations.txt>
11Event Parameter Keys <Location Index:Agents>
12Event Files list filename <event_files_list.txt>
13One Time Event filename <>

event_files_list.txt

1<one_event.txt>

generate_files.py

 1import sys
 2
 3import numpy as np
 4
 5
 6def write_agents(filename,n):
 7	header='Agent Index'
 8
 9	f=open(filename,'w')
10	f.write(str(n)+'\n')
11	f.write(header+'\n')
12
13	for i in range(n):
14		f.write(str(i)+'\n')
15
16def write_events(filename,no_locations,no_agents):
17	info_dict={}
18	#ID enumerates from 0 to n-1
19	header='Location Index:Agents'
20
21	f=open(filename,'w')
22	f.write(str(1)+'\n')
23	f.write(header+'\n')
24
25	line=str(0)+':'
26	for i in range(no_agents):
27		line+=str(i)
28		if i!=no_agents-1:
29			line+=','
30
31	f.write(line)
32
33number_of_agents=int(sys.argv[1])
34write_agents('agents.txt',number_of_agents)
35write_events('one_event.txt',1,number_of_agents)

generate_files_csv.py

1from csv import DictWriter
2
3with open('agents.csv', 'w', newline='') as file:
4    fieldnames = ['Agent Index']
5    writer = DictWriter(file, fieldnames=fieldnames)
6
7    writer.writeheader()
8    for i in range(1000):
9    	writer.writerow({'Agent Index': i})

generate_interactions.py

 1from csv import DictWriter
 2
 3with open('interactions.csv', 'w', newline='') as file:
 4    fieldnames = ['Agent Index','Interacting Agent']
 5    writer = DictWriter(file, fieldnames=fieldnames)
 6
 7    writer.writeheader()
 8    for i in range(1000):
 9    	if i!=10:
10    		writer.writerow({'Agent Index': i,'Interacting Agent':i+1})

locations.txt

11
2Location Index
30

one_event.txt

11
2Location Index:Agents
30:0,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,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271,272,273,274,275,276,277,278,279,280,281,282,283,284,285,286,287,288,289,290,291,292,293,294,295,296,297,298,299,300,301,302,303,304,305,306,307,308,309,310,311,312,313,314,315,316,317,318,319,320,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,337,338,339,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,356,357,358,359,360,361,362,363,364,365,366,367,368,369,370,371,372,373,374,375,376,377,378,379,380,381,382,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,399,400,401,402,403,404,405,406,407,408,409,410,411,412,413,414,415,416,417,418,419,420,421,422,423,424,425,426,427,428,429,430,431,432,433,434,435,436,437,438,439,440,441,442,443,444,445,446,447,448,449,450,451,452,453,454,455,456,457,458,459,460,461,462,463,464,465,466,467,468,469,470,471,472,473,474,475,476,477,478,479,480,481,482,483,484,485,486,487,488,489,490,491,492,493,494,495,496,497,498,499,500,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600,601,602,603,604,605,606,607,608,609,610,611,612,613,614,615,616,617,618,619,620,621,622,623,624,625,626,627,628,629,630,631,632,633,634,635,636,637,638,639,640,641,642,643,644,645,646,647,648,649,650,651,652,653,654,655,656,657,658,659,660,661,662,663,664,665,666,667,668,669,670,671,672,673,674,675,676,677,678,679,680,681,682,683,684,685,686,687,688,689,690,691,692,693,694,695,696,697,698,699,700,701,702,703,704,705,706,707,708,709,710,711,712,713,714,715,716,717,718,719,720,721,722,723,724,725,726,727,728,729,730,731,732,733,734,735,736,737,738,739,740,741,742,743,744,745,746,747,748,749,750,751,752,753,754,755,756,757,758,759,760,761,762,763,764,765,766,767,768,769,770,771,772,773,774,775,776,777,778,779,780,781,782,783,784,785,786,787,788,789,790,791,792,793,794,795,796,797,798,799,800,801,802,803,804,805,806,807,808,809,810,811,812,813,814,815,816,817,818,819,820,821,822,823,824,825,826,827,828,829,830,831,832,833,834,835,836,837,838,839,840,841,842,843,844,845,846,847,848,849,850,851,852,853,854,855,856,857,858,859,860,861,862,863,864,865,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,919,920,921,922,923,924,925,926,927,928,929,930,931,932,933,934,935,936,937,938,939,940,941,942,943,944,945,946,947,948,949,950,951,952,953,954,955,956,957,958,959,960,961,962,963,964,965,966,967,968,969,970,971,972,973,974,975,976,977,978,979,980,981,982,983,984,985,986,987,988,989,990,991,992,993,994,995,996,997,998,999

parameter.json

1{
2    "states":["Infected","Recovered"],
3    "num_runs":100
4}

vd_config.txt

1VD Target <Agent>
2VD Algorithm <SimpleVulnerableAgent>
3Algorithm Parameter File <parameter.json>
4Pre Processing <>
5Post Processing <>
6Output Mode <Default>

Star_Graph

Showcases the Agent Vulnerability functionality with the star graph.

Star


Generate_policy.py

1
2def generate_policy():
3	policy_list=[]
4
5	return policy_list

UserModel.py

 1import episimmer.model as model
 2
 3
 4def probability_of_infection_fn(p_infected_states_list,contact_agent,c_dict,current_time_step):
 5	if contact_agent.state=='Infected':
 6		return 0.4
 7	return 0
 8
 9class UserModel(model.StochasticModel):
10	def __init__(self):
11		individual_types=['Susceptible','Infected','Recovered']
12		infected_states=['Infected']
13		state_proportion={
14							'Susceptible':0.5,
15							'Infected':0.5,
16							'Recovered':0
17						}
18		model.StochasticModel.__init__(self,individual_types,infected_states,state_proportion)
19		self.set_transition('Susceptible', 'Infected', self.p_infection(probability_of_infection_fn,None))
20		self.set_transition('Infected', 'Recovered', self.p_standard(0.2))
21
22
23		self.name='Stochastic SIR on complete graph'

agents.txt

 110
 2Agent Index
 30
 41
 52
 63
 74
 85
 96
107
118
129

config.txt

 1Random Seed <3>
 2Number of worlds <1>
 3Number of Days <10>
 4Agent Parameter Keys <Agent Index>
 5Agent list filename <agents.txt>
 6Interaction Info Keys <Agent Index:Interacting Agent Index>
 7Interaction Files list filename <interaction_files_list.txt>
 8Probabilistic Interaction Files list filename <>
 9Location Parameter Keys <Location Index>
10Location list filename <locations.txt>
11Event Parameter Keys <>
12Event Files list filename <>
13One Time Event filename <>

interaction_files_list.txt

1<interactions_list.txt>

interactions_list.txt

 112
 2Agent Index:Interacting Agent Index
 30:1
 41:0
 50:2
 62:0
 70:3
 83:0
 90:4
104:0
110:5
125:0
130:6
146:0

locations.txt

11
2Location Index
30

parameter.json

1{
2    "states":["Infected","Recovered"],
3    "num_runs":100,
4    "num_agents_to_remove":1,
5    "chunk_len_range":[1,30]
6}

vd_config.txt

1VD Target <Agent>
2VD Algorithm <ChunkAgentVulnerability>
3Algorithm Parameter File <parameter.json>
4Pre Processing <>
5Post Processing <>
6Output Mode <Default>