From da87c480b2a5727b55db7a433d531fd251cf8d8e Mon Sep 17 00:00:00 2001 From: ptaillandier Date: Thu, 15 Jun 2023 14:53:46 +0700 Subject: [PATCH] Modification of parameter values for micro and some minor enhancements --- COMOKIT/Core/Models/Entities/Policy.gaml | 5 ++++- COMOKIT/Meso/Models/Entities/Activity.gaml | 2 ++ COMOKIT/Meso/Models/Entities/Individual.gaml | 4 ++-- .../Experiments/Abstract Batch Experiment.gaml | 1 + COMOKIT/Meso/Models/Global.gaml | 3 ++- .../Micro/Models/Entities/BuildingIndividual.gaml | 10 +++++++++- COMOKIT/Micro/Models/Global.gaml | 3 ++- COMOKIT/Micro/Models/Parameters.gaml | 14 +++++++------- 8 files changed, 29 insertions(+), 13 deletions(-) diff --git a/COMOKIT/Core/Models/Entities/Policy.gaml b/COMOKIT/Core/Models/Entities/Policy.gaml index 23e71b4..913b76b 100644 --- a/COMOKIT/Core/Models/Entities/Policy.gaml +++ b/COMOKIT/Core/Models/Entities/Policy.gaml @@ -235,7 +235,8 @@ species DynamicSpatialPolicy parent: SpatialPolicy { action apply { if(every(1#day)) { - list infecteds <- all_individuals where(each.report_status = tested_positive); + list infecteds <- all_individuals where((each.report_status = tested_positive) and each.is_infectious ); + write sample(length(infecteds)); //ask targets {do die;} //target <- target; application_area <- nil; @@ -243,6 +244,8 @@ species DynamicSpatialPolicy parent: SpatialPolicy { if (not empty(infecteds)) { // write "la: " + length(infecteds); application_area<-union(infecteds collect (circle(radius) at_location each.location)); + write sample(application_area.perimeter); + // SpatialPolicy with: [target::target, application_area::union(infecteds collect (circle(radius) at_location each.location))] returns: result; //targets << first(result); diff --git a/COMOKIT/Meso/Models/Entities/Activity.gaml b/COMOKIT/Meso/Models/Entities/Activity.gaml index 47c7085..cb28b7b 100644 --- a/COMOKIT/Meso/Models/Entities/Activity.gaml +++ b/COMOKIT/Meso/Models/Entities/Activity.gaml @@ -216,6 +216,7 @@ global { species Activity parent: AbstractActivity frequency: 0 { list types_of_building <- []; map> buildings; + bool always_allowed <- false; map> find_target (Individual i) { float start <- BENCHMARK ? machine_time : 0.0; @@ -318,6 +319,7 @@ species studying parent: Activity { species staying_home parent: Activity { string name <- act_home; + bool always_allowed <- true; map> find_target (Individual i) { return [i.home::list(i.relatives)]; } diff --git a/COMOKIT/Meso/Models/Entities/Individual.gaml b/COMOKIT/Meso/Models/Entities/Individual.gaml index b96769e..fde1bf0 100644 --- a/COMOKIT/Meso/Models/Entities/Individual.gaml +++ b/COMOKIT/Meso/Models/Entities/Individual.gaml @@ -303,9 +303,9 @@ species Individual parent: AbstractIndividual schedules: use_activity_precomputa is_activity_allowed<- Authority[0].allows(self, act.key); nb_max_fellow <- Authority[0].limitGroupActivity(self, act.key) - 1; } - else if (Authority[0].allows(self, act.key)) { + else if (act.key.always_allowed or Authority[0].allows(self, act.key)) { int nb_fellows <- Authority[0].limitGroupActivity(self, act.key) - 1; - if (nb_fellows > 0) { + if (nb_fellows > 0) { activity_fellows <-nb_fellows among act.value; } else { activity_fellows <- []; diff --git a/COMOKIT/Meso/Models/Experiments/Abstract Batch Experiment.gaml b/COMOKIT/Meso/Models/Experiments/Abstract Batch Experiment.gaml index 391e2bd..c62117c 100644 --- a/COMOKIT/Meso/Models/Experiments/Abstract Batch Experiment.gaml +++ b/COMOKIT/Meso/Models/Experiments/Abstract Batch Experiment.gaml @@ -32,6 +32,7 @@ global{ bool sim_stop { return (all_individuals all_match ([susceptible, removed] contains each.state)); } init{ + mode_batch <- true; if (idSimulation = -1){ idSimulation <- int(self); } diff --git a/COMOKIT/Meso/Models/Global.gaml b/COMOKIT/Meso/Models/Global.gaml index 261372e..09092a2 100644 --- a/COMOKIT/Meso/Models/Global.gaml +++ b/COMOKIT/Meso/Models/Global.gaml @@ -39,6 +39,7 @@ global { list agents_history; list all_individuals_id; + bool mode_batch <- false; list all_buildings; geometry shape <- envelope(file_exists(shp_boundary_path) ?shape_file(shp_boundary_path) : shape_file(shp_buildings_path) ); Outside the_outside; @@ -191,7 +192,7 @@ global { firsts <- false; } - reflex end when: cycle > 24 and (use_activity_precomputation ? empty(all_individuals): ((all_individuals count (each.is_susceptible or (each.state = removed))) = length(all_individuals))) { + reflex end when: not mode_batch and cycle > 24 and (use_activity_precomputation ? empty(all_individuals): ((all_individuals count (each.is_susceptible or (each.state = removed))) = length(all_individuals))) { write "nb cycle: " + cycle; write "time tot: " + (machine_time - t_ref); write "time cycle: " + (machine_time - t_ref2) / cycle; diff --git a/COMOKIT/Micro/Models/Entities/BuildingIndividual.gaml b/COMOKIT/Micro/Models/Entities/BuildingIndividual.gaml index 1a21b41..2fbc52c 100644 --- a/COMOKIT/Micro/Models/Entities/BuildingIndividual.gaml +++ b/COMOKIT/Micro/Models/Entities/BuildingIndividual.gaml @@ -27,6 +27,8 @@ global { int infection_direct; int infection_object; int infection_air; + int infection_restaurant; + int infection_office; } species IndividualScheduler schedules: shuffle(agents of_generic_species BuildingIndividual) where (each.clinical_status != dead); @@ -111,7 +113,13 @@ species BuildingIndividual parent: AbstractIndividual skills: [moving] schedule if flip(proba) { do infect_someone(succesful_contact); - + if (succesful_contact.current_room.type = "restaurant") { + infection_restaurant <- infection_restaurant + 1; + } + if (succesful_contact.current_room.type = "office") { + infection_office <- infection_office + 1; + } + infection_direct <- infection_direct + 1; } } diff --git a/COMOKIT/Micro/Models/Global.gaml b/COMOKIT/Micro/Models/Global.gaml index 9c3be81..defc11e 100644 --- a/COMOKIT/Micro/Models/Global.gaml +++ b/COMOKIT/Micro/Models/Global.gaml @@ -162,7 +162,8 @@ global { //map> rooms_type <- Room group_by each.type; do create_individuals; - + ventilation_viral_decrease <- ventilated_viral_air_decrease_per_day; + do init_epidemiological_parameters; do init_sars_cov_2; viral_agent <- viruses first_with (each.name = variant); diff --git a/COMOKIT/Micro/Models/Parameters.gaml b/COMOKIT/Micro/Models/Parameters.gaml index 984b839..1edeb77 100644 --- a/COMOKIT/Micro/Models/Parameters.gaml +++ b/COMOKIT/Micro/Models/Parameters.gaml @@ -23,14 +23,14 @@ global { //EPIDEMIOLOGIC PARAMETERS string variant <- DELTA; - float infectionDistance <- 1.5#m; + float infectionDistance <- 1.4#m; float unit_cell_size <- 1#m; - - float basic_viral_air_increase_per_day <- 2.0; - float basic_viral_local_increase_per_day <- 1.0; - float basic_viral_air_decrease_per_day <- 0.3; - float basic_viral_local_decrease_per_day <- 0.3; - float ventilated_viral_air_decrease_per_day <- 1.8; + + float basic_viral_air_increase_per_day <- 1.0; + float basic_viral_local_increase_per_day <- 0.8; + float basic_viral_air_decrease_per_day <- 0.2; + float basic_viral_local_decrease_per_day <- 0.5; + float ventilated_viral_air_decrease_per_day <- 100.0; bool allow_air_transmission <- true; bool allow_direct_transmission <- true;