From 1945dd7524cee6cd50ab0143bb67e3637b016dbe Mon Sep 17 00:00:00 2001 From: Jakob Rehmann Date: Tue, 20 Aug 2024 15:27:45 +0200 Subject: [PATCH] removed scenario specific files from matsim-episim-libs --- pom.xml | 38 + scenarios/BerlinBrandenburg.mk | 160 --- scenarios/BerlinWeek.mk | 149 -- scenarios/Cologne.mk | 57 - scenarios/Dresden.mk | 54 - scenarios/Germany.mk | 27 - scenarios/Heinsberg.mk | 83 -- scenarios/MunichWeek.mk.off | 45 - .../episim/analysis/CreateODMatrix.java | 1 - .../analysis}/DistrictLookup.java | 2 +- .../listener/HouseholdSusceptibility.java | 2 +- src/main/java/org/matsim/run/KnRunEpisim.java | 456 ------ src/main/java/org/matsim/run/RunEpisim.java | 6 +- .../java/org/matsim/run/ScenarioCreation.java | 53 - .../java/org/matsim/run/batch/BMBF210430.java | 314 ---- .../java/org/matsim/run/batch/BMBF210521.java | 298 ---- .../matsim/run/batch/BMBF210618Mutations.java | 311 ---- .../java/org/matsim/run/batch/BMBF210716.java | 312 ---- .../java/org/matsim/run/batch/BMBF210827.java | 520 ------- .../java/org/matsim/run/batch/BMBF210903.java | 488 ------- .../matsim/run/batch/BMBF211119Cologne.java | 862 ----------- .../org/matsim/run/batch/Berlin220215.java | 756 ---------- .../run/batch/BerlinClusterTracing.java | 144 -- .../BerlinContactModelsAndInterventions.java | 137 -- .../org/matsim/run/batch/BerlinCurfew.java | 129 -- .../matsim/run/batch/BerlinDiseaseImport.java | 111 -- .../matsim/run/batch/BerlinDispersion.java | 61 - .../run/batch/BerlinInterventionsOct.java | 224 --- .../matsim/run/batch/BerlinOutOfSample.java | 250 ---- .../run/batch/BerlinPaperInterventions.java | 190 --- .../matsim/run/batch/BerlinPercolation.java | 214 --- .../run/batch/BerlinPublicTransport.java | 69 - .../matsim/run/batch/BerlinQuarantine.java | 67 - .../batch/BerlinSchoolClosureAndMasks.java | 152 -- .../batch/BerlinSchoolClosureAndTracing.java | 158 --- .../run/batch/BerlinSecondLockdown.java | 199 --- .../run/batch/BerlinSensitivityRuns.java | 129 -- .../run/batch/BerlinSuperSpreading.java | 73 - .../BerlinSuperSpreadingContainment.java | 97 -- .../batch/BerlinSymmetricInterventions.java | 125 -- .../matsim/run/batch/BerlinVaccinations.java | 152 -- .../batch/BerlinVaccinationsWinterEnd.java | 163 --- .../matsim/run/batch/BerlinWeekSeason.java | 78 - .../matsim/run/batch/Bmbf210924Cologne.java | 549 ------- .../matsim/run/batch/Bmbf211022Cologne.java | 755 ---------- .../org/matsim/run/batch/Calibration.java | 456 ------ .../matsim/run/batch/CologneBMBF20220805.java | 729 ---------- .../run/batch/CologneBMBF20220805_IfSG.java | 993 ------------- .../batch/CologneBMBF20220805_leisSplit.java | 1008 ------------- .../matsim/run/batch/CologneBMBF20221024.java | 692 --------- .../batch/CologneBMBF20221024_snapshot.java | 723 ---------- .../run/batch/CologneBMBF20221202_soup.java | 744 ---------- .../org/matsim/run/batch/CologneBMBF2023.java | 780 ---------- .../matsim/run/batch/CologneBMBF202302XX.java | 809 ----------- .../run/batch/CologneBMBF202310XX_soup.java | 1016 ------------- .../matsim/run/batch/CologneBMBF211219.java | 796 ----------- .../matsim/run/batch/CologneBMBF220121.java | 594 -------- .../matsim/run/batch/CologneBMBF220211.java | 637 --------- .../matsim/run/batch/CologneBMBF220217.java | 663 --------- .../run/batch/CologneBMBF220217BA2.java | 562 -------- .../matsim/run/batch/CologneBMBF220426.java | 750 ---------- .../matsim/run/batch/CologneBMBF220628.java | 605 -------- .../run/batch/CologneBMBF220628_3G.java | 756 ---------- .../matsim/run/batch/CologneCalibration.java | 533 ------- .../matsim/run/batch/CologneDistricts.java | 699 --------- .../java/org/matsim/run/batch/CologneJR.java | 771 ---------- .../org/matsim/run/batch/CologneOmicron.java | 756 ---------- .../java/org/matsim/run/batch/CologneSM.java | 740 ---------- .../matsim/run/batch/CologneScenarioHub.java | 403 ------ .../batch/CologneVaryHhSusceptibility.java | 594 -------- .../org/matsim/run/batch/ContactModels.java | 117 -- .../matsim/run/batch/DresdenCalibration.java | 84 -- .../java/org/matsim/run/batch/EventSizes.java | 129 -- .../batch/HeinsbergSchoolClosureAndMasks.java | 141 -- .../matsim/run/batch/HolidayReturnees.java | 122 -- .../org/matsim/run/batch/InterventionMix.java | 111 -- .../org/matsim/run/batch/Interventions.java | 269 ---- .../matsim/run/batch/Interventions2004.java | 231 --- .../java/org/matsim/run/batch/JRBatch.java | 63 - .../java/org/matsim/run/batch/KNBatch.java | 118 -- .../matsim/run/batch/MunichDiseaseImport.java | 201 --- .../org/matsim/run/batch/ParamsBatch.java | 73 - .../org/matsim/run/batch/Percolation.java | 84 -- .../org/matsim/run/batch/PtInterventions.java | 142 -- .../org/matsim/run/batch/RCalculator.java | 281 ---- .../matsim/run/batch/RestrictGroupSizes.java | 158 --- .../matsim/run/batch/SMAdaptivePolicy.java | 214 --- .../java/org/matsim/run/batch/SMBatch.java | 191 --- .../org/matsim/run/batch/SMCalibration.java | 113 -- .../java/org/matsim/run/batch/SMTesting.java | 390 ----- .../org/matsim/run/batch/SchoolClosure.java | 109 -- .../matsim/run/batch/SecondWavePotential.java | 82 -- .../org/matsim/run/batch/StabilityRuns.java | 66 - .../run/batch/StartFromImmunizations.java | 155 -- .../matsim/run/batch/StarterBatchBerlin.java | 120 -- .../matsim/run/batch/StarterBatchCologne.java | 136 -- .../org/matsim/run/batch/StrainPaper.java | 131 -- .../run/batch/StrainPaperAdaptivePolicy.java | 260 ---- .../java/org/matsim/run/batch/UtilsJR.java | 209 --- .../run/batch/VaccinationAcceptance.java | 228 --- .../run/modules/AbstractSnzScenario.java | 87 -- .../modules/SnzBerlinScenario100pct2020.java | 89 -- .../SnzBerlinSuperSpreaderScenario.java | 171 --- .../modules/SnzBerlinWeekScenario2020.java | 328 ----- .../modules/SnzCologneProductionScenario.java | 1263 ----------------- .../run/modules/SnzDresdenScenario.java | 228 --- .../run/modules/SnzGermanyScenario.java | 318 ----- .../run/modules/SnzHeinsbergScenario.java | 92 -- .../modules/SnzMunichScenario25pct2020.java | 204 --- .../SnzMunichWeekScenario2020Symmetric.java | 224 --- .../scenarioCreation/BuildSchoolPlans.java | 197 --- .../ConvertPersonAttributes.java | 217 --- .../scenarioCreation/CreateStayHomePlans.java | 68 - .../scenarioCreation/CreateVehicleFiles.java | 87 -- .../scenarioCreation/CreationUtils.java | 53 - ...ulationFitting2UseCaseAdultPopulation.java | 214 --- ...tiateLeisureActivitiesInEventsCologne.java | 180 --- .../scenarioCreation/DownSampleScenario.java | 160 --- .../DownloadGoogleMobilityReport.java | 129 -- .../DownloadVaccinationData.java | 105 -- .../scenarioCreation/DownloadWeatherData.java | 116 -- .../matsim/scenarioCreation/EducFacility.java | 203 --- .../scenarioCreation/ExtractContacts.java | 129 -- .../ExtractPersonIdsToTxt.java | 77 - .../FilterEducFacilitiesForCertainArea.java | 197 --- .../matsim/scenarioCreation/FilterEvents.java | 122 -- .../scenarioCreation/FilterHandler.java | 156 -- .../scenarioCreation/FilterPersons.java | 206 --- .../matsim/scenarioCreation/MergeEvents.java | 93 -- .../ReducePopulationAttributesFile.java | 96 -- .../matsim/scenarioCreation/RunMATSim.java | 90 -- .../org/matsim/scenarioCreation/RunTrial.java | 302 ---- .../matsim/scenarioCreation/SearchAgents.java | 85 -- .../scenarioCreation/SplitHomeFacilities.java | 373 ----- .../ZipcodeAndSubdistrictLookup.java | 212 --- .../java/org/matsim/scenarioCreation/info.txt | 47 - .../AssignChildrenToParentHomeLocations.java | 223 --- ...olPopulationFromCorineLandCoverCoords.java | 145 -- .../org/matsim/episim}/SyntheticBatch.java | 5 +- .../org/matsim/episim}/SyntheticScenario.java | 8 +- .../org/matsim/run/RunEpisimSnapshotTest.java | 1 + .../org/matsim/run/RunSnzIntegrationTest.java | 6 +- .../run/modules/AbstractSnzScenario2020.java | 1 - .../run/modules/OpenBerlinScenario.java | 0 .../modules/SnzBerlinProductionScenario.java | 18 +- .../modules/SnzBerlinScenario25pct2020.java | 1 - .../run/modules/SnzProductionScenario.java | 5 +- .../run/modules/SyntheticScenarioTest.java | 3 +- 148 files changed, 61 insertions(+), 39030 deletions(-) delete mode 100644 scenarios/BerlinBrandenburg.mk delete mode 100644 scenarios/BerlinWeek.mk delete mode 100644 scenarios/Cologne.mk delete mode 100644 scenarios/Dresden.mk delete mode 100644 scenarios/Germany.mk delete mode 100644 scenarios/Heinsberg.mk delete mode 100644 scenarios/MunichWeek.mk.off rename src/main/java/org/matsim/{scenarioCreation => episim/analysis}/DistrictLookup.java (99%) delete mode 100644 src/main/java/org/matsim/run/KnRunEpisim.java delete mode 100644 src/main/java/org/matsim/run/ScenarioCreation.java delete mode 100644 src/main/java/org/matsim/run/batch/BMBF210430.java delete mode 100644 src/main/java/org/matsim/run/batch/BMBF210521.java delete mode 100644 src/main/java/org/matsim/run/batch/BMBF210618Mutations.java delete mode 100644 src/main/java/org/matsim/run/batch/BMBF210716.java delete mode 100644 src/main/java/org/matsim/run/batch/BMBF210827.java delete mode 100644 src/main/java/org/matsim/run/batch/BMBF210903.java delete mode 100644 src/main/java/org/matsim/run/batch/BMBF211119Cologne.java delete mode 100644 src/main/java/org/matsim/run/batch/Berlin220215.java delete mode 100644 src/main/java/org/matsim/run/batch/BerlinClusterTracing.java delete mode 100644 src/main/java/org/matsim/run/batch/BerlinContactModelsAndInterventions.java delete mode 100644 src/main/java/org/matsim/run/batch/BerlinCurfew.java delete mode 100644 src/main/java/org/matsim/run/batch/BerlinDiseaseImport.java delete mode 100644 src/main/java/org/matsim/run/batch/BerlinDispersion.java delete mode 100644 src/main/java/org/matsim/run/batch/BerlinInterventionsOct.java delete mode 100644 src/main/java/org/matsim/run/batch/BerlinOutOfSample.java delete mode 100644 src/main/java/org/matsim/run/batch/BerlinPaperInterventions.java delete mode 100644 src/main/java/org/matsim/run/batch/BerlinPercolation.java delete mode 100644 src/main/java/org/matsim/run/batch/BerlinPublicTransport.java delete mode 100644 src/main/java/org/matsim/run/batch/BerlinQuarantine.java delete mode 100644 src/main/java/org/matsim/run/batch/BerlinSchoolClosureAndMasks.java delete mode 100644 src/main/java/org/matsim/run/batch/BerlinSchoolClosureAndTracing.java delete mode 100644 src/main/java/org/matsim/run/batch/BerlinSecondLockdown.java delete mode 100644 src/main/java/org/matsim/run/batch/BerlinSensitivityRuns.java delete mode 100644 src/main/java/org/matsim/run/batch/BerlinSuperSpreading.java delete mode 100644 src/main/java/org/matsim/run/batch/BerlinSuperSpreadingContainment.java delete mode 100644 src/main/java/org/matsim/run/batch/BerlinSymmetricInterventions.java delete mode 100644 src/main/java/org/matsim/run/batch/BerlinVaccinations.java delete mode 100644 src/main/java/org/matsim/run/batch/BerlinVaccinationsWinterEnd.java delete mode 100644 src/main/java/org/matsim/run/batch/BerlinWeekSeason.java delete mode 100644 src/main/java/org/matsim/run/batch/Bmbf210924Cologne.java delete mode 100644 src/main/java/org/matsim/run/batch/Bmbf211022Cologne.java delete mode 100644 src/main/java/org/matsim/run/batch/Calibration.java delete mode 100644 src/main/java/org/matsim/run/batch/CologneBMBF20220805.java delete mode 100644 src/main/java/org/matsim/run/batch/CologneBMBF20220805_IfSG.java delete mode 100644 src/main/java/org/matsim/run/batch/CologneBMBF20220805_leisSplit.java delete mode 100644 src/main/java/org/matsim/run/batch/CologneBMBF20221024.java delete mode 100644 src/main/java/org/matsim/run/batch/CologneBMBF20221024_snapshot.java delete mode 100644 src/main/java/org/matsim/run/batch/CologneBMBF20221202_soup.java delete mode 100644 src/main/java/org/matsim/run/batch/CologneBMBF2023.java delete mode 100644 src/main/java/org/matsim/run/batch/CologneBMBF202302XX.java delete mode 100644 src/main/java/org/matsim/run/batch/CologneBMBF202310XX_soup.java delete mode 100644 src/main/java/org/matsim/run/batch/CologneBMBF211219.java delete mode 100644 src/main/java/org/matsim/run/batch/CologneBMBF220121.java delete mode 100644 src/main/java/org/matsim/run/batch/CologneBMBF220211.java delete mode 100644 src/main/java/org/matsim/run/batch/CologneBMBF220217.java delete mode 100644 src/main/java/org/matsim/run/batch/CologneBMBF220217BA2.java delete mode 100644 src/main/java/org/matsim/run/batch/CologneBMBF220426.java delete mode 100644 src/main/java/org/matsim/run/batch/CologneBMBF220628.java delete mode 100644 src/main/java/org/matsim/run/batch/CologneBMBF220628_3G.java delete mode 100644 src/main/java/org/matsim/run/batch/CologneCalibration.java delete mode 100644 src/main/java/org/matsim/run/batch/CologneDistricts.java delete mode 100644 src/main/java/org/matsim/run/batch/CologneJR.java delete mode 100644 src/main/java/org/matsim/run/batch/CologneOmicron.java delete mode 100644 src/main/java/org/matsim/run/batch/CologneSM.java delete mode 100644 src/main/java/org/matsim/run/batch/CologneScenarioHub.java delete mode 100644 src/main/java/org/matsim/run/batch/CologneVaryHhSusceptibility.java delete mode 100644 src/main/java/org/matsim/run/batch/ContactModels.java delete mode 100644 src/main/java/org/matsim/run/batch/DresdenCalibration.java delete mode 100644 src/main/java/org/matsim/run/batch/EventSizes.java delete mode 100644 src/main/java/org/matsim/run/batch/HeinsbergSchoolClosureAndMasks.java delete mode 100644 src/main/java/org/matsim/run/batch/HolidayReturnees.java delete mode 100644 src/main/java/org/matsim/run/batch/InterventionMix.java delete mode 100644 src/main/java/org/matsim/run/batch/Interventions.java delete mode 100644 src/main/java/org/matsim/run/batch/Interventions2004.java delete mode 100644 src/main/java/org/matsim/run/batch/JRBatch.java delete mode 100644 src/main/java/org/matsim/run/batch/KNBatch.java delete mode 100644 src/main/java/org/matsim/run/batch/MunichDiseaseImport.java delete mode 100644 src/main/java/org/matsim/run/batch/ParamsBatch.java delete mode 100644 src/main/java/org/matsim/run/batch/Percolation.java delete mode 100644 src/main/java/org/matsim/run/batch/PtInterventions.java delete mode 100644 src/main/java/org/matsim/run/batch/RCalculator.java delete mode 100644 src/main/java/org/matsim/run/batch/RestrictGroupSizes.java delete mode 100644 src/main/java/org/matsim/run/batch/SMAdaptivePolicy.java delete mode 100644 src/main/java/org/matsim/run/batch/SMBatch.java delete mode 100644 src/main/java/org/matsim/run/batch/SMCalibration.java delete mode 100644 src/main/java/org/matsim/run/batch/SMTesting.java delete mode 100644 src/main/java/org/matsim/run/batch/SchoolClosure.java delete mode 100644 src/main/java/org/matsim/run/batch/SecondWavePotential.java delete mode 100644 src/main/java/org/matsim/run/batch/StabilityRuns.java delete mode 100644 src/main/java/org/matsim/run/batch/StartFromImmunizations.java delete mode 100644 src/main/java/org/matsim/run/batch/StarterBatchBerlin.java delete mode 100644 src/main/java/org/matsim/run/batch/StarterBatchCologne.java delete mode 100644 src/main/java/org/matsim/run/batch/StrainPaper.java delete mode 100644 src/main/java/org/matsim/run/batch/StrainPaperAdaptivePolicy.java delete mode 100644 src/main/java/org/matsim/run/batch/UtilsJR.java delete mode 100644 src/main/java/org/matsim/run/batch/VaccinationAcceptance.java delete mode 100644 src/main/java/org/matsim/run/modules/AbstractSnzScenario.java delete mode 100644 src/main/java/org/matsim/run/modules/SnzBerlinScenario100pct2020.java delete mode 100644 src/main/java/org/matsim/run/modules/SnzBerlinSuperSpreaderScenario.java delete mode 100644 src/main/java/org/matsim/run/modules/SnzBerlinWeekScenario2020.java delete mode 100644 src/main/java/org/matsim/run/modules/SnzCologneProductionScenario.java delete mode 100644 src/main/java/org/matsim/run/modules/SnzDresdenScenario.java delete mode 100644 src/main/java/org/matsim/run/modules/SnzGermanyScenario.java delete mode 100644 src/main/java/org/matsim/run/modules/SnzHeinsbergScenario.java delete mode 100644 src/main/java/org/matsim/run/modules/SnzMunichScenario25pct2020.java delete mode 100644 src/main/java/org/matsim/run/modules/SnzMunichWeekScenario2020Symmetric.java delete mode 100644 src/main/java/org/matsim/scenarioCreation/BuildSchoolPlans.java delete mode 100644 src/main/java/org/matsim/scenarioCreation/ConvertPersonAttributes.java delete mode 100644 src/main/java/org/matsim/scenarioCreation/CreateStayHomePlans.java delete mode 100644 src/main/java/org/matsim/scenarioCreation/CreateVehicleFiles.java delete mode 100644 src/main/java/org/matsim/scenarioCreation/CreationUtils.java delete mode 100644 src/main/java/org/matsim/scenarioCreation/CutSchoolPopulationFitting2UseCaseAdultPopulation.java delete mode 100644 src/main/java/org/matsim/scenarioCreation/DifferentiateLeisureActivitiesInEventsCologne.java delete mode 100644 src/main/java/org/matsim/scenarioCreation/DownSampleScenario.java delete mode 100644 src/main/java/org/matsim/scenarioCreation/DownloadGoogleMobilityReport.java delete mode 100644 src/main/java/org/matsim/scenarioCreation/DownloadVaccinationData.java delete mode 100644 src/main/java/org/matsim/scenarioCreation/DownloadWeatherData.java delete mode 100644 src/main/java/org/matsim/scenarioCreation/EducFacility.java delete mode 100644 src/main/java/org/matsim/scenarioCreation/ExtractContacts.java delete mode 100644 src/main/java/org/matsim/scenarioCreation/ExtractPersonIdsToTxt.java delete mode 100644 src/main/java/org/matsim/scenarioCreation/FilterEducFacilitiesForCertainArea.java delete mode 100644 src/main/java/org/matsim/scenarioCreation/FilterEvents.java delete mode 100644 src/main/java/org/matsim/scenarioCreation/FilterHandler.java delete mode 100644 src/main/java/org/matsim/scenarioCreation/FilterPersons.java delete mode 100644 src/main/java/org/matsim/scenarioCreation/MergeEvents.java delete mode 100644 src/main/java/org/matsim/scenarioCreation/ReducePopulationAttributesFile.java delete mode 100644 src/main/java/org/matsim/scenarioCreation/RunMATSim.java delete mode 100644 src/main/java/org/matsim/scenarioCreation/RunTrial.java delete mode 100644 src/main/java/org/matsim/scenarioCreation/SearchAgents.java delete mode 100644 src/main/java/org/matsim/scenarioCreation/SplitHomeFacilities.java delete mode 100644 src/main/java/org/matsim/scenarioCreation/ZipcodeAndSubdistrictLookup.java delete mode 100644 src/main/java/org/matsim/scenarioCreation/info.txt delete mode 100644 src/main/java/org/matsim/scenarioCreation/openBerlinScenario/AssignChildrenToParentHomeLocations.java delete mode 100644 src/main/java/org/matsim/scenarioCreation/openBerlinScenario/CreateSchoolPopulationFromCorineLandCoverCoords.java rename src/{main/java/org/matsim/run/batch => test/java/org/matsim/episim}/SyntheticBatch.java (96%) rename src/{main/java/org/matsim/run/modules => test/java/org/matsim/episim}/SyntheticScenario.java (97%) rename src/{main => test}/java/org/matsim/run/modules/AbstractSnzScenario2020.java (99%) rename src/{main => test}/java/org/matsim/run/modules/OpenBerlinScenario.java (100%) rename src/{main => test}/java/org/matsim/run/modules/SnzBerlinProductionScenario.java (96%) rename src/{main => test}/java/org/matsim/run/modules/SnzBerlinScenario25pct2020.java (99%) rename src/{main => test}/java/org/matsim/run/modules/SnzProductionScenario.java (99%) diff --git a/pom.xml b/pom.xml index 8433cdd08..98789b20d 100644 --- a/pom.xml +++ b/pom.xml @@ -431,9 +431,47 @@ + + + org.jacoco + jacoco-maven-plugin + 0.8.8 + + + + prepare-agent + + + + report + test + + report + + + + + + + + + org.jacoco + jacoco-maven-plugin + + + + + report + + + + + + + release diff --git a/scenarios/BerlinBrandenburg.mk b/scenarios/BerlinBrandenburg.mk deleted file mode 100644 index ee49af71d..000000000 --- a/scenarios/BerlinBrandenburg.mk +++ /dev/null @@ -1,160 +0,0 @@ -# To run this, you need a newer version of make. 4.4.1 works (in macOS under the command of gmake) -# To run, execute "gmake BerlinBrandenburg" in terminal -in = $(WD)/snz/BerlinBrandenburg/original-data -out = $(WD)/snz/BerlinBrandenburg/episim-input -tmp = $(WD)/snz/BerlinBrandenburg/processed-data - -BerlinBrandenburg: $(JAR) $(out)/bb_2020-week_snz_episim_events_wt_25pt_split.xml.gz $(out)/bb_2020-week_snz_entirePopulation_emptyPlans_withDistricts_25pt_split.xml.gz \ -$(out)/bb_2020-week_snz_episim_events_wt_100pt_split.xml.gz $(out)/bb_2020-week_snz_entirePopulation_emptyPlans_withDistricts_100pt_split.xml.gz - echo "Building Berlin Brandenburg Week scenario" - -BerlinBrandenburgSamples: $(JAR) $(out)/samples/bb_2020-week_snz_episim_events_wt_10pt_split.xml.gz $(out)/samples/bb_2020-week_snz_episim_events_wt_5pt_split.xml.gz \ -$(out)/samples/bb_2020-week_snz_episim_events_wt_1pt_split.xml.gz - echo "Building Berlin Brandenburg Week samples" - -$(tmp)/personIds.diluted.txt.gz: - $(sc) filterPersons $(in)/de2020gsmwt_events_reduced.xml.gz\ - --facilities $(in)/facilities_assigned_simplified.xml.gz\ - --attributes $(in)/populationAttributes.xml.gz\ - --shape-file $(out)/shape-File/BerlinBrandenburg.shp\ - --shape-crs EPSG:25833\ - --output $@ - - - -$(out)/bb_2020-week_snz_entirePopulation_emptyPlans_100pt.xml.gz: $(tmp)/personIds.diluted.txt.gz - $(sc) convertPersonAttributes $(in)/populationAttributes.xml.gz\ - --ids $<\ - --requireAttribute "microm:modeled:age"\ - --output $@ - -$(out)/bb_2020-week_snz_entirePopulation_emptyPlans_withDistricts_100pt.xml.gz: $(out)/bb_2020-week_snz_entirePopulation_emptyPlans_100pt.xml.gz - $(sc) districtLookup $<\ - --output $@\ - --shp ../public-svn/matsim/scenarios/countries/de/episim/original-data/landkreise-in-germany/landkreise-in-germany.shp - -######## -# 25pct -######## - -$(out)/bb_2020-week_snz_entirePopulation_emptyPlans_withDistricts_25pt.xml.gz $(out)/bb_2020-week_snz_episim_events_wt_25pt.xml.gz &: \ -$(out)/bb_2020-week_snz_entirePopulation_emptyPlans_withDistricts_100pt.xml.gz - $(sc) downSample 0.25\ - --population $<\ - --events $(in)/de2020gsmwt_events_reduced.xml.gz\ - --events $(in)/de2020gsmsa_events_reduced.xml.gz\ - --events $(in)/de2020gsmso_events_reduced.xml.gz\ - --output $(tmp) - - mv $(tmp)/population0.25.xml.gz $(out)/bb_2020-week_snz_entirePopulation_emptyPlans_withDistricts_25pt.xml.gz - mv $(tmp)/de2020gsmwt_events_reduced-0.25.xml.gz $(out)/bb_2020-week_snz_episim_events_wt_25pt.xml.gz - mv $(tmp)/de2020gsmsa_events_reduced-0.25.xml.gz $(out)/bb_2020-week_snz_episim_events_sa_25pt.xml.gz - mv $(tmp)/de2020gsmso_events_reduced-0.25.xml.gz $(out)/bb_2020-week_snz_episim_events_so_25pt.xml.gz - -$(out)/bb_2020-week_snz_entirePopulation_emptyPlans_withDistricts_25pt_split.xml.gz $(out)/bb_2020-week_snz_episim_events_wt_25pt_split.xml.gz &: \ -$(out)/bb_2020-week_snz_entirePopulation_emptyPlans_withDistricts_25pt.xml.gz $(out)/bb_2020-week_snz_episim_events_wt_25pt.xml.gz - $(sc) splitHomeFacilities $<\ - --events $(out)/bb_2020-week_snz_episim_events_wt_25pt.xml.gz\ - --events $(out)/bb_2020-week_snz_episim_events_sa_25pt.xml.gz\ - --events $(out)/bb_2020-week_snz_episim_events_so_25pt.xml.gz\ - --shape-file $(out)/../shape-File/BerlinBrandenburg.shp\ - --output $(out) - -$(out)/wLeisure/bb_2020-week_snz_entirePopulation_emptyPlans_withDistricts_25pt_split.xml.gz $(out)/wLeisure/bb_2020-week_snz_episim_events_wt_25pt_split.xml.gz &: \ -$(out)/bb_2020-week_snz_entirePopulation_emptyPlans_withDistricts_25pt.xml.gz $(out)/bb_2020-week_snz_episim_events_wt_25pt.xml.gz - $(sc) splitHomeFacilities $<\ - --events $(out)/bb_2020-week_snz_episim_events_wt_25pt.xml.gz\ - --events $(out)/bb_2020-week_snz_episim_events_sa_25pt.xml.gz\ - --events $(out)/bb_2020-week_snz_episim_events_so_25pt.xml.gz\ - --shape-file $(out)/../shape-File/dilutionArea.shp\ - --remap visit --remap leisure\ - --output $(out)/wLeisure - -########### -# 100 pct -########### - -$(out)/bb_2020-week_snz_entirePopulation_emptyPlans_withDistricts_100pt_filtered.xml.gz $(out)/bb_2020-week_snz_episim_events_wt_100pt.xml.gz &: \ -$(out)/bb_2020-week_snz_entirePopulation_emptyPlans_withDistricts_100pt.xml.gz - $(sc) downSample 1.0\ - --population $<\ - --events $(in)/de2020gsmwt_events_reduced.xml.gz\ - --events $(in)/de2020gsmsa_events_reduced.xml.gz\ - --events $(in)/de2020gsmso_events_reduced.xml.gz\ - --output $(tmp) - - mv $(tmp)/population1.0.xml.gz $(out)/bb_2020-week_snz_entirePopulation_emptyPlans_withDistricts_100pt_filtered.xml.gz - mv $(tmp)/de2020gsmwt_events_reduced-1.0.xml.gz $(out)/bb_2020-week_snz_episim_events_wt_100pt.xml.gz - mv $(tmp)/de2020gsmsa_events_reduced-1.0.xml.gz $(out)/bb_2020-week_snz_episim_events_sa_100pt.xml.gz - mv $(tmp)/de2020gsmso_events_reduced-1.0.xml.gz $(out)/bb_2020-week_snz_episim_events_so_100pt.xml.gz - -$(out)/bb_2020-week_snz_entirePopulation_emptyPlans_withDistricts_100pt_split.xml.gz $(out)/bb_2020-week_snz_episim_events_wt_100pt_split.xml.gz &: \ -$(out)/bb_2020-week_snz_entirePopulation_emptyPlans_withDistricts_100pt_filtered.xml.gz $(out)/bb_2020-week_snz_episim_events_wt_100pt.xml.gz - $(sc) splitHomeFacilities $<\ - --events $(out)/bb_2020-week_snz_episim_events_wt_100pt.xml.gz\ - --events $(out)/bb_2020-week_snz_episim_events_sa_100pt.xml.gz\ - --events $(out)/bb_2020-week_snz_episim_events_so_100pt.xml.gz\ - --shape-file $(out)/../shape-File/dilutionArea.shp\ - --output $(out) - -################# -# 10pct 5pct 1pct -################# - - -$(out)/samples/bb_2020-week_snz_entirePopulation_emptyPlans_withDistricts_10pt.xml.gz $(out)/samples/bb_2020-week_snz_episim_events_wt_10pt.xml.gz &: \ -$(out)/bb_2020-week_snz_entirePopulation_emptyPlans_withDistricts_100pt.xml.gz - $(sc) downSample 0.1\ - --population $<\ - --events $(in)/de2020gsmwt_events_reduced.xml.gz\ - --events $(in)/de2020gsmsa_events_reduced.xml.gz\ - --events $(in)/de2020gsmso_events_reduced.xml.gz\ - --output $(tmp) - - mkdir $(out)/samples - - mv $(tmp)/population0.1.xml.gz $(out)/samples//bb_2020-week_snz_entirePopulation_emptyPlans_withDistricts_10pt.xml.gz - mv $(tmp)/de2020gsmwt_events_reduced-0.1.xml.gz $(out)/samples/bb_2020-week_snz_episim_events_wt_10pt.xml.gz - mv $(tmp)/de2020gsmsa_events_reduced-0.1.xml.gz $(out)/samples/bb_2020-week_snz_episim_events_sa_10pt.xml.gz - mv $(tmp)/de2020gsmso_events_reduced-0.1.xml.gz $(out)/samples/bb_2020-week_snz_episim_events_so_10pt.xml.gz - - -$(out)/samples/bb_2020-week_snz_entirePopulation_emptyPlans_withDistricts_5pt_split.xml.gz $(out)/samples/bb_2020-week_snz_episim_events_wt_5pt_split.xml.gz &: \ -$(out)/bb_2020-week_snz_entirePopulation_emptyPlans_withDistricts_100pt.xml.gz - $(sc) downSample 0.05\ - --population $<\ - --events $(in)/de2020gsmwt_events_reduced.xml.gz\ - --events $(in)/de2020gsmsa_events_reduced.xml.gz\ - --events $(in)/de2020gsmso_events_reduced.xml.gz\ - --output $(tmp) - - mkdir $(out)/samples - mv $(tmp)/population0.05.xml.gz $(out)/samples//bb_2020-week_snz_entirePopulation_emptyPlans_withDistricts_5pt_split.xml.gz - mv $(tmp)/de2020gsmwt_events_reduced-0.05.xml.gz $(out)/samples/bb_2020-week_snz_episim_events_wt_5pt_split.xml.gz - mv $(tmp)/de2020gsmsa_events_reduced-0.05.xml.gz $(out)/samples/bb_2020-week_snz_episim_events_sa_5pt_split.xml.gz - mv $(tmp)/de2020gsmso_events_reduced-0.05.xml.gz $(out)/samples/bb_2020-week_snz_episim_events_so_5pt_split.xml.gz - -$(out)/samples/bb_2020-week_snz_entirePopulation_emptyPlans_withDistricts_1pt_split.xml.gz $(out)/samples/bb_2020-week_snz_episim_events_wt_1pt_split.xml.gz &: \ -$(out)/bb_2020-week_snz_entirePopulation_emptyPlans_withDistricts_100pt.xml.gz - $(sc) downSample 0.01\ - --population $<\ - --events $(in)/de2020gsmwt_events_reduced.xml.gz\ - --events $(in)/de2020gsmsa_events_reduced.xml.gz\ - --events $(in)/de2020gsmso_events_reduced.xml.gz\ - --output $(tmp) - - mkdir $(out)/samples - mv $(tmp)/population0.01.xml.gz $(out)/samples//bb_2020-week_snz_entirePopulation_emptyPlans_withDistricts_1pt_split.xml.gz - mv $(tmp)/de2020gsmwt_events_reduced-0.01.xml.gz $(out)/samples/bb_2020-week_snz_episim_events_wt_1pt_split.xml.gz - mv $(tmp)/de2020gsmsa_events_reduced-0.01.xml.gz $(out)/samples/bb_2020-week_snz_episim_events_sa_1pt_split.xml.gz - mv $(tmp)/de2020gsmso_events_reduced-0.01.xml.gz $(out)/samples/bb_2020-week_snz_episim_events_so_1pt_split.xml.gz - - -$(out)/samples/bb_2020-week_snz_entirePopulation_emptyPlans_withDistricts_10pt_split.xml.gz $(out)/samples/bb_2020-week_snz_episim_events_wt_10pt_split.xml.gz &: \ -$(out)/samples/bb_2020-week_snz_entirePopulation_emptyPlans_withDistricts_10pt.xml.gz $(out)/samples/bb_2020-week_snz_episim_events_wt_10pt.xml.gz - $(sc) splitHomeFacilities $<\ - --events $(out)/samples/bb_2020-week_snz_episim_events_wt_10pt.xml.gz\ - --events $(out)/samples/bb_2020-week_snz_episim_events_sa_10pt.xml.gz\ - --events $(out)/samples/bb_2020-week_snz_episim_events_so_10pt.xml.gz\ - --shape-file $(out)/../shape-File/dilutionArea.shp\ - --output $(out)/samples \ No newline at end of file diff --git a/scenarios/BerlinWeek.mk b/scenarios/BerlinWeek.mk deleted file mode 100644 index 6b32553ff..000000000 --- a/scenarios/BerlinWeek.mk +++ /dev/null @@ -1,149 +0,0 @@ - -in = $(WD)/snz/BerlinV2/original-data -out = $(WD)/snz/BerlinV2/episim-input -tmp = $(WD)/snz/BerlinV2/processed-data - -BerlinWeek: $(JAR) $(out)/be_2020-week_snz_episim_events_wt_25pt_split.xml.gz $(out)/be_2020-week_snz_entirePopulation_emptyPlans_withDistricts_25pt_split.xml.gz \ -$(out)/be_2020-week_snz_episim_events_wt_100pt_split.xml.gz $(out)/be_2020-week_snz_entirePopulation_emptyPlans_withDistricts_100pt_split.xml.gz - echo "Building Berlin Week scenario" - -BerlinWeekSamples: $(JAR) $(out)/samples/be_2020-week_snz_episim_events_wt_10pt_split.xml.gz $(out)/samples/be_2020-week_snz_episim_events_wt_5pt_split.xml.gz \ -$(out)/samples/be_2020-week_snz_episim_events_wt_1pt_split.xml.gz - echo "Building Berlin Week samples" - -$(out)/be_2020-week_snz_entirePopulation_emptyPlans_100pt.xml.gz: - $(sc) convertPersonAttributes $(in)/populationAttributes.xml.gz\ - --ids $(in)/berlin_umland_wt/personIds.diluted.txt.gz\ - --requireAttribute "microm:modeled:age"\ - --output $@ - -$(out)/be_2020-week_snz_entirePopulation_emptyPlans_withDistricts_100pt.xml.gz: $(out)/be_2020-week_snz_entirePopulation_emptyPlans_100pt.xml.gz - $(sc) districtLookup $<\ - --output $@\ - --shp ../public-svn/matsim/scenarios/countries/de/episim/original-data/landkreise-in-germany/landkreise-in-germany.shp - -######## -# 25pct -######## - -$(out)/be_2020-week_snz_entirePopulation_emptyPlans_withDistricts_25pt.xml.gz $(out)/be_2020-week_snz_episim_events_wt_25pt.xml.gz &: \ -$(out)/be_2020-week_snz_entirePopulation_emptyPlans_withDistricts_100pt.xml.gz - $(sc) downSample 0.25\ - --population $<\ - --events $(in)/de2020gsmwt_events_reduced.xml.gz\ - --events $(in)/de2020gsmsa_events_reduced.xml.gz\ - --events $(in)/de2020gsmso_events_reduced.xml.gz\ - --output $(tmp) - - mv $(tmp)/population0.25.xml.gz $(out)/be_2020-week_snz_entirePopulation_emptyPlans_withDistricts_25pt.xml.gz - mv $(tmp)/de2020gsmwt_events_reduced-0.25.xml.gz $(out)/be_2020-week_snz_episim_events_wt_25pt.xml.gz - mv $(tmp)/de2020gsmsa_events_reduced-0.25.xml.gz $(out)/be_2020-week_snz_episim_events_sa_25pt.xml.gz - mv $(tmp)/de2020gsmso_events_reduced-0.25.xml.gz $(out)/be_2020-week_snz_episim_events_so_25pt.xml.gz - -$(out)/be_2020-week_snz_entirePopulation_emptyPlans_withDistricts_25pt_split.xml.gz $(out)/be_2020-week_snz_episim_events_wt_25pt_split.xml.gz &: \ -$(out)/be_2020-week_snz_entirePopulation_emptyPlans_withDistricts_25pt.xml.gz $(out)/be_2020-week_snz_episim_events_wt_25pt.xml.gz - $(sc) splitHomeFacilities $<\ - --events $(out)/be_2020-week_snz_episim_events_wt_25pt.xml.gz\ - --events $(out)/be_2020-week_snz_episim_events_sa_25pt.xml.gz\ - --events $(out)/be_2020-week_snz_episim_events_so_25pt.xml.gz\ - --shape-file $(out)/../shape-File/dilutionArea.shp\ - --output $(out) - -$(out)/wLeisure/be_2020-week_snz_entirePopulation_emptyPlans_withDistricts_25pt_split.xml.gz $(out)/wLeisure/be_2020-week_snz_episim_events_wt_25pt_split.xml.gz &: \ -$(out)/be_2020-week_snz_entirePopulation_emptyPlans_withDistricts_25pt.xml.gz $(out)/be_2020-week_snz_episim_events_wt_25pt.xml.gz - $(sc) splitHomeFacilities $<\ - --events $(out)/be_2020-week_snz_episim_events_wt_25pt.xml.gz\ - --events $(out)/be_2020-week_snz_episim_events_sa_25pt.xml.gz\ - --events $(out)/be_2020-week_snz_episim_events_so_25pt.xml.gz\ - --shape-file $(out)/../shape-File/dilutionArea.shp\ - --remap visit --remap leisure\ - --output $(out)/wLeisure - -########### -# 100 pct -########### - -$(out)/be_2020-week_snz_entirePopulation_emptyPlans_withDistricts_100pt_filtered.xml.gz $(out)/be_2020-week_snz_episim_events_wt_100pt.xml.gz &: \ -$(out)/be_2020-week_snz_entirePopulation_emptyPlans_withDistricts_100pt.xml.gz - $(sc) downSample 1.0\ - --population $<\ - --events $(in)/de2020gsmwt_events_reduced.xml.gz\ - --events $(in)/de2020gsmsa_events_reduced.xml.gz\ - --events $(in)/de2020gsmso_events_reduced.xml.gz\ - --output $(tmp) - - mv $(tmp)/population1.0.xml.gz $(out)/be_2020-week_snz_entirePopulation_emptyPlans_withDistricts_100pt_filtered.xml.gz - mv $(tmp)/de2020gsmwt_events_reduced-1.0.xml.gz $(out)/be_2020-week_snz_episim_events_wt_100pt.xml.gz - mv $(tmp)/de2020gsmsa_events_reduced-1.0.xml.gz $(out)/be_2020-week_snz_episim_events_sa_100pt.xml.gz - mv $(tmp)/de2020gsmso_events_reduced-1.0.xml.gz $(out)/be_2020-week_snz_episim_events_so_100pt.xml.gz - -$(out)/be_2020-week_snz_entirePopulation_emptyPlans_withDistricts_100pt_split.xml.gz $(out)/be_2020-week_snz_episim_events_wt_100pt_split.xml.gz &: \ -$(out)/be_2020-week_snz_entirePopulation_emptyPlans_withDistricts_100pt_filtered.xml.gz $(out)/be_2020-week_snz_episim_events_wt_100pt.xml.gz - $(sc) splitHomeFacilities $<\ - --events $(out)/be_2020-week_snz_episim_events_wt_100pt.xml.gz\ - --events $(out)/be_2020-week_snz_episim_events_sa_100pt.xml.gz\ - --events $(out)/be_2020-week_snz_episim_events_so_100pt.xml.gz\ - --shape-file $(out)/../shape-File/dilutionArea.shp\ - --output $(out) - -################# -# 10pct 5pct 1pct -################# - - -$(out)/samples/be_2020-week_snz_entirePopulation_emptyPlans_withDistricts_10pt.xml.gz $(out)/samples/be_2020-week_snz_episim_events_wt_10pt.xml.gz &: \ -$(out)/be_2020-week_snz_entirePopulation_emptyPlans_withDistricts_100pt.xml.gz - $(sc) downSample 0.1\ - --population $<\ - --events $(in)/de2020gsmwt_events_reduced.xml.gz\ - --events $(in)/de2020gsmsa_events_reduced.xml.gz\ - --events $(in)/de2020gsmso_events_reduced.xml.gz\ - --output $(tmp) - - mkdir $(out)/samples - - mv $(tmp)/population0.1.xml.gz $(out)/samples//be_2020-week_snz_entirePopulation_emptyPlans_withDistricts_10pt.xml.gz - mv $(tmp)/de2020gsmwt_events_reduced-0.1.xml.gz $(out)/samples/be_2020-week_snz_episim_events_wt_10pt.xml.gz - mv $(tmp)/de2020gsmsa_events_reduced-0.1.xml.gz $(out)/samples/be_2020-week_snz_episim_events_sa_10pt.xml.gz - mv $(tmp)/de2020gsmso_events_reduced-0.1.xml.gz $(out)/samples/be_2020-week_snz_episim_events_so_10pt.xml.gz - - -$(out)/samples/be_2020-week_snz_entirePopulation_emptyPlans_withDistricts_5pt_split.xml.gz $(out)/samples/be_2020-week_snz_episim_events_wt_5pt_split.xml.gz &: \ -$(out)/be_2020-week_snz_entirePopulation_emptyPlans_withDistricts_100pt.xml.gz - $(sc) downSample 0.05\ - --population $<\ - --events $(in)/de2020gsmwt_events_reduced.xml.gz\ - --events $(in)/de2020gsmsa_events_reduced.xml.gz\ - --events $(in)/de2020gsmso_events_reduced.xml.gz\ - --output $(tmp) - - mkdir $(out)/samples - mv $(tmp)/population0.05.xml.gz $(out)/samples//be_2020-week_snz_entirePopulation_emptyPlans_withDistricts_5pt_split.xml.gz - mv $(tmp)/de2020gsmwt_events_reduced-0.05.xml.gz $(out)/samples/be_2020-week_snz_episim_events_wt_5pt_split.xml.gz - mv $(tmp)/de2020gsmsa_events_reduced-0.05.xml.gz $(out)/samples/be_2020-week_snz_episim_events_sa_5pt_split.xml.gz - mv $(tmp)/de2020gsmso_events_reduced-0.05.xml.gz $(out)/samples/be_2020-week_snz_episim_events_so_5pt_split.xml.gz - -$(out)/samples/be_2020-week_snz_entirePopulation_emptyPlans_withDistricts_1pt_split.xml.gz $(out)/samples/be_2020-week_snz_episim_events_wt_1pt_split.xml.gz &: \ -$(out)/be_2020-week_snz_entirePopulation_emptyPlans_withDistricts_100pt.xml.gz - $(sc) downSample 0.01\ - --population $<\ - --events $(in)/de2020gsmwt_events_reduced.xml.gz\ - --events $(in)/de2020gsmsa_events_reduced.xml.gz\ - --events $(in)/de2020gsmso_events_reduced.xml.gz\ - --output $(tmp) - - mkdir $(out)/samples - mv $(tmp)/population0.01.xml.gz $(out)/samples//be_2020-week_snz_entirePopulation_emptyPlans_withDistricts_1pt_split.xml.gz - mv $(tmp)/de2020gsmwt_events_reduced-0.01.xml.gz $(out)/samples/be_2020-week_snz_episim_events_wt_1pt_split.xml.gz - mv $(tmp)/de2020gsmsa_events_reduced-0.01.xml.gz $(out)/samples/be_2020-week_snz_episim_events_sa_1pt_split.xml.gz - mv $(tmp)/de2020gsmso_events_reduced-0.01.xml.gz $(out)/samples/be_2020-week_snz_episim_events_so_1pt_split.xml.gz - - -$(out)/samples/be_2020-week_snz_entirePopulation_emptyPlans_withDistricts_10pt_split.xml.gz $(out)/samples/be_2020-week_snz_episim_events_wt_10pt_split.xml.gz &: \ -$(out)/samples/be_2020-week_snz_entirePopulation_emptyPlans_withDistricts_10pt.xml.gz $(out)/samples/be_2020-week_snz_episim_events_wt_10pt.xml.gz - $(sc) splitHomeFacilities $<\ - --events $(out)/samples/be_2020-week_snz_episim_events_wt_10pt.xml.gz\ - --events $(out)/samples/be_2020-week_snz_episim_events_sa_10pt.xml.gz\ - --events $(out)/samples/be_2020-week_snz_episim_events_so_10pt.xml.gz\ - --shape-file $(out)/../shape-File/dilutionArea.shp\ - --output $(out)/samples \ No newline at end of file diff --git a/scenarios/Cologne.mk b/scenarios/Cologne.mk deleted file mode 100644 index 4a34f37d7..000000000 --- a/scenarios/Cologne.mk +++ /dev/null @@ -1,57 +0,0 @@ - -in = $(WD)/snz/CologneV2/original-data -out = $(WD)/snz/CologneV2/episim-input -tmp = $(WD)/snz/CologneV2/processed-data - -Cologne: $(out)/cologne_snz_episim_events_wt_25pt_split.xml.gz $(out)/cologne_snz_entirePopulation_emptyPlans_withDistricts_25pt_split.xml.gz - echo "Building Cologne scenario" - -$(tmp)/personIds.diluted.txt.gz: - $(sc) filterPersons $(in)/de2020gsmwt_events_reduced.xml.gz\ - --facilities $(in)/facilities_assigned_simplified.xml.gz\ - --attributes $(in)/populationAttributes.xml.gz\ - --shape-file $(out)/../shape-File/cologne-shp.shp\ - --shape-crs EPSG:25832\ - --output $@ - -$(out)/cologne_snz_entirePopulation_emptyPlans_100pt.xml.gz: $(tmp)/personIds.diluted.txt.gz - $(sc) convertPersonAttributes $(in)/populationAttributes.xml.gz\ - --ids $<\ - --requireAttribute "microm:modeled:age"\ - --output $@ - -$(out)/cologne_snz_entirePopulation_emptyPlans_withDistricts_100pt.xml.gz: $(out)/cologne_snz_entirePopulation_emptyPlans_100pt.xml.gz - $(sc) districtLookup $<\ - --output $@\ - --shp ../public-svn/matsim/scenarios/countries/de/episim/original-data/landkreise-in-germany/landkreise-in-germany.shp - -########### -# 25 pct -########### -# https://www.destatis.de/DE/Themen/Gesellschaft-Umwelt/Bevoelkerung/Haushalte-Familien/Tabellen/1-2-privathaushalte-bundeslaender.html -# https://de.statista.com/statistik/daten/studie/1195923/umfrage/haushaltsgroessen-koeln/ - -$(out)/cologne_snz_entirePopulation_emptyPlans_withDistricts_25pt.xml.gz $(out)/cologne_snz_episim_events_wt_25pt.xml.gz &: \ -$(out)/cologne_snz_entirePopulation_emptyPlans_withDistricts_100pt.xml.gz - $(sc) downSample 0.25\ - --population $<\ - --events $(in)/de2020gsmwt_events_reduced.xml.gz\ - --events $(in)/de2020gsmsa_events_reduced.xml.gz\ - --events $(in)/de2020gsmso_events_reduced.xml.gz\ - --output $(tmp) - - mv $(tmp)/population0.25.xml.gz $(out)/cologne_snz_entirePopulation_emptyPlans_withDistricts_25pt.xml.gz - mv $(tmp)/de2020gsmwt_events_reduced-0.25.xml.gz $(out)/cologne_snz_episim_events_wt_25pt.xml.gz - mv $(tmp)/de2020gsmsa_events_reduced-0.25.xml.gz $(out)/cologne_snz_episim_events_sa_25pt.xml.gz - mv $(tmp)/de2020gsmso_events_reduced-0.25.xml.gz $(out)/cologne_snz_episim_events_so_25pt.xml.gz - -$(out)/cologne_snz_entirePopulation_emptyPlans_withDistricts_25pt_split.xml.gz $(out)/cologne_snz_episim_events_wt_25pt_split.xml.gz &: \ -$(out)/cologne_snz_entirePopulation_emptyPlans_withDistricts_25pt.xml.gz $(out)/cologne_snz_episim_events_wt_25pt.xml.gz - $(sc) splitHomeFacilities $<\ - --events $(out)/cologne_snz_episim_events_wt_25pt.xml.gz\ - --events $(out)/cologne_snz_episim_events_sa_25pt.xml.gz\ - --events $(out)/cologne_snz_episim_events_so_25pt.xml.gz\ - --target="44.9 35.2 10.4 7.4 2.1"\ - --shape-file $(out)/../shape-File/cologne-shp.shp\ - --output $(out) - diff --git a/scenarios/Dresden.mk b/scenarios/Dresden.mk deleted file mode 100644 index 8fc122697..000000000 --- a/scenarios/Dresden.mk +++ /dev/null @@ -1,54 +0,0 @@ - -in = $(WD)/snz/Dresden/original-data -out = $(WD)/snz/Dresden/episim-input -tmp = $(WD)/snz/Dresden/processed-data - -Dresden: $(out)/dresden_snz_episim_events_wt_100pt_split.xml.gz $(out)/dresden_snz_entirePopulation_emptyPlans_withDistricts_100pt_split.xml.gz - echo "Building Dresden scenario" - -$(tmp)/personIds.diluted.txt.gz: - $(sc) filterPersons $(in)/de2020gsmwt_events_reduced.xml.gz\ - --facilities $(in)/facilities_assigned_simplified.xml.gz\ - --shape-file $(out)/../shape-file/case-study_Dresden_PLZ.shp\ - --output $@ - -$(out)/dresden_snz_entirePopulation_emptyPlans_100pt.xml.gz: $(tmp)/personIds.diluted.txt.gz - $(sc) convertPersonAttributes $(in)/populationAttributes.xml.gz\ - --ids $<\ - --requireAttribute "microm:modeled:age"\ - --output $@ - -$(out)/dresden_snz_entirePopulation_emptyPlans_withDistricts_100pt.xml.gz: $(out)/dresden_snz_entirePopulation_emptyPlans_100pt.xml.gz - $(sc) districtLookup $<\ - --output $@\ - --shp ../public-svn/matsim/scenarios/countries/de/episim/original-data/landkreise-in-germany/landkreise-in-germany.shp - -########### -# 100 pct -########### -# https://www.destatis.de/DE/Themen/Gesellschaft-Umwelt/Bevoelkerung/Haushalte-Familien/Tabellen/1-2-privathaushalte-bundeslaender.html - -$(out)/dresden_snz_entirePopulation_emptyPlans_withDistricts_100pt_filtered.xml.gz $(out)/dresden_snz_episim_events_wt_100pt.xml.gz &: \ -$(out)/dresden_snz_entirePopulation_emptyPlans_withDistricts_100pt.xml.gz - $(sc) downSample 1.0\ - --population $<\ - --events $(in)/de2020gsmwt_events_reduced.xml.gz\ - --events $(in)/de2020gsmsa_events_reduced.xml.gz\ - --events $(in)/de2020gsmso_events_reduced.xml.gz\ - --output $(tmp) - - mv $(tmp)/population1.0.xml.gz $(out)/dresden_snz_entirePopulation_emptyPlans_withDistricts_100pt_filtered.xml.gz - mv $(tmp)/de2020gsmwt_events_reduced-1.0.xml.gz $(out)/dresden_snz_episim_events_wt_100pt.xml.gz - mv $(tmp)/de2020gsmsa_events_reduced-1.0.xml.gz $(out)/dresden_snz_episim_events_sa_100pt.xml.gz - mv $(tmp)/de2020gsmso_events_reduced-1.0.xml.gz $(out)/dresden_snz_episim_events_so_100pt.xml.gz - -$(out)/dresden_snz_entirePopulation_emptyPlans_withDistricts_100pt_split.xml.gz $(out)/dresden_snz_episim_events_wt_100pt_split.xml.gz &: \ -$(out)/dresden_snz_entirePopulation_emptyPlans_withDistricts_100pt_filtered.xml.gz $(out)/dresden_snz_episim_events_wt_100pt.xml.gz - $(sc) splitHomeFacilities $<\ - --events $(out)/dresden_snz_episim_events_wt_100pt.xml.gz\ - --events $(out)/dresden_snz_episim_events_sa_100pt.xml.gz\ - --events $(out)/dresden_snz_episim_events_so_100pt.xml.gz\ - --target="44.9 35.2 10.4 7.4 2.1"\ - --shape-file $(out)/../shape-file-utm32/case-study_Dresden_PLZ.shp\ - --output $(out) - diff --git a/scenarios/Germany.mk b/scenarios/Germany.mk deleted file mode 100644 index b707cc3e1..000000000 --- a/scenarios/Germany.mk +++ /dev/null @@ -1,27 +0,0 @@ - -in = $(WD)/snz/Dresden/original-data -out = $(WD)/snz/Dresden/episim-input -tmp = $(WD)/snz/Dresden/processed-data - -Germany: $(out)/germany_snz_entirePopulation_emptyPlans_withDistricts_100pt.xml.gz - echo "Building Germany scenario" - -$(out)/germany_snz_entirePopulation_emptyPlans_100pt.xml.gz: - $(sc) convertPersonAttributes $(in)/populationAttributes.xml.gz\ - --requireAttribute "microm:modeled:age"\ - --output $@ - -$(out)/germany_snz_entirePopulation_emptyPlans_withDistricts_100pt.xml.gz: $(out)/germany_snz_entirePopulation_emptyPlans_100pt.xml.gz - $(sc) districtLookup $<\ - --output $@\ - --shp ../public-svn/matsim/scenarios/countries/de/episim/original-data/landkreise-in-germany/landkreise-in-germany.shp - -$(out)/germany_snz_entirePopulation_emptyPlans_withDistricts_25pt.xml.gz: $(out)/germany_snz_entirePopulation_emptyPlans_withDistricts_100pt.xml.gz - $(sc) downSample 0.25\ - --population $<\ - --events $(in)/de2020gsmwt_events_reduced.xml.gz\ - --events $(in)/de2020gsmsa_events_reduced.xml.gz\ - --events $(in)/de2020gsmso_events_reduced.xml.gz\ - --output $(tmp) - - mv $(tmp)/population0.25.xml.gz $(out)/germany_snz_entirePopulation_emptyPlans_withDistricts_25pt.xml.gz diff --git a/scenarios/Heinsberg.mk b/scenarios/Heinsberg.mk deleted file mode 100644 index 16c2845f3..000000000 --- a/scenarios/Heinsberg.mk +++ /dev/null @@ -1,83 +0,0 @@ - -in = $(WD)/snz/Heinsberg/original-data -out = $(WD)/snz/Heinsberg/episim-input -tmp = $(WD)/snz/Heinsberg/processed-data - -Heinsberg: $(JAR) $(out)/hb_2020-week_snz_episim_events_wt_25pt_split.xml.gz $(out)/hb_2020-week_snz_entirePopulation_emptyPlans_withDistricts_25pt_split.xml.gz \ -$(out)/hb_2020-week_snz_episim_events_wt_100pt_split.xml.gz $(out)/hb_2020-week_snz_entirePopulation_emptyPlans_withDistricts_100pt_split.xml.gz - echo "Building Berlin Week scenario" - -$(out)/hb_2020-week_snz_entirePopulation_emptyPlans_100pt.xml.gz: - $(sc) convertPersonAttributes $(in)/populationAttributes.xml.gz\ - --ids $(in)/personIds.diluted.txt.gz\ - --requireAttribute "microm:modeled:age"\ - --output $@ - -$(out)/hb_2020-week_snz_entirePopulation_emptyPlans_withDistricts_100pt.xml.gz: $(out)/hb_2020-week_snz_entirePopulation_emptyPlans_100pt.xml.gz - $(sc) districtLookup $<\ - --output $@\ - --shp ../public-svn/matsim/scenarios/countries/de/episim/original-data/landkreise-in-germany/landkreise-in-germany.shp - -######## -# 25pct -######## - -$(out)/hb_2020-week_snz_entirePopulation_emptyPlans_withDistricts_25pt.xml.gz $(out)/hb_2020-week_snz_episim_events_wt_25pt.xml.gz &: \ -$(out)/hb_2020-week_snz_entirePopulation_emptyPlans_withDistricts_100pt.xml.gz - $(sc) downSample 0.25\ - --population $<\ - --events $(in)/de2020gsmwt_events_reduced.xml.gz\ - --events $(in)/de2020gsmsa_events_reduced.xml.gz\ - --events $(in)/de2020gsmso_events_reduced.xml.gz\ - --output $(tmp) - - mv $(tmp)/population0.25.xml.gz $(out)/hb_2020-week_snz_entirePopulation_emptyPlans_withDistricts_25pt.xml.gz - mv $(tmp)/de2020gsmwt_events_reduced-0.25.xml.gz $(out)/hb_2020-week_snz_episim_events_wt_25pt.xml.gz - mv $(tmp)/de2020gsmsa_events_reduced-0.25.xml.gz $(out)/hb_2020-week_snz_episim_events_sa_25pt.xml.gz - mv $(tmp)/de2020gsmso_events_reduced-0.25.xml.gz $(out)/hb_2020-week_snz_episim_events_so_25pt.xml.gz - -$(out)/hb_2020-week_snz_entirePopulation_emptyPlans_withDistricts_25pt_split.xml.gz $(out)/hb_2020-week_snz_episim_events_wt_25pt_split.xml.gz &: \ -$(out)/hb_2020-week_snz_entirePopulation_emptyPlans_withDistricts_25pt.xml.gz $(out)/hb_2020-week_snz_episim_events_wt_25pt.xml.gz - $(sc) splitHomeFacilities $<\ - --events $(out)/hb_2020-week_snz_episim_events_wt_25pt.xml.gz\ - --events $(out)/hb_2020-week_snz_episim_events_sa_25pt.xml.gz\ - --events $(out)/hb_2020-week_snz_episim_events_so_25pt.xml.gz\ - --shape-file $(in)/dilutionArea.shp\ - --output $(out) - -$(out)/wLeisure/hb_2020-week_snz_entirePopulation_emptyPlans_withDistricts_25pt_split.xml.gz $(out)/wLeisure/hb_2020-week_snz_episim_events_wt_25pt_split.xml.gz &: \ -$(out)/hb_2020-week_snz_entirePopulation_emptyPlans_withDistricts_25pt.xml.gz $(out)/hb_2020-week_snz_episim_events_wt_25pt.xml.gz - $(sc) splitHomeFacilities $<\ - --events $(out)/hb_2020-week_snz_episim_events_wt_25pt.xml.gz\ - --events $(out)/hb_2020-week_snz_episim_events_sa_25pt.xml.gz\ - --events $(out)/hb_2020-week_snz_episim_events_so_25pt.xml.gz\ - --shape-file $(in)/dilutionArea.shp\ - --remap visit\ - --output $(out)/wLeisure - -########### -# 100 pct -########### - -$(out)/hb_2020-week_snz_entirePopulation_emptyPlans_withDistricts_100pt_filtered.xml.gz $(out)/hb_2020-week_snz_episim_events_wt_100pt.xml.gz &: \ -$(out)/hb_2020-week_snz_entirePopulation_emptyPlans_withDistricts_100pt.xml.gz - $(sc) downSample 1.0\ - --population $<\ - --events $(in)/de2020gsmwt_events_reduced.xml.gz\ - --events $(in)/de2020gsmsa_events_reduced.xml.gz\ - --events $(in)/de2020gsmso_events_reduced.xml.gz\ - --output $(tmp) - - mv $(tmp)/population1.0.xml.gz $(out)/hb_2020-week_snz_entirePopulation_emptyPlans_withDistricts_100pt_filtered.xml.gz - mv $(tmp)/de2020gsmwt_events_reduced-1.0.xml.gz $(out)/hb_2020-week_snz_episim_events_wt_100pt.xml.gz - mv $(tmp)/de2020gsmsa_events_reduced-1.0.xml.gz $(out)/hb_2020-week_snz_episim_events_sa_100pt.xml.gz - mv $(tmp)/de2020gsmso_events_reduced-1.0.xml.gz $(out)/hb_2020-week_snz_episim_events_so_100pt.xml.gz - -$(out)/hb_2020-week_snz_entirePopulation_emptyPlans_withDistricts_100pt_split.xml.gz $(out)/hb_2020-week_snz_episim_events_wt_100pt_split.xml.gz &: \ -$(out)/hb_2020-week_snz_entirePopulation_emptyPlans_withDistricts_100pt_filtered.xml.gz $(out)/hb_2020-week_snz_episim_events_wt_100pt.xml.gz - $(sc) splitHomeFacilities $<\ - --events $(out)/hb_2020-week_snz_episim_events_wt_100pt.xml.gz\ - --events $(out)/hb_2020-week_snz_episim_events_sa_100pt.xml.gz\ - --events $(out)/hb_2020-week_snz_episim_events_so_100pt.xml.gz\ - --shape-file $(in)/dilutionArea.shp\ - --output $(out) \ No newline at end of file diff --git a/scenarios/MunichWeek.mk.off b/scenarios/MunichWeek.mk.off deleted file mode 100644 index 853a01676..000000000 --- a/scenarios/MunichWeek.mk.off +++ /dev/null @@ -1,45 +0,0 @@ - -in = $(WD)/snz/MunichV2/original-data -out = $(WD)/snz/MunichV2/episim-input -tmp = $(WD)/snz/MunichV2/processed-data - -MunichWeek: $(JAR) $(out)/mu_2020-week_snz_episim_events_wt_25pt_split.xml.gz $(out)/mu_2020-week_snz_entirePopulation_emptyPlans_withDistricts_25pt_split.xml.gz - echo "Building Munich Week scenario" - -$(out)/mu_2020-week_snz_entirePopulation_emptyPlans_100pt.xml.gz: - $(sc) convertPersonAttributes $(in)/populationAttributes.xml.gz\ - --ids $(in)/muenchen_umland/personIds.diluted.txt.gz\ - --requireAttribute "microm:modeled:age"\ - --output $@ - -$(out)/mu_2020-week_snz_entirePopulation_emptyPlans_withDistricts_100pt.xml.gz: $(out)/mu_2020-week_snz_entirePopulation_emptyPlans_100pt.xml.gz - $(sc) districtLookup $<\ - --output $@\ - --shp ../public-svn/matsim/scenarios/countries/de/episim/original-data/landkreise-in-germany/landkreise-in-germany.shp - -######## -# 25pct -######## - -$(out)/mu_2020-week_snz_entirePopulation_emptyPlans_withDistricts_25pt.xml.gz $(out)/mu_2020-week_snz_episim_events_wt_25pt.xml.gz &: \ -$(out)/mu_2020-week_snz_entirePopulation_emptyPlans_withDistricts_100pt.xml.gz - $(sc) downSample 0.25\ - --population $<\ - --events $(in)/de2020gsmwt_events_reduced.xml.gz\ - --events $(in)/de2020gsmsa_events_reduced.xml.gz\ - --events $(in)/de2020gsmso_events_reduced.xml.gz\ - --output $(tmp) - - mv $(tmp)/population0.25.xml.gz $(out)/mu_2020-week_snz_entirePopulation_emptyPlans_withDistricts_25pt.xml.gz - mv $(tmp)/de2020gsmwt_events_reduced-0.25.xml.gz $(out)/mu_2020-week_snz_episim_events_wt_25pt.xml.gz - mv $(tmp)/de2020gsmsa_events_reduced-0.25.xml.gz $(out)/mu_2020-week_snz_episim_events_sa_25pt.xml.gz - mv $(tmp)/de2020gsmso_events_reduced-0.25.xml.gz $(out)/mu_2020-week_snz_episim_events_so_25pt.xml.gz - -$(out)/mu_2020-week_snz_entirePopulation_emptyPlans_withDistricts_25pt_split.xml.gz $(out)/mu_2020-week_snz_episim_events_wt_25pt_split.xml.gz &: \ -$(out)/mu_2020-week_snz_entirePopulation_emptyPlans_withDistricts_25pt.xml.gz $(out)/mu_2020-week_snz_episim_events_wt_25pt.xml.gz - $(sc) splitHomeFacilities $<\ - --events $(out)/mu_2020-week_snz_episim_events_wt_25pt.xml.gz\ - --events $(out)/mu_2020-week_snz_episim_events_sa_25pt.xml.gz\ - --events $(out)/mu_2020-week_snz_episim_events_so_25pt.xml.gz\ - --shape-file $(in)/muenchen_umland/dilutionArea.shp\ - --output $(out) \ No newline at end of file diff --git a/src/main/java/org/matsim/episim/analysis/CreateODMatrix.java b/src/main/java/org/matsim/episim/analysis/CreateODMatrix.java index 36a38fdd7..e880ae3b6 100644 --- a/src/main/java/org/matsim/episim/analysis/CreateODMatrix.java +++ b/src/main/java/org/matsim/episim/analysis/CreateODMatrix.java @@ -21,7 +21,6 @@ import org.matsim.core.scenario.ScenarioUtils; import org.matsim.core.utils.geometry.transformations.TransformationFactory; import org.matsim.facilities.ActivityFacility; -import org.matsim.scenarioCreation.DistrictLookup; import picocli.CommandLine; import java.io.BufferedWriter; diff --git a/src/main/java/org/matsim/scenarioCreation/DistrictLookup.java b/src/main/java/org/matsim/episim/analysis/DistrictLookup.java similarity index 99% rename from src/main/java/org/matsim/scenarioCreation/DistrictLookup.java rename to src/main/java/org/matsim/episim/analysis/DistrictLookup.java index 42e1642cc..7731ab845 100644 --- a/src/main/java/org/matsim/scenarioCreation/DistrictLookup.java +++ b/src/main/java/org/matsim/episim/analysis/DistrictLookup.java @@ -18,7 +18,7 @@ * along with this program. If not, see . * #L% */ -package org.matsim.scenarioCreation; +package org.matsim.episim.analysis; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; diff --git a/src/main/java/org/matsim/episim/model/listener/HouseholdSusceptibility.java b/src/main/java/org/matsim/episim/model/listener/HouseholdSusceptibility.java index 53478a655..1b55616ec 100644 --- a/src/main/java/org/matsim/episim/model/listener/HouseholdSusceptibility.java +++ b/src/main/java/org/matsim/episim/model/listener/HouseholdSusceptibility.java @@ -13,9 +13,9 @@ import org.matsim.core.utils.geometry.transformations.IdentityTransformation; import org.matsim.episim.EpisimPerson; import org.matsim.episim.InfectionEventHandler; +import org.matsim.episim.analysis.DistrictLookup; import org.matsim.episim.model.SimulationListener; import org.matsim.facilities.ActivityFacility; -import org.matsim.scenarioCreation.DistrictLookup; import org.matsim.vehicles.Vehicle; import java.io.IOException; diff --git a/src/main/java/org/matsim/run/KnRunEpisim.java b/src/main/java/org/matsim/run/KnRunEpisim.java deleted file mode 100644 index a638ad971..000000000 --- a/src/main/java/org/matsim/run/KnRunEpisim.java +++ /dev/null @@ -1,456 +0,0 @@ -/*- - * #%L - * MATSim Episim - * %% - * Copyright (C) 2020 matsim-org - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - * #L% - */ -package org.matsim.run; - -import com.google.common.base.Joiner; -import com.google.inject.Module; -import com.google.inject.*; -import it.unimi.dsi.fastutil.objects.Object2IntMap; -import org.apache.logging.log4j.Level; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; -import org.apache.logging.log4j.core.config.Configurator; -import org.matsim.api.core.v01.Scenario; -import org.matsim.api.core.v01.population.Person; -import org.matsim.core.api.experimental.events.EventsManager; -import org.matsim.core.config.Config; -import org.matsim.core.config.ConfigUtils; -import org.matsim.core.controler.ControlerUtils; -import org.matsim.core.controler.OutputDirectoryLogging; -import org.matsim.core.events.EventsUtils; -import org.matsim.core.utils.io.IOUtils; -import org.matsim.core.utils.io.UncheckedIOException; -import org.matsim.episim.*; -import org.matsim.episim.model.*; -import org.matsim.episim.model.input.CreateRestrictionsFromCSV; -import org.matsim.episim.model.progression.AgeDependentDiseaseStatusTransitionModel; -import org.matsim.episim.model.progression.DiseaseStatusTransitionModel; -import org.matsim.episim.policy.FixedPolicy; -import org.matsim.episim.reporting.AsyncEpisimWriter; -import org.matsim.episim.reporting.EpisimWriter; -import org.matsim.run.modules.OpenBerlinScenario; -import org.matsim.run.modules.SnzBerlinScenario25pct2020; -import org.matsim.run.modules.SnzBerlinWeekScenario2020; - -import java.io.BufferedWriter; -import java.io.File; -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.StandardCopyOption; -import java.time.LocalDateTime; -import java.time.format.DateTimeFormatter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.SplittableRandom; - -import static org.matsim.episim.EpisimConfigGroup.WriteEvents; -import static org.matsim.episim.EpisimUtils.nextLogNormalFromMeanAndSigma; - -@Deprecated -public class KnRunEpisim { - public static final String SUSCEPTIBILITY = "susceptibility"; - public static final String VIRAL_LOAD = "viralLoad"; - - private static final Logger log = LogManager.getLogger( KnRunEpisim.class ); - - private static final boolean verbose = false; - private static final boolean logToOutput = true; - - // === - - private enum ScenarioType{ openBln1pct, snzBerlinWeek2020Symmetric} - private static final ScenarioType scenarioType = ScenarioType.snzBerlinWeek2020Symmetric; - - private enum ContactModelType{ original, oldSymmetric, symmetric, sqrt, direct } - private static final ContactModelType contactModelType = ContactModelType.oldSymmetric; - - enum RestrictionsType {unrestr, triang, fromSnz, fromConfig } - private static final RestrictionsType restrictionsType = RestrictionsType.unrestr; - - private static final double SIGMA_INFECT = 0.; - // 2 leads to dynamics so unstable that it does not look plausible w.r.t. reality. kai, jun'20 - - private static final double SIGMA_SUSC = 0.; - - private static final int DISEASE_IMPORT_OFFSET = -0; - - // === - - public static void main(String[] args) throws IOException{ - - OutputDirectoryLogging.catchLogEntries(); - - if (!verbose) { - Configurator.setLevel("org.matsim.core.config", Level.WARN); - Configurator.setLevel("org.matsim.core.controler", Level.WARN); - Configurator.setLevel("org.matsim.core.events", Level.WARN); - } - - List modules = new ArrayList<>(); - modules.add( new AbstractModule(){ - @Override protected void configure() { - - binder().requireExplicitBindings(); - - // Main model classes regarding progression / infection etc.. - switch( contactModelType ) { - case original: - bind( ContactModel.class ).to( DefaultContactModel.class ).in( Singleton.class ); - break; - case symmetric: - bind( ContactModel.class ).to( SymmetricContactModel.class ).in( Singleton.class ); - break; - case oldSymmetric: - bind( ContactModel.class ).to( OldSymmetricContactModel.class ).in( Singleton.class ); - break; - case sqrt: - bind( ContactModel.class ).to( SqrtContactModel.class ).in( Singleton.class ); - break; - case direct: - bind( ContactModel.class ).to( DirectContactModel.class ).in( Singleton.class ); - break; - default: - throw new IllegalStateException( "Unexpected value: " + contactModelType ); - } - if ( scenarioType == ScenarioType.openBln1pct ) { - bind( InfectionModel.class ).to( DefaultInfectionModel.class ).in( Singleton.class ); - bind( ProgressionModel.class ).to( ConfigurableProgressionModel.class ).in( Singleton.class ); - bind( FaceMaskModel.class ).to( DefaultFaceMaskModel.class ).in( Singleton.class ); - bind( InitialInfectionHandler.class ).to( RandomInitialInfections.class ).in( Singleton.class ); - } else { - bind( InfectionModel.class ).to( AgeDependentInfectionModelWithSeasonality.class ).in( Singleton.class ); - bind( DiseaseStatusTransitionModel.class ).to( AgeDependentDiseaseStatusTransitionModel.class ).in( Singleton.class ); - bind( FaceMaskModel.class ).to( DefaultFaceMaskModel.class ).in( Singleton.class ); - bind( InitialInfectionHandler.class ).to( RandomInitialInfections.class ).in( Singleton.class ); - } - - // Internal classes, should rarely be needed to be reconfigured - bind(EpisimRunner.class).in( Singleton.class ); - bind( ReplayHandler.class ).in( Singleton.class ); - bind( InfectionEventHandler.class ).in( Singleton.class ); - bind( EpisimReporting.class ).in( Singleton.class ); - - } - @Provides @Singleton public Scenario scenario( Config config ) { - - Scenario scenario ; - switch( scenarioType ) { - case openBln1pct: - scenario = new SnzBerlinWeekScenario2020().scenario( config ); // try using this one - break; - case snzBerlinWeek2020Symmetric: - scenario = new SnzBerlinWeekScenario2020().scenario( config ); - break; - default: - throw new IllegalStateException( "Unexpected value: " + scenarioType ); - } - - SplittableRandom rnd = new SplittableRandom( 4715 ); - for( Person person : scenario.getPopulation().getPersons().values() ){ - person.getAttributes().putAttribute( VIRAL_LOAD, nextLogNormalFromMeanAndSigma( rnd, 1, SIGMA_INFECT ) ); - person.getAttributes().putAttribute( SUSCEPTIBILITY, nextLogNormalFromMeanAndSigma( rnd, 1, SIGMA_SUSC ) ); - } - - return scenario; - } - @Provides @Singleton public EpisimConfigGroup epsimConfig( Config config ) { - return ConfigUtils.addOrGetModule(config, EpisimConfigGroup.class); - } - @Provides @Singleton public TracingConfigGroup tracingConfig( Config config ) { - return ConfigUtils.addOrGetModule(config, TracingConfigGroup.class); - } - @Provides @Singleton public EpisimWriter episimWriter( EpisimConfigGroup episimConfig ) { - - // Async writer is used for huge event number - if (Runtime.getRuntime().availableProcessors() > 1 && episimConfig.getWriteEvents() != WriteEvents.episim) - // by default only one episim simulation is running - return new AsyncEpisimWriter(1); - else - return new EpisimWriter(); - } - @Provides @Singleton public EventsManager eventsManager() { - return EventsUtils.createEventsManager(); - } - @Provides @Singleton public SplittableRandom splittableRandom( Config config ) { - return new SplittableRandom(config.global().getRandomSeed()); - } - @Provides @Singleton public Config config(){ - Config config ; - EpisimConfigGroup episimConfig ; - - // NOTE: The dynamics is set by the guice bindings above; this here just configures parameters that have something to do with those different dynamics. - if( contactModelType == ContactModelType.original ){ - if ( scenarioType == ScenarioType.snzBerlinWeek2020Symmetric ){ - config = new SnzBerlinWeekScenario2020().config(); - episimConfig = ConfigUtils.addOrGetModule( config, EpisimConfigGroup.class ); - episimConfig.setCalibrationParameter( 1.e-5 ); - episimConfig.setStartDate( "2020-02-17" ); - episimConfig.setMaxContacts( 3. ); - } else if ( scenarioType == ScenarioType.openBln1pct ) { - config = new OpenBerlinScenario().config(); - episimConfig = ConfigUtils.addOrGetModule( config, EpisimConfigGroup.class ); - episimConfig.setCalibrationParameter( 1.e-5 ); - episimConfig.setStartDate( "2020-02-17" ); - episimConfig.setMaxContacts( 3. ); - } else { - throw new RuntimeException( "not implemented" ); - } - } else if( contactModelType == ContactModelType.oldSymmetric ){ - if ( scenarioType == ScenarioType.snzBerlinWeek2020Symmetric ){ - config = new SnzBerlinWeekScenario2020().config(); - config.global().setRandomSeed( 4711 ); - episimConfig = ConfigUtils.addOrGetModule( config, EpisimConfigGroup.class ); - episimConfig.setStartDate( "2020-02-18" ); - episimConfig.setCalibrationParameter( 5.e-6 ); - } else if ( scenarioType == ScenarioType.openBln1pct ) { - config = new OpenBerlinScenario().config(); - config.global().setRandomSeed( 4711 ); - episimConfig = ConfigUtils.addOrGetModule( config, EpisimConfigGroup.class ); - episimConfig.setStartDate( "2020-02-18" ); - episimConfig.setCalibrationParameter( 5.e-4 ); - } else { - throw new RuntimeException( "not implemented" ); - } - } else if( contactModelType == ContactModelType.symmetric ){ - if ( scenarioType == ScenarioType.snzBerlinWeek2020Symmetric ){ - config = new SnzBerlinWeekScenario2020().config(); - episimConfig = ConfigUtils.addOrGetModule( config, EpisimConfigGroup.class ); - episimConfig.setStartDate( "2020-02-18" ); - episimConfig.setCalibrationParameter( 2.1e-5 ); - episimConfig.setMaxContacts( Double.NaN ); - - // to save computing time: - TracingConfigGroup tracingConfig = tracingConfig( config ); - tracingConfig.setTracingCapacity_pers_per_day( 0 ); - tracingConfig.setPutTraceablePersonsInQuarantineAfterDay( Integer.MAX_VALUE ); - } else if ( scenarioType == ScenarioType.openBln1pct ) { - config = new OpenBerlinScenario().config(); - config.global().setRandomSeed( 4711 ); - episimConfig = ConfigUtils.addOrGetModule( config, EpisimConfigGroup.class ); - episimConfig.setStartDate( "2020-02-18" ); - episimConfig.setCalibrationParameter( 5.e-6 ); - } else { - throw new RuntimeException( "not implemented" ); - } - } else if( contactModelType == ContactModelType.sqrt ){ - if ( scenarioType== ScenarioType.snzBerlinWeek2020Symmetric ){ - config = new SnzBerlinWeekScenario2020().config(); - episimConfig = ConfigUtils.addOrGetModule( config, EpisimConfigGroup.class ); - episimConfig.setStartDate( "2020-02-13" ); - episimConfig.setCalibrationParameter( 1.e-5 ); - episimConfig.setMaxContacts( 10 ); // interpreted as "typical number of interactions" - } else { - throw new RuntimeException( "not implemented" ); - } - } else if( contactModelType == ContactModelType.direct ){ - config = new SnzBerlinWeekScenario2020().config(); - episimConfig = ConfigUtils.addOrGetModule( config, EpisimConfigGroup.class ); - episimConfig.setStartDate( "2020-02-17" ); - episimConfig.setCalibrationParameter( 1.2e-5 ); - } else{ - throw new RuntimeException( "not implemented for infectionModelType=" + contactModelType ); - } - - // derzeit proba_interact = maxIA/sqrt(containerSize). Konsequenzen: - // * wenn containerSize < maxIA, dann IA deterministisch. Vermutl. kein Schaden. - // * wenn containerSize gross, dann theta und maxIA multiplikativ und somit redundant. - // Ich werde jetzt erstmal maxIA auf das theta des alten Modells kalibrieren. Aber perspektivisch - // könnte man (wie ja auch schon vorher) maxIA plausibel festlegen, und dann theta kalibrieren. - - TracingConfigGroup tracingConfig = ConfigUtils.addOrGetModule(config, TracingConfigGroup.class); - - episimConfig.setWriteEvents( WriteEvents.episim ); - - // --- - -// tracingConfig.setTracingCapacity_per_day( Integer.MAX_VALUE ); -// tracingConfig.setTracingCapacity_pers_per_day( 0 ); - - // --- - - StringBuilder strb = new StringBuilder(); - strb.append( LocalDateTime.now().format( DateTimeFormatter.ofPattern("yyyy-MM-dd_HH-mm-ss" ) ) ); - strb.append( "__" ).append( contactModelType.name() ); - strb.append( "__" ).append( restrictionsType.name() ); - strb.append( "__theta" ).append( episimConfig.getCalibrationParameter() ).append( "@" ).append( episimConfig.getMaxContacts() ); - if ( SIGMA_INFECT !=0. ) strb.append( "__sInfct" ).append( SIGMA_INFECT ); - if ( SIGMA_SUSC !=0. ) strb.append( "__sSusc" ).append( SIGMA_SUSC ); - - if ( restrictionsType==RestrictionsType.fromConfig ) { - // do nothing - } else if ( restrictionsType==RestrictionsType.fromSnz ){ - SnzBerlinScenario25pct2020.BasePolicyBuilder basePolicyBuilder = new SnzBerlinScenario25pct2020.BasePolicyBuilder( episimConfig ); - basePolicyBuilder.setCiCorrections( Map.of("2020-03-07", 0.25 )); - - CreateRestrictionsFromCSV r = new CreateRestrictionsFromCSV(episimConfig); - r.setAlpha(1.); - basePolicyBuilder.setActivityParticipation(r); - - FixedPolicy.ConfigBuilder restrictions = basePolicyBuilder.buildFixed(); - episimConfig.setPolicy(FixedPolicy.class, restrictions.build()); - - strb.append( "_ciCorr" ).append(Joiner.on("_").withKeyValueSeparator("@").join(basePolicyBuilder.getCiCorrections())); - strb.append( "_alph" ).append( r.getAlpha() ); - - } else if ( restrictionsType==RestrictionsType.unrestr ) { - final FixedPolicy.ConfigBuilder restrictions = FixedPolicy.config(); - episimConfig.setPolicy( FixedPolicy.class, restrictions.build() ); // overwrite snz policy with empty policy - tracingConfig.setTracingCapacity_pers_per_day( 0 ); - } - - strb.append( "_seed" ).append( config.global().getRandomSeed() ); - strb.append( "_strtDt" ).append( episimConfig.getStartDate() ); - strb.append( "_imprtOffst" ).append( DISEASE_IMPORT_OFFSET ); - if ( !tracingConfig.getTracingCapacity().isEmpty() ) { - strb.append( "_trCap" ).append( tracingConfig.getTracingCapacity() ); - strb.append( "_quStrt" ).append( episimConfig.getStartDate().plusDays( tracingConfig.getPutTraceablePersonsInQuarantineAfterDay() ) ); - } - config.controler().setOutputDirectory( "output/" + strb.toString() ); - - return config; - } - - }); - - log.info( "Starting with modules: {}", modules ); - - Injector injector = Guice.createInjector(modules); - - RunEpisim.printBindings( injector ); - - Config config = injector.getInstance(Config.class); - - if (logToOutput) OutputDirectoryLogging.initLoggingWithOutputDirectory(config.controler().getOutputDirectory()); - - File fromFile = new File( "/Users/kainagel/git/all-matsim/episim-matsim/src/main/java/org/matsim/run/KnRunEpisim.java"); - File toFile = new File( config.controler().getOutputDirectory() + "/KnRunEpisim.java" ) ; - - try { - Files.copy(fromFile.toPath(), toFile.toPath(), StandardCopyOption.REPLACE_EXISTING, StandardCopyOption.COPY_ATTRIBUTES ); - } catch (IOException e) { - throw new UncheckedIOException(e); - } - - ControlerUtils.checkConfigConsistencyAndWriteToLog( config, "just before calling run" ); - ConfigUtils.writeConfig( config, config.controler().getOutputDirectory() + "/output_config.xml.gz" ); - ConfigUtils.writeMinimalConfig( config, config.controler().getOutputDirectory() + "/output_config_reduced.xml.gz" ); - -// injector.getInstance(EpisimRunner.class).run( 90 ); - { - - // Construct these dependencies as late as possible, so all other configs etc have been fully configured - final ReplayHandler replay = injector.getInstance( ReplayHandler.class ); - final InfectionEventHandler handler = injector.getInstance( InfectionEventHandler.class ); - final EventsManager manager = injector.getInstance( EventsManager.class ); - - ControlerUtils.checkConfigConsistencyAndWriteToLog( config, "Just before running init" ); - - throw new IllegalStateException("Unsupported function, which is now private."); - //handler.init( replay.getEvents() ); - } - //if (logToOutput) OutputDirectoryLogging.closeOutputDirLogging(); - - } - - public static void writeGroupSizes( Object2IntMap> maxGroupSize ){ - { - List cnts = new ArrayList<>(); - for( Object2IntMap.Entry> entry : maxGroupSize.object2IntEntrySet() ){ - EpisimContainer container = entry.getKey(); - if( !(container instanceof InfectionEventHandler.EpisimFacility) ){ - continue; - } - int idx = container.getMaxGroupSize(); - while( idx >= cnts.size() ){ - cnts.add( 0L ); - } - cnts.set( idx, cnts.get( idx ) + 1 ); - } - try( BufferedWriter writer = IOUtils.getBufferedWriter( "maxGroupSizeFac.csv" ) ){ - for( int ii = 0 ; ii < cnts.size() ; ii++ ){ - writer.write( ii + "," + cnts.get( ii ) + "\n" ); - } - } catch( IOException e ){ - e.printStackTrace(); - } - } - { - List cnts = new ArrayList<>(); - for( Object2IntMap.Entry> entry : maxGroupSize.object2IntEntrySet() ){ - EpisimContainer container = entry.getKey(); - if( !(container instanceof InfectionEventHandler.EpisimVehicle) ){ - continue; - } - int idx = container.getMaxGroupSize(); - while( idx >= cnts.size() ){ - cnts.add( 0L ); - } - cnts.set( idx, cnts.get( idx ) + 1 ); - } - try( BufferedWriter writer = IOUtils.getBufferedWriter( "maxGroupSizeVeh.csv" ) ){ - for( int ii = 0 ; ii < cnts.size() ; ii++ ){ - writer.write( ii + "," + cnts.get( ii ) + "\n" ); - } - } catch( IOException e ){ - e.printStackTrace(); - } - } - - log.warn( "stopping here ..." ); - System.exit( -1 ); - } - - - /* - private static class MyInfectionModel implements InfectionModel { - - private final FaceMaskModel maskModel; - private final EpisimConfigGroup episimConfig; - - @Inject MyInfectionModel(Config config, FaceMaskModel maskModel ) { - this.maskModel = maskModel; - this.episimConfig = ConfigUtils.addOrGetModule(config, EpisimConfigGroup.class); - } - - - @Override - public double calcInfectionProbability(EpisimPerson target, EpisimPerson infector, Map restrictions, InfectionParams act1, InfectionParams act2, double jointTimeInContainer) { - - double contactIntensity = Math.min(act1.getContactIntensity(), act2.getContactIntensity()); - // ci corr can not be null, because sim is initialized with non null value - double ciCorrection = Math.min(restrictions.get(act1.getContainerName()).getCiCorrection(), restrictions.get(act2.getContainerName()).getCiCorrection()); - - // note that for 1pct runs, calibParam is of the order of one, which means that for typical times of 100sec or more, exp( - 1 * 1 * 100 ) \approx 0, and - // thus the infection proba becomes 1. Which also means that changes in contactIntensity has no effect. kai, mar'20 - - double susceptibility = (double) target.getAttributes().getAttribute( SUSCEPTIBILITY ); - double infectability = (double) infector.getAttributes().getAttribute( VIRAL_LOAD ); - - return 1 - Math.exp(-episimConfig.getCalibrationParameter() * susceptibility * infectability * contactIntensity * jointTimeInContainer * ciCorrection - * maskModel.getWornMask(infector, act2, restrictions.get(act2.getContainerName())).shedding - * maskModel.getWornMask(target, act1, restrictions.get(act1.getContainerName())).intake - ); - } - } - */ - -} diff --git a/src/main/java/org/matsim/run/RunEpisim.java b/src/main/java/org/matsim/run/RunEpisim.java index b4fea1ce9..7de5adfb9 100644 --- a/src/main/java/org/matsim/run/RunEpisim.java +++ b/src/main/java/org/matsim/run/RunEpisim.java @@ -37,7 +37,6 @@ import org.matsim.core.controler.OutputDirectoryLogging; import org.matsim.episim.EpisimModule; import org.matsim.episim.EpisimRunner; -import org.matsim.run.modules.OpenBerlinScenario; import picocli.CommandLine; import java.lang.reflect.Constructor; @@ -71,7 +70,7 @@ footerHeading = "\n", usageHelpWidth = 120, usageHelpAutoWidth = true, showDefaultValues = true, mixinStandardHelpOptions = true, abbreviateSynopsis = true, - subcommands = {CommandLine.HelpCommand.class, RunParallel.class, CreateBatteryForCluster.class, ScenarioCreation.class, AnalysisCommand.class} + subcommands = {CommandLine.HelpCommand.class, RunParallel.class, CreateBatteryForCluster.class, AnalysisCommand.class} ) public final class RunEpisim implements Callable { @@ -224,8 +223,7 @@ public Integer call() throws Exception { } if (modules.isEmpty()) { - log.info("Using default OpenBerlinScenario"); - modules.add(new OpenBerlinScenario()); + throw new IllegalArgumentException("No module specificied "); } log.info("Starting with modules: {}", modules); diff --git a/src/main/java/org/matsim/run/ScenarioCreation.java b/src/main/java/org/matsim/run/ScenarioCreation.java deleted file mode 100644 index 64b2858cc..000000000 --- a/src/main/java/org/matsim/run/ScenarioCreation.java +++ /dev/null @@ -1,53 +0,0 @@ -/*- - * #%L - * MATSim Episim - * %% - * Copyright (C) 2020 matsim-org - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - * #L% - */ -package org.matsim.run; - -import org.matsim.scenarioCreation.*; -import picocli.AutoComplete; -import picocli.CommandLine; - -/** - * Runnable class that does nothing by itself, but has to be invoked with one subcommand of - * the scenario creation utils. - */ -@CommandLine.Command( - name = "scenarioCreation", - description = "Scenario creation tool for Episim offering various subcommands.", - mixinStandardHelpOptions = true, - usageHelpWidth = 120, - subcommands = {CommandLine.HelpCommand.class, AutoComplete.GenerateCompletion.class, RunTrial.class, - DistrictLookup.class, SplitHomeFacilities.class, ConvertPersonAttributes.class, FilterEvents.class, FilterPersons.class, - MergeEvents.class, DownSampleScenario.class, DownloadWeatherData.class, DownloadVaccinationData.class, DownloadGoogleMobilityReport.class} -) -public class ScenarioCreation implements Runnable { - - @CommandLine.Spec - CommandLine.Model.CommandSpec spec; - - public static void main(String[] args) { - System.exit(new CommandLine(new ScenarioCreation()).execute(args)); - } - - @Override - public void run() { - throw new CommandLine.ParameterException(spec.commandLine(), "Missing required subcommand"); - } -} diff --git a/src/main/java/org/matsim/run/batch/BMBF210430.java b/src/main/java/org/matsim/run/batch/BMBF210430.java deleted file mode 100644 index 0e5982bcc..000000000 --- a/src/main/java/org/matsim/run/batch/BMBF210430.java +++ /dev/null @@ -1,314 +0,0 @@ -package org.matsim.run.batch; - -import com.google.inject.AbstractModule; -import org.matsim.core.config.Config; -import org.matsim.core.config.ConfigUtils; -import org.matsim.episim.BatchRun; -import org.matsim.episim.EpisimConfigGroup; -import org.matsim.episim.TestingConfigGroup; -import org.matsim.episim.VaccinationConfigGroup; -import org.matsim.episim.VirusStrainConfigGroup; -import org.matsim.episim.model.FaceMask; -import org.matsim.episim.model.VaccinationType; -import org.matsim.episim.model.VirusStrain; -import org.matsim.episim.policy.FixedPolicy; -import org.matsim.episim.policy.FixedPolicy.ConfigBuilder; -import org.matsim.episim.policy.Restriction; -import org.matsim.run.RunParallel; -import org.matsim.run.modules.AbstractSnzScenario2020; -import org.matsim.run.modules.SnzBerlinProductionScenario; -import org.matsim.run.modules.SnzProductionScenario.ChristmasModel; -import org.matsim.run.modules.SnzProductionScenario.EasterModel; - -import javax.annotation.Nullable; -import java.time.LocalDate; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; - - -/** - * Opening strategies - */ -public class BMBF210430 implements BatchRun { - - @Override - public AbstractModule getBindings(int id, @Nullable Params params) { - return new SnzBerlinProductionScenario.Builder().setSnapshot(SnzBerlinProductionScenario.Snapshot.no).createSnzBerlinProductionScenario(); - } - - @Override - public Metadata getMetadata() { - return Metadata.of("berlin", "opening"); - } - -// @Override -// public int getOffset() { -// return 10000; -// } - - @Override - public Config prepareConfig(int id, Params params) { - - ChristmasModel christmasModel = SnzBerlinProductionScenario.ChristmasModel.valueOf(params.christmasModel); - EasterModel easterModel = SnzBerlinProductionScenario.EasterModel.valueOf(params.easterModel); - - SnzBerlinProductionScenario module = new SnzBerlinProductionScenario.Builder() - .setSnapshot(SnzBerlinProductionScenario.Snapshot.no) - .setEasterModel(easterModel) - .setChristmasModel(christmasModel) - .createSnzBerlinProductionScenario(); - Config config = module.config(); - config.global().setRandomSeed(4711L); - - - EpisimConfigGroup episimConfig = ConfigUtils.addOrGetModule(config, EpisimConfigGroup.class); - - episimConfig.setSnapshotSeed(EpisimConfigGroup.SnapshotSeed.reseed); - episimConfig.setStartFromSnapshot("../episim-snapshot-270-2020-11-20.zip"); -// episimConfig.setSnapshotInterval(30); - - ConfigBuilder builder = FixedPolicy.parse(episimConfig.getPolicy()); - - - Map infPerDayVariant = new HashMap<>(); - infPerDayVariant.put(LocalDate.parse("2020-01-01"), 0); - infPerDayVariant.put(LocalDate.parse("2020-11-30"), 1); - - episimConfig.setInfections_pers_per_day(VirusStrain.ALPHA, infPerDayVariant); - - - builder.restrict("2021-04-06", Restriction.ofClosingHours(21, 5), "leisure", "visit"); - Map curfewCompliance = new HashMap(); - curfewCompliance.put(LocalDate.parse("2021-04-06"), 0.5); - - LocalDate date1 = LocalDate.parse("2021-05-15"); - LocalDate date2 = date1.plusWeeks(3); - LocalDate date3 = date2.plusWeeks(3); - - builder.restrict(date1, params.sc_1, "educ_primary", "educ_secondary", "educ_tertiary", "educ_other", "educ_kiga"); - builder.restrict(date2, params.sc_2, "educ_primary", "educ_secondary", "educ_tertiary", "educ_other", "educ_kiga"); - //Sommerferien - builder.restrict("2021-08-07", params.sc_2, "educ_primary", "educ_secondary", "educ_tertiary", "educ_other"); - - builder.restrict(date1, params.sh_e_1, "shop_daily", "shop_other", "errands"); - builder.restrict(date2, params.sh_e_2, "shop_daily", "shop_other", "errands"); - builder.restrict(date3, params.sh_e_3, "shop_daily", "shop_other", "errands"); - - builder.restrict(date1, params.l_w_1, "work", "business"); - builder.restrict(date2, params.l_w_2, "work", "business"); - builder.restrict(date3, params.l_w_3, "work", "business"); - - builder.restrict(date1, params.l_w_1, "leisure", "visit"); - builder.restrict(date2, params.l_w_2, "leisure", "visit"); - builder.restrict(date3, params.l_w_3, "leisure", "visit"); - - if (params.l_w_1 > 0.78) curfewCompliance.put(date1, 0.0); - if (params.l_w_2> 0.78) curfewCompliance.put(date2, 0.0); - if (params.l_w_3 > 0.78) curfewCompliance.put(date3, 0.0); - - builder.restrict(date2, params.u_2, "educ_higher"); - builder.restrict(date3, params.u_3, "educ_higher"); - - episimConfig.setCurfewCompliance(curfewCompliance); - - if(params.m_3.equals("no")) { - builder.restrict(date3, Restriction.ofMask(Map.of(FaceMask.CLOTH, 0.0, FaceMask.SURGICAL, 0.0, FaceMask.N95, 0.0)), AbstractSnzScenario2020.DEFAULT_ACTIVITIES); - builder.restrict(date3, Restriction.ofMask(Map.of(FaceMask.CLOTH, 0.0, FaceMask.SURGICAL, 0.0, FaceMask.N95, 0.0)), "pt"); - } - - - episimConfig.setPolicy(FixedPolicy.class, builder.build()); - - - VirusStrainConfigGroup virusStrainConfigGroup = ConfigUtils.addOrGetModule(config, VirusStrainConfigGroup.class); - - virusStrainConfigGroup.getOrAddParams(VirusStrain.ALPHA).setInfectiousness(1.8); - virusStrainConfigGroup.getOrAddParams(VirusStrain.ALPHA).setVaccineEffectiveness(1.0); - virusStrainConfigGroup.getOrAddParams(VirusStrain.ALPHA).setFactorSeriouslySick(1.5); - - - VaccinationConfigGroup vaccinationConfig = ConfigUtils.addOrGetModule(config, VaccinationConfigGroup.class); - vaccinationConfig.getParams(VaccinationType.generic).setFactorSeriouslySick(0.5); -// Map vaccinationCompliance = new HashMap<>(); -// -// for(int i = 0; i<120; i++) vaccinationCompliance.put(i, params.vaccinationCompliance); -// -// vaccinationConfig.setCompliancePerAge(vaccinationCompliance); - - if (!params.vaccination.equals("current")) { - Map vaccinations = vaccinationConfig.getVaccinationCapacity(); - int population = 4_800_000; - double dailyPercentageMay = (2./3.) * (250_000. / 7. / 3_645_000.); - double dailyPercentageJune = (2./3.) * (340_000. / 7. / 3_645_000.); - vaccinations.put(LocalDate.parse("2021-05-01"), (int) (dailyPercentageMay * population)); - vaccinations.put(LocalDate.parse("2021-06-01"), (int) (dailyPercentageJune * population)); - vaccinationConfig.setVaccinationCapacity_pers_per_day(vaccinations); - } - - - TestingConfigGroup testingConfigGroup = ConfigUtils.addOrGetModule(config, TestingConfigGroup.class); - - testingConfigGroup.setStrategy(TestingConfigGroup.Strategy.ACTIVITIES); - - List actsList = new ArrayList(); - actsList.add("leisure"); - actsList.add("work"); - actsList.add("business"); - actsList.add("educ_kiga"); - actsList.add("educ_primary"); - actsList.add("educ_secondary"); - actsList.add("educ_tertiary"); - actsList.add("educ_other"); - actsList.add("educ_higher"); - testingConfigGroup.setActivities(actsList); - - testingConfigGroup.setFalseNegativeRate(0.3); - testingConfigGroup.setFalsePositiveRate(0.03); - testingConfigGroup.setHouseholdCompliance(1.0); - - LocalDate testingDate = LocalDate.parse("2021-04-19"); - - double leisureRate = Integer.parseInt(params.testingRateEduWorkLeisure.split("-")[2]) / 100.; - double workRate = Integer.parseInt(params.testingRateEduWorkLeisure.split("-")[1]) / 100.; - double eduRate = Integer.parseInt(params.testingRateEduWorkLeisure.split("-")[0]) / 100.; - - testingConfigGroup.setTestingRatePerActivityAndDate((Map.of( - "leisure", Map.of( - LocalDate.parse("2020-01-01"), 0., - testingDate, leisureRate - ), - "work", Map.of( - LocalDate.parse("2020-01-01"), 0., - testingDate, workRate - ), - "business", Map.of( - LocalDate.parse("2020-01-01"), 0., - testingDate, workRate - ), - "educ_kiga", Map.of( - LocalDate.parse("2020-01-01"), 0., - testingDate, eduRate - ), - "educ_primary", Map.of( - LocalDate.parse("2020-01-01"), 0., - testingDate, eduRate - ), - "educ_secondary", Map.of( - LocalDate.parse("2020-01-01"), 0., - testingDate, eduRate - ), - "educ_tertiary", Map.of( - LocalDate.parse("2020-01-01"), 0., - testingDate, eduRate - ), - "educ_higher", Map.of( - LocalDate.parse("2020-01-01"), 0., - testingDate, eduRate - ), - "educ_other", Map.of( - LocalDate.parse("2020-01-01"), 0., - testingDate, eduRate - ) - ))); - - testingConfigGroup.setTestingCapacity_pers_per_day(Map.of( - LocalDate.of(1970, 1, 1), 0, - testingDate, Integer.MAX_VALUE)); - - - - - return config; - } - - public static final class Params { - -// @GenerateSeeds(5) -// public long seed; - -// @StringParameter({"2020-12-15"}) -// String newVariantDate; - -// @StringParameter({"permissive", "restrictive"}) - @StringParameter({"restrictive"}) - String christmasModel; - -// @StringParameter({"yes", "no"}) - @StringParameter({"no"}) - String easterModel; - -// @StringParameter({"2020-12-10", "2020-12-05", "2020-11-30", "2020-11-25"}) -// String b117Date; - -// @Parameter({1.0, 1.5}) -// double factorSeriouslySickB117; -// -// @Parameter({1.0, 0.5}) -// double factorSeriouslySickVaccine; - -// @StringParameter({"0-0-0", "20-5-5"}) - @StringParameter({"0-0-0", "20-5-5"}) - String testingRateEduWorkLeisure; - - @Parameter({1.0, 0.75, 0.5}) - double sc_1; - - @Parameter({1.0, 0.75}) - double sc_2; - - @Parameter({1.0, 0.78}) - double sh_e_1; - - @Parameter({1.0}) - double sh_e_2; - - @Parameter({1.0}) - double sh_e_3; - - @Parameter({0.78, 0.9, 1.0}) - double l_w_1; - - @Parameter({0.78, 0.9, 1.0}) - double l_w_2; - - @Parameter({0.9, 1.0}) - double l_w_3; - - @Parameter({0.2, 0.5, 0.75, 1.0}) - double u_2; - - @Parameter({0.2, 0.5, 0.75, 1.0}) - double u_3; - - @StringParameter({"current"}) - String vaccination; - - @StringParameter({"yes", "no"}) - String m_3; - -// @StringParameter({"0-0-0", "20-5-5", "20-10-5"}) -// String testingRateEduWorkLeisure2; -// -// @StringParameter({"0-0-0", "20-5-5", "20-10-5"}) -// String testingRateEduWorkLeisure3; - - } - - public static void main(String[] args) { - String[] args2 = { - RunParallel.OPTION_SETUP, BMBF210430.class.getName(), - RunParallel.OPTION_PARAMS, Params.class.getName(), - RunParallel.OPTION_TASKS, Integer.toString(1), - RunParallel.OPTION_ITERATIONS, Integer.toString(500), - RunParallel.OPTION_METADATA - }; - - RunParallel.main(args2); - } - - -} - diff --git a/src/main/java/org/matsim/run/batch/BMBF210521.java b/src/main/java/org/matsim/run/batch/BMBF210521.java deleted file mode 100644 index cfbfc7989..000000000 --- a/src/main/java/org/matsim/run/batch/BMBF210521.java +++ /dev/null @@ -1,298 +0,0 @@ -package org.matsim.run.batch; - -import com.google.inject.AbstractModule; -import org.matsim.core.config.Config; -import org.matsim.core.config.ConfigUtils; -import org.matsim.episim.BatchRun; -import org.matsim.episim.EpisimConfigGroup; -import org.matsim.episim.TestingConfigGroup; -import org.matsim.episim.VaccinationConfigGroup; -import org.matsim.episim.VirusStrainConfigGroup; -import org.matsim.episim.model.FaceMask; -import org.matsim.episim.model.VaccinationType; -import org.matsim.episim.model.VirusStrain; -import org.matsim.episim.policy.FixedPolicy; -import org.matsim.episim.policy.FixedPolicy.ConfigBuilder; -import org.matsim.episim.policy.Restriction; -import org.matsim.run.RunParallel; -import org.matsim.run.modules.AbstractSnzScenario2020; -import org.matsim.run.modules.SnzBerlinProductionScenario; - - -import javax.annotation.Nullable; -import java.time.LocalDate; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - - -/** - * Opening strategies - */ -public class BMBF210521 implements BatchRun { - - @Override - public AbstractModule getBindings(int id, @Nullable Params params) { - return new SnzBerlinProductionScenario.Builder().setSnapshot(SnzBerlinProductionScenario.Snapshot.no).createSnzBerlinProductionScenario(); - } - - @Override - public Metadata getMetadata() { - return Metadata.of("berlin", "opening"); - } - -// @Override -// public int getOffset() { -// return 10000; -// } - - @Override - public Config prepareConfig(int id, Params params) { - - - SnzBerlinProductionScenario module = new SnzBerlinProductionScenario.Builder() - .setSnapshot(SnzBerlinProductionScenario.Snapshot.no) - .setEasterModel(SnzBerlinProductionScenario.EasterModel.no) - .setChristmasModel(SnzBerlinProductionScenario.ChristmasModel.restrictive) - .createSnzBerlinProductionScenario(); - Config config = module.config(); - - config.global().setRandomSeed(3831662765844904176L); - config.global().setRandomSeed(params.seed); - - - EpisimConfigGroup episimConfig = ConfigUtils.addOrGetModule(config, EpisimConfigGroup.class); - - episimConfig.setSnapshotSeed(EpisimConfigGroup.SnapshotSeed.reseed); - episimConfig.setStartFromSnapshot("../episim-snapshot-270-2020-11-20.zip"); -// episimConfig.setSnapshotInterval(30); - - ConfigBuilder builder = FixedPolicy.parse(episimConfig.getPolicy()); - - - Map infPerDayVariant = new HashMap<>(); - infPerDayVariant.put(LocalDate.parse("2020-01-01"), 0); - infPerDayVariant.put(LocalDate.parse("2020-11-30"), 1); - - episimConfig.setInfections_pers_per_day(VirusStrain.ALPHA, infPerDayVariant); - - - builder.restrict("2021-04-06", Restriction.ofClosingHours(21, 5), "leisure", "visit"); - Map curfewCompliance = new HashMap(); - curfewCompliance.put(LocalDate.parse("2021-04-06"), 0.5); - - LocalDate date1 = LocalDate.parse("2021-05-22"); - LocalDate date2 = date1.plusWeeks(3); - LocalDate date3 = date2.plusWeeks(3); - - builder.restrict(date1, 0.5, "educ_primary", "educ_secondary", "educ_tertiary", "educ_other", "educ_kiga"); - builder.restrict(date2, 1.0, "educ_primary", "educ_secondary", "educ_tertiary", "educ_other", "educ_kiga"); - //Sommerferien - builder.restrict("2021-08-07", 1.0, "educ_primary", "educ_secondary", "educ_tertiary", "educ_other"); - - builder.restrict(date1, 0.75, "shop_daily", "shop_other", "errands"); - builder.restrict(date2, 1.0, "shop_daily", "shop_other", "errands"); - - builder.restrict(date1, 0.9, "work", "business", "leisure", "visit"); - builder.restrict(date2, 1.0, "work", "business", "leisure", "visit"); - - curfewCompliance.put(date1, 0.0); - - builder.restrict(date2, 0.5, "educ_higher"); - - builder.restrict("2021-07-18", 0.2, "educ_higher"); - builder.restrict("2021-10-18", 1.0, "educ_higher"); - - - episimConfig.setCurfewCompliance(curfewCompliance); - - if(params.masks.equals("no")) { - builder.restrict(date3, Restriction.ofMask(Map.of(FaceMask.CLOTH, 0.0, FaceMask.SURGICAL, 0.0, FaceMask.N95, 0.0)), AbstractSnzScenario2020.DEFAULT_ACTIVITIES); - builder.restrict(date3, Restriction.ofMask(Map.of(FaceMask.CLOTH, 0.0, FaceMask.SURGICAL, 0.0, FaceMask.N95, 0.0)), "pt"); - } - - builder.apply("2021-03-26", "2021-04-09", (d, e) -> e.put("fraction", 0.83 * (double) e.get("fraction")), "work", "business"); - - builder.restrict("2021-06-24", 0.83, "work", "business"); - builder.restrict("2021-08-06", 1.0, "work", "business"); - - builder.restrict("2021-10-11", 0.83, "work", "business"); - builder.restrict("2021-10-23", 1.0, "work", "business"); - - builder.restrict("2021-12-24", 0.83, "work", "business"); - builder.restrict("2021-12-31", 1.0, "work", "business"); - - - episimConfig.setPolicy(FixedPolicy.class, builder.build()); - - VaccinationConfigGroup vaccinationConfig = ConfigUtils.addOrGetModule(config, VaccinationConfigGroup.class); - double vaccineEffectiveness = vaccinationConfig.getParams(VaccinationType.generic).getEffectiveness(); - - VirusStrainConfigGroup virusStrainConfigGroup = ConfigUtils.addOrGetModule(config, VirusStrainConfigGroup.class); - - virusStrainConfigGroup.getOrAddParams(VirusStrain.ALPHA).setInfectiousness(1.8); - virusStrainConfigGroup.getOrAddParams(VirusStrain.ALPHA).setVaccineEffectiveness(1.0); - virusStrainConfigGroup.getOrAddParams(VirusStrain.ALPHA).setFactorSeriouslySick(1.5); - virusStrainConfigGroup.getOrAddParams(VirusStrain.ALPHA).setFactorSeriouslySickVaccinated(0.05 / (1-vaccineEffectiveness)); - - virusStrainConfigGroup.getOrAddParams(VirusStrain.SARS_CoV_2).setFactorSeriouslySickVaccinated(0.05 / (1-vaccineEffectiveness)); - - if (params.b1351inf > 0.0) { - Map infPerDayB1351 = new HashMap<>(); - infPerDayB1351.put(LocalDate.parse("2020-01-01"), 0); - infPerDayB1351.put(LocalDate.parse(params.b1351date), 1); - episimConfig.setInfections_pers_per_day(VirusStrain.B1351, infPerDayB1351); - virusStrainConfigGroup.getOrAddParams(VirusStrain.B1351).setInfectiousness(params.b1351inf); - virusStrainConfigGroup.getOrAddParams(VirusStrain.B1351).setVaccineEffectiveness(params.b1351VaccinationEffectiveness / vaccineEffectiveness); - virusStrainConfigGroup.getOrAddParams(VirusStrain.B1351).setReVaccineEffectiveness(1.0); - virusStrainConfigGroup.getOrAddParams(VirusStrain.B1351).setFactorSeriouslySickVaccinated(0.05 / (1- params.b1351VaccinationEffectiveness)); - - } - -// vaccinationConfig.setFactorSeriouslySick(0.5); - - Map vaccinationCompliance = new HashMap<>(); - - for(int i = 0; i<12; i++) vaccinationCompliance.put(i, 0.); - double vaccinationCompliance1518 = 0.0; - if (params.vaccinate1216.equals("yes")) vaccinationCompliance1518 = params.vaccinationCompliance; - for(int i = 12; i<16; i++) vaccinationCompliance.put(i, vaccinationCompliance1518); - for(int i = 16; i<120; i++) vaccinationCompliance.put(i, params.vaccinationCompliance); - - vaccinationConfig.setCompliancePerAge(vaccinationCompliance); - - Map reVaccinations = new HashMap<>(); - - if (!params.revaccinationDate.equals("no")) { - reVaccinations.put(LocalDate.parse("2020-01-01"), 0); - reVaccinations.put(LocalDate.parse(params.revaccinationDate), (int) (params.revaccinationSpeed * 4_831_120)); - vaccinationConfig.setReVaccinationCapacity_pers_per_day(reVaccinations); - } - - - TestingConfigGroup testingConfigGroup = ConfigUtils.addOrGetModule(config, TestingConfigGroup.class); - - testingConfigGroup.setStrategy(TestingConfigGroup.Strategy.ACTIVITIES); - - List actsList = new ArrayList(); - actsList.add("leisure"); - actsList.add("work"); - actsList.add("business"); - actsList.add("educ_kiga"); - actsList.add("educ_primary"); - actsList.add("educ_secondary"); - actsList.add("educ_tertiary"); - actsList.add("educ_other"); - actsList.add("educ_higher"); - testingConfigGroup.setActivities(actsList); - - testingConfigGroup.setFalseNegativeRate(0.3); - testingConfigGroup.setFalsePositiveRate(0.03); - testingConfigGroup.setHouseholdCompliance(1.0); - - LocalDate testingDate = LocalDate.parse("2021-03-19"); - - double leisureRate1 = Integer.parseInt(params.testingRateEduWorkLeisure1.split("-")[2]) / 100.; - double workRate1 = Integer.parseInt(params.testingRateEduWorkLeisure1.split("-")[1]) / 100.; - double eduRate1 = Integer.parseInt(params.testingRateEduWorkLeisure1.split("-")[0]) / 100.; - - Map leisureTests = new HashMap(); - Map workTests = new HashMap(); - Map eduTests = new HashMap(); - leisureTests.put(LocalDate.parse("2020-01-01"), 0.); - workTests.put(LocalDate.parse("2020-01-01"), 0.); - eduTests.put(LocalDate.parse("2020-01-01"), 0.); - - for (int i = 1; i<=31; i++) { - leisureTests.put(testingDate.plusDays(i), leisureRate1 * i / 31.); - workTests.put(testingDate.plusDays(i), workRate1 * i / 31.); - eduTests.put(testingDate.plusDays(i), eduRate1 * i / 31.); - } - if (params.testing.equals("no")) { - leisureTests.put(date3, 0.0); - workTests.put(date3, 0.0); - eduTests.put(date3, 0.0); - } - - testingConfigGroup.setTestingRatePerActivityAndDate((Map.of( - "leisure", leisureTests, - "work", workTests, - "business", workTests, - "educ_kiga", eduTests, - "educ_primary", eduTests, - "educ_secondary", eduTests, - "educ_tertiary", eduTests, - "educ_higher", eduTests, - "educ_other", eduTests - ))); - - testingConfigGroup.setTestingCapacity_pers_per_day(Map.of( - LocalDate.of(1970, 1, 1), 0, - testingDate, Integer.MAX_VALUE)); - - return config; - } - - public static final class Params { - - @GenerateSeeds(5) - public long seed; - - @StringParameter({"20-5-5"}) - String testingRateEduWorkLeisure1; - - @StringParameter({"no", "yes"}) - String testing; - - @StringParameter({"no", "yes"}) - String masks; - -// @Parameter({1.0, 0.83}) -// double workFactor; - -// @StringParameter({"2021-04-01", "2021-06-01"}) - @StringParameter({"2021-04-01"}) - String b1351date; - - @Parameter({1.0, 1.4, 1.8}) - double b1351inf; - - @Parameter({0.9, 0.8, 0.7, 0.6, 0.5}) - double b1351VaccinationEffectiveness; - - @Parameter({0.8, 0.6}) - double vaccinationCompliance; - - @StringParameter({"yes", "no"}) - String vaccinate1216; - - @StringParameter({"no", "2021-08-01", "2021-10-01"}) - String revaccinationDate; - - @Parameter({0.01, 0.02}) - double revaccinationSpeed; - -// @StringParameter({"0-0-0", "20-5-5", "20-10-5"}) -// String testingRateEduWorkLeisure2; -// -// @StringParameter({"0-0-0", "20-5-5", "20-10-5"}) -// String testingRateEduWorkLeisure3; - - } - - public static void main(String[] args) { - String[] args2 = { - RunParallel.OPTION_SETUP, BMBF210521.class.getName(), - RunParallel.OPTION_PARAMS, Params.class.getName(), - RunParallel.OPTION_TASKS, Integer.toString(1), - RunParallel.OPTION_ITERATIONS, Integer.toString(500), - RunParallel.OPTION_METADATA - }; - - RunParallel.main(args2); - } - - -} - diff --git a/src/main/java/org/matsim/run/batch/BMBF210618Mutations.java b/src/main/java/org/matsim/run/batch/BMBF210618Mutations.java deleted file mode 100644 index 0ff3fcd0e..000000000 --- a/src/main/java/org/matsim/run/batch/BMBF210618Mutations.java +++ /dev/null @@ -1,311 +0,0 @@ -package org.matsim.run.batch; - -import com.google.inject.AbstractModule; -import org.matsim.core.config.Config; -import org.matsim.core.config.ConfigUtils; -import org.matsim.episim.BatchRun; -import org.matsim.episim.EpisimConfigGroup; -import org.matsim.episim.TestingConfigGroup; -import org.matsim.episim.VaccinationConfigGroup; -import org.matsim.episim.VirusStrainConfigGroup; -import org.matsim.episim.model.FaceMask; -import org.matsim.episim.model.VaccinationType; -import org.matsim.episim.model.VirusStrain; -import org.matsim.episim.policy.FixedPolicy; -import org.matsim.episim.policy.FixedPolicy.ConfigBuilder; -import org.matsim.episim.policy.Restriction; -import org.matsim.run.RunParallel; -import org.matsim.run.modules.AbstractSnzScenario2020; -import org.matsim.run.modules.SnzBerlinProductionScenario; - -import javax.annotation.Nullable; -import java.time.LocalDate; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - - -/** - * Mutations - */ -public class BMBF210618Mutations implements BatchRun { - - @Override - public AbstractModule getBindings(int id, @Nullable Params params) { - return new SnzBerlinProductionScenario.Builder().setSnapshot(SnzBerlinProductionScenario.Snapshot.no).createSnzBerlinProductionScenario(); - } - - @Override - public Metadata getMetadata() { - return Metadata.of("berlin", "mutations"); - } - -// @Override -// public int getOffset() { -// return 20000; -// } - - @Override - public Config prepareConfig(int id, Params params) { - - - SnzBerlinProductionScenario module = new SnzBerlinProductionScenario.Builder() - .setSnapshot(SnzBerlinProductionScenario.Snapshot.no) - .setEasterModel(SnzBerlinProductionScenario.EasterModel.no) - .setChristmasModel(SnzBerlinProductionScenario.ChristmasModel.restrictive) - .createSnzBerlinProductionScenario(); - Config config = module.config(); - -// config.global().setRandomSeed(params.seed); - config.global().setRandomSeed(3831662765844904176L); - - - EpisimConfigGroup episimConfig = ConfigUtils.addOrGetModule(config, EpisimConfigGroup.class); - - episimConfig.setSnapshotSeed(EpisimConfigGroup.SnapshotSeed.reseed); - episimConfig.setStartFromSnapshot("../episim-snapshot-270-2020-11-20.zip"); -// episimConfig.setSnapshotInterval(30); - - ConfigBuilder builder = FixedPolicy.parse(episimConfig.getPolicy()); - - - Map infPerDayVariant = new HashMap<>(); - infPerDayVariant.put(LocalDate.parse("2020-01-01"), 0); - infPerDayVariant.put(LocalDate.parse("2020-11-30"), 1); - - episimConfig.setInfections_pers_per_day(VirusStrain.ALPHA, infPerDayVariant); - - - builder.restrict("2021-04-06", Restriction.ofClosingHours(21, 5), "leisure", "visit"); - Map curfewCompliance = new HashMap(); - curfewCompliance.put(LocalDate.parse("2021-04-06"), 0.5); - curfewCompliance.put(LocalDate.parse("2021-05-16"), 0.0); - episimConfig.setCurfewCompliance(curfewCompliance); - - - LocalDate date1 = LocalDate.parse("2021-06-21"); - - builder.restrict(date1, 1.0, "educ_primary", "educ_secondary", "educ_tertiary", "educ_other", "educ_kiga"); - //Sommerferien - builder.restrict("2021-08-07", 1.0, "educ_primary", "educ_secondary", "educ_tertiary", "educ_other"); - //kein zusätzliches Lüften mehr nach den Sommerferien - builder.restrict("2021-08-07", Restriction.ofCiCorrection(params.ciCorrectionEdu), "educ_primary", "educ_kiga", "educ_secondary", "educ_higher", "educ_tertiary", "educ_other"); - - - builder.restrict(date1, 1.0, "shop_daily", "shop_other", "errands"); - - builder.restrict(date1, 1.0, "work", "business", "leisure", "visit"); - - builder.restrict("2021-10-18", 1.0, "educ_higher"); - - - if(params.masks.equals("no")) { - builder.restrict(date1, Restriction.ofMask(Map.of(FaceMask.CLOTH, 0.0, FaceMask.SURGICAL, 0.0, FaceMask.N95, 0.0)), AbstractSnzScenario2020.DEFAULT_ACTIVITIES); - builder.restrict(date1, Restriction.ofMask(Map.of(FaceMask.CLOTH, 0.0, FaceMask.SURGICAL, 0.0, FaceMask.N95, 0.0)), "pt"); - } - - if(params.masks.equals("fromOctober")) { - builder.restrict(date1, Restriction.ofMask(Map.of(FaceMask.CLOTH, 0.0, FaceMask.SURGICAL, 0.0, FaceMask.N95, 0.0)), AbstractSnzScenario2020.DEFAULT_ACTIVITIES); - builder.restrict(date1, Restriction.ofMask(Map.of(FaceMask.CLOTH, 0.0, FaceMask.SURGICAL, 0.0, FaceMask.N95, 0.0)), "pt"); - builder.restrict("2021-10-01", Restriction.ofMask(Map.of(FaceMask.CLOTH, 0.9 * 0.9, FaceMask.SURGICAL, 0.9 * 0.1)), "pt", "shop_daily", "shop_other", "errands"); - builder.restrict("2021-10-01", Restriction.ofMask(Map.of(FaceMask.CLOTH, 0.8 * 0.9, FaceMask.SURGICAL, 0.8 * 0.1)), "educ_higher", "educ_tertiary", "educ_other"); - } - - builder.apply("2021-03-26", "2021-04-09", (d, e) -> e.put("fraction", 0.92 * (double) e.get("fraction")), "work", "business"); - - builder.restrict("2021-06-24", 0.83, "work", "business"); - builder.restrict("2021-08-06", 1.0, "work", "business"); - - builder.restrict("2021-10-11", 0.83, "work", "business"); - builder.restrict("2021-10-23", 1.0, "work", "business"); - - builder.restrict("2021-12-20", 0.83, "work", "business"); - builder.restrict("2022-01-02", 1.0, "work", "business"); - - builder.restrict("2021-12-20", 0.2, "educ_higher"); - builder.restrict("2022-01-02", 1.0, "educ_higher"); - - - episimConfig.setPolicy(FixedPolicy.class, builder.build()); - - VaccinationConfigGroup vaccinationConfig = ConfigUtils.addOrGetModule(config, VaccinationConfigGroup.class); - double vaccineEffectiveness = vaccinationConfig.getParams(VaccinationType.generic).getEffectiveness(); - - VirusStrainConfigGroup virusStrainConfigGroup = ConfigUtils.addOrGetModule(config, VirusStrainConfigGroup.class); - - virusStrainConfigGroup.getOrAddParams(VirusStrain.ALPHA).setInfectiousness(1.8); - virusStrainConfigGroup.getOrAddParams(VirusStrain.ALPHA).setVaccineEffectiveness(1.0); - virusStrainConfigGroup.getOrAddParams(VirusStrain.ALPHA).setFactorSeriouslySick(1.5); - virusStrainConfigGroup.getOrAddParams(VirusStrain.ALPHA).setFactorSeriouslySickVaccinated(0.05 / (1-vaccineEffectiveness)); - - virusStrainConfigGroup.getOrAddParams(VirusStrain.SARS_CoV_2).setFactorSeriouslySickVaccinated(0.05 / (1-vaccineEffectiveness)); - - if (params.mutBinf > 0.0) { - Map infPerDayB1351 = new HashMap<>(); - infPerDayB1351.put(LocalDate.parse("2020-01-01"), 0); - infPerDayB1351.put(LocalDate.parse(params.mutBDate), 1); - episimConfig.setInfections_pers_per_day(VirusStrain.DELTA, infPerDayB1351); - virusStrainConfigGroup.getOrAddParams(VirusStrain.DELTA).setInfectiousness(params.mutBinf); - virusStrainConfigGroup.getOrAddParams(VirusStrain.DELTA).setVaccineEffectiveness(params.mutBVaccinationEffectiveness / vaccineEffectiveness); - virusStrainConfigGroup.getOrAddParams(VirusStrain.DELTA).setReVaccineEffectiveness(1.0); - virusStrainConfigGroup.getOrAddParams(VirusStrain.DELTA).setFactorSeriouslySickVaccinated(0.05 / (1- params.mutBVaccinationEffectiveness)); - - } - - Map vaccinationCompliance = new HashMap<>(); - - if (params.vaccinationAgeGroup.equals("6m")) { - vaccinationCompliance.put(0, params.vaccinationCompliance * 0.5); - for(int i = 1; i<120; i++) vaccinationCompliance.put(i, params.vaccinationCompliance); - } - if (params.vaccinationAgeGroup.equals("12y")) { - for(int i = 0; i<11; i++) vaccinationCompliance.put(i, 0.0); - for(int i = 12; i<120; i++) vaccinationCompliance.put(i, params.vaccinationCompliance); - } - if (params.vaccinationAgeGroup.equals("16y")) { - for(int i = 0; i<15; i++) vaccinationCompliance.put(i, 0.0); - for(int i = 16; i<120; i++) vaccinationCompliance.put(i, params.vaccinationCompliance); - } - - vaccinationConfig.setCompliancePerAge(vaccinationCompliance); - - Map reVaccinations = new HashMap<>(); - - if (!params.revaccinationDate.equals("no")) { - reVaccinations.put(LocalDate.parse("2020-01-01"), 0); - reVaccinations.put(LocalDate.parse(params.revaccinationDate), (int) (params.revaccinationSpeed * 4_831_120)); - vaccinationConfig.setReVaccinationCapacity_pers_per_day(reVaccinations); - } - - - TestingConfigGroup testingConfigGroup = ConfigUtils.addOrGetModule(config, TestingConfigGroup.class); - - testingConfigGroup.setStrategy(TestingConfigGroup.Strategy.ACTIVITIES); - - List actsList = new ArrayList(); - actsList.add("leisure"); - actsList.add("work"); - actsList.add("business"); - actsList.add("educ_kiga"); - actsList.add("educ_primary"); - actsList.add("educ_secondary"); - actsList.add("educ_tertiary"); - actsList.add("educ_other"); - actsList.add("educ_higher"); - testingConfigGroup.setActivities(actsList); - - testingConfigGroup.setFalseNegativeRate(0.3); - testingConfigGroup.setFalsePositiveRate(0.03); - testingConfigGroup.setHouseholdCompliance(1.0); - - LocalDate testingDate = LocalDate.parse("2021-03-19"); - - double leisureRate1 = Integer.parseInt(params.testingRateEduWorkLeisure1.split("-")[2]) / 100.; - double workRate1 = Integer.parseInt(params.testingRateEduWorkLeisure1.split("-")[1]) / 100.; - double eduRate1 = Integer.parseInt(params.testingRateEduWorkLeisure1.split("-")[0]) / 100.; - - Map leisureTests = new HashMap(); - Map workTests = new HashMap(); - Map eduTests = new HashMap(); - leisureTests.put(LocalDate.parse("2020-01-01"), 0.); - workTests.put(LocalDate.parse("2020-01-01"), 0.); - eduTests.put(LocalDate.parse("2020-01-01"), 0.); - - for (int i = 1; i<=31; i++) { - leisureTests.put(testingDate.plusDays(i), leisureRate1 * i / 31.); - workTests.put(testingDate.plusDays(i), workRate1 * i / 31.); - eduTests.put(testingDate.plusDays(i), eduRate1 * i / 31.); - } - if (params.testing.equals("no")) { - leisureTests.put(date1, 0.0); - workTests.put(date1, 0.0); - eduTests.put(date1, 0.0); - } - if (params.testing.equals("fromOctober")) { - leisureTests.put(date1, 0.0); - workTests.put(date1, 0.0); - eduTests.put(date1, 0.0); - leisureTests.put(LocalDate.parse("2021-10-01"), leisureRate1); - workTests.put(LocalDate.parse("2021-10-01"), workRate1); - eduTests.put(LocalDate.parse("2021-10-01"), eduRate1); - } - - testingConfigGroup.setTestingRatePerActivityAndDate((Map.of( - "leisure", leisureTests, - "work", workTests, - "business", workTests, - "educ_kiga", eduTests, - "educ_primary", eduTests, - "educ_secondary", eduTests, - "educ_tertiary", eduTests, - "educ_higher", eduTests, - "educ_other", eduTests - ))); - - testingConfigGroup.setTestingCapacity_pers_per_day(Map.of( - LocalDate.of(1970, 1, 1), 0, - testingDate, Integer.MAX_VALUE)); - - return config; - } - - public static final class Params { - -// @GenerateSeeds(1) -// public long seed; - - @StringParameter({"20-5-5"}) - String testingRateEduWorkLeisure1; - - @StringParameter({"no", "yes"}) - String testing; - - @StringParameter({"no", "yes", "fromOctober"}) - String masks; - -// @Parameter({1.0, 0.83}) -// double workFactor; - -// @StringParameter({"2021-04-01", "2021-06-01"}) - @StringParameter({"2021-04-07"}) - String mutBDate; - - @Parameter({1.8, 2.2, 2.5}) - double mutBinf; - - @Parameter({0.9, 0.8, 0.7}) - double mutBVaccinationEffectiveness; - - @Parameter({0.8, 0.95}) - double vaccinationCompliance; - - @StringParameter({"6m", "12y", "16y"}) - String vaccinationAgeGroup; - - @StringParameter({"no", "2021-08-01", "2021-10-01"}) - String revaccinationDate; - - @Parameter({0.02}) - double revaccinationSpeed; - - @Parameter({0.5, 1.0}) - double ciCorrectionEdu; - - } - - public static void main(String[] args) { - String[] args2 = { - RunParallel.OPTION_SETUP, BMBF210618Mutations.class.getName(), - RunParallel.OPTION_PARAMS, Params.class.getName(), - RunParallel.OPTION_TASKS, Integer.toString(1), - RunParallel.OPTION_ITERATIONS, Integer.toString(280), - RunParallel.OPTION_METADATA - }; - - RunParallel.main(args2); - } - - -} - diff --git a/src/main/java/org/matsim/run/batch/BMBF210716.java b/src/main/java/org/matsim/run/batch/BMBF210716.java deleted file mode 100644 index b7e15d733..000000000 --- a/src/main/java/org/matsim/run/batch/BMBF210716.java +++ /dev/null @@ -1,312 +0,0 @@ -package org.matsim.run.batch; - -import com.google.inject.AbstractModule; -import org.matsim.core.config.Config; -import org.matsim.core.config.ConfigUtils; -import org.matsim.episim.BatchRun; -import org.matsim.episim.EpisimConfigGroup; -import org.matsim.episim.TestingConfigGroup; -import org.matsim.episim.TestingConfigGroup.TestingParams; -import org.matsim.episim.VaccinationConfigGroup; -import org.matsim.episim.VirusStrainConfigGroup; -import org.matsim.episim.model.FaceMask; -import org.matsim.episim.model.VaccinationType; -import org.matsim.episim.model.VirusStrain; -import org.matsim.episim.model.testing.TestType; -import org.matsim.episim.policy.FixedPolicy; -import org.matsim.episim.policy.FixedPolicy.ConfigBuilder; -import org.matsim.episim.policy.Restriction; -import org.matsim.run.RunParallel; -import org.matsim.run.modules.AbstractSnzScenario2020; -import org.matsim.run.modules.SnzBerlinProductionScenario; - -import javax.annotation.Nullable; -import java.time.LocalDate; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - - -/** - * Mutations - */ -public class BMBF210716 implements BatchRun { - - @Override - public AbstractModule getBindings(int id, @Nullable Params params) { - return new SnzBerlinProductionScenario.Builder().setSnapshot(SnzBerlinProductionScenario.Snapshot.no).createSnzBerlinProductionScenario(); - } - - @Override - public Metadata getMetadata() { - return Metadata.of("berlin", "mutations"); - } - -// @Override -// public int getOffset() { -// return 20000; -// } - - @Override - public Config prepareConfig(int id, Params params) { - - - SnzBerlinProductionScenario module = new SnzBerlinProductionScenario.Builder() - .setSnapshot(SnzBerlinProductionScenario.Snapshot.no) - .setEasterModel(SnzBerlinProductionScenario.EasterModel.no) - .setChristmasModel(SnzBerlinProductionScenario.ChristmasModel.restrictive) - .createSnzBerlinProductionScenario(); - Config config = module.config(); - -// config.global().setRandomSeed(params.seed); - config.global().setRandomSeed(3831662765844904176L); - - - EpisimConfigGroup episimConfig = ConfigUtils.addOrGetModule(config, EpisimConfigGroup.class); - - episimConfig.setSnapshotSeed(EpisimConfigGroup.SnapshotSeed.reseed); - episimConfig.setStartFromSnapshot("../episim-snapshot-270-2020-11-20.zip"); -// episimConfig.setSnapshotInterval(30); - - - //restrictions - ConfigBuilder builder = FixedPolicy.parse(episimConfig.getPolicy()); - - builder.restrict("2021-04-06", Restriction.ofClosingHours(21, 5), "leisure", "visit"); - Map curfewCompliance = new HashMap(); - curfewCompliance.put(LocalDate.parse("2021-04-06"), 0.5); - curfewCompliance.put(LocalDate.parse("2021-05-16"), 0.0); - episimConfig.setCurfewCompliance(curfewCompliance); - - LocalDate date1 = LocalDate.parse("2021-08-06"); - //kein zusätzliches Lüften mehr nach den Sommerferien - builder.restrict("2021-08-07", Restriction.ofCiCorrection(params.ciCorrectionEdu), "educ_primary", "educ_kiga", "educ_secondary", "educ_higher", "educ_tertiary", "educ_other"); - - builder.restrict(date1, 1.0, "shop_daily", "shop_other", "errands"); - - builder.restrict(date1, 1.0, "work", "business", "leisure", "visit"); - - builder.restrict("2021-10-18", 1.0, "educ_higher"); - - if(params.masks.equals("no")) { - builder.restrict(date1, Restriction.ofMask(Map.of(FaceMask.CLOTH, 0.0, FaceMask.SURGICAL, 0.0, FaceMask.N95, 0.0)), AbstractSnzScenario2020.DEFAULT_ACTIVITIES); - builder.restrict(date1, Restriction.ofMask(Map.of(FaceMask.CLOTH, 0.0, FaceMask.SURGICAL, 0.0, FaceMask.N95, 0.0)), "pt"); - } - - builder.apply("2021-03-26", "2021-04-09", (d, e) -> e.put("fraction", 0.92 * (double) e.get("fraction")), "work", "business"); - builder.apply("2021-06-24", "2021-08-05", (d, e) -> e.put("fraction", 0.92 * (double) e.get("fraction")), "work", "business"); - - builder.restrict("2021-10-11", 0.83, "work", "business"); - builder.restrict("2021-10-23", 1.0, "work", "business"); - - builder.restrict("2021-12-20", 0.83, "work", "business"); - builder.restrict("2022-01-02", 1.0, "work", "business"); - - builder.restrict("2021-12-20", 0.2, "educ_higher"); - builder.restrict("2022-01-02", 1.0, "educ_higher"); - - episimConfig.setPolicy(FixedPolicy.class, builder.build()); - - - //mutations and vaccinations - Map infPerDayB117 = new HashMap<>(); - infPerDayB117.put(LocalDate.parse("2020-01-01"), 0); - infPerDayB117.put(LocalDate.parse("2020-11-30"), 1); - episimConfig.setInfections_pers_per_day(VirusStrain.ALPHA, infPerDayB117); - - VaccinationConfigGroup vaccinationConfig = ConfigUtils.addOrGetModule(config, VaccinationConfigGroup.class); - double vaccineEffectiveness = vaccinationConfig.getParams(VaccinationType.generic).getEffectiveness(); - - VirusStrainConfigGroup virusStrainConfigGroup = ConfigUtils.addOrGetModule(config, VirusStrainConfigGroup.class); - - virusStrainConfigGroup.getOrAddParams(VirusStrain.ALPHA).setInfectiousness(1.8); - virusStrainConfigGroup.getOrAddParams(VirusStrain.ALPHA).setVaccineEffectiveness(1.0); - virusStrainConfigGroup.getOrAddParams(VirusStrain.ALPHA).setFactorSeriouslySick(1.5); - virusStrainConfigGroup.getOrAddParams(VirusStrain.ALPHA).setFactorSeriouslySickVaccinated(0.05 / (1-vaccineEffectiveness)); - - virusStrainConfigGroup.getOrAddParams(VirusStrain.SARS_CoV_2).setFactorSeriouslySickVaccinated(0.05 / (1-vaccineEffectiveness)); - - Map infPerDayMUTB = new HashMap<>(); - infPerDayMUTB.put(LocalDate.parse("2020-01-01"), 0); - infPerDayMUTB.put(LocalDate.parse("2021-04-07"), 1); - episimConfig.setInfections_pers_per_day(VirusStrain.DELTA, infPerDayMUTB); - virusStrainConfigGroup.getOrAddParams(VirusStrain.DELTA).setInfectiousness(2.5); - virusStrainConfigGroup.getOrAddParams(VirusStrain.DELTA).setVaccineEffectiveness(params.mutBVaccinationEffectiveness / vaccineEffectiveness); - virusStrainConfigGroup.getOrAddParams(VirusStrain.DELTA).setReVaccineEffectiveness(1.0); - virusStrainConfigGroup.getOrAddParams(VirusStrain.DELTA).setFactorSeriouslySickVaccinated(0.05 / (1- params.mutBVaccinationEffectiveness)); - - Map vaccinationCompliance = new HashMap<>(); - - if (params.vaccinationAgeGroup.equals("6m")) { - vaccinationCompliance.put(0, params.vaccinationCompliance * 0.5); - for(int i = 1; i<120; i++) vaccinationCompliance.put(i, params.vaccinationCompliance); - } - if (params.vaccinationAgeGroup.equals("12y")) { - for(int i = 0; i<11; i++) vaccinationCompliance.put(i, 0.0); - for(int i = 12; i<120; i++) vaccinationCompliance.put(i, params.vaccinationCompliance); - } - if (params.vaccinationAgeGroup.equals("16y")) { - for(int i = 0; i<15; i++) vaccinationCompliance.put(i, 0.0); - for(int i = 16; i<120; i++) vaccinationCompliance.put(i, params.vaccinationCompliance); - } - - vaccinationConfig.setCompliancePerAge(vaccinationCompliance); - - Map reVaccinations = new HashMap<>(); - - if (!params.revaccinationDate.equals("no")) { - reVaccinations.put(LocalDate.parse("2020-01-01"), 0); - reVaccinations.put(LocalDate.parse(params.revaccinationDate), (int) (params.revaccinationSpeed * 4_831_120)); - vaccinationConfig.setReVaccinationCapacity_pers_per_day(reVaccinations); - } - - //testing - TestingConfigGroup testingConfigGroup = ConfigUtils.addOrGetModule(config, TestingConfigGroup.class); - -// TestType testType = TestType.valueOf(params.testType); - - TestingParams rapidTest = testingConfigGroup.getOrAddParams(TestType.RAPID_TEST); - TestingParams pcrTest = testingConfigGroup.getOrAddParams(TestType.PCR); - - testingConfigGroup.setStrategy(TestingConfigGroup.Strategy.ACTIVITIES); - - List actsList = new ArrayList(); - actsList.add("leisure"); - actsList.add("work"); - actsList.add("business"); - actsList.add("educ_kiga"); - actsList.add("educ_primary"); - actsList.add("educ_secondary"); - actsList.add("educ_tertiary"); - actsList.add("educ_other"); - actsList.add("educ_higher"); - testingConfigGroup.setActivities(actsList); - - rapidTest.setFalseNegativeRate(0.3); - rapidTest.setFalsePositiveRate(0.03); - - pcrTest.setFalseNegativeRate(0.1); - pcrTest.setFalsePositiveRate(0.01); - - testingConfigGroup.setHouseholdCompliance(1.0); - - LocalDate testingStartDate = LocalDate.parse("2021-03-19"); - - Map leisureTests = new HashMap(); - Map workTests = new HashMap(); - Map eduTests = new HashMap(); - leisureTests.put(LocalDate.parse("2020-01-01"), 0.); - workTests.put(LocalDate.parse("2020-01-01"), 0.); - eduTests.put(LocalDate.parse("2020-01-01"), 0.); - - for (int i = 1; i<=31; i++) { - leisureTests.put(testingStartDate.plusDays(i), 0.05 * i / 31.); - workTests.put(testingStartDate.plusDays(i), 0.05 * i / 31.); - eduTests.put(testingStartDate.plusDays(i), 0.2 * i / 31.); - } - - eduTests.put(LocalDate.parse("2021-06-24"), 0.0); - workTests.put(LocalDate.parse("2021-06-24"), 0.0); - leisureTests.put(LocalDate.parse("2021-06-24"), 0.0); - - eduTests.put(LocalDate.parse("2021-08-06"), params.testingRateRapidTest); - - rapidTest.setTestingRatePerActivityAndDate((Map.of( - "leisure", leisureTests, - "work", workTests, - "business", workTests, - "educ_kiga", eduTests, - "educ_primary", eduTests, - "educ_secondary", eduTests, - "educ_tertiary", eduTests, - "educ_higher", eduTests, - "educ_other", eduTests - ))); - - Map leisureTestsPCR = new HashMap(); - Map workTestsPCR = new HashMap(); - Map eduTestsPCR = new HashMap(); - leisureTestsPCR.put(LocalDate.parse("2020-01-01"), 0.); - workTestsPCR.put(LocalDate.parse("2020-01-01"), 0.); - eduTestsPCR.put(LocalDate.parse("2020-01-01"), 0.); - - eduTestsPCR.put(LocalDate.parse("2021-08-06"), params.testingRatePCRTest); - - pcrTest.setTestingRatePerActivityAndDate((Map.of( - "leisure", leisureTestsPCR, - "work", workTestsPCR, - "business", workTestsPCR, - "educ_kiga", eduTestsPCR, - "educ_primary", eduTestsPCR, - "educ_secondary", eduTestsPCR, - "educ_tertiary", eduTestsPCR, - "educ_higher", eduTestsPCR, - "educ_other", eduTestsPCR - ))); - - rapidTest.setTestingCapacity_pers_per_day(Map.of( - LocalDate.of(1970, 1, 1), 0, - testingStartDate, Integer.MAX_VALUE)); - - pcrTest.setTestingCapacity_pers_per_day(Map.of( - LocalDate.of(1970, 1, 1), 0, - testingStartDate, Integer.MAX_VALUE)); - - return config; - } - - public static final class Params { - -// @GenerateSeeds(1) -// public long seed; - - @StringParameter({"no", "yes"}) - String masks; - -// @Parameter({0.9, 0.8, 0.7}) - @Parameter({0.9, 0.7}) - double mutBVaccinationEffectiveness; - - @Parameter({0.8, 0.95}) - double vaccinationCompliance; - - @StringParameter({"6m", "12y", "16y"}) - String vaccinationAgeGroup; - -// @StringParameter({"no", "2021-10-01"}) - @StringParameter({"no"}) - String revaccinationDate; - - @Parameter({0.02}) - double revaccinationSpeed; - - @Parameter({0.125, 0.25, 0.5, 1.0}) - double ciCorrectionEdu; - -// @StringParameter({"RAPID_TEST", "PCR"}) -// String testType; - - @Parameter({0.0, 0.2, 0.4, 0.6, 0.8, 1.0}) - double testingRateRapidTest; - - @Parameter({0.0, 0.2, 0.4, 0.6, 0.8, 1.0}) - double testingRatePCRTest; - - } - - public static void main(String[] args) { - String[] args2 = { - RunParallel.OPTION_SETUP, BMBF210716.class.getName(), - RunParallel.OPTION_PARAMS, Params.class.getName(), - RunParallel.OPTION_TASKS, Integer.toString(1), - RunParallel.OPTION_ITERATIONS, Integer.toString(280), - RunParallel.OPTION_METADATA - }; - - RunParallel.main(args2); - } - - -} - diff --git a/src/main/java/org/matsim/run/batch/BMBF210827.java b/src/main/java/org/matsim/run/batch/BMBF210827.java deleted file mode 100644 index 113d0ab76..000000000 --- a/src/main/java/org/matsim/run/batch/BMBF210827.java +++ /dev/null @@ -1,520 +0,0 @@ -package org.matsim.run.batch; - -import org.matsim.core.config.Config; -import org.matsim.core.config.ConfigUtils; -import org.matsim.episim.*; -import org.matsim.episim.EpisimConfigGroup.SnapshotSeed; -import org.matsim.episim.model.FaceMask; -import org.matsim.episim.model.Transition; -import org.matsim.episim.model.VaccinationType; -import org.matsim.episim.model.VirusStrain; -import org.matsim.episim.model.testing.TestType; -import org.matsim.episim.policy.FixedPolicy; -import org.matsim.episim.policy.FixedPolicy.ConfigBuilder; -import org.matsim.episim.policy.Restriction; -import org.matsim.run.RunParallel; -import org.matsim.run.modules.SnzBerlinProductionScenario; -import org.matsim.run.modules.SnzProductionScenario.ChristmasModel; -import org.matsim.run.modules.SnzBerlinProductionScenario.Snapshot; -import org.matsim.run.modules.SnzProductionScenario.Tracing; - -import javax.annotation.Nullable; - -import static org.matsim.episim.model.Transition.to; - -import java.io.IOException; -import java.time.LocalDate; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - - -/** - * Calibration - */ -public class BMBF210827 implements BatchRun { - - @Override - public SnzBerlinProductionScenario getBindings(int id, @Nullable Params params) { - - return new SnzBerlinProductionScenario.Builder() - .setActivityHandling(EpisimConfigGroup.ActivityHandling.startOfDay) -// .setWeatherModel(params == null ? SnzBerlinProductionScenario.WeatherModel.midpoints_200_250 : params.weatherModel) -// .setImportFactorBeforeJune(params == null ? 1d : params.importFactorBeforeJune) -// .setImportFactorAfterJune(params == null ? 1d : params.importFactorAfterJune) - .setEasterModel(SnzBerlinProductionScenario.EasterModel.no) - .setChristmasModel(SnzBerlinProductionScenario.ChristmasModel.no) - .createSnzBerlinProductionScenario(); - } - - @Override - public Metadata getMetadata() { - return Metadata.of("berlin", "calibration"); - } - -// @Override -// public int getOffset() { -// return 10000; -// } - - @Override - public Config prepareConfig(int id, Params params) { - - SnzBerlinProductionScenario module = getBindings(id, params); - - Config config = module.config(); - config.global().setRandomSeed(params.seed); - - EpisimConfigGroup episimConfig = ConfigUtils.addOrGetModule(config, EpisimConfigGroup.class); - - episimConfig.setProgressionConfig(progressionConfig(params, Transition.config()).build()); - episimConfig.setDaysInfectious(Integer.MAX_VALUE); - - episimConfig.setCalibrationParameter(1.0e-05); - - episimConfig.setCalibrationParameter(episimConfig.getCalibrationParameter() * 0.83); - - episimConfig.setStartFromSnapshot("/scratch/projects/bzz0020/episim-input/snapshots-20210820/" + params.seed + "-270-2020-11-20.zip"); - - episimConfig.setSnapshotSeed(SnapshotSeed.restore); - - -// if (id == 1) -// episimConfig.setSnapshotInterval(100); - - //restrictions - ConfigBuilder builder = FixedPolicy.parse(episimConfig.getPolicy()); - - builder.restrict("2021-04-06", Restriction.ofClosingHours(21, 5), "leisure", "visit"); - Map curfewCompliance = new HashMap(); - curfewCompliance.put(LocalDate.parse("2021-04-06"), 1.0); - curfewCompliance.put(LocalDate.parse("2021-05-16"), 0.0); - episimConfig.setCurfewCompliance(curfewCompliance); - - //kein zusätzliches Lüften mehr nach den Sommerferien - builder.restrict("2021-08-07", Restriction.ofCiCorrection(1.0), "educ_primary", "educ_kiga", "educ_secondary", "educ_higher", "educ_tertiary", "educ_other"); - - - //Maskenpflicht nach den Sommerferien - builder.restrict(LocalDate.parse("2021-08-07"), Restriction.ofMask(Map.of( - FaceMask.N95, 0.45, - FaceMask.SURGICAL, 0.45)), - "educ_primary", "educ_secondary", "educ_higher", "educ_tertiary", "educ_other"); - -// if (params.schoolMasks.equals("no")) { - builder.restrict(LocalDate.parse("2021-09-06"), Restriction.ofMask(Map.of( - FaceMask.N95, 0.0, - FaceMask.SURGICAL, 0.0)), - "educ_primary", "educ_secondary", "educ_tertiary", "educ_other"); -// } - - - builder.restrict("2021-10-18", 1.0, "educ_higher"); - builder.restrict("2021-12-20", 0.2, "educ_higher"); - builder.restrict("2022-01-02", 1.0, "educ_higher"); - - if (!params.fractionUnv.equals("no")) { - double fraction = Double.parseDouble(params.fractionUnv); - builder.restrict("2021-09-06", Restriction.ofSusceptibleRf(fraction), "leisure", "work", "business"); - } - - - - // These entries will have no effect when extrapolation is based on hospital numbers -// builder.restrict("2021-10-11", 0.83, "work", "business"); -// builder.restrict("2021-10-23", 1.0, "work", "business"); -// -// builder.restrict("2021-12-20", 0.83, "work", "business"); -// builder.restrict("2022-01-02", 1.0, "work", "business"); - - episimConfig.setPolicy(builder.build()); - - //weather model - try { - Map outdoorFractions = EpisimUtils.getOutDoorFractionFromDateAndTemp2(SnzBerlinProductionScenario.INPUT.resolve("tempelhofWeatherUntil20210816.csv").toFile(), - SnzBerlinProductionScenario.INPUT.resolve("temeplhofWeatherDataAvg2000-2020.csv").toFile(), 0.5, 18.5, 25., 18.5, params.midpoint, 5., params.alpha, 1.0); - episimConfig.setLeisureOutdoorFraction(outdoorFractions); - } catch (IOException e) { - e.printStackTrace(); - } - - - //mutations and vaccinations - VaccinationConfigGroup vaccinationConfig = ConfigUtils.addOrGetModule(config, VaccinationConfigGroup.class); - VirusStrainConfigGroup virusStrainConfigGroup = ConfigUtils.addOrGetModule(config, VirusStrainConfigGroup.class); - - Map infPerDayB117 = new HashMap<>(); - infPerDayB117.put(LocalDate.parse("2020-01-01"), 0); - infPerDayB117.put(LocalDate.parse("2020-12-05"), 1); - episimConfig.setInfections_pers_per_day(VirusStrain.ALPHA, infPerDayB117); - - virusStrainConfigGroup.getOrAddParams(VirusStrain.ALPHA).setInfectiousness(1.7); - virusStrainConfigGroup.getOrAddParams(VirusStrain.ALPHA).setFactorSeriouslySick(1.0); - - Map infPerDayMUTB = new HashMap<>(); - infPerDayMUTB.put(LocalDate.parse("2020-01-01"), 0); - infPerDayMUTB.put(LocalDate.parse(params.deltaDate), 1); - - SnzBerlinProductionScenario.interpolateImport(infPerDayMUTB, 1.0, LocalDate.parse("2021-06-14").plusDays(0), - LocalDate.parse("2021-06-21").plusDays(0), 1.0, params.importFactor * 1.6); - SnzBerlinProductionScenario.interpolateImport(infPerDayMUTB, params.importFactor, LocalDate.parse("2021-06-21").plusDays(0), - LocalDate.parse("2021-06-28").plusDays(0), 1.6, 2.8); - SnzBerlinProductionScenario.interpolateImport(infPerDayMUTB, params.importFactor, LocalDate.parse("2021-06-28").plusDays(0), - LocalDate.parse("2021-07-05").plusDays(0), 2.8, 4.6); - SnzBerlinProductionScenario.interpolateImport(infPerDayMUTB, params.importFactor, LocalDate.parse("2021-07-05").plusDays(0), - LocalDate.parse("2021-07-12").plusDays(0), 4.6, 5.9); - SnzBerlinProductionScenario.interpolateImport(infPerDayMUTB, params.importFactor, LocalDate.parse("2021-07-12").plusDays(0), - LocalDate.parse("2021-07-19").plusDays(0), 5.9, 7.3); - SnzBerlinProductionScenario.interpolateImport(infPerDayMUTB, params.importFactor, LocalDate.parse("2021-07-19").plusDays(0), - LocalDate.parse("2021-07-26").plusDays(0), 7.3, 10.2); - SnzBerlinProductionScenario.interpolateImport(infPerDayMUTB, params.importFactor, LocalDate.parse("2021-07-26").plusDays(0), - LocalDate.parse("2021-08-02").plusDays(0), 10.2, 13.2); - - SnzBerlinProductionScenario.interpolateImport(infPerDayMUTB, 1.0, LocalDate.parse("2021-08-09").plusDays(0), - LocalDate.parse("2021-08-31").plusDays(0), params.importFactor * 13.2, 1.0); - - - episimConfig.setInfections_pers_per_day(VirusStrain.DELTA, infPerDayMUTB); - virusStrainConfigGroup.getOrAddParams(VirusStrain.DELTA).setInfectiousness(params.deltaInf); - virusStrainConfigGroup.getOrAddParams(VirusStrain.DELTA).setFactorSeriouslySick(params.deltaSeriouslySick); - - - double effectivnessMRNA = params.deltaVacEffect; - double factorShowingSymptomsMRNA = 0.12 / (1 - effectivnessMRNA); - double factorSeriouslySickMRNA = 0.02 / ((1 - effectivnessMRNA) * factorShowingSymptomsMRNA); - int fullEffectMRNA = 7 * 7; //second shot after 6 weeks, full effect one week after second shot - vaccinationConfig.getOrAddParams(VaccinationType.mRNA) - .setDaysBeforeFullEffect(fullEffectMRNA) - .setEffectiveness(VaccinationConfigGroup.forStrain(VirusStrain.DELTA) - .atDay(1, 0.0) - .atDay(fullEffectMRNA-7, effectivnessMRNA/2.) - .atFullEffect(effectivnessMRNA) - .atDay(fullEffectMRNA + 5*365, 0.0) //10% reduction every 6 months (source: TC) - ) - .setFactorShowingSymptoms(VaccinationConfigGroup.forStrain(VirusStrain.DELTA) - .atDay(1, 1.0) - .atDay(fullEffectMRNA-7, 1.0 - ((1.0 - factorShowingSymptomsMRNA) / 2.)) - .atFullEffect(factorShowingSymptomsMRNA) - .atDay(fullEffectMRNA + 5*365, 1.0) //10% reduction every 6 months (source: TC) - ) - .setFactorSeriouslySick(VaccinationConfigGroup.forStrain(VirusStrain.DELTA) - .atDay(1, 1.0) - .atDay(fullEffectMRNA-7, 1.0 - ((1.0 - factorSeriouslySickMRNA) / 2.)) - .atFullEffect(factorSeriouslySickMRNA) - .atDay(fullEffectMRNA + 5*365, 1.0) //10% reduction every 6 months (source: TC) - ) - ; - - double effectivnessVector = params.deltaVacEffect * 0.5/0.7; - double factorShowingSymptomsVector = 0.32 / (1 - effectivnessVector); - double factorSeriouslySickVector = 0.15 / ((1 - effectivnessVector) * factorShowingSymptomsVector); - int fullEffectVector = 10 * 7; //second shot after 9 weeks, full effect one week after second shot - - vaccinationConfig.getOrAddParams(VaccinationType.vector) - .setDaysBeforeFullEffect(fullEffectVector) - .setEffectiveness(VaccinationConfigGroup.forStrain(VirusStrain.DELTA) - .atDay(1, 0.0) - .atDay(fullEffectVector-7, effectivnessVector/2.) - .atFullEffect(effectivnessVector) - .atDay(fullEffectVector + 5*365, 0.0) //10% reduction every 6 months (source: TC) - ) - .setFactorShowingSymptoms(VaccinationConfigGroup.forStrain(VirusStrain.DELTA) - .atDay(1, 1.0) - .atDay(fullEffectVector-7, 1.0 - ((1.0 - factorShowingSymptomsVector) / 2.)) - .atFullEffect(factorShowingSymptomsVector) - .atDay(fullEffectVector + 5*365, 1.0) //10% reduction every 6 months (source: TC) - ) - .setFactorSeriouslySick(VaccinationConfigGroup.forStrain(VirusStrain.DELTA) - .atDay(1, 1.0) - .atDay(fullEffectVector-7, 1.0 - ((1.0 - factorSeriouslySickVector) / 2.)) - .atFullEffect(factorSeriouslySickVector) - .atDay(fullEffectVector + 5*365, 1.0) //10% reduction every 6 months (source: TC) - ) - ; - - - - - - Map vaccinationCompliance = new HashMap<>(); - - if (params.vacCompl.equals("current")) { - for (int i = 0; i < 12; i++) vaccinationCompliance.put(i, 0.0); - for (int i = 12; i < 18; i++) vaccinationCompliance.put(i, 0.7); - for (int i = 18; i < 25; i++) vaccinationCompliance.put(i, 0.7); - for (int i = 25; i < 40; i++) vaccinationCompliance.put(i, 0.75); - for (int i = 40; i < 65; i++) vaccinationCompliance.put(i, 0.8); - for (int i = 65; i <= 120; i++) vaccinationCompliance.put(i, 0.9); - } - else if (params.vacCompl.equals("0.9")) { - for (int i = 0; i < 12; i++) vaccinationCompliance.put(i, 0.0); - for (int i = 12; i < 18; i++) vaccinationCompliance.put(i, 0.9); - for (int i = 18; i < 25; i++) vaccinationCompliance.put(i, 0.9); - for (int i = 25; i < 40; i++) vaccinationCompliance.put(i, 0.9); - for (int i = 40; i < 65; i++) vaccinationCompliance.put(i, 0.9); - for (int i = 65; i <= 120; i++) vaccinationCompliance.put(i, 0.9); - } - else { - throw new RuntimeException(); - } - - - vaccinationConfig.setCompliancePerAge(vaccinationCompliance); - - //testing - TestingConfigGroup testingConfigGroup = ConfigUtils.addOrGetModule(config, TestingConfigGroup.class); - - if (params.testVac.equals("yes")) { - testingConfigGroup.setTestAllPersonsAfter(LocalDate.EPOCH); - } - -// TestType testType = TestType.valueOf(params.testType); - - TestingConfigGroup.TestingParams rapidTest = testingConfigGroup.getOrAddParams(TestType.RAPID_TEST); - TestingConfigGroup.TestingParams pcrTest = testingConfigGroup.getOrAddParams(TestType.PCR); - - testingConfigGroup.setStrategy(TestingConfigGroup.Strategy.ACTIVITIES); - - List actsList = new ArrayList(); - actsList.add("leisure"); - actsList.add("work"); - actsList.add("business"); - actsList.add("educ_kiga"); - actsList.add("educ_primary"); - actsList.add("educ_secondary"); - actsList.add("educ_tertiary"); - actsList.add("educ_other"); - actsList.add("educ_higher"); - testingConfigGroup.setActivities(actsList); - - rapidTest.setFalseNegativeRate(0.3); - rapidTest.setFalsePositiveRate(0.03); - - pcrTest.setFalseNegativeRate(0.1); - pcrTest.setFalsePositiveRate(0.01); - - testingConfigGroup.setHouseholdCompliance(1.0); - - LocalDate testingStartDate = LocalDate.parse("2021-03-19"); - - Map leisureTests = new HashMap(); - Map workTests = new HashMap(); - Map eduTests = new HashMap(); - leisureTests.put(LocalDate.parse("2020-01-01"), 0.); - workTests.put(LocalDate.parse("2020-01-01"), 0.); - eduTests.put(LocalDate.parse("2020-01-01"), 0.); - - for (int i = 1; i <= 31; i++) { - leisureTests.put(testingStartDate.plusDays(i), params.tesRateLeisureWork * i / 31.); - workTests.put(testingStartDate.plusDays(i), params.tesRateLeisureWork * i / 31.); - eduTests.put(testingStartDate.plusDays(i), 0.8 * i / 31.); - } - - - eduTests.put(LocalDate.parse("2021-06-24"), 0.0); - workTests.put(LocalDate.parse("2021-06-04"), params.tesRateLeisureWork2); -// workTests.put(LocalDate.parse("2021-09-06"), params.rapidTestWork); - - - leisureTests.put(LocalDate.parse("2021-06-04"), params.tesRateLeisureWork2); -// leisureTests.put(LocalDate.parse("2021-08-23"), 0.2); - -// leisureTests.put(LocalDate.parse("2021-09-06"), params.rapidTestLeis); - - - eduTests.put(LocalDate.parse("2021-08-06"), 0.6); - eduTests.put(LocalDate.parse("2021-08-30"), 0.4); -// eduTests.put(LocalDate.parse("2021-09-06"), params.rapidTestEdu); - - - - rapidTest.setTestingRatePerActivityAndDate((Map.of( - "leisure", leisureTests, - "work", workTests, - "business", workTests, - "educ_kiga", eduTests, - "educ_primary", eduTests, - "educ_secondary", eduTests, - "educ_tertiary", eduTests, - "educ_higher", eduTests, - "educ_other", eduTests - ))); - - Map leisureTestsPCR = new HashMap(); - Map workTestsPCR = new HashMap(); - Map eduTestsPCR = new HashMap(); - leisureTestsPCR.put(LocalDate.parse("2020-01-01"), 0.); - workTestsPCR.put(LocalDate.parse("2020-01-01"), 0.); - eduTestsPCR.put(LocalDate.parse("2020-01-01"), 0.); - -// eduTestsPCR.put(LocalDate.parse("2021-09-06"), params.pcrTestEdu); -// workTestsPCR.put(LocalDate.parse("2021-09-06"), params.pcrTestWork); -// leisureTestsPCR.put(LocalDate.parse("2021-09-06"), params.pcrTestLeis); - - -// eduTestsPCR.put(LocalDate.parse("2021-08-06"), 0.1); - - pcrTest.setTestingRatePerActivityAndDate((Map.of( - "leisure", leisureTestsPCR, - "work", workTestsPCR, - "business", workTestsPCR, - "educ_kiga", eduTestsPCR, - "educ_primary", eduTestsPCR, - "educ_secondary", eduTestsPCR, - "educ_tertiary", eduTestsPCR, - "educ_higher", eduTestsPCR, - "educ_other", eduTestsPCR - ))); - - rapidTest.setTestingCapacity_pers_per_day(Map.of( - LocalDate.of(1970, 1, 1), 0, - testingStartDate, Integer.MAX_VALUE)); - - pcrTest.setTestingCapacity_pers_per_day(Map.of( - LocalDate.of(1970, 1, 1), 0, - testingStartDate, Integer.MAX_VALUE)); - - - if (params.tracingCapacity > 200) { - TracingConfigGroup tracingConfig = ConfigUtils.addOrGetModule(config, TracingConfigGroup.class); - int tracingCapacity = 200; - tracingConfig.setTracingCapacity_pers_per_day(Map.of( - LocalDate.of(2020, 4, 1), (int) (tracingCapacity * 0.2), - LocalDate.of(2020, 6, 15), tracingCapacity, - LocalDate.of(2021, 4, 15), params.tracingCapacity - )); - } - - - return config; - } - - public static final class Params { - - @GenerateSeeds(5) - public long seed; - - @Parameter({1.0, 2.0, 4.0}) - double importFactor; - - @Parameter({1.0}) - double alpha; - - @Parameter({22.5}) - double midpoint; - - @Parameter({2.0, 2.2, 2.4, 2.6}) - double deltaInf; - - @Parameter({0.5, 0.7}) - double deltaVacEffect; - - @Parameter({0.25}) - double tesRateLeisureWork; - - @Parameter({0.05, 0.1}) - double tesRateLeisureWork2; - - @IntParameter({200}) - int tracingCapacity; - -// @StringParameter({"alpha", "0.5"}) -// String delta1Vac; - -// @StringParameter({"no"}) -// String schoolMasks; - - @StringParameter({"2021-03-01", "2021-03-15", "2021-04-01", "2021-04-15", "2021-05-01"}) - String deltaDate; - - @StringParameter({"current"}) - String vacCompl; - -// @Parameter({0.0}) -// double rapidTestEdu; -// -// @Parameter({0.0}) -// double rapidTestLeis; -// -// @Parameter({0.0}) -// double rapidTestWork; -// -// @Parameter({0.0}) -// double pcrTestEdu; -// -// @Parameter({0.0}) -// double pcrTestLeis; -// -// @Parameter({0.0}) -// double pcrTestWork; - - @Parameter({2.0}) - double deltaSeriouslySick; - - @StringParameter({"no"}) - String testVac; - - @StringParameter({"no"}) - String fractionUnv; - - } - - public static void main(String[] args) { - String[] args2 = { - RunParallel.OPTION_SETUP, BMBF210827.class.getName(), - RunParallel.OPTION_PARAMS, Params.class.getName(), - RunParallel.OPTION_TASKS, Integer.toString(1), - RunParallel.OPTION_ITERATIONS, Integer.toString(500), - RunParallel.OPTION_METADATA - }; - - RunParallel.main(args2); - } - - /** - * Adds progression config to the given builder. - * @param params - */ - private static Transition.Builder progressionConfig(Params params, Transition.Builder builder) { - - Transition transitionRecSus; - - transitionRecSus = Transition.logNormalWithMedianAndStd(180., 10.); - - return builder - // Inkubationszeit: Die Inkubationszeit [ ... ] liegt im Mittel (Median) bei 5–6 Tagen (Spannweite 1 bis 14 Tage) - .from(EpisimPerson.DiseaseStatus.infectedButNotContagious, - to(EpisimPerson.DiseaseStatus.contagious, Transition.fixed(0))) - -// Dauer Infektiosität:: Es wurde geschätzt, dass eine relevante Infektiosität bereits zwei Tage vor Symptombeginn vorhanden ist und die höchste Infektiosität am Tag vor dem Symptombeginn liegt -// Dauer Infektiosität: Abstrichproben vom Rachen enthielten vermehrungsfähige Viren bis zum vierten, aus dem Sputum bis zum achten Tag nach Symptombeginn - .from(EpisimPerson.DiseaseStatus.contagious, - to(EpisimPerson.DiseaseStatus.showingSymptoms, Transition.logNormalWithMedianAndStd(6., 6.)), //80% - to(EpisimPerson.DiseaseStatus.recovered, Transition.logNormalWithMedianAndStd(8., 8.))) //20% - -// Erkankungsbeginn -> Hospitalisierung: Eine Studie aus Deutschland zu 50 Patienten mit eher schwereren Verläufen berichtete für alle Patienten eine mittlere (Median) Dauer von vier Tagen (IQR: 1–8 Tage) - .from(EpisimPerson.DiseaseStatus.showingSymptoms, - to(EpisimPerson.DiseaseStatus.seriouslySick, Transition.logNormalWithMedianAndStd(5., 5.)), - to(EpisimPerson.DiseaseStatus.recovered, Transition.logNormalWithMedianAndStd(8., 8.))) - -// Hospitalisierung -> ITS: In einer chinesischen Fallserie betrug diese Zeitspanne im Mittel (Median) einen Tag (IQR: 0–3 Tage) - .from(EpisimPerson.DiseaseStatus.seriouslySick, - to(EpisimPerson.DiseaseStatus.critical, Transition.logNormalWithMedianAndStd(1., 1.)), - to(EpisimPerson.DiseaseStatus.recovered, Transition.logNormalWithMedianAndStd(14., 14.))) - -// Dauer des Krankenhausaufenthalts: „WHO-China Joint Mission on Coronavirus Disease 2019“ wird berichtet, dass milde Fälle im Mittel (Median) einen Krankheitsverlauf von zwei Wochen haben und schwere von 3–6 Wochen - .from(EpisimPerson.DiseaseStatus.critical, - to(EpisimPerson.DiseaseStatus.seriouslySickAfterCritical, Transition.logNormalWithMedianAndStd(21., 21.))) - - .from(EpisimPerson.DiseaseStatus.seriouslySickAfterCritical, - to(EpisimPerson.DiseaseStatus.recovered, Transition.logNormalWithMedianAndStd(7., 7.))) - - .from(EpisimPerson.DiseaseStatus.recovered, - to(EpisimPerson.DiseaseStatus.susceptible, transitionRecSus)) - ; - } - - -} - diff --git a/src/main/java/org/matsim/run/batch/BMBF210903.java b/src/main/java/org/matsim/run/batch/BMBF210903.java deleted file mode 100644 index b8f7db87b..000000000 --- a/src/main/java/org/matsim/run/batch/BMBF210903.java +++ /dev/null @@ -1,488 +0,0 @@ -package org.matsim.run.batch; - -import org.matsim.core.config.Config; -import org.matsim.core.config.ConfigUtils; -import org.matsim.episim.*; -import org.matsim.episim.EpisimConfigGroup.SnapshotSeed; -import org.matsim.episim.model.FaceMask; -import org.matsim.episim.model.Transition; -import org.matsim.episim.model.VaccinationType; -import org.matsim.episim.model.VirusStrain; -import org.matsim.episim.model.testing.TestType; -import org.matsim.episim.policy.FixedPolicy; -import org.matsim.episim.policy.FixedPolicy.ConfigBuilder; -import org.matsim.episim.policy.Restriction; -import org.matsim.run.RunParallel; -import org.matsim.run.modules.SnzBerlinProductionScenario; - -import javax.annotation.Nullable; - -import static org.matsim.episim.model.Transition.to; - -import java.io.IOException; -import java.time.LocalDate; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - - -/** - * bmbf runs - */ -public class BMBF210903 implements BatchRun { - - @Override - public SnzBerlinProductionScenario getBindings(int id, @Nullable Params params) { - - return new SnzBerlinProductionScenario.Builder() - .setActivityHandling(EpisimConfigGroup.ActivityHandling.startOfDay) -// .setWeatherModel(params == null ? SnzBerlinProductionScenario.WeatherModel.midpoints_200_250 : params.weatherModel) -// .setImportFactorBeforeJune(params == null ? 1d : params.importFactorBeforeJune) -// .setImportFactorAfterJune(params == null ? 1d : params.importFactorAfterJune) - .setEasterModel(SnzBerlinProductionScenario.EasterModel.no) - .setChristmasModel(SnzBerlinProductionScenario.ChristmasModel.no) - .createSnzBerlinProductionScenario(); - } - - @Override - public Metadata getMetadata() { - return Metadata.of("berlin", "bmbf"); - } - -// @Override -// public int getOffset() { -// return 10000; -// } - - @Override - public Config prepareConfig(int id, Params params) { - - SnzBerlinProductionScenario module = getBindings(id, params); - - Config config = module.config(); - config.global().setRandomSeed(params.seed); - - EpisimConfigGroup episimConfig = ConfigUtils.addOrGetModule(config, EpisimConfigGroup.class); - - episimConfig.setProgressionConfig(progressionConfig(params, Transition.config()).build()); - episimConfig.setDaysInfectious(Integer.MAX_VALUE); - - episimConfig.setCalibrationParameter(1.0e-05); - - episimConfig.setCalibrationParameter(episimConfig.getCalibrationParameter() * 0.83); - - episimConfig.setStartFromSnapshot("/scratch/projects/bzz0020/episim-input/snapshots-20210901/" + params.seed + "-270-2020-11-20.zip"); - - episimConfig.setSnapshotSeed(SnapshotSeed.restore); - - -// if (id == 1) -// episimConfig.setSnapshotInterval(100); - - //restrictions - ConfigBuilder builder = FixedPolicy.parse(episimConfig.getPolicy()); - - builder.restrict("2021-04-06", Restriction.ofClosingHours(21, 5), "leisure", "visit"); - Map curfewCompliance = new HashMap(); - curfewCompliance.put(LocalDate.parse("2021-04-06"), 1.0); - curfewCompliance.put(LocalDate.parse("2021-05-16"), 0.0); - episimConfig.setCurfewCompliance(curfewCompliance); - - //kein zusätzliches Lüften mehr nach den Sommerferien - builder.restrict("2021-08-07", Restriction.ofCiCorrection(1.0), "educ_primary", "educ_kiga", "educ_secondary", "educ_higher", "educ_tertiary", "educ_other"); - - - //Maskenpflicht nach den Sommerferien - builder.restrict(LocalDate.parse("2021-08-07"), Restriction.ofMask(Map.of( - FaceMask.N95, 0.45, - FaceMask.SURGICAL, 0.45)), - "educ_primary", "educ_secondary", "educ_higher", "educ_tertiary", "educ_other"); - -// if (params.schoolMasks.equals("no")) { - builder.restrict(LocalDate.parse("2021-09-06"), Restriction.ofMask(Map.of( - FaceMask.N95, 0.0, - FaceMask.SURGICAL, 0.0)), - "educ_primary", "educ_secondary", "educ_tertiary", "educ_other"); -// } - - - builder.restrict("2021-10-18", 1.0, "educ_higher"); - builder.restrict("2021-12-20", 0.2, "educ_higher"); - builder.restrict("2022-01-02", 1.0, "educ_higher"); - - if (!params.workUnv.equals("no")) { - double fraction = Double.parseDouble(params.workUnv); - builder.restrict("2021-09-06", Restriction.ofSusceptibleRf(fraction), "work", "business"); - } - if (!params.leisureUnv.equals("no")) { - double fraction = Double.parseDouble(params.leisureUnv); - builder.restrict("2021-09-06", Restriction.ofSusceptibleRf(fraction), "leisure"); - } - - - - // These entries will have no effect when extrapolation is based on hospital numbers -// builder.restrict("2021-10-11", 0.83, "work", "business"); -// builder.restrict("2021-10-23", 1.0, "work", "business"); -// -// builder.restrict("2021-12-20", 0.83, "work", "business"); -// builder.restrict("2022-01-02", 1.0, "work", "business"); - - episimConfig.setPolicy(builder.build()); - - //weather model - try { - Map outdoorFractions = EpisimUtils.getOutdoorFractions2(SnzBerlinProductionScenario.INPUT.resolve("tempelhofWeatherUntil20210905.csv").toFile(), - SnzBerlinProductionScenario.INPUT.resolve("temeplhofWeatherDataAvg2000-2020.csv").toFile(), 0.5, 18.5, 22.5, 5.); - episimConfig.setLeisureOutdoorFraction(outdoorFractions); - } catch (IOException e) { - e.printStackTrace(); - } - - - //mutations and vaccinations - VaccinationConfigGroup vaccinationConfig = ConfigUtils.addOrGetModule(config, VaccinationConfigGroup.class); - VirusStrainConfigGroup virusStrainConfigGroup = ConfigUtils.addOrGetModule(config, VirusStrainConfigGroup.class); - - Map infPerDayB117 = new HashMap<>(); - infPerDayB117.put(LocalDate.parse("2020-01-01"), 0); - infPerDayB117.put(LocalDate.parse("2020-12-05"), 1); - episimConfig.setInfections_pers_per_day(VirusStrain.ALPHA, infPerDayB117); - - virusStrainConfigGroup.getOrAddParams(VirusStrain.ALPHA).setInfectiousness(1.7); - virusStrainConfigGroup.getOrAddParams(VirusStrain.ALPHA).setFactorSeriouslySick(1.0); - - Map infPerDayMUTB = new HashMap<>(); - infPerDayMUTB.put(LocalDate.parse("2020-01-01"), 0); - infPerDayMUTB.put(LocalDate.parse("2021-05-01"), 1); - - double importFactor = params.importFactor; - SnzBerlinProductionScenario.interpolateImport(infPerDayMUTB, 1.0, LocalDate.parse("2021-06-14").plusDays(0), - LocalDate.parse("2021-06-21").plusDays(0), 1.0, importFactor * 1.6); - SnzBerlinProductionScenario.interpolateImport(infPerDayMUTB, importFactor, LocalDate.parse("2021-06-21").plusDays(0), - LocalDate.parse("2021-06-28").plusDays(0), 1.6, 2.8); - SnzBerlinProductionScenario.interpolateImport(infPerDayMUTB, importFactor, LocalDate.parse("2021-06-28").plusDays(0), - LocalDate.parse("2021-07-05").plusDays(0), 2.8, 4.6); - SnzBerlinProductionScenario.interpolateImport(infPerDayMUTB, importFactor, LocalDate.parse("2021-07-05").plusDays(0), - LocalDate.parse("2021-07-12").plusDays(0), 4.6, 5.9); - SnzBerlinProductionScenario.interpolateImport(infPerDayMUTB, importFactor, LocalDate.parse("2021-07-12").plusDays(0), - LocalDate.parse("2021-07-19").plusDays(0), 5.9, 7.3); - SnzBerlinProductionScenario.interpolateImport(infPerDayMUTB, importFactor, LocalDate.parse("2021-07-19").plusDays(0), - LocalDate.parse("2021-07-26").plusDays(0), 7.3, 10.2); - SnzBerlinProductionScenario.interpolateImport(infPerDayMUTB, importFactor, LocalDate.parse("2021-07-26").plusDays(0), - LocalDate.parse("2021-08-02").plusDays(0), 10.2, 13.2); - - SnzBerlinProductionScenario.interpolateImport(infPerDayMUTB, 1.0, LocalDate.parse("2021-08-09").plusDays(0), - LocalDate.parse("2021-08-31").plusDays(0), importFactor * 13.2, 1.0); - - - episimConfig.setInfections_pers_per_day(VirusStrain.DELTA, infPerDayMUTB); - virusStrainConfigGroup.getOrAddParams(VirusStrain.DELTA).setInfectiousness(params.deltaInf); - virusStrainConfigGroup.getOrAddParams(VirusStrain.DELTA).setFactorSeriouslySick(2.0); - - - double effectivnessMRNA = params.deltaVacEffect; - double factorShowingSymptomsMRNA = 0.12 / (1 - effectivnessMRNA); - double factorSeriouslySickMRNA = 0.02 / ((1 - effectivnessMRNA) * factorShowingSymptomsMRNA); - int fullEffectMRNA = 7 * 7; //second shot after 6 weeks, full effect one week after second shot - vaccinationConfig.getOrAddParams(VaccinationType.mRNA) - .setDaysBeforeFullEffect(fullEffectMRNA) - .setEffectiveness(VaccinationConfigGroup.forStrain(VirusStrain.DELTA) - .atDay(1, 0.0) - .atDay(fullEffectMRNA-7, effectivnessMRNA/2.) - .atFullEffect(effectivnessMRNA) - .atDay(fullEffectMRNA + 5*365, 0.0) //10% reduction every 6 months (source: TC) - ) - .setFactorShowingSymptoms(VaccinationConfigGroup.forStrain(VirusStrain.DELTA) - .atDay(1, 1.0) - .atDay(fullEffectMRNA-7, 1.0 - ((1.0 - factorShowingSymptomsMRNA) / 2.)) - .atFullEffect(factorShowingSymptomsMRNA) - .atDay(fullEffectMRNA + 5*365, 1.0) //10% reduction every 6 months (source: TC) - ) - .setFactorSeriouslySick(VaccinationConfigGroup.forStrain(VirusStrain.DELTA) - .atDay(1, 1.0) - .atDay(fullEffectMRNA-7, 1.0 - ((1.0 - factorSeriouslySickMRNA) / 2.)) - .atFullEffect(factorSeriouslySickMRNA) - .atDay(fullEffectMRNA + 5*365, 1.0) //10% reduction every 6 months (source: TC) - ) - ; - - double effectivnessVector = params.deltaVacEffect * 0.5/0.7; - double factorShowingSymptomsVector = 0.32 / (1 - effectivnessVector); - double factorSeriouslySickVector = 0.15 / ((1 - effectivnessVector) * factorShowingSymptomsVector); - int fullEffectVector = 10 * 7; //second shot after 9 weeks, full effect one week after second shot - - vaccinationConfig.getOrAddParams(VaccinationType.vector) - .setDaysBeforeFullEffect(fullEffectVector) - .setEffectiveness(VaccinationConfigGroup.forStrain(VirusStrain.DELTA) - .atDay(1, 0.0) - .atDay(fullEffectVector-7, effectivnessVector/2.) - .atFullEffect(effectivnessVector) - .atDay(fullEffectVector + 5*365, 0.0) //10% reduction every 6 months (source: TC) - ) - .setFactorShowingSymptoms(VaccinationConfigGroup.forStrain(VirusStrain.DELTA) - .atDay(1, 1.0) - .atDay(fullEffectVector-7, 1.0 - ((1.0 - factorShowingSymptomsVector) / 2.)) - .atFullEffect(factorShowingSymptomsVector) - .atDay(fullEffectVector + 5*365, 1.0) //10% reduction every 6 months (source: TC) - ) - .setFactorSeriouslySick(VaccinationConfigGroup.forStrain(VirusStrain.DELTA) - .atDay(1, 1.0) - .atDay(fullEffectVector-7, 1.0 - ((1.0 - factorSeriouslySickVector) / 2.)) - .atFullEffect(factorSeriouslySickVector) - .atDay(fullEffectVector + 5*365, 1.0) //10% reduction every 6 months (source: TC) - ) - ; - - - - - - Map vaccinationCompliance = new HashMap<>(); - -// if (params.vacCompl.equals("current")) { - for (int i = 0; i < 12; i++) vaccinationCompliance.put(i, 0.0); - for (int i = 12; i < 18; i++) vaccinationCompliance.put(i, 0.7); - for (int i = 18; i < 25; i++) vaccinationCompliance.put(i, 0.7); - for (int i = 25; i < 40; i++) vaccinationCompliance.put(i, 0.75); - for (int i = 40; i < 65; i++) vaccinationCompliance.put(i, 0.8); - for (int i = 65; i <= 120; i++) vaccinationCompliance.put(i, 0.9); -// } -// else if (params.vacCompl.equals("0.9")) { -// for (int i = 0; i < 12; i++) vaccinationCompliance.put(i, 0.0); -// for (int i = 12; i < 18; i++) vaccinationCompliance.put(i, 0.9); -// for (int i = 18; i < 25; i++) vaccinationCompliance.put(i, 0.9); -// for (int i = 25; i < 40; i++) vaccinationCompliance.put(i, 0.9); -// for (int i = 40; i < 65; i++) vaccinationCompliance.put(i, 0.9); -// for (int i = 65; i <= 120; i++) vaccinationCompliance.put(i, 0.9); -// } -// else { -// throw new RuntimeException(); -// } - - - vaccinationConfig.setCompliancePerAge(vaccinationCompliance); - - //testing - TestingConfigGroup testingConfigGroup = ConfigUtils.addOrGetModule(config, TestingConfigGroup.class); - - if (params.testVac.equals("yes")) { - testingConfigGroup.setTestAllPersonsAfter(LocalDate.EPOCH); - } - -// TestType testType = TestType.valueOf(params.testType); - - TestingConfigGroup.TestingParams rapidTest = testingConfigGroup.getOrAddParams(TestType.RAPID_TEST); - TestingConfigGroup.TestingParams pcrTest = testingConfigGroup.getOrAddParams(TestType.PCR); - - testingConfigGroup.setStrategy(TestingConfigGroup.Strategy.ACTIVITIES); - - List actsList = new ArrayList(); - actsList.add("leisure"); - actsList.add("work"); - actsList.add("business"); - actsList.add("educ_kiga"); - actsList.add("educ_primary"); - actsList.add("educ_secondary"); - actsList.add("educ_tertiary"); - actsList.add("educ_other"); - actsList.add("educ_higher"); - testingConfigGroup.setActivities(actsList); - - rapidTest.setFalseNegativeRate(0.3); - rapidTest.setFalsePositiveRate(0.03); - - pcrTest.setFalseNegativeRate(0.1); - pcrTest.setFalsePositiveRate(0.01); - - testingConfigGroup.setHouseholdCompliance(1.0); - - LocalDate testingStartDate = LocalDate.parse("2021-03-19"); - - Map leisureTests = new HashMap(); - Map workTests = new HashMap(); - Map eduTests = new HashMap(); - leisureTests.put(LocalDate.parse("2020-01-01"), 0.); - workTests.put(LocalDate.parse("2020-01-01"), 0.); - eduTests.put(LocalDate.parse("2020-01-01"), 0.); - - for (int i = 1; i <= 31; i++) { - leisureTests.put(testingStartDate.plusDays(i), 0.25 * i / 31.); - workTests.put(testingStartDate.plusDays(i), 0.25 * i / 31.); - eduTests.put(testingStartDate.plusDays(i), 0.8 * i / 31.); - } - - - eduTests.put(LocalDate.parse("2021-06-24"), 0.0); - workTests.put(LocalDate.parse("2021-06-04"), 0.05); - if (!params.workTests.equals("current")) - workTests.put(LocalDate.parse("2021-09-06"), Double.parseDouble(params.workTests.split("-")[0])); - - - leisureTests.put(LocalDate.parse("2021-06-04"), 0.05); -// leisureTests.put(LocalDate.parse("2021-08-23"), 0.2); - - if (!params.leisureTests.equals("current")) - leisureTests.put(LocalDate.parse("2021-09-06"), Double.parseDouble(params.leisureTests.split("-")[0])); - - - eduTests.put(LocalDate.parse("2021-08-06"), 0.6); - eduTests.put(LocalDate.parse("2021-08-30"), 0.4); - - if (!params.eduTests.equals("current")) - eduTests.put(LocalDate.parse("2021-09-06"), Double.parseDouble(params.eduTests.split("-")[0])); - - - - rapidTest.setTestingRatePerActivityAndDate((Map.of( - "leisure", leisureTests, - "work", workTests, - "business", workTests, - "educ_kiga", eduTests, - "educ_primary", eduTests, - "educ_secondary", eduTests, - "educ_tertiary", eduTests, - "educ_higher", eduTests, - "educ_other", eduTests - ))); - - Map leisureTestsPCR = new HashMap(); - Map workTestsPCR = new HashMap(); - Map eduTestsPCR = new HashMap(); - leisureTestsPCR.put(LocalDate.parse("2020-01-01"), 0.); - workTestsPCR.put(LocalDate.parse("2020-01-01"), 0.); - eduTestsPCR.put(LocalDate.parse("2020-01-01"), 0.); - - if (!params.eduTests.equals("current")) - eduTestsPCR.put(LocalDate.parse("2021-09-06"), Double.parseDouble(params.eduTests.split("-")[1])); - if (!params.workTests.equals("current")) - workTestsPCR.put(LocalDate.parse("2021-09-06"), Double.parseDouble(params.workTests.split("-")[1])); - if (!params.leisureTests.equals("current")) - leisureTestsPCR.put(LocalDate.parse("2021-09-06"), Double.parseDouble(params.leisureTests.split("-")[1])); - - -// eduTestsPCR.put(LocalDate.parse("2021-08-06"), 0.1); - - pcrTest.setTestingRatePerActivityAndDate((Map.of( - "leisure", leisureTestsPCR, - "work", workTestsPCR, - "business", workTestsPCR, - "educ_kiga", eduTestsPCR, - "educ_primary", eduTestsPCR, - "educ_secondary", eduTestsPCR, - "educ_tertiary", eduTestsPCR, - "educ_higher", eduTestsPCR, - "educ_other", eduTestsPCR - ))); - - rapidTest.setTestingCapacity_pers_per_day(Map.of( - LocalDate.of(1970, 1, 1), 0, - testingStartDate, Integer.MAX_VALUE)); - - pcrTest.setTestingCapacity_pers_per_day(Map.of( - LocalDate.of(1970, 1, 1), 0, - testingStartDate, Integer.MAX_VALUE)); - - - return config; - } - - public static final class Params { - - @GenerateSeeds(5) - public long seed; - - @Parameter({2.2}) - double deltaInf; - - @Parameter({0.7}) - double deltaVacEffect; - - @Parameter({4.0}) - double importFactor; - -// @StringParameter({"alpha", "0.5"}) -// String delta1Vac; - -// @StringParameter({"no"}) -// String schoolMasks; - - @StringParameter({"current", "0.0-0.2", "0.0-0.6", "0.6-0.0"}) - String eduTests; - - @StringParameter({"current", "0.0-0.2", "0.0-0.6", "0.6-0.0"}) - String workTests; - - @StringParameter({"current", "0.0-0.2", "0.0-0.6", "0.6-0.0"}) - String leisureTests; - - @StringParameter({"no", "yes"}) - String testVac; - - @StringParameter({"no", "0.5"}) - String workUnv; - - @StringParameter({"no", "0.5", "0.0"}) - String leisureUnv; - - } - - public static void main(String[] args) { - String[] args2 = { - RunParallel.OPTION_SETUP, BMBF210903.class.getName(), - RunParallel.OPTION_PARAMS, Params.class.getName(), - RunParallel.OPTION_TASKS, Integer.toString(1), - RunParallel.OPTION_ITERATIONS, Integer.toString(500), - RunParallel.OPTION_METADATA - }; - - RunParallel.main(args2); - } - - /** - * Adds progression config to the given builder. - * @param params - */ - private static Transition.Builder progressionConfig(Params params, Transition.Builder builder) { - - Transition transitionRecSus; - - transitionRecSus = Transition.logNormalWithMedianAndStd(180., 10.); - - return builder - // Inkubationszeit: Die Inkubationszeit [ ... ] liegt im Mittel (Median) bei 5–6 Tagen (Spannweite 1 bis 14 Tage) - .from(EpisimPerson.DiseaseStatus.infectedButNotContagious, - to(EpisimPerson.DiseaseStatus.contagious, Transition.fixed(0))) - -// Dauer Infektiosität:: Es wurde geschätzt, dass eine relevante Infektiosität bereits zwei Tage vor Symptombeginn vorhanden ist und die höchste Infektiosität am Tag vor dem Symptombeginn liegt -// Dauer Infektiosität: Abstrichproben vom Rachen enthielten vermehrungsfähige Viren bis zum vierten, aus dem Sputum bis zum achten Tag nach Symptombeginn - .from(EpisimPerson.DiseaseStatus.contagious, - to(EpisimPerson.DiseaseStatus.showingSymptoms, Transition.logNormalWithMedianAndStd(6., 6.)), //80% - to(EpisimPerson.DiseaseStatus.recovered, Transition.logNormalWithMedianAndStd(8., 8.))) //20% - -// Erkankungsbeginn -> Hospitalisierung: Eine Studie aus Deutschland zu 50 Patienten mit eher schwereren Verläufen berichtete für alle Patienten eine mittlere (Median) Dauer von vier Tagen (IQR: 1–8 Tage) - .from(EpisimPerson.DiseaseStatus.showingSymptoms, - to(EpisimPerson.DiseaseStatus.seriouslySick, Transition.logNormalWithMedianAndStd(5., 5.)), - to(EpisimPerson.DiseaseStatus.recovered, Transition.logNormalWithMedianAndStd(8., 8.))) - -// Hospitalisierung -> ITS: In einer chinesischen Fallserie betrug diese Zeitspanne im Mittel (Median) einen Tag (IQR: 0–3 Tage) - .from(EpisimPerson.DiseaseStatus.seriouslySick, - to(EpisimPerson.DiseaseStatus.critical, Transition.logNormalWithMedianAndStd(1., 1.)), - to(EpisimPerson.DiseaseStatus.recovered, Transition.logNormalWithMedianAndStd(14., 14.))) - -// Dauer des Krankenhausaufenthalts: „WHO-China Joint Mission on Coronavirus Disease 2019“ wird berichtet, dass milde Fälle im Mittel (Median) einen Krankheitsverlauf von zwei Wochen haben und schwere von 3–6 Wochen - .from(EpisimPerson.DiseaseStatus.critical, - to(EpisimPerson.DiseaseStatus.seriouslySickAfterCritical, Transition.logNormalWithMedianAndStd(21., 21.))) - - .from(EpisimPerson.DiseaseStatus.seriouslySickAfterCritical, - to(EpisimPerson.DiseaseStatus.recovered, Transition.logNormalWithMedianAndStd(7., 7.))) - - .from(EpisimPerson.DiseaseStatus.recovered, - to(EpisimPerson.DiseaseStatus.susceptible, transitionRecSus)) - ; - } - - -} - diff --git a/src/main/java/org/matsim/run/batch/BMBF211119Cologne.java b/src/main/java/org/matsim/run/batch/BMBF211119Cologne.java deleted file mode 100644 index fe8ea2096..000000000 --- a/src/main/java/org/matsim/run/batch/BMBF211119Cologne.java +++ /dev/null @@ -1,862 +0,0 @@ -package org.matsim.run.batch; - -import org.matsim.core.config.Config; -import org.matsim.core.config.ConfigUtils; -import org.matsim.episim.*; -import org.matsim.episim.model.FaceMask; -import org.matsim.episim.model.Transition; -import org.matsim.episim.model.VaccinationType; -import org.matsim.episim.model.VirusStrain; -import org.matsim.episim.model.testing.TestType; -import org.matsim.episim.policy.FixedPolicy; -import org.matsim.episim.policy.FixedPolicy.ConfigBuilder; -import org.matsim.episim.policy.Restriction; -import org.matsim.run.RunParallel; -import org.matsim.run.modules.SnzCologneProductionScenario; - -import javax.annotation.Nullable; - -import java.io.IOException; -import java.time.DayOfWeek; -import java.time.LocalDate; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import static org.matsim.episim.model.Transition.to; - - -/** - * Batch for bmbf report - */ -public class BMBF211119Cologne implements BatchRun { - - @Override - public SnzCologneProductionScenario getBindings(int id, @Nullable Params params) { - - double pHousehold = 0.0; - -// if (params != null) -// pHousehold = params.pHousehold; - - return new SnzCologneProductionScenario.Builder() - .setScaleForActivityLevels(1.3 ) - .setSuscHouseholds_pct(pHousehold ) - .setActivityHandling(EpisimConfigGroup.ActivityHandling.startOfDay) - .build(); - } - - @Override - public Metadata getMetadata() { - return Metadata.of("cologne", "calibration"); - } - - @Override - public Config prepareConfig(int id, Params params) { - - LocalDate restrictionDate = LocalDate.parse("2021-11-29"); - - SnzCologneProductionScenario module = getBindings(id, params); - - Config config = module.config(); - - config.global().setRandomSeed(params.seed); - - EpisimConfigGroup episimConfig = ConfigUtils.addOrGetModule(config, EpisimConfigGroup.class); - - episimConfig.setProgressionConfig(progressionConfig(params, Transition.config()).build()); - episimConfig.setDaysInfectious(Integer.MAX_VALUE); - - episimConfig.setCalibrationParameter(1.0e-05); - - episimConfig.setCalibrationParameter(episimConfig.getCalibrationParameter() * 0.83 * 1.4); - -// episimConfig.setStartFromSnapshot("/scratch/projects/bzz0020/episim-input/snapshots-cologne-20210917/" + params.seed + "-270-2020-11-20.zip"); -// episimConfig.setSnapshotSeed(SnapshotSeed.restore); - - // age susceptibility increases by 28% every 10 years -// if (params.ageDep.equals("yes")) { -// episimConfig.setCalibrationParameter(episimConfig.getCalibrationParameter() / 3.5); -// Map map = new HashMap<>(); -// for (int i = 0; i<120; i++) map.put(i, Math.pow(1.02499323, i)); -// episimConfig.setAgeSusceptibility(map); -// } - - //restrictions - ConfigBuilder builder = FixedPolicy.parse(episimConfig.getPolicy()); - - //curfew - builder.restrict("2021-04-17", Restriction.ofClosingHours(21, 5), "leisure", "visit"); - Map curfewCompliance = new HashMap(); - curfewCompliance.put(LocalDate.parse("2021-04-17"), 1.0); - curfewCompliance.put(LocalDate.parse("2021-05-31"), 0.0); -// if (params.curfew.equals("yes")) curfewCompliance.put(restrictionDate, 1.0); - episimConfig.setCurfewCompliance(curfewCompliance); - -// builder.restrict("2021-10-10", 0.92 * 0.79, "work", "business"); -// builder.restrict("2021-10-24", 0.74, "work", "business"); - - //masks -// if (params.masksEdu.equals("no")) builder.restrict(restrictionDate, Restriction.ofMask(FaceMask.N95, 0.0), "educ_primary", "educ_kiga", "educ_secondary", "educ_higher", "educ_tertiary", "educ_other"); - - //2G - builder.restrict(restrictionDate, Restriction.ofSusceptibleRf(params.leisUnv), "leisure"); - - if (params.schools.equals("unprotected") || params.schools.equals("noMasks")) - builder.restrict(restrictionDate, Restriction.ofMask(FaceMask.N95, 0.0), "educ_primary", "educ_kiga", "educ_secondary", "educ_tertiary", "educ_other"); - - if (params.schools.equals("unprotected")) - builder.restrict(restrictionDate, Restriction.ofCiCorrection(1.0), "educ_primary", "educ_kiga", "educ_secondary", "educ_tertiary", "educ_other"); - - builder.setHospitalScale(1.3); - - episimConfig.setPolicy(builder.build()); - - Map inputDays = new HashMap<>(); - inputDays.put(LocalDate.parse("2021-11-01"), DayOfWeek.SUNDAY); -// if (params.monday.equals("sunday")) { -// for (int ii = 0; ii < Integer.MAX_VALUE; ii++) { -// if (restrictionDate.plusDays(ii).getDayOfWeek() == DayOfWeek.MONDAY) { -// inputDays.put(restrictionDate.plusDays(ii), DayOfWeek.SUNDAY); -// } -// if (restrictionDate.plusDays(ii).isAfter(LocalDate.parse("2023-06-01"))) { -// break; -// } -// } -// } - episimConfig.setInputDays(inputDays); - - //disease import 2020 - Map importMap = new HashMap<>(); - double importFactorBeforeJune = 4.0; - double imprtFctMult = 1.0; - long importOffset = 0; - double cologneFactor = 0.5; - - SnzCologneProductionScenario.interpolateImport(importMap, cologneFactor * imprtFctMult * importFactorBeforeJune, LocalDate.parse("2020-02-24").plusDays(importOffset), - LocalDate.parse("2020-03-09").plusDays(importOffset), 0.9, 23.1); - SnzCologneProductionScenario.interpolateImport(importMap, cologneFactor * imprtFctMult * importFactorBeforeJune, LocalDate.parse("2020-03-09").plusDays(importOffset), - LocalDate.parse("2020-03-23").plusDays(importOffset), 23.1, 3.9); - SnzCologneProductionScenario.interpolateImport(importMap, cologneFactor * imprtFctMult * importFactorBeforeJune, LocalDate.parse("2020-03-23").plusDays(importOffset), - LocalDate.parse("2020-04-13").plusDays(importOffset), 3.9, 0.1); - - importMap.put(LocalDate.parse("2020-07-19"), (int) (0.5 * 32)); - importMap.put(LocalDate.parse("2020-08-09"), 1); - - episimConfig.setInfections_pers_per_day(importMap); - - - //weather model - try { - Map outdoorFractions = EpisimUtils.getOutDoorFractionFromDateAndTemp2(SnzCologneProductionScenario.INPUT.resolve("cologneWeather.csv").toFile(), - SnzCologneProductionScenario.INPUT.resolve("weatherDataAvgCologne2000-2020.csv").toFile(), 0.5, 18.5, 25.0, 18.5, 18.5, 5., 1.0, 1.0); - episimConfig.setLeisureOutdoorFraction(outdoorFractions); - } catch (IOException e) { - e.printStackTrace(); - } - - - //mutations and vaccinations - VaccinationConfigGroup vaccinationConfig = ConfigUtils.addOrGetModule(config, VaccinationConfigGroup.class); - VirusStrainConfigGroup virusStrainConfigGroup = ConfigUtils.addOrGetModule(config, VirusStrainConfigGroup.class); - - Map infPerDayB117 = new HashMap<>(); - infPerDayB117.put(LocalDate.parse("2020-01-01"), 0); - - infPerDayB117.put(LocalDate.parse("2020-12-30"), 1); - episimConfig.setInfections_pers_per_day(VirusStrain.ALPHA, infPerDayB117); - - virusStrainConfigGroup.getOrAddParams(VirusStrain.ALPHA).setInfectiousness(1.8); - virusStrainConfigGroup.getOrAddParams(VirusStrain.ALPHA).setFactorSeriouslySick(1.0); - - Map infPerDayMUTB = new HashMap<>(); - infPerDayMUTB.put(LocalDate.parse("2020-01-01"), 0); - -// if(params.deltaInf == 2.2) infPerDayMUTB.put(LocalDate.parse("2021-04-05"), 1); -// else if (params.deltaInf == 2.8) infPerDayMUTB.put(LocalDate.parse("2021-04-19"), 1); -// else if (params.deltaInf == 3.4) infPerDayMUTB.put(LocalDate.parse("2021-05-03"), 1); -// else throw new RuntimeException(); - - infPerDayMUTB.put(LocalDate.parse("2021-06-14"), 1); - - //disease import 2021 - double impFacSum = 3.0; - int imp = 16; - SnzCologneProductionScenario.interpolateImport(infPerDayMUTB, cologneFactor * impFacSum, LocalDate.parse("2021-07-03").plusDays(0), - LocalDate.parse("2021-07-25").plusDays(0), 1, 48); - SnzCologneProductionScenario.interpolateImport(infPerDayMUTB, cologneFactor * impFacSum, LocalDate.parse("2021-07-26").plusDays(0), - LocalDate.parse("2021-08-17").plusDays(0), 48, imp); - - infPerDayMUTB.put(LocalDate.parse("2021-08-18"), imp); - - double impFacOct = 2.0; - SnzCologneProductionScenario.interpolateImport(infPerDayMUTB, cologneFactor * impFacOct, LocalDate.parse("2021-10-09").plusDays(0), - LocalDate.parse("2021-10-16").plusDays(0), imp, 16); - SnzCologneProductionScenario.interpolateImport(infPerDayMUTB, cologneFactor * impFacOct, LocalDate.parse("2021-10-17").plusDays(0), - LocalDate.parse("2021-10-24").plusDays(0), 16, 1); - infPerDayMUTB.put(LocalDate.parse("2021-10-25"), 1); - -// infPerDayMUTB.put(LocalDate.parse("2021-07-25"), (int) (0.5 * 48 * 2)); -// infPerDayMUTB.put(LocalDate.parse("2021-08-15"), 1); - episimConfig.setInfections_pers_per_day(VirusStrain.DELTA, infPerDayMUTB); - - virusStrainConfigGroup.getOrAddParams(VirusStrain.DELTA).setInfectiousness(3.4); - virusStrainConfigGroup.getOrAddParams(VirusStrain.DELTA).setFactorSeriouslySick(2.0); - - Map vaccinationCompliance = new HashMap<>(); - - for (int i = 0; i < 12; i++) vaccinationCompliance.put(i, 0.0); - for (int i = 12; i <= 120; i++) vaccinationCompliance.put(i, 1.0); - - - vaccinationConfig.setCompliancePerAge(vaccinationCompliance); - - Map vaccinations = new HashMap<>(); - - double population = 2_352_480; - vaccinations.put(LocalDate.parse("2021-11-03"), (int) (0.01 * 0.25 * population / 7)); - vaccinations.put(restrictionDate , (int) (0.01 * params.vacSp * population / 7)); - - vaccinationConfig.setVaccinationCapacity_pers_per_day(vaccinations); - -// if (!params.vaccine.equals("cur")) { -// Map> share = new HashMap<>(); -// if(params.vaccine.equals("mRNA")) -// share.put(LocalDate.parse("2020-01-01"), Map.of(VaccinationType.mRNA, 1d, VaccinationType.vector, 0d)); -// if(params.vaccine.equals("vector")) -// share.put(LocalDate.parse("2020-01-01"), Map.of(VaccinationType.mRNA, 0d, VaccinationType.vector, 1d)); -// vaccinationConfig.setVaccinationShare(share); -// } - - if(params.vacRate.equals("DRS")) - vaccinationConfig.setFromFile(SnzCologneProductionScenario.INPUT.resolve("dresdemVaccinations.csv").toString()); - - adaptVacinationEffectiveness(vaccinationConfig, 0.4); - - configureBooster(vaccinationConfig, 0.9, params.boostSp * 0.01, params.boostAfter, 0.4, restrictionDate); - - //testing - TestingConfigGroup testingConfigGroup = ConfigUtils.addOrGetModule(config, TestingConfigGroup.class); - -// if (params.testVaccinated.equals("yes")) { - testingConfigGroup.setTestAllPersonsAfter(restrictionDate); -// } - - TestingConfigGroup.TestingParams rapidTest = testingConfigGroup.getOrAddParams(TestType.RAPID_TEST); - TestingConfigGroup.TestingParams pcrTest = testingConfigGroup.getOrAddParams(TestType.PCR); - - testingConfigGroup.setStrategy(TestingConfigGroup.Strategy.ACTIVITIES); - - List actsList = new ArrayList(); - actsList.add("leisure"); - actsList.add("work"); - actsList.add("business"); - actsList.add("educ_kiga"); - actsList.add("educ_primary"); - actsList.add("educ_secondary"); - actsList.add("educ_tertiary"); - actsList.add("educ_other"); - actsList.add("educ_higher"); - testingConfigGroup.setActivities(actsList); - - rapidTest.setFalseNegativeRate(0.3); - rapidTest.setFalsePositiveRate(0.03); - - pcrTest.setFalseNegativeRate(0.1); - pcrTest.setFalsePositiveRate(0.01); - - testingConfigGroup.setHouseholdCompliance(1.0); - - LocalDate testingStartDate = LocalDate.parse("2021-03-19"); - - Map leisureTests = new HashMap(); - Map workTests = new HashMap(); - Map eduTests = new HashMap(); - Map uniTests = new HashMap(); - leisureTests.put(LocalDate.parse("2020-01-01"), 0.); - workTests.put(LocalDate.parse("2020-01-01"), 0.); - eduTests.put(LocalDate.parse("2020-01-01"), 0.); - uniTests.put(LocalDate.parse("2020-01-01"), 0.); - - for (int i = 1; i <= 31; i++) { - leisureTests.put(testingStartDate.plusDays(i), 0.25 * i / 31.); - workTests.put(testingStartDate.plusDays(i), 0.25 * i / 31.); - eduTests.put(testingStartDate.plusDays(i), 0.8 * i / 31.); - uniTests.put(testingStartDate.plusDays(i), 0.8 * i / 31.); - - } - - - eduTests.put(LocalDate.parse("2021-06-24"), 0.0); - uniTests.put(LocalDate.parse("2021-06-24"), 0.0); - workTests.put(LocalDate.parse("2021-06-04"), 0.05); - - if (params.wTest.startsWith("0.5")) { - workTests.put(restrictionDate, 0.5); - } - - leisureTests.put(LocalDate.parse("2021-06-04"), 0.05); - leisureTests.put(restrictionDate, params.lTestUnVac); - - eduTests.put(LocalDate.parse("2021-08-06"), 0.6); - eduTests.put(LocalDate.parse("2021-08-30"), 0.4); - uniTests.put(LocalDate.parse("2021-08-06"), 0.6); - uniTests.put(LocalDate.parse("2021-08-30"), 0.4); - if (params.schools.equals("unprotected")) { - eduTests.put(restrictionDate, 0.0); - } - - rapidTest.setTestingRatePerActivityAndDate((Map.of( - "leisure", leisureTests, - "work", workTests, - "business", workTests, - "educ_kiga", eduTests, - "educ_primary", eduTests, - "educ_secondary", eduTests, - "educ_tertiary", eduTests, - "educ_higher", uniTests, - "educ_other", eduTests - ))); - - Map leisureTestsVaccinated = new HashMap(); - Map workTestsVaccinated = new HashMap(); - Map eduTestsVaccinated = new HashMap(); - leisureTestsVaccinated.put(restrictionDate, params.lTestVac); - - if (params.wTest.equals("0.5-all")) { - workTestsVaccinated.put(restrictionDate, 0.5); - } else { - workTestsVaccinated.put(restrictionDate, 0.); - } - - eduTestsVaccinated.put(restrictionDate, 0.); - - rapidTest.setTestingRatePerActivityAndDateVaccinated((Map.of( - "leisure", leisureTestsVaccinated, - "work", workTestsVaccinated, - "business", workTestsVaccinated, - "educ_kiga", eduTestsVaccinated, - "educ_primary", eduTestsVaccinated, - "educ_secondary", eduTestsVaccinated, - "educ_tertiary", eduTestsVaccinated, - "educ_higher", eduTestsVaccinated, - "educ_other", eduTestsVaccinated - ))); - - - Map leisureTestsPCR = new HashMap(); - Map workTestsPCR = new HashMap(); - Map eduTestsPCR = new HashMap(); - leisureTestsPCR.put(LocalDate.parse("2020-01-01"), 0.); - workTestsPCR.put(LocalDate.parse("2020-01-01"), 0.); - eduTestsPCR.put(LocalDate.parse("2020-01-01"), 0.); -// leisureTestsPCR.put(restrictionDate, Double.parseDouble(params.lTestUnVac.split("-")[1])); - - pcrTest.setTestingRatePerActivityAndDate((Map.of( - "leisure", leisureTestsPCR, - "work", workTestsPCR, - "business", workTestsPCR, - "educ_kiga", eduTestsPCR, - "educ_primary", eduTestsPCR, - "educ_secondary", eduTestsPCR, - "educ_tertiary", eduTestsPCR, - "educ_higher", eduTestsPCR, - "educ_other", eduTestsPCR - ))); - - Map leisureTestsPCRVaccinated = new HashMap(); - Map workTestsPCRVaccinated = new HashMap(); - Map eduTestsPCRVaccinated = new HashMap(); - leisureTestsPCRVaccinated.put(restrictionDate, 0.); - workTestsPCRVaccinated.put(restrictionDate, 0.); - eduTestsPCRVaccinated.put(restrictionDate, 0.); - - pcrTest.setTestingRatePerActivityAndDateVaccinated((Map.of( - "leisure", leisureTestsPCRVaccinated, - "work", workTestsPCRVaccinated, - "business", workTestsPCRVaccinated, - "educ_kiga", eduTestsPCRVaccinated, - "educ_primary", eduTestsPCRVaccinated, - "educ_secondary", eduTestsPCRVaccinated, - "educ_tertiary", eduTestsPCRVaccinated, - "educ_higher", eduTestsPCRVaccinated, - "educ_other", eduTestsPCRVaccinated - ))); - - rapidTest.setTestingCapacity_pers_per_day(Map.of( - LocalDate.of(1970, 1, 1), 0, - testingStartDate, Integer.MAX_VALUE)); - - pcrTest.setTestingCapacity_pers_per_day(Map.of( - LocalDate.of(1970, 1, 1), 0, - testingStartDate, Integer.MAX_VALUE)); - - - return config; - } - - private void adaptVacinationEffectiveness(VaccinationConfigGroup vaccinationConfig, double vacMult) { - - double effectivnessAlphaMRNA = 0.85; - double factorShowingSymptomsAlphaMRNA = 0.06 / (1 - effectivnessAlphaMRNA); - double factorSeriouslySickAlphaMRNA = 0.02 / ((1 - effectivnessAlphaMRNA) * factorShowingSymptomsAlphaMRNA); - - double effectivnessDeltaMRNA = 0.8; - double factorShowingSymptomsDeltaMRNA = 0.15 / (1 - effectivnessDeltaMRNA); - double factorSeriouslySickDeltaMRNA = 0.09 / ((1 - effectivnessDeltaMRNA) * factorShowingSymptomsDeltaMRNA); - - double infectivityAlphaMRNA = 0.32; - double infectivityDeltaMRNA = 0.5; - - int fullEffectMRNA = 7 * 7; //second shot after 6 weeks, full effect one week after second shot - vaccinationConfig.getOrAddParams(VaccinationType.mRNA) - .setDaysBeforeFullEffect(fullEffectMRNA) - .setEffectiveness(VaccinationConfigGroup.forStrain(VirusStrain.SARS_CoV_2) - .atDay(1, 0.0) - .atFullEffect(1.0 - ((1.0 - effectivnessAlphaMRNA) * vacMult)) - .atDay(fullEffectMRNA + 14, 1.0 - ((1.0 - 0.78) * vacMult)) - .atDay(fullEffectMRNA + 98, 1.0 - ((1.0 - 0.64) * vacMult)) -// .atDay(fullEffectMRNA + 482, 0.0) - ) - .setEffectiveness(VaccinationConfigGroup.forStrain(VirusStrain.ALPHA) - .atDay(1, 0.0) - .atFullEffect(1.0 - ((1.0 - effectivnessAlphaMRNA) * vacMult)) - .atDay(fullEffectMRNA + 14, 1.0 - ((1.0 - 0.78) * vacMult)) - .atDay(fullEffectMRNA + 98, 1.0 - ((1.0 - 0.64) * vacMult)) -// .atDay(fullEffectMRNA + 482, 0.0) - ) - .setEffectiveness(VaccinationConfigGroup.forStrain(VirusStrain.DELTA) - .atDay(1, 0.0) - .atFullEffect(1.0 - ((1.0 - effectivnessDeltaMRNA) * vacMult)) - .atDay(fullEffectMRNA + 14, 1.0 - ((1.0 - 0.72) * vacMult)) - .atDay(fullEffectMRNA + 98, 1.0 - ((1.0 - 0.55) * vacMult)) -// .atDay(fullEffectMRNA + 370, 0.0) - ) - .setFactorShowingSymptoms(VaccinationConfigGroup.forStrain(VirusStrain.SARS_CoV_2) - .atDay(1, 1.0) - .atFullEffect(factorShowingSymptomsAlphaMRNA) - ) - .setFactorShowingSymptoms(VaccinationConfigGroup.forStrain(VirusStrain.ALPHA) - .atDay(1, 1.0) - .atFullEffect(factorShowingSymptomsAlphaMRNA) - ) - .setFactorShowingSymptoms(VaccinationConfigGroup.forStrain(VirusStrain.DELTA) - .atDay(1, 1.0) - .atFullEffect(factorShowingSymptomsDeltaMRNA) - ) - .setFactorSeriouslySick(VaccinationConfigGroup.forStrain(VirusStrain.SARS_CoV_2) - .atDay(1, 1.0) - .atFullEffect(factorSeriouslySickAlphaMRNA) - ) - .setFactorSeriouslySick(VaccinationConfigGroup.forStrain(VirusStrain.ALPHA) - .atDay(1, 1.0) - .atFullEffect(factorSeriouslySickAlphaMRNA) - ) - .setFactorSeriouslySick(VaccinationConfigGroup.forStrain(VirusStrain.DELTA) - .atDay(1, 1.0) - .atFullEffect(factorSeriouslySickDeltaMRNA) - ) - .setInfectivity(VaccinationConfigGroup.forStrain(VirusStrain.SARS_CoV_2) - .atDay(1, 1.0) - .atFullEffect(infectivityAlphaMRNA) - .atDay(fullEffectMRNA + 14, 0.38) - .atDay(fullEffectMRNA + 98, 0.5) -// .atDay(fullEffectMRNA + 448, 1.0) - ) - .setInfectivity(VaccinationConfigGroup.forStrain(VirusStrain.ALPHA) - .atDay(1, 1.0) - .atFullEffect(infectivityAlphaMRNA) - .atDay(fullEffectMRNA + 14, 0.38) - .atDay(fullEffectMRNA + 98, 0.5) -// .atDay(fullEffectMRNA + 448, 1.0) - ) - .setInfectivity(VaccinationConfigGroup.forStrain(VirusStrain.DELTA) - .atDay(1, 1.0) - .atFullEffect(infectivityDeltaMRNA) - .atDay(fullEffectMRNA + 14, 0.6) - .atDay(fullEffectMRNA + 98, 0.78) -// .atDay(fullEffectMRNA + 201, 1.0) - ) - ; - - - double effectivnessAlphaVector = 0.6; - double factorShowingSymptomsAlphaVector = 0.25 / (1 - effectivnessAlphaVector); - double factorSeriouslySickAlphaVector = 0.02 / ((1 - effectivnessAlphaVector) * factorShowingSymptomsAlphaVector); - - double effectivnessDeltaVector = 0.58; - double factorShowingSymptomsDeltaVector = 0.35 / (1 - effectivnessDeltaVector); - double factorSeriouslySickDeltaVector = 0.09 / ((1 - effectivnessDeltaVector) * factorShowingSymptomsDeltaVector); - - double infectivityAlphaVector = 0.48; - double infectivityDeltaVector = 0.78; - - int fullEffectVector = 10 * 7; //second shot after 9 weeks, full effect one week after second shot - vaccinationConfig.getOrAddParams(VaccinationType.vector) - .setDaysBeforeFullEffect(fullEffectVector) - .setEffectiveness(VaccinationConfigGroup.forStrain(VirusStrain.SARS_CoV_2) - .atDay(1, 0.0) - .atFullEffect(1.0 - ((1.0 - effectivnessAlphaVector) * vacMult)) - .atDay(fullEffectVector + 14, 1.0 - ((1.0 - 0.52) * vacMult)) - .atDay(fullEffectVector + 98, 1.0 - ((1.0 - 0.38) * vacMult)) -// .atDay(fullEffectVector + 326, 0.0) - ) - .setEffectiveness(VaccinationConfigGroup.forStrain(VirusStrain.ALPHA) - .atDay(1, 0.0) - .atFullEffect(1.0 - ((1.0 - effectivnessAlphaVector) * vacMult)) - .atDay(fullEffectVector + 14, 1.0 - ((1.0 - 0.52) * vacMult)) - .atDay(fullEffectVector + 98, 1.0 - ((1.0 - 0.38) * vacMult)) -// .atDay(fullEffectVector + 326, 0.0) - ) - .setEffectiveness(VaccinationConfigGroup.forStrain(VirusStrain.DELTA) - .atDay(1, 0.0) - .atFullEffect(1.0 - ((1.0 - effectivnessDeltaVector) * vacMult)) - .atDay(fullEffectVector + 14, 1.0 - ((1.0 - 0.5) * vacMult)) - .atDay(fullEffectVector + 98, 1.0 - ((1.0 - 0.35) * vacMult)) -// .atDay(fullEffectVector + 294, 0.0) - ) - .setFactorShowingSymptoms(VaccinationConfigGroup.forStrain(VirusStrain.SARS_CoV_2) - .atDay(1, 1.0) - .atFullEffect(factorShowingSymptomsAlphaVector) - ) - .setFactorShowingSymptoms(VaccinationConfigGroup.forStrain(VirusStrain.ALPHA) - .atDay(1, 1.0) - .atFullEffect(factorShowingSymptomsAlphaVector) - ) - .setFactorShowingSymptoms(VaccinationConfigGroup.forStrain(VirusStrain.DELTA) - .atDay(1, 1.0) - .atFullEffect(factorShowingSymptomsDeltaVector) - ) - .setFactorSeriouslySick(VaccinationConfigGroup.forStrain(VirusStrain.SARS_CoV_2) - .atDay(1, 1.0) - .atFullEffect(factorSeriouslySickAlphaVector) - ) - .setFactorSeriouslySick(VaccinationConfigGroup.forStrain(VirusStrain.ALPHA) - .atDay(1, 1.0) - .atFullEffect(factorSeriouslySickAlphaVector) - ) - .setFactorSeriouslySick(VaccinationConfigGroup.forStrain(VirusStrain.DELTA) - .atDay(1, 1.0) - .atFullEffect(factorSeriouslySickDeltaVector) - ) - .setInfectivity(VaccinationConfigGroup.forStrain(VirusStrain.SARS_CoV_2) - .atDay(1, 1.0) - .atFullEffect(infectivityAlphaVector) - .atDay(fullEffectMRNA + 14, 0.54) - .atDay(fullEffectMRNA + 98, 0.64) -// .atDay(fullEffectMRNA + 400, 1.0) - ) - .setInfectivity(VaccinationConfigGroup.forStrain(VirusStrain.ALPHA) - .atDay(1, 1.0) - .atFullEffect(infectivityAlphaVector) - .atDay(fullEffectMRNA + 14, 0.54) - .atDay(fullEffectMRNA + 98, 0.64) -// .atDay(fullEffectMRNA + 400, 1.0) - - ) - .setInfectivity(VaccinationConfigGroup.forStrain(VirusStrain.DELTA) - .atDay(1, 1.0) - .atFullEffect(infectivityDeltaVector) - .atDay(fullEffectMRNA + 14, 0.85) - .atDay(fullEffectMRNA + 98, 1.0) - ) - ; - - double effectivnessAlphaNatural = 0.95; - double effectivnessDeltaNatural = 0.9; - - double factorShowingSymptomsNatural = 0.5; - double factorSeriouslySickNatural = 0.5; - double infectivityNatural = 0.5; - - int fullEffectNatural = 2; - vaccinationConfig.getOrAddParams(VaccinationType.natural) - .setDaysBeforeFullEffect(fullEffectNatural) - .setEffectiveness(VaccinationConfigGroup.forStrain(VirusStrain.SARS_CoV_2) - .atDay(1, 0.0) - .atFullEffect(1.0 - ((1.0 - effectivnessAlphaNatural) * 0.6)) - .atDay(100, effectivnessAlphaNatural - 0.02) - .atDay(400, effectivnessAlphaNatural - 0.07) - .atDay(700, effectivnessAlphaNatural - 0.12) - ) - .setEffectiveness(VaccinationConfigGroup.forStrain(VirusStrain.SARS_CoV_2) - .atDay(1, 0.0) - .atFullEffect(1.0 - ((1.0 - effectivnessAlphaNatural) * 0.6)) - .atDay(100, effectivnessAlphaNatural - 0.02) - .atDay(400, effectivnessAlphaNatural - 0.07) - .atDay(700, effectivnessAlphaNatural - 0.12) - ) - .setEffectiveness(VaccinationConfigGroup.forStrain(VirusStrain.DELTA) - .atDay(1, 0.0) - .atFullEffect(1.0 - ((1.0 - effectivnessDeltaNatural) * 0.6)) - .atDay(100, effectivnessDeltaNatural - 0.06) - .atDay(400, effectivnessDeltaNatural - 0.14) - .atDay(700, effectivnessDeltaNatural - 0.22) - ) - .setFactorShowingSymptoms(VaccinationConfigGroup.forStrain(VirusStrain.SARS_CoV_2) - .atDay(1, 1.0) - .atFullEffect(factorShowingSymptomsNatural) - ) - .setFactorShowingSymptoms(VaccinationConfigGroup.forStrain(VirusStrain.ALPHA) - .atDay(1, 1.0) - .atFullEffect(factorShowingSymptomsNatural) - ) - .setFactorShowingSymptoms(VaccinationConfigGroup.forStrain(VirusStrain.DELTA) - .atDay(1, 1.0) - .atFullEffect(factorShowingSymptomsNatural) - ) - .setFactorSeriouslySick(VaccinationConfigGroup.forStrain(VirusStrain.SARS_CoV_2) - .atDay(1, 1.0) - .atFullEffect(factorSeriouslySickNatural) - ) - .setFactorSeriouslySick(VaccinationConfigGroup.forStrain(VirusStrain.ALPHA) - .atDay(1, 1.0) - .atFullEffect(factorSeriouslySickNatural) - ) - .setFactorSeriouslySick(VaccinationConfigGroup.forStrain(VirusStrain.DELTA) - .atDay(1, 1.0) - .atFullEffect(factorSeriouslySickNatural) - ) - .setInfectivity(VaccinationConfigGroup.forStrain(VirusStrain.SARS_CoV_2) - .atDay(1, 1.0) - .atFullEffect(infectivityNatural) - ) - .setInfectivity(VaccinationConfigGroup.forStrain(VirusStrain.ALPHA) - .atDay(1, 1.0) - .atFullEffect(infectivityNatural) - ) - .setInfectivity(VaccinationConfigGroup.forStrain(VirusStrain.DELTA) - .atDay(1, 1.0) - .atFullEffect(infectivityNatural) - ) - ; - - - } - - private void configureBooster(VaccinationConfigGroup vaccinationConfig, double boosterEff, double boosterSpeed, int boostAfter, double vacMult, LocalDate restrictionDate) { - - Map boosterVaccinations = new HashMap<>(); - - boosterVaccinations.put(LocalDate.parse("2020-01-01"), 0); - - boosterVaccinations.put(LocalDate.parse("2021-09-01"), (int) (0.001 * 2_352_480. / 7)); - boosterVaccinations.put(LocalDate.parse("2021-09-07"), (int) (0.002 * 2_352_480. / 7)); - boosterVaccinations.put(LocalDate.parse("2021-09-24"), (int) (0.003 * 2_352_480. / 7)); - boosterVaccinations.put(LocalDate.parse("2021-10-20"), (int) (0.004 * 2_352_480. / 7)); - boosterVaccinations.put(LocalDate.parse("2021-10-26"), (int) (0.005 * 2_352_480. / 7)); - boosterVaccinations.put(LocalDate.parse("2021-10-29"), (int) (0.006 * 2_352_480. / 7)); - boosterVaccinations.put(LocalDate.parse("2021-11-03"), (int) (0.007 * 2_352_480. / 7)); - boosterVaccinations.put(LocalDate.parse("2021-11-05"), (int) (0.008 * 2_352_480. / 7)); - boosterVaccinations.put(LocalDate.parse("2021-11-08"), (int) (0.01 * 2_352_480. / 7)); - boosterVaccinations.put(LocalDate.parse("2021-11-09"), (int) (0.012 * 2_352_480. / 7)); - boosterVaccinations.put(LocalDate.parse("2021-11-10"), (int) (0.013 * 2_352_480. / 7)); - - boosterVaccinations.put(restrictionDate, (int) (2_352_480 * boosterSpeed / 7)); - - vaccinationConfig.setReVaccinationCapacity_pers_per_day(boosterVaccinations); - - double boostEffectiveness = 1.0 - ((1.0 - boosterEff) * vacMult); - - vaccinationConfig.getOrAddParams(VaccinationType.mRNA) - .setBoostEffectiveness(VaccinationConfigGroup.forStrain(VirusStrain.SARS_CoV_2) - .atDay(1, 0.0) - .atDay(7, boostEffectiveness) - ) - .setBoostEffectiveness(VaccinationConfigGroup.forStrain(VirusStrain.ALPHA) - .atDay(1, 0.0) - .atDay(7, boostEffectiveness) - ) - .setBoostEffectiveness(VaccinationConfigGroup.forStrain(VirusStrain.DELTA) - .atDay(1, 0.0) - .atDay(7, boostEffectiveness) - ) - .setBoostWaitPeriod(boostAfter * 30 + 6 * 7); - ; - - vaccinationConfig.getOrAddParams(VaccinationType.vector) - .setBoostEffectiveness(VaccinationConfigGroup.forStrain(VirusStrain.SARS_CoV_2) - .atDay(1, 0.0) - .atDay(7, boostEffectiveness) - ) - .setBoostEffectiveness(VaccinationConfigGroup.forStrain(VirusStrain.ALPHA) - .atDay(1, 0.0) - .atDay(7, boostEffectiveness) - ) - .setBoostEffectiveness(VaccinationConfigGroup.forStrain(VirusStrain.DELTA) - .atDay(1, 0.0) - .atDay(7, boostEffectiveness) - ) - .setBoostWaitPeriod(boostAfter * 30 + 9 * 7); - ; - } - - public static final class Params { - - @GenerateSeeds(5) - public long seed; - -// @Parameter({0.05}) -// double testRateLeisure; - -// @StringParameter({"no", "yes"}) -// String testVaccinated; - -// @Parameter({1.0}) -// double thetaFactor; - -// @Parameter({3.0}) -// double impFacSum; -// -// @Parameter({2.0}) -// double impFacOct; - -// @IntParameter({16}) -// int imp; - -// @Parameter({0.4}) -// double vacMult; - -// @StringParameter({"mRNADelta", "mRNA", "all"}) -// String vacEffDecrType; - - @Parameter({1.3, 7.0, 14.0}) - double boostSp; - - @Parameter({0.25}) - double vacSp; - -// @Parameter({0.9}) -// double boosterEff; - - @IntParameter({5}) - int boostAfter; -// -// @StringParameter({"2021-12-01", "2022-01-01", "2022-12-01"}) -// String endBooster; - -// @StringParameter({"2021-04-05", "2021-04-19", "2021-05-03", "2021-05-17" }) -// String deltaDate; - -// @StringParameter({"yes", "no"}) -// String ageDep; - -// @Parameter({3.1}) -// double deltaInf; -// -// @StringParameter({"2021-06-14"}) -// String deltaDate; - - @Parameter({1.0, 0.5, 0.0}) - double leisUnv; - -// @Parameter({0.05, 0.5}) -// double lRTest; - -// @Parameter({0.0, 0.5}) -// double lRTestVac; -// -// @Parameter({0.0, 0.5}) -// double lPCRTestVac; - - @Parameter({0.0, 0.5}) - double lTestVac; - - @Parameter({0.05, 0.5}) - double lTestUnVac; - - @StringParameter({"current", "0.5-unvaccinated", "0.5-all"}) - String wTest; - -// @Parameter({0.05, 0.5}) -// double wRTest; - -// @StringParameter({"current", "sunday"}) -// String monday; - - @StringParameter({"protected", "noMasks"}) - String schools; - - @StringParameter({"CGN", "DRS"}) - String vacRate; - -// @StringParameter({"cur", "mRNA", "vector"}) -// @StringParameter({"cur"}) -// String vaccine; - -// @IntParameter({1}) -// int recSus; - -// @StringParameter({"no"}) -// String curfew; - -// @StringParameter({"yes"}) -// String masksEdu; - - } - - public static void main(String[] args) { - String[] args2 = { - RunParallel.OPTION_SETUP, BMBF211119Cologne.class.getName(), - RunParallel.OPTION_PARAMS, Params.class.getName(), - RunParallel.OPTION_TASKS, Integer.toString(1), - RunParallel.OPTION_ITERATIONS, Integer.toString(500), - RunParallel.OPTION_METADATA - }; - - RunParallel.main(args2); - } - - /** - * Adds progression config to the given builder. - * @param params - */ - private static Transition.Builder progressionConfig(Params params, Transition.Builder builder) { - -// Transition transitionRecSus; -// -// if (params.recSus != 180 ) { -// transitionRecSus = Transition.fixed(params.recSus); -// } -// else { -// transitionRecSus = Transition.logNormalWithMedianAndStd(params.recSus, 10.); -// -// } - - return builder - // Inkubationszeit: Die Inkubationszeit [ ... ] liegt im Mittel (Median) bei 5–6 Tagen (Spannweite 1 bis 14 Tage) - .from(EpisimPerson.DiseaseStatus.infectedButNotContagious, - to(EpisimPerson.DiseaseStatus.contagious, Transition.fixed(0))) - -// Dauer Infektiosität:: Es wurde geschätzt, dass eine relevante Infektiosität bereits zwei Tage vor Symptombeginn vorhanden ist und die höchste Infektiosität am Tag vor dem Symptombeginn liegt -// Dauer Infektiosität: Abstrichproben vom Rachen enthielten vermehrungsfähige Viren bis zum vierten, aus dem Sputum bis zum achten Tag nach Symptombeginn - .from(EpisimPerson.DiseaseStatus.contagious, - to(EpisimPerson.DiseaseStatus.showingSymptoms, Transition.logNormalWithMedianAndStd(6., 6.)), //80% - to(EpisimPerson.DiseaseStatus.recovered, Transition.logNormalWithMedianAndStd(8., 8.))) //20% - -// Erkankungsbeginn -> Hospitalisierung: Eine Studie aus Deutschland zu 50 Patienten mit eher schwereren Verläufen berichtete für alle Patienten eine mittlere (Median) Dauer von vier Tagen (IQR: 1–8 Tage) - .from(EpisimPerson.DiseaseStatus.showingSymptoms, - to(EpisimPerson.DiseaseStatus.seriouslySick, Transition.logNormalWithMedianAndStd(5., 5.)), - to(EpisimPerson.DiseaseStatus.recovered, Transition.logNormalWithMedianAndStd(8., 8.))) - -// Hospitalisierung -> ITS: In einer chinesischen Fallserie betrug diese Zeitspanne im Mittel (Median) einen Tag (IQR: 0–3 Tage) - .from(EpisimPerson.DiseaseStatus.seriouslySick, - to(EpisimPerson.DiseaseStatus.critical, Transition.logNormalWithMedianAndStd(1., 1.)), - to(EpisimPerson.DiseaseStatus.recovered, Transition.logNormalWithMedianAndStd(14., 14.))) - -// Dauer des Krankenhausaufenthalts: „WHO-China Joint Mission on Coronavirus Disease 2019“ wird berichtet, dass milde Fälle im Mittel (Median) einen Krankheitsverlauf von zwei Wochen haben und schwere von 3–6 Wochen - .from(EpisimPerson.DiseaseStatus.critical, - to(EpisimPerson.DiseaseStatus.seriouslySickAfterCritical, Transition.logNormalWithMedianAndStd(21., 21.))) - - .from(EpisimPerson.DiseaseStatus.seriouslySickAfterCritical, - to(EpisimPerson.DiseaseStatus.recovered, Transition.logNormalWithMedianAndStd(7., 7.))) - - .from(EpisimPerson.DiseaseStatus.recovered, - to(EpisimPerson.DiseaseStatus.susceptible, Transition.fixed(1))) - ; - } - - -} - diff --git a/src/main/java/org/matsim/run/batch/Berlin220215.java b/src/main/java/org/matsim/run/batch/Berlin220215.java deleted file mode 100644 index 4edb83da6..000000000 --- a/src/main/java/org/matsim/run/batch/Berlin220215.java +++ /dev/null @@ -1,756 +0,0 @@ -package org.matsim.run.batch; - -import com.google.inject.AbstractModule; -import com.google.inject.Module; -import com.google.inject.Singleton; -import com.google.inject.multibindings.Multibinder; -import com.google.inject.util.Modules; -import org.matsim.core.config.Config; -import org.matsim.core.config.ConfigUtils; -import org.matsim.episim.*; -import org.matsim.episim.EpisimPerson.QuarantineStatus; -import org.matsim.episim.analysis.OutputAnalysis; -import org.matsim.episim.analysis.RValuesFromEvents; -import org.matsim.episim.analysis.VaccinationEffectiveness; -import org.matsim.episim.analysis.VaccinationEffectivenessFromPotentialInfections; -import org.matsim.episim.model.FaceMask; -import org.matsim.episim.model.InfectionModelWithAntibodies; -import org.matsim.episim.model.VaccinationType; -import org.matsim.episim.model.VirusStrain; -import org.matsim.episim.model.testing.TestType; -import org.matsim.episim.model.vaccination.VaccinationModel; -import org.matsim.episim.model.vaccination.VaccinationStrategy; -import org.matsim.episim.policy.FixedPolicy; -import org.matsim.episim.policy.FixedPolicy.ConfigBuilder; -import org.matsim.episim.policy.Restriction; -import org.matsim.run.RunParallel; -import org.matsim.run.modules.SnzBerlinProductionScenario; -import org.matsim.run.modules.SnzCologneProductionScenario; - -import javax.annotation.Nullable; -import java.io.File; -import java.io.IOException; -import java.nio.file.Path; -import java.time.DayOfWeek; -import java.time.LocalDate; -import java.util.*; - - -/** - * Batch for Bmbf runs - */ -public class Berlin220215 implements BatchRun { - - - boolean DEBUG = false; - - @Nullable - @Override - public Module getBindings(int id, @Nullable Params params) { - return Modules.override(getBindings(0.0)).with(new AbstractModule() { - @Override - protected void configure() { - - Multibinder set = Multibinder.newSetBinder(binder(), VaccinationModel.class); - - set.addBinding().to(VaccinationStrategy.class).in(Singleton.class); - LocalDate oVacStartDate = null; - int campaignDuration = 0; - if (params != null) { - oVacStartDate = LocalDate.parse(params.oVac); - campaignDuration = params.dur; - } - - bind(VaccinationStrategy.Config.class).toInstance(new VaccinationStrategy.Config(oVacStartDate, campaignDuration, VaccinationType.mRNA, 0.0, 0.0)); - } - }); - } - - private SnzBerlinProductionScenario getBindings(double pHousehold) { - return new SnzBerlinProductionScenario.Builder() -// .setScale(1.3) -// .setHouseholdSusc(pHousehold) - .setActivityHandling(EpisimConfigGroup.ActivityHandling.startOfDay) - .setInfectionModel(InfectionModelWithAntibodies.class) - .setEasterModel(SnzBerlinProductionScenario.EasterModel.no) - .setChristmasModel(SnzBerlinProductionScenario.ChristmasModel.no) - .setSample(DEBUG ? 1 : 25) - .build(); - } - - @Override - public Metadata getMetadata() { - return Metadata.of("berlin", "calibration"); - } - - @Override - public Collection postProcessing() { - return List.of( - new VaccinationEffectiveness().withArgs("--district", "Berlin"),//"--input","../shared-svn/projects/episim/matsim-files/snz/BerlinV2/episim-input", -// "--population-file", "/be_2020_snz_entirePopulation_emptyPlans_withDistricts_25pt_split.xml.gz", -// "--district", "Berlin"),//TODO: clean up & check this functions properly - new RValuesFromEvents().withArgs(), - new VaccinationEffectivenessFromPotentialInfections().withArgs("--remove-infected") - ); - } - - boolean oneRun = true; - @Override - public Config prepareConfig(int id, Params params) { - - if(!oneRun && DEBUG) return null; - else oneRun = false; - - - SnzBerlinProductionScenario module = getBindings(0.0); - - // GENERAL CONFIGURATION - //config - Config config = module.config(); - - config.global().setRandomSeed(params.seed); - - //episim-config - EpisimConfigGroup episimConfig = ConfigUtils.addOrGetModule(config, EpisimConfigGroup.class); - - episimConfig.setCalibrationParameter(1.0e-05 * 0.83 * params.thetaFactor); // 0.83 important b/c days infectious was turned up - - episimConfig.setDaysInfectious(Integer.MAX_VALUE); - -// episimConfig.setStartFromSnapshot("/scratch/projects/bzz0020/episim-input/snapshots-cologne-20210917/" + params.seed + "-270-2020-11-20.zip"); -// episimConfig.setSnapshotSeed(SnapshotSeed.restore); - - // age susceptibility increases by 28% every 10 years -// if (params.ageDep.equals("yes")) { -// episimConfig.setCalibrationParameter(episimConfig.getCalibrationParameter() / 3.5); -// Map map = new HashMap<>(); -// for (int i = 0; i<120; i++) map.put(i, Math.pow(1.02499323, i)); -// episimConfig.setAgeSusceptibility(map); -// } - - //WEATHER -// Path INPUT = EpisimUtils.resolveInputPath("../shared-svn/projects/episim/matsim-files/snz/BerlinV2/episim-input"); -// -// File weather = INPUT.resolve("tempelhofWeatherUntil20220208.csv").toFile(); -// File avgWeather = INPUT.resolve("temeplhofWeatherDataAvg2000-2020.csv").toFile(); -// Map outdoorFractions = null; -// try { -// outdoorFractions = EpisimUtils.getOutDoorFractionFromDateAndTemp2(weather, avgWeather, 0.5, 18.5, 25., 18.5, params.TmidFall, 5., 1.0); -// } catch (IOException e) { -// e.printStackTrace(); -// } -// episimConfig.setLeisureOutdoorFraction(outdoorFractions); - - - // RESTRICTIONS - ConfigBuilder builder = FixedPolicy.parse(episimConfig.getPolicy()); - - //2G Policy: - builder.restrict(LocalDate.parse("2021-11-27"), Restriction.ofSusceptibleRf(0.75), "leisure"); //https://www.berlin.de/en/news/coronavirus/7115029-6098215-2g-rule-for-retail-from-saturday.en.html -// builder.restrict(LocalDate.parse("2022-03-01"), Restriction.ofSusceptibleRf(params.leis), "leisure"); - - builder.restrict(LocalDate.parse("2021-12-20"), Restriction.ofVaccinatedRf(0.75), "leisure"); //TODO: does this make sense? - // builder.restrict(restrictionDate, Restriction.ofVaccinatedRf(params.leis), "leisure"); - - - //Schools TODO: check end of vacation Berlin, & mask restrictions - double schoolFac = 0.5; - - // school vacations up to 2023 are already included in SnzBerlinScenario25pct2020 - - // contact intensity correction - builder.restrict(LocalDate.parse("2021-08-17"), Restriction.ofCiCorrection(1 - (0.5 * schoolFac)), "educ_primary", "educ_kiga", "educ_secondary", "educ_tertiary", "educ_other"); //TODO: is this accurate? - - // masks - //Maskenpflicht für Schule im Schuljahr 2021/2022 - builder.restrict(LocalDate.parse("2021-08-17"), Restriction.ofMask(FaceMask.N95, 0.9 * schoolFac), "educ_primary", "educ_secondary", "educ_higher", "educ_tertiary", "educ_other"); - //Maskenpflicht für Grundschule entfaellt (bis einschliesslich 6. Klasse): https://www.berlin.de/sen/bjf/service/presse/pressearchiv-2021/pressemitteilung.1130780.php - builder.restrict(LocalDate.parse("2021-09-28"), Restriction.ofMask(FaceMask.N95, 0.), "educ_primary"); - //Maskenpflicht für Grundschule wieder eingefuert: https://www.berlin.de/sen/bjf/service/presse/pressearchiv-2021/pressemitteilung.1143667.php - builder.restrict(LocalDate.parse("2021-11-08"), Restriction.ofMask(FaceMask.N95, 0.9 * schoolFac), "educ_primary"); - - //university (only included up to May 2020 in SnzBerlinScenario25pct2020) - builder.restrict("2021-10-18", 1.0, "educ_higher"); - builder.restrict("2021-12-20", 0.2, "educ_higher"); - builder.restrict("2022-01-02", 1.0, "educ_higher"); - -// if (params.school.equals("protected")) { -// builder.restrict(restrictionDate, Restriction.ofMask(FaceMask.N95, 0.9), "educ_primary", "educ_secondary", "educ_higher", "educ_tertiary", "educ_other"); -// builder.restrict(restrictionDate, Restriction.ofCiCorrection(0.5), "educ_primary", "educ_kiga", "educ_secondary", "educ_tertiary", "educ_other"); -// } - - // TODO: weird warning: local remaining fraction removed (Restriction, line 539) -// builder.restrict(restrictionDate, 0.78, "work", "leisure", "shop_daily", "shop_other", "visit", "errands", "business"); - - episimConfig.setPolicy(builder.build()); - - - // WEEKDAY DESIGNATION FOR HOLIDAYS - Map inputDays = new HashMap<>(); -// inputDays.put(LocalDate.parse("2021-11-01"), DayOfWeek.SUNDAY); Allerheiligentag is not an official holiday in Berlin - //christmas 2021 - inputDays.put(LocalDate.parse("2021-12-24"), DayOfWeek.SATURDAY); - inputDays.put(LocalDate.parse("2021-12-25"), DayOfWeek.SUNDAY); - inputDays.put(LocalDate.parse("2021-12-26"), DayOfWeek.SUNDAY); - inputDays.put(LocalDate.parse("2021-12-27"), DayOfWeek.SATURDAY); - inputDays.put(LocalDate.parse("2021-12-28"), DayOfWeek.SATURDAY); - inputDays.put(LocalDate.parse("2021-12-29"), DayOfWeek.SATURDAY); - inputDays.put(LocalDate.parse("2021-12-30"), DayOfWeek.SATURDAY); - inputDays.put(LocalDate.parse("2021-12-31"), DayOfWeek.SATURDAY); - inputDays.put(LocalDate.parse("2022-01-01"), DayOfWeek.SUNDAY); - //christmas 2022 - inputDays.put(LocalDate.parse("2022-12-24"), DayOfWeek.SATURDAY); - inputDays.put(LocalDate.parse("2022-12-25"), DayOfWeek.SUNDAY); - inputDays.put(LocalDate.parse("2022-12-26"), DayOfWeek.SUNDAY); - inputDays.put(LocalDate.parse("2022-12-27"), DayOfWeek.SATURDAY); - inputDays.put(LocalDate.parse("2022-12-28"), DayOfWeek.SATURDAY); - inputDays.put(LocalDate.parse("2022-12-29"), DayOfWeek.SATURDAY); - inputDays.put(LocalDate.parse("2022-12-30"), DayOfWeek.SATURDAY); - inputDays.put(LocalDate.parse("2022-12-31"), DayOfWeek.SATURDAY); - inputDays.put(LocalDate.parse("2023-01-01"), DayOfWeek.SUNDAY); - episimConfig.setInputDays(inputDays); - - // VARIANTS OF CONCERN // TODO: leave for now, but update in future - VirusStrainConfigGroup virusStrainConfigGroup = ConfigUtils.addOrGetModule(config, VirusStrainConfigGroup.class); - - //alpha (b117) - Map infPerDayB117 = new HashMap<>(); - infPerDayB117.put(LocalDate.parse("2020-01-01"), 0); - infPerDayB117.put(LocalDate.parse("2020-12-05"), 1); - episimConfig.setInfections_pers_per_day(VirusStrain.ALPHA, infPerDayB117); - - episimConfig.setInfections_pers_per_day(VirusStrain.ALPHA, infPerDayB117); - - virusStrainConfigGroup.getOrAddParams(VirusStrain.ALPHA).setInfectiousness(1.55); - virusStrainConfigGroup.getOrAddParams(VirusStrain.ALPHA).setFactorSeriouslySick(1.0); - - //delta - Map infPerDayMUTB = new HashMap<>(); - infPerDayMUTB.put(LocalDate.parse("2020-01-01"), 0); - infPerDayMUTB.put(LocalDate.parse("2021-05-01"), 1); - - - //disease import of MUTB (Delta) in 2021 - double impFacSum = params.impFacSum;//5.0; - int imp = 16; - - //Sommerferien - SnzCologneProductionScenario.interpolateImport(infPerDayMUTB, impFacSum, LocalDate.parse("2021-06-24").plusDays(0), - LocalDate.parse("2021-07-17").plusDays(0), 1, 48); // summer vacation: beginning -> middle - SnzCologneProductionScenario.interpolateImport(infPerDayMUTB, impFacSum, LocalDate.parse("2021-07-18").plusDays(0), - LocalDate.parse("2021-08-09").plusDays(0), 48, imp); // summer vacation: middle -> end TODO:check - - infPerDayMUTB.put(LocalDate.parse("2021-08-10"), imp); - - //Herbstferien - double impFacOct = params.impFacOct;// 2.0; - SnzCologneProductionScenario.interpolateImport(infPerDayMUTB, impFacOct, LocalDate.parse("2021-10-09").plusDays(0), - LocalDate.parse("2021-10-16").plusDays(0), imp, imp); - SnzCologneProductionScenario.interpolateImport(infPerDayMUTB, impFacOct, LocalDate.parse("2021-10-17").plusDays(0), - LocalDate.parse("2021-10-24").plusDays(0), imp, 1); - infPerDayMUTB.put(LocalDate.parse("2021-10-25"), 1); - - - episimConfig.setInfections_pers_per_day(VirusStrain.DELTA, infPerDayMUTB); - double deltaInf = 2.0; - virusStrainConfigGroup.getOrAddParams(VirusStrain.DELTA).setInfectiousness(deltaInf); - virusStrainConfigGroup.getOrAddParams(VirusStrain.DELTA).setFactorSeriouslySick(1.25); - virusStrainConfigGroup.getOrAddParams(VirusStrain.DELTA).setFactorSeriouslySickVaccinated(1.25); - - - //omicron - double oInf = 2.0; - Map infPerDayOmicron = new HashMap<>(); - infPerDayOmicron.put(LocalDate.parse("2020-01-01"), 0); - infPerDayOmicron.put(LocalDate.parse("2021-11-28"), 4); //TODO: change potentially - infPerDayOmicron.put(LocalDate.parse("2021-12-03").plusDays(1), 1); - episimConfig.setInfections_pers_per_day(VirusStrain.OMICRON_BA1, infPerDayOmicron); - virusStrainConfigGroup.getOrAddParams(VirusStrain.OMICRON_BA1).setInfectiousness(deltaInf * oInf); - virusStrainConfigGroup.getOrAddParams(VirusStrain.OMICRON_BA1).setFactorSeriouslySick(0.5 * 1.25); - virusStrainConfigGroup.getOrAddParams(VirusStrain.OMICRON_BA1).setFactorSeriouslySickVaccinated(0.5 * 1.25); - virusStrainConfigGroup.getOrAddParams(VirusStrain.OMICRON_BA1).setFactorCritical(0.5); - - //BA.2 - Map infPerDayBA2 = new HashMap<>(); - infPerDayBA2.put(LocalDate.parse("2020-01-01"), 0); - infPerDayBA2.put(LocalDate.parse("2022-01-24"), 4); //TODO: change potentially - infPerDayBA2.put(LocalDate.parse("2022-01-24").plusDays(6), 1); - episimConfig.setInfections_pers_per_day(VirusStrain.OMICRON_BA2, infPerDayBA2); - virusStrainConfigGroup.getOrAddParams(VirusStrain.OMICRON_BA2).setInfectiousness(deltaInf * oInf * 1.5); - virusStrainConfigGroup.getOrAddParams(VirusStrain.OMICRON_BA2).setFactorSeriouslySick(0.5 * 1.25); - virusStrainConfigGroup.getOrAddParams(VirusStrain.OMICRON_BA2).setFactorSeriouslySickVaccinated(0.5 * 1.25); - virusStrainConfigGroup.getOrAddParams(VirusStrain.OMICRON_BA2).setFactorCritical(0.5); - - // VACCINATIONS - VaccinationConfigGroup vaccinationConfig = ConfigUtils.addOrGetModule(config, VaccinationConfigGroup.class); - - //vaccination compliance - Map vaccinationCompliance = new HashMap<>(); - for (int i = 0; i < 5; i++) vaccinationCompliance.put(i, 0.0); - for (int i = 5; i <= 11; i++) vaccinationCompliance.put(i, 0.4); - for (int i = 12; i <= 120; i++) vaccinationCompliance.put(i, 1.0); - vaccinationConfig.setCompliancePerAge(vaccinationCompliance); - - //vaccination capacity (partially set in production scenario but updated here) - Map vaccinations = new HashMap<>(vaccinationConfig.getVaccinationCapacity()); - double population = 4_800_000; // pop of Berlin - vaccinations.put(LocalDate.parse("2022-01-17"), (int) (0.0035 * population / 7)); // TODO: maybe change? // 0.0035 = 0.3% of pop vaxxed per week - vaccinations.put(LocalDate.parse("2022-06-30"), 0); - vaccinationConfig.setVaccinationCapacity_pers_per_day(vaccinations); - - //length of time that vaccination is valid (along w/ start date for this policy) - vaccinationConfig.setDaysValid(270); - vaccinationConfig.setValidDeadline(LocalDate.parse("2022-01-01")); //TODO: deadline seems to be a misleading term here - - //vaccination effectiveness against different VOCs - adaptVacinationEffectiveness(vaccinationConfig); - -// //antibodies per strain -// Map ak50PerStrain = new HashMap<>(); -// ak50PerStrain.put(VirusStrain.SARS_CoV_2, 0.3); // TODO: move from param to here -// ak50PerStrain.put(VirusStrain.ALPHA, 0.3); -// ak50PerStrain.put(VirusStrain.DELTA, 0.4); -// ak50PerStrain.put(VirusStrain.OMICRON_BA1, 2.4); -// ak50PerStrain.put(VirusStrain.OMICRON_BA2, 3.0); -// -// vaccinationConfig.setAk50PerStrain(ak50PerStrain); - - //booster configuration - vaccinationConfig.setBeta(1.0); - configureBooster(vaccinationConfig, 1.0, 3); // TODO go into here - - - // TESTING - TestingConfigGroup testingConfigGroup = ConfigUtils.addOrGetModule(config, TestingConfigGroup.class); - - testingConfigGroup.setTestAllPersonsAfter(LocalDate.parse("2021-10-01")); - - TestingConfigGroup.TestingParams rapidTest = testingConfigGroup.getOrAddParams(TestType.RAPID_TEST); - TestingConfigGroup.TestingParams pcrTest = testingConfigGroup.getOrAddParams(TestType.PCR); - - testingConfigGroup.setStrategy(TestingConfigGroup.Strategy.ACTIVITIES); - - List actsList = new ArrayList<>(); - actsList.add("leisure"); - actsList.add("work"); - actsList.add("business"); - actsList.add("educ_kiga"); - actsList.add("educ_primary"); - actsList.add("educ_secondary"); - actsList.add("educ_tertiary"); - actsList.add("educ_other"); - actsList.add("educ_higher"); - testingConfigGroup.setActivities(actsList); - - rapidTest.setFalseNegativeRate(0.3); - rapidTest.setFalsePositiveRate(0.03); - - pcrTest.setFalseNegativeRate(0.1); - pcrTest.setFalsePositiveRate(0.01); - - testingConfigGroup.setHouseholdCompliance(1.0); - - LocalDate testingStartDate = LocalDate.parse("2021-03-19"); - - //rapid tests - Map leisureTests = new HashMap(); - Map workTests = new HashMap(); - Map eduTests = new HashMap(); - Map kigaPrimaryTests = new HashMap(); - Map uniTests = new HashMap(); - leisureTests.put(LocalDate.parse("2020-01-01"), 0.); - workTests.put(LocalDate.parse("2020-01-01"), 0.); - eduTests.put(LocalDate.parse("2020-01-01"), 0.); - kigaPrimaryTests.put(LocalDate.parse("2020-01-01"), 0.); - uniTests.put(LocalDate.parse("2020-01-01"), 0.); - - for (int i = 1; i <= 31; i++) { - leisureTests.put(testingStartDate.plusDays(i), 0.1 * i / 31.); - workTests.put(testingStartDate.plusDays(i), 0.1 * i / 31.); - eduTests.put(testingStartDate.plusDays(i), 0.4 * i / 31.); // 2x per week //TODO: maybe diff for berlin - kigaPrimaryTests.put(testingStartDate.plusDays(i), 0.4 * i / 31.); - uniTests.put(testingStartDate.plusDays(i), 0.8 * i / 31.); - - } - - kigaPrimaryTests.put(LocalDate.parse("2021-05-10"), 0.0); - - workTests.put(LocalDate.parse("2021-06-04"), 0.05); - - workTests.put(LocalDate.parse("2021-11-24"), 0.5); - - leisureTests.put(LocalDate.parse("2021-06-04"), 0.05); - leisureTests.put(LocalDate.parse("2021-08-23"), 0.2 * params.leisureTestCorrection); //TODO: revert - - eduTests.put(LocalDate.parse("2021-09-20"), 0.6 * params.eduTestCorrection); // 3x per week TODO: same for berlin? - - rapidTest.setTestingRatePerActivityAndDate((Map.of( - "leisure", leisureTests, - "work", workTests, - "business", workTests, - "educ_kiga", eduTests, - "educ_primary", eduTests, - "educ_secondary", eduTests, - "educ_tertiary", eduTests, - "educ_higher", uniTests, - "educ_other", eduTests - ))); - - // tests for vaccinated agents - Map leisureTestsVaccinated = new HashMap(); - Map workTestsVaccinated = new HashMap(); - Map eduTestsVaccinated = new HashMap(); - - leisureTestsVaccinated.put(LocalDate.parse("2020-01-01"), 0.); - workTestsVaccinated.put(LocalDate.parse("2020-01-01"), 0.); - eduTestsVaccinated.put(LocalDate.parse("2020-01-01"), 0.); - - leisureTestsVaccinated.put(LocalDate.parse("2021-08-23"), 0.2); - - rapidTest.setTestingRatePerActivityAndDateVaccinated((Map.of( - "leisure", leisureTestsVaccinated, - "work", workTestsVaccinated, - "business", workTestsVaccinated, - "educ_kiga", eduTestsVaccinated, - "educ_primary", eduTestsVaccinated, - "educ_secondary", eduTestsVaccinated, - "educ_tertiary", eduTestsVaccinated, - "educ_higher", eduTestsVaccinated, - "educ_other", eduTestsVaccinated - ))); - - - Map leisureTestsPCR = new HashMap(); - Map workTestsPCR = new HashMap(); - Map kigaPramaryTestsPCR = new HashMap(); - Map eduTestsPCR = new HashMap(); - - leisureTestsPCR.put(LocalDate.parse("2020-01-01"), 0.); - workTestsPCR.put(LocalDate.parse("2020-01-01"), 0.); - kigaPramaryTestsPCR.put(LocalDate.parse("2020-01-01"), 0.); - eduTestsPCR.put(LocalDate.parse("2020-01-01"), 0.); - - kigaPramaryTestsPCR.put(LocalDate.parse("2021-05-10"), 0.4); // TODO: PCR lolli tests in berlin? ask sydney? remove or replace w/ antigen? - - pcrTest.setTestingRatePerActivityAndDate((Map.of( - "leisure", leisureTestsPCR, - "work", workTestsPCR, - "business", workTestsPCR, - "educ_kiga", kigaPramaryTestsPCR, - "educ_primary", kigaPramaryTestsPCR, - "educ_secondary", eduTestsPCR, - "educ_tertiary", eduTestsPCR, - "educ_higher", eduTestsPCR, - "educ_other", eduTestsPCR - ))); - - // useless for now - Map leisureTestsPCRVaccinated = new HashMap(); - Map workTestsPCRVaccinated = new HashMap(); - Map eduTestsPCRVaccinated = new HashMap(); - leisureTestsPCRVaccinated.put(LocalDate.parse("2020-01-01"), 0.); - workTestsPCRVaccinated.put(LocalDate.parse("2020-01-01"), 0.); - eduTestsPCRVaccinated.put(LocalDate.parse("2020-01-01"), 0.); - - pcrTest.setTestingRatePerActivityAndDateVaccinated((Map.of( - "leisure", leisureTestsPCRVaccinated, - "work", workTestsPCRVaccinated, - "business", workTestsPCRVaccinated, - "educ_kiga", eduTestsPCRVaccinated, - "educ_primary", eduTestsPCRVaccinated, - "educ_secondary", eduTestsPCRVaccinated, - "educ_tertiary", eduTestsPCRVaccinated, - "educ_higher", eduTestsPCRVaccinated, - "educ_other", eduTestsPCRVaccinated - ))); - - rapidTest.setTestingCapacity_pers_per_day(Map.of( - LocalDate.of(1970, 1, 1), 0, - testingStartDate, Integer.MAX_VALUE)); - - pcrTest.setTestingCapacity_pers_per_day(Map.of( - LocalDate.of(1970, 1, 1), 0, - testingStartDate, Integer.MAX_VALUE)); - - // TRACING - TracingConfigGroup tracingConfig = ConfigUtils.addOrGetModule(config, TracingConfigGroup.class); - - tracingConfig.setQuarantineVaccinated((Map.of( - episimConfig.getStartDate(), false -// restrictionDate, qv - ))); - - tracingConfig.setQuarantineDuration(Map.of( - episimConfig.getStartDate(), 14, - LocalDate.parse("2022-01-01"), 10 - )); - - int greenPassValid = 90; // green pass holders do not have to go into quarantine b/c of contact w/ covid - int greenPassValidBoostered = Integer.MAX_VALUE; - - tracingConfig.setGreenPassValidDays(greenPassValid); - tracingConfig.setGreenPassBoosterValidDays(greenPassValidBoostered); - - QuarantineStatus qs = QuarantineStatus.atHome; - - tracingConfig.setQuarantineStatus(Map.of( - episimConfig.getStartDate(), QuarantineStatus.atHome -// restrictionDate, qs - )); - - - - - - return config; - } - - private void adaptVacinationEffectiveness(VaccinationConfigGroup vaccinationConfig) { - - double factorSymptomsMRNA = 0.4; - double factorSymptomsVector = 0.76; - - double factorSeriouslySickMRNA = 0.63; - double factorSeriouslySickVector = 0.19; - - int fullEffectMRNA = 7 * 7; //second shot after 6 weeks, full effect one week after second shot - - vaccinationConfig.getOrAddParams(VaccinationType.mRNA) - .setDaysBeforeFullEffect(fullEffectMRNA) - .setFactorShowingSymptoms(VaccinationConfigGroup.forStrain(VirusStrain.SARS_CoV_2) - .atFullEffect(factorSymptomsMRNA) - ) - .setFactorShowingSymptoms(VaccinationConfigGroup.forStrain(VirusStrain.ALPHA) - .atFullEffect(factorSymptomsMRNA) - ) - .setFactorShowingSymptoms(VaccinationConfigGroup.forStrain(VirusStrain.DELTA) - .atFullEffect(factorSymptomsMRNA) - ) - .setFactorShowingSymptoms(VaccinationConfigGroup.forStrain(VirusStrain.OMICRON_BA1) - .atFullEffect(factorSymptomsMRNA) - ) - .setFactorShowingSymptoms(VaccinationConfigGroup.forStrain(VirusStrain.OMICRON_BA2) - .atFullEffect(factorSymptomsMRNA) - ) - .setFactorSeriouslySick(VaccinationConfigGroup.forStrain(VirusStrain.SARS_CoV_2) - .atFullEffect(factorSeriouslySickMRNA) - ) - .setFactorSeriouslySick(VaccinationConfigGroup.forStrain(VirusStrain.ALPHA) - .atFullEffect(factorSeriouslySickMRNA) - ) - .setFactorSeriouslySick(VaccinationConfigGroup.forStrain(VirusStrain.DELTA) - .atFullEffect(factorSeriouslySickMRNA) - ) - .setFactorSeriouslySick(VaccinationConfigGroup.forStrain(VirusStrain.OMICRON_BA1) - .atFullEffect(factorSeriouslySickMRNA) - ) - .setFactorSeriouslySick(VaccinationConfigGroup.forStrain(VirusStrain.OMICRON_BA2) - .atFullEffect(factorSeriouslySickMRNA) - ) - .setFactorSeriouslySick(VaccinationConfigGroup.forStrain(VirusStrain.STRAIN_A) - .atFullEffect(factorSeriouslySickMRNA) - ) - .setFactorSeriouslySick(VaccinationConfigGroup.forStrain(VirusStrain.STRAIN_B) - .atFullEffect(factorSeriouslySickMRNA) - ) - ; - - int fullEffectVector = 10 * 7; //second shot after 9 weeks, full effect one week after second shot - - vaccinationConfig.getOrAddParams(VaccinationType.vector) - .setDaysBeforeFullEffect(fullEffectVector) - .setFactorShowingSymptoms(VaccinationConfigGroup.forStrain(VirusStrain.SARS_CoV_2) - .atFullEffect(factorSymptomsVector) - ) - .setFactorShowingSymptoms(VaccinationConfigGroup.forStrain(VirusStrain.ALPHA) - .atFullEffect(factorSymptomsVector) - ) - .setFactorShowingSymptoms(VaccinationConfigGroup.forStrain(VirusStrain.DELTA) - .atFullEffect(factorSymptomsVector) - ) - .setFactorShowingSymptoms(VaccinationConfigGroup.forStrain(VirusStrain.OMICRON_BA1) - .atFullEffect(factorSymptomsVector) - ) - .setFactorShowingSymptoms(VaccinationConfigGroup.forStrain(VirusStrain.OMICRON_BA2) - .atFullEffect(factorSymptomsVector) - ) - .setFactorSeriouslySick(VaccinationConfigGroup.forStrain(VirusStrain.SARS_CoV_2) - .atFullEffect(factorSeriouslySickVector) - ) - .setFactorSeriouslySick(VaccinationConfigGroup.forStrain(VirusStrain.ALPHA) - .atFullEffect(factorSeriouslySickVector) - ) - .setFactorSeriouslySick(VaccinationConfigGroup.forStrain(VirusStrain.DELTA) - .atFullEffect(factorSeriouslySickVector) - ) - .setFactorSeriouslySick(VaccinationConfigGroup.forStrain(VirusStrain.OMICRON_BA1) - .atFullEffect(factorSeriouslySickVector) - ) - .setFactorSeriouslySick(VaccinationConfigGroup.forStrain(VirusStrain.OMICRON_BA2) - .atFullEffect(factorSeriouslySickVector) - ) - .setFactorSeriouslySick(VaccinationConfigGroup.forStrain(VirusStrain.STRAIN_A) - .atFullEffect(factorSeriouslySickVector) - ) - .setFactorSeriouslySick(VaccinationConfigGroup.forStrain(VirusStrain.STRAIN_B) - .atFullEffect(factorSeriouslySickVector) - ) - ; - - vaccinationConfig.getOrAddParams(VaccinationType.ba1Update) - .setDaysBeforeFullEffect(fullEffectMRNA) - .setFactorShowingSymptoms(VaccinationConfigGroup.forStrain(VirusStrain.SARS_CoV_2) - .atFullEffect(factorSymptomsMRNA) - ) - .setFactorShowingSymptoms(VaccinationConfigGroup.forStrain(VirusStrain.ALPHA) - .atFullEffect(factorSymptomsMRNA) - ) - .setFactorShowingSymptoms(VaccinationConfigGroup.forStrain(VirusStrain.DELTA) - .atFullEffect(factorSymptomsMRNA) - ) - .setFactorShowingSymptoms(VaccinationConfigGroup.forStrain(VirusStrain.OMICRON_BA1) - .atFullEffect(factorSymptomsMRNA) - ) - .setFactorShowingSymptoms(VaccinationConfigGroup.forStrain(VirusStrain.OMICRON_BA2) - .atFullEffect(factorSymptomsMRNA) - ) - .setFactorSeriouslySick(VaccinationConfigGroup.forStrain(VirusStrain.SARS_CoV_2) - .atFullEffect(factorSeriouslySickMRNA) - ) - .setFactorSeriouslySick(VaccinationConfigGroup.forStrain(VirusStrain.ALPHA) - .atFullEffect(factorSeriouslySickMRNA) - ) - .setFactorSeriouslySick(VaccinationConfigGroup.forStrain(VirusStrain.DELTA) - .atFullEffect(factorSeriouslySickMRNA) - ) - .setFactorSeriouslySick(VaccinationConfigGroup.forStrain(VirusStrain.OMICRON_BA1) - .atFullEffect(factorSeriouslySickMRNA) - ) - .setFactorSeriouslySick(VaccinationConfigGroup.forStrain(VirusStrain.OMICRON_BA2) - .atFullEffect(factorSeriouslySickMRNA) - ) - .setFactorSeriouslySick(VaccinationConfigGroup.forStrain(VirusStrain.STRAIN_A) - .atFullEffect(factorSeriouslySickMRNA) - ) - .setFactorSeriouslySick(VaccinationConfigGroup.forStrain(VirusStrain.STRAIN_B) - .atFullEffect(factorSeriouslySickMRNA) - ) -; - - int fullEffectNatural = 2; - vaccinationConfig.getOrAddParams(VaccinationType.natural) - .setDaysBeforeFullEffect(fullEffectNatural) - .setFactorShowingSymptoms(VaccinationConfigGroup.forStrain(VirusStrain.SARS_CoV_2) - .atFullEffect(factorSymptomsMRNA) - ) - .setFactorShowingSymptoms(VaccinationConfigGroup.forStrain(VirusStrain.ALPHA) - .atFullEffect(factorSymptomsMRNA) - ) - .setFactorShowingSymptoms(VaccinationConfigGroup.forStrain(VirusStrain.DELTA) - .atFullEffect(factorSymptomsMRNA) - ) - .setFactorShowingSymptoms(VaccinationConfigGroup.forStrain(VirusStrain.OMICRON_BA1) - .atFullEffect(factorSymptomsMRNA) - ) - .setFactorShowingSymptoms(VaccinationConfigGroup.forStrain(VirusStrain.OMICRON_BA2) - .atFullEffect(factorSymptomsMRNA) - ) - .setFactorSeriouslySick(VaccinationConfigGroup.forStrain(VirusStrain.SARS_CoV_2) - .atFullEffect(factorSeriouslySickMRNA) - ) - .setFactorSeriouslySick(VaccinationConfigGroup.forStrain(VirusStrain.ALPHA) - .atFullEffect(factorSeriouslySickMRNA) - ) - .setFactorSeriouslySick(VaccinationConfigGroup.forStrain(VirusStrain.DELTA) - .atFullEffect(factorSeriouslySickMRNA) - ) - .setFactorSeriouslySick(VaccinationConfigGroup.forStrain(VirusStrain.OMICRON_BA1) - .atFullEffect(factorSeriouslySickMRNA) - ) - .setFactorSeriouslySick(VaccinationConfigGroup.forStrain(VirusStrain.OMICRON_BA2) - .atFullEffect(factorSeriouslySickMRNA) - ) - .setFactorSeriouslySick(VaccinationConfigGroup.forStrain(VirusStrain.STRAIN_A) - .atFullEffect(factorSeriouslySickMRNA) - ) - .setFactorSeriouslySick(VaccinationConfigGroup.forStrain(VirusStrain.STRAIN_B) - .atFullEffect(factorSeriouslySickMRNA) - ) - ; - - - } - - private void configureBooster(VaccinationConfigGroup vaccinationConfig, double boosterSpeed, int boostAfter) { - - Map boosterVaccinations = new HashMap<>(); - - boosterVaccinations.put(LocalDate.parse("2020-01-01"), 0); - - boosterVaccinations.put(LocalDate.parse("2022-01-17"), (int) (4_800_000 * 0.04 * boosterSpeed / 7)); // TODO maybe use new booster data: change date to today - boosterVaccinations.put(LocalDate.parse("2022-06-30"), 0); - - vaccinationConfig.setReVaccinationCapacity_pers_per_day(boosterVaccinations); - - - vaccinationConfig.getOrAddParams(VaccinationType.mRNA) - .setBoostWaitPeriod(boostAfter * 30 + 6 * 7); - ; - - vaccinationConfig.getOrAddParams(VaccinationType.ba1Update) - .setBoostWaitPeriod(boostAfter * 30 + 6 * 7); -; - - vaccinationConfig.getOrAddParams(VaccinationType.vector) - .setBoostWaitPeriod(boostAfter * 30 + 9 * 7); - ; - } - - public static final class Params { - // ~1000 runs is max - - - @GenerateSeeds(5) - public long seed; - - @Parameter({0.5,1.0}) - public double leisureTestCorrection; - - @Parameter({0.5,1.0}) - public double eduTestCorrection; - - @Parameter({2.0,3.0,4.0,5.0}) - public double impFacSum; - - @Parameter({2.0,3.,4.,5.}) - public double impFacOct; - -// @Parameter({20.0,22.5,25.0,27.5,30}) -// double TmidFall; - - @Parameter({1.})//{0.96, 0.98, 1.0, 1.2, 1.4}) - double thetaFactor; - - @StringParameter({"2099-01-01"})//"2022-03-01", "2099-01-01"}) - String oVac; - - @IntParameter({50})//, 80}) - int dur; - - } - - public static void main(String[] args) { - String[] args2 = { - RunParallel.OPTION_SETUP, Berlin220215.class.getName(), - RunParallel.OPTION_PARAMS, Params.class.getName(), - RunParallel.OPTION_TASKS, Integer.toString(1), - RunParallel.OPTION_ITERATIONS, Integer.toString(30), - RunParallel.OPTION_METADATA - }; - - RunParallel.main(args2); - } - - -} - diff --git a/src/main/java/org/matsim/run/batch/BerlinClusterTracing.java b/src/main/java/org/matsim/run/batch/BerlinClusterTracing.java deleted file mode 100644 index 0b8215ff3..000000000 --- a/src/main/java/org/matsim/run/batch/BerlinClusterTracing.java +++ /dev/null @@ -1,144 +0,0 @@ -/*- - * #%L - * MATSim Episim - * %% - * Copyright (C) 2020 matsim-org - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - * #L% - */ -package org.matsim.run.batch; - -import com.google.inject.AbstractModule; -import com.google.inject.Inject; -import com.google.inject.Module; -import com.google.inject.name.Names; -import com.google.inject.util.Modules; -import org.matsim.core.config.Config; -import org.matsim.core.config.ConfigUtils; -import org.matsim.episim.*; -import org.matsim.episim.model.progression.AgeDependentDiseaseStatusTransitionModel; -import org.matsim.episim.model.progression.DiseaseStatusTransitionModel; -import org.matsim.episim.policy.FixedPolicy; -import org.matsim.run.modules.SnzBerlinProductionScenario; - -import javax.inject.Named; -import java.util.SplittableRandom; - -/** - * Batch run for tracing options. - */ -public final class BerlinClusterTracing implements BatchRun { - - @Override - public Metadata getMetadata() { - return Metadata.of("berlin", "clusterTracing"); - } - - private SnzBerlinProductionScenario getScenario(Params params) { - SnzBerlinProductionScenario.Builder scenario = new SnzBerlinProductionScenario.Builder(); - - if (params != null && params.unrestricted.equals("no")) - scenario.setSnapshot(SnzBerlinProductionScenario.Snapshot.episim_snapshot_240_2020_10_21); - - return scenario.createSnzBerlinProductionScenario(); - } - - @Override - public Module getBindings(int id, Params params) { - return Modules.override(getScenario(params)).with(new AbstractModule() { - @Override - protected void configure() { - if (params != null) { - bindConstant().annotatedWith(Names.named("symptomatic")).to(params.symptomatic); - bind(DiseaseStatusTransitionModel.class).to(CustomProgressionModel.class); - } - } - }); - } - - @Override - public Config prepareConfig(int id, BerlinClusterTracing.Params params) { - - Config config = getScenario(params).config(); - - config.global().setRandomSeed(params.seed); - - EpisimConfigGroup episimConfig = ConfigUtils.addOrGetModule(config, EpisimConfigGroup.class); - TracingConfigGroup tracingConfig = ConfigUtils.addOrGetModule(config, TracingConfigGroup.class); - - episimConfig.setSnapshotSeed(EpisimConfigGroup.SnapshotSeed.reseed); - - if (params.unrestricted.equals("yes")) - episimConfig.setPolicy(FixedPolicy.class, FixedPolicy.config().build()); - - // Filter some runs without tracing - if (params.tracingStrategy == TracingConfigGroup.Strategy.NONE && params.tracingCapacity != Integer.MAX_VALUE) - return null; - - tracingConfig.setPutTraceablePersonsInQuarantineAfterDay(30); - tracingConfig.setStrategy(params.tracingStrategy); - tracingConfig.setLocationThreshold(3); - tracingConfig.setTracingDelay_days(1); - tracingConfig.setCapacityType(TracingConfigGroup.CapacityType.PER_PERSON); - tracingConfig.setTracingCapacity_pers_per_day(params.tracingCapacity); - tracingConfig.setTracingProbability(params.tracingProbability); - - - return config; - } - - public static final class Params { - - @GenerateSeeds(20) - long seed; - - @EnumParameter(value = TracingConfigGroup.Strategy.class, ignore = "RANDOM") - TracingConfigGroup.Strategy tracingStrategy; - - @Parameter({0.5, 0.8, 1.0}) - double symptomatic; - - @IntParameter({200, 1000, Integer.MAX_VALUE}) - int tracingCapacity; - - @Parameter({0.6, 1.0}) - double tracingProbability; - - @StringParameter({"no"}) - String unrestricted; - - - } - - private static final class CustomProgressionModel extends AgeDependentDiseaseStatusTransitionModel { - - private final double symptomatic; - - @Inject - public CustomProgressionModel( - @Named("symptomatic") double symptomatic, EpisimConfigGroup episimConfig, - SplittableRandom rnd, VirusStrainConfigGroup strainConfig, VaccinationConfigGroup vaccinationConfig) { - super(rnd, episimConfig, vaccinationConfig, strainConfig); - this.symptomatic = symptomatic; - } - - @Override - protected double getProbaOfTransitioningToShowingSymptoms(EpisimPerson person) { - return symptomatic; - } - } - -} - diff --git a/src/main/java/org/matsim/run/batch/BerlinContactModelsAndInterventions.java b/src/main/java/org/matsim/run/batch/BerlinContactModelsAndInterventions.java deleted file mode 100644 index 403aebb6e..000000000 --- a/src/main/java/org/matsim/run/batch/BerlinContactModelsAndInterventions.java +++ /dev/null @@ -1,137 +0,0 @@ -package org.matsim.run.batch; - -import com.google.inject.AbstractModule; -import org.matsim.core.config.Config; -import org.matsim.core.config.ConfigUtils; -import org.matsim.episim.BatchRun; -import org.matsim.episim.EpisimConfigGroup; -import org.matsim.episim.EpisimConfigGroup.InfectionParams; -import org.matsim.episim.TracingConfigGroup; -import org.matsim.episim.model.*; -import org.matsim.episim.policy.FixedPolicy; -import org.matsim.episim.policy.FixedPolicy.ConfigBuilder; -import org.matsim.episim.policy.Restriction; -import org.matsim.run.modules.AbstractSnzScenario2020; -import org.matsim.run.modules.SnzBerlinWeekScenario2020; - -import javax.annotation.Nullable; -import java.util.Map; - -import static org.matsim.run.batch.ContactModels.*; - - -/** - * Interventions for symmetric Berlin week model with different contact models - */ -public class BerlinContactModelsAndInterventions implements BatchRun { - - - - @Override - public AbstractModule getBindings(int id, @Nullable Params params) { - if (params == null) - return new SnzBerlinWeekScenario2020(); - - boolean withModifiedCi = !params.contactModel.equals(OLD); - return new SnzBerlinWeekScenario2020(25, false, withModifiedCi, ContactModels.MODELS.get(params.contactModel)); - } - - @Override - public Metadata getMetadata() { - return Metadata.of("berlin", "contactModels&Interventions"); - } - - @Override - public Config prepareConfig(int id, Params params) { - - int nSpaces = 1; - - if (params.contactModel.equals(SYMMETRIC_NEW_NSPACES_20)) nSpaces = 20; - - boolean withModifiedCi = !params.contactModel.equals(OLD); - - SnzBerlinWeekScenario2020 module = new SnzBerlinWeekScenario2020(25, false, withModifiedCi, MODELS.get(params.contactModel)); - Config config = module.config(); - config.global().setRandomSeed(params.seed); - - EpisimConfigGroup episimConfig = ConfigUtils.addOrGetModule(config, EpisimConfigGroup.class); - - for (InfectionParams infParams : episimConfig.getInfectionParams()) { - if (!infParams.includesActivity("home")) infParams.setSpacesPerFacility(nSpaces); - } - - episimConfig.setStartDate("2020-02-18"); - - TracingConfigGroup tracingConfig = ConfigUtils.addOrGetModule(config, TracingConfigGroup.class); - - tracingConfig.setPutTraceablePersonsInQuarantineAfterDay(Integer.MAX_VALUE); - - ConfigBuilder builder = FixedPolicy.config(); - - { - if (params.restriction.startsWith("none") || params.restriction.startsWith("calibr")) ; - - else if (params.restriction.equals("0.9CLOTH@PT&SHOP")) - builder.restrict(20, Restriction.ofMask(FaceMask.CLOTH, 0.9), "pt", "shop_daily", "shop_other"); - - else if (params.restriction.equals("0.9CLOTH@EDU")) - builder.restrict(20, Restriction.ofMask(FaceMask.CLOTH, 0.9), "educ_primary", "educ_kiga", "educ_secondary", "educ_higher", "educ_tertiary", "educ_other"); - - else if (params.restriction.equals("workBusiness50")) builder.restrict(20, 0.5, "work", "business"); - else if (params.restriction.equals("workBusiness0")) builder.restrict(20, 0., "work", "business"); - - else if (params.restriction.equals("leisure50")) builder.restrict(20, 0.5, "leisure"); - else if (params.restriction.equals("leisure0")) builder.restrict(20, 0., "leisure"); - - else if (params.restriction.equals("shop50")) builder.restrict(20, 0.5, "shop_daily", "shop_other"); - else if (params.restriction.equals("shop0")) builder.restrict(20, 0., "shop_daily", "shop_other"); - - else if (params.restriction.equals("educ_kiga50")) builder.restrict(20, 0.5, "educ_kiga"); - else if (params.restriction.equals("educ_kiga0")) builder.restrict(20, 0., "educ_kiga"); - - else if (params.restriction.equals("educ_school50")) - builder.restrict(20, 0.5, "educ_primary", "educ_secondary", "educ_tertiary"); - - else if (params.restriction.equals("educ_school0")) - builder.restrict(20, 0., "educ_primary", "educ_secondary", "educ_tertiary"); - - else if (params.restriction.equals("educ_higher50")) builder.restrict(20, 0.5, "educ_higher"); - else if (params.restriction.equals("educ_higher0")) builder.restrict(20, 0., "educ_higher"); - - else if (params.restriction.equals("outOfHome50")) builder.restrict(20, 0.5, AbstractSnzScenario2020.DEFAULT_ACTIVITIES); - else if (params.restriction.equals("outOfHome0")) builder.restrict(20, 0., AbstractSnzScenario2020.DEFAULT_ACTIVITIES); - - else if (params.restriction.contains("tracing")) { - tracingConfig.setPutTraceablePersonsInQuarantineAfterDay(1); - tracingConfig.setTracingCapacity_pers_per_day(Map.of( - episimConfig.getStartDate(), 0, - episimConfig.getStartDate().plusDays(20), Integer.MAX_VALUE) - ); - tracingConfig.setTracingProbability(0.75); - } - else throw new RuntimeException("Measure not implemented: " + params.restriction); - } - - episimConfig.setPolicy(FixedPolicy.class, builder.build()); - - return config; - } - - public static final class Params { - - @GenerateSeeds(20) - public long seed; - - @StringParameter({"none", "tracing75", "0.9CLOTH@PT&SHOP", "0.9CLOTH@EDU", "workBusiness50", "workBusiness0", "leisure50", "leisure0", "shop50", "shop0", "educ_kiga50", "educ_kiga0", - "educ_school50", "educ_school0", "educ_higher50", "educ_higher0", "outOfHome50", "outOfHome0"}) -// @StringParameter({"calibr"}) - public String restriction; - - @StringParameter({OLD, SYMMETRIC_OLD, SYMMETRIC_NEW_NSPACES_1, SYMMETRIC_NEW_NSPACES_20}) -// @StringParameter({OLD, SYMMETRIC_OLD, SYMMETRIC_NEW_NSPACES_1, SYMMETRIC_NEW_NSPACES_20, PAIRWISE}) - public String contactModel; - - } - - -} diff --git a/src/main/java/org/matsim/run/batch/BerlinCurfew.java b/src/main/java/org/matsim/run/batch/BerlinCurfew.java deleted file mode 100644 index a97811388..000000000 --- a/src/main/java/org/matsim/run/batch/BerlinCurfew.java +++ /dev/null @@ -1,129 +0,0 @@ -package org.matsim.run.batch; - -import com.google.inject.AbstractModule; -import org.matsim.core.config.Config; -import org.matsim.core.config.ConfigUtils; -import org.matsim.episim.BatchRun; -import org.matsim.episim.EpisimConfigGroup; -import org.matsim.episim.TracingConfigGroup; -import org.matsim.episim.model.*; -import org.matsim.episim.policy.FixedPolicy; -import org.matsim.episim.policy.FixedPolicy.ConfigBuilder; -import org.matsim.episim.policy.Restriction; -import org.matsim.run.modules.SnzBerlinWeekScenario2020; - -import javax.annotation.Nullable; -import java.time.LocalDate; -import java.util.Map; - -/** - * Batch class for curfew runs - */ -public class BerlinCurfew implements BatchRun { - - - @Override - public AbstractModule getBindings(int id, @Nullable Params params) { - - return new SnzBerlinWeekScenario2020(25, true, true, OldSymmetricContactModel.class); - } - - @Override - public Metadata getMetadata() { - return Metadata.of("berlin", "curfew"); - } - - @Override - public Config prepareConfig(int id, Params params) { - - SnzBerlinWeekScenario2020 module = new SnzBerlinWeekScenario2020(25, true, true, OldSymmetricContactModel.class); - Config config = module.config(); - config.global().setRandomSeed(params.seed); - - EpisimConfigGroup episimConfig = ConfigUtils.addOrGetModule(config, EpisimConfigGroup.class); - - ConfigBuilder builder; - LocalDate day; - - // test scenario with few restrictions - if (params.variant.equals("testing")) { - builder = FixedPolicy.config(); - day = episimConfig.getStartDate().plusDays(20); - - TracingConfigGroup tracingConfig = ConfigUtils.addOrGetModule(config, TracingConfigGroup.class); - tracingConfig.setPutTraceablePersonsInQuarantineAfterDay(Integer.MAX_VALUE); - } else { - builder = FixedPolicy.parse(episimConfig.getPolicy()); - day = LocalDate.of(2020, 10, 12); - - TracingConfigGroup tracingConfig = ConfigUtils.addOrGetModule(config, TracingConfigGroup.class); - tracingConfig.setTracingCapacity_pers_per_day(Map.of( - LocalDate.of(2020, 4, 1), 30, - LocalDate.of(2020, 6, 15), params.tracingCapacity - )); - } - - switch (params.curfew) { - case "1-6": - builder.restrict(day, Restriction.ofClosingHours(1, 6), "leisure"); - break; - case "0-6": - builder.restrict(day, Restriction.ofClosingHours(0, 6), "leisure"); - break; - case "23-6": - builder.restrict(day, Restriction.ofClosingHours(23, 6), "leisure"); - break; - case "22-6": - builder.restrict(day, Restriction.ofClosingHours(22, 6), "leisure"); - break; - case "21-6": - builder.restrict(day, Restriction.ofClosingHours(21, 6), "leisure"); - break; - case "20-6": - builder.restrict(day, Restriction.ofClosingHours(20, 6), "leisure"); - break; - case "19-6": - builder.restrict(day, Restriction.ofClosingHours(19, 6), "leisure"); - break; - case "0-24": - builder.restrict(day, Restriction.ofClosingHours(0, 24), "leisure"); - break; - case "remainingFraction0": - builder.restrict(day, 0., "leisure"); - break; - case "no": - break; - default: - throw new RuntimeException("not implemented"); - } - - if (params.holidays.equals("no")) builder.restrict("2020-10-12", 1., "educ_primary", "educ_secondary", "educ_tertiary", "educ_other"); - else if (params.holidays.equals("yes")); - else throw new RuntimeException(); - - episimConfig.setPolicy(FixedPolicy.class, builder.build()); - - return config; - } - - public static final class Params { - - @GenerateSeeds(20) - public long seed; - -// @StringParameter({"current"}) - public String variant = "current"; - - @StringParameter({"no", "yes"}) - public String holidays; - - @StringParameter({"no", "0-6", "23-6", "22-6", "21-6", "20-6", "19-6", "0-24"}) - public String curfew; - - @IntParameter({200, Integer.MAX_VALUE}) - int tracingCapacity; - - } - - -} diff --git a/src/main/java/org/matsim/run/batch/BerlinDiseaseImport.java b/src/main/java/org/matsim/run/batch/BerlinDiseaseImport.java deleted file mode 100644 index c6f200718..000000000 --- a/src/main/java/org/matsim/run/batch/BerlinDiseaseImport.java +++ /dev/null @@ -1,111 +0,0 @@ -package org.matsim.run.batch; - -import com.google.inject.AbstractModule; - - -import org.matsim.core.config.Config; -import org.matsim.core.config.ConfigUtils; -import org.matsim.episim.BatchRun; -import org.matsim.episim.EpisimConfigGroup; -import org.matsim.episim.TracingConfigGroup; -import org.matsim.episim.model.OldSymmetricContactModel; -import org.matsim.run.modules.SnzBerlinWeekScenario2020; - -import java.time.LocalDate; -import java.util.Map; - -import javax.annotation.Nullable; - - -/** - * batch class used for calibration of scenario with disease import from data - */ -public class BerlinDiseaseImport implements BatchRun { - - - @Override - public AbstractModule getBindings(int id, @Nullable Params params) { - return new SnzBerlinWeekScenario2020(25, true, true, OldSymmetricContactModel.class); - } - - @Override - public Metadata getMetadata() { - return Metadata.of("berlin", "diseaseImport"); - } - - @Override - public Config prepareConfig(int id, Params params) { - - SnzBerlinWeekScenario2020 module = new SnzBerlinWeekScenario2020(); - Config config = module.config(); - config.global().setRandomSeed(params.seed); - - EpisimConfigGroup episimConfig = ConfigUtils.addOrGetModule(config, EpisimConfigGroup.class); - - episimConfig.setInitialInfectionDistrict(null); - episimConfig.setInitialInfections(Integer.MAX_VALUE); - - if (params.ageBoundaries.startsWith("0")) { - episimConfig.setUpperAgeBoundaryForInitInfections(9); - } - if (params.ageBoundaries.startsWith("1")) { - episimConfig.setLowerAgeBoundaryForInitInfections(10); - episimConfig.setUpperAgeBoundaryForInitInfections(19); - } - if (params.ageBoundaries.startsWith("2")) { - episimConfig.setLowerAgeBoundaryForInitInfections(20); - episimConfig.setUpperAgeBoundaryForInitInfections(29); - } - if (params.ageBoundaries.startsWith("3")) { - episimConfig.setLowerAgeBoundaryForInitInfections(30); - episimConfig.setUpperAgeBoundaryForInitInfections(39); - } - if (params.ageBoundaries.startsWith("4")) { - episimConfig.setLowerAgeBoundaryForInitInfections(40); - episimConfig.setUpperAgeBoundaryForInitInfections(49); - } - if (params.ageBoundaries.startsWith("5")) { - episimConfig.setLowerAgeBoundaryForInitInfections(50); - episimConfig.setUpperAgeBoundaryForInitInfections(59); - } - if (params.ageBoundaries.startsWith("6")) { - episimConfig.setLowerAgeBoundaryForInitInfections(60); - episimConfig.setUpperAgeBoundaryForInitInfections(69); - } - if (params.ageBoundaries.startsWith("7")) { - episimConfig.setLowerAgeBoundaryForInitInfections(70); - episimConfig.setUpperAgeBoundaryForInitInfections(79); - } - if (params.ageBoundaries.startsWith("8")) { - episimConfig.setLowerAgeBoundaryForInitInfections(80); - } - //6.e-6 is current default for runs without age boundaries - episimConfig.setCalibrationParameter(params.calibrationParam); -// episimConfig.setCalibrationParameter(6.e-6); - - TracingConfigGroup tracingConfig = ConfigUtils.addOrGetModule(config, TracingConfigGroup.class); - tracingConfig.setTracingCapacity_pers_per_day(Map.of( - LocalDate.of(2020, 4, 1), 30, - LocalDate.of(2020, 6, 15), params.tracingCapacity - )); - - return config; - } - - public static final class Params { - - @GenerateSeeds(10) - long seed; - - @Parameter({6.e-6, 4.e-6, 2.e-6}) - private double calibrationParam; - - @StringParameter({"0-9", "10-19", "20-29", "30-39", "40-49", "50-59", "60-69", "70-79", "80+", "random"}) - public String ageBoundaries; - - @IntParameter({100, Integer.MAX_VALUE}) - private int tracingCapacity; - - } - -} diff --git a/src/main/java/org/matsim/run/batch/BerlinDispersion.java b/src/main/java/org/matsim/run/batch/BerlinDispersion.java deleted file mode 100644 index 2213f6742..000000000 --- a/src/main/java/org/matsim/run/batch/BerlinDispersion.java +++ /dev/null @@ -1,61 +0,0 @@ -package org.matsim.run.batch; - -import com.google.inject.AbstractModule; -import org.matsim.core.config.Config; -import org.matsim.core.config.ConfigUtils; -import org.matsim.episim.BatchRun; -import org.matsim.episim.EpisimConfigGroup; -import org.matsim.episim.TracingConfigGroup; -import org.matsim.episim.policy.FixedPolicy; -import org.matsim.run.modules.SnzBerlinSuperSpreaderScenario; - -/** - * Compare different tracing options with regard to super spreading. - */ -public class BerlinDispersion implements BatchRun { - - @Override - public Metadata getMetadata() { - return Metadata.of("berlin", "dispersion"); - } - - @Override - public AbstractModule getBindings(int id, Params params) { - Params p = (Params) params; - return new SnzBerlinSuperSpreaderScenario(p.contactModel.equals("SYMMETRIC"), p.maxContacts, p.sigma, p.sigma); - } - - @Override - public Config prepareConfig(int id, Params params) { - - Config config = new SnzBerlinSuperSpreaderScenario(params.contactModel.equals("SYMMETRIC"), params.maxContacts, params.sigma, params.sigma).config(); - - config.global().setRandomSeed(params.seed); - - EpisimConfigGroup episimConfig = ConfigUtils.addOrGetModule(config, EpisimConfigGroup.class); - TracingConfigGroup tracingConfig = ConfigUtils.addOrGetModule(config, TracingConfigGroup.class); - - tracingConfig.setPutTraceablePersonsInQuarantineAfterDay(Integer.MAX_VALUE); - - // unrestricted - episimConfig.setPolicy(FixedPolicy.class, FixedPolicy.config().build()); - - return config; - } - - public static final class Params { - - @GenerateSeeds(10) - private long seed; - - @Parameter({0}) - private double sigma; - - @StringParameter({"DEFAULT", "SYMMETRIC"}) - public String contactModel; - - @IntParameter({1, 3, 10, 30}) - private int maxContacts; - - } -} diff --git a/src/main/java/org/matsim/run/batch/BerlinInterventionsOct.java b/src/main/java/org/matsim/run/batch/BerlinInterventionsOct.java deleted file mode 100644 index 9de986437..000000000 --- a/src/main/java/org/matsim/run/batch/BerlinInterventionsOct.java +++ /dev/null @@ -1,224 +0,0 @@ -package org.matsim.run.batch; - -import com.google.inject.AbstractModule; -import org.matsim.core.config.Config; -import org.matsim.core.config.ConfigUtils; -import org.matsim.episim.BatchRun; -import org.matsim.episim.EpisimConfigGroup; -import org.matsim.episim.TracingConfigGroup; -import org.matsim.episim.model.*; -import org.matsim.episim.policy.FixedPolicy; -import org.matsim.episim.policy.Restriction; -import org.matsim.run.modules.AbstractSnzScenario2020; -import org.matsim.run.modules.SnzBerlinProductionScenario; -import org.matsim.run.modules.SnzProductionScenario.DiseaseImport; -import org.matsim.run.modules.SnzProductionScenario.Masks; -import org.matsim.run.modules.SnzProductionScenario.Restrictions; -import org.matsim.run.modules.SnzBerlinProductionScenario.Snapshot; -import org.matsim.run.modules.SnzProductionScenario.Tracing; - -import javax.annotation.Nullable; - -import java.time.LocalDate; -import java.util.Map; - - -/** - * Interventions for symmetric Berlin week model with different contact models - */ -public class BerlinInterventionsOct implements BatchRun { - - @Override - public AbstractModule getBindings(int id, @Nullable Params params) { - - return new SnzBerlinProductionScenario.Builder().setSnapshot( - Snapshot.episim_snapshot_240_2020_10_21 ).setDiseaseImport( DiseaseImport.yes ).setRestrictions( Restrictions.yes ).setMasks( Masks.yes ).setTracing( Tracing.yes ).setInfectionModel( AgeDependentInfectionModelWithSeasonality.class ).createSnzBerlinProductionScenario(); - } - - @Override - public Metadata getMetadata() { - return Metadata.of("berlin", "interventionsOctober"); - } - - @Override - public Config prepareConfig(int id, Params params) { - - SnzBerlinProductionScenario module = new SnzBerlinProductionScenario.Builder().setSnapshot( Snapshot.episim_snapshot_240_2020_10_21 ).setDiseaseImport( DiseaseImport.yes ).setRestrictions( Restrictions.yes ).setMasks( - Masks.yes ).setTracing( Tracing.yes ).setInfectionModel( - AgeDependentInfectionModelWithSeasonality.class ).createSnzBerlinProductionScenario(); - Config config = module.config(); - config.global().setRandomSeed(params.seed); - - EpisimConfigGroup episimConfig = ConfigUtils.addOrGetModule(config, EpisimConfigGroup.class); - - episimConfig.setSnapshotSeed(EpisimConfigGroup.SnapshotSeed.reseed); - - TracingConfigGroup tracingConfig = ConfigUtils.addOrGetModule(config, TracingConfigGroup.class); - - FixedPolicy.ConfigBuilder builder = FixedPolicy.parse(episimConfig.getPolicy()); - - if (params.lockdown.equals("outOfHomeExceptEdu59")) { - for (String act : AbstractSnzScenario2020.DEFAULT_ACTIVITIES) { - if (act.contains("educ")) continue; - builder.restrict("2020-11-02", 0.59, act); - } - } - - LocalDate interventionDate = LocalDate.parse("2020-11-23"); - builder.clearAfter(interventionDate.toString()); - - { - if (params.restriction.equals("current")); - else if (params.restriction.equals("tracing-inf-90-2d")) { - tracingConfig.setTracingCapacity_pers_per_day(Map.of( - LocalDate.of(2020, 4, 1), 300, - LocalDate.of(2020, 6, 15), 2000, - interventionDate, Integer.MAX_VALUE - )); - tracingConfig.setTracingProbability(Map.of( - LocalDate.of(1970, 1, 1), 0.6, - interventionDate, 0.9 - )); - tracingConfig.setTracingDelay_days(Map.of( - LocalDate.of(1970, 1, 1), 4, - interventionDate, 2 - )); - } - else if (params.restriction.equals("tracing-cap-90-2d")) { - tracingConfig.setTracingProbability(Map.of( - LocalDate.of(1970, 1, 1), 0.6, - interventionDate, 0.9 - )); - tracingConfig.setTracingDelay_days(Map.of( - LocalDate.of(1970, 1, 1), 4, - interventionDate, 2 - )); - } - else if (params.restriction.equals("tracing-inf-90-4d")) { - tracingConfig.setTracingCapacity_pers_per_day(Map.of( - LocalDate.of(2020, 4, 1), 300, - LocalDate.of(2020, 6, 15), 2000, - interventionDate, Integer.MAX_VALUE - )); - tracingConfig.setTracingProbability(Map.of( - LocalDate.of(1970, 1, 1), 0.6, - interventionDate, 0.9 - )); - - - } - else if (params.restriction.equals("tracing-cap-90-4d")) { - tracingConfig.setTracingProbability(Map.of( - LocalDate.of(1970, 1, 1), 0.6, - interventionDate, 0.9 - )); - - } - else if (params.restriction.equals("tracing-inf-60-2d")) { - tracingConfig.setTracingCapacity_pers_per_day(Map.of( - LocalDate.of(2020, 4, 1), 300, - LocalDate.of(2020, 6, 15), 2000, - interventionDate, Integer.MAX_VALUE - )); - tracingConfig.setTracingDelay_days(Map.of( - LocalDate.of(1970, 1, 1), 4, - interventionDate, 2 - )); - - } - else if (params.restriction.equals("tracing-cap-60-2d")) { - tracingConfig.setTracingDelay_days(Map.of( - LocalDate.of(1970, 1, 1), 4, - interventionDate, 2 - )); - } - else if (params.restriction.equals("tracing-inf-60-4d")) { - tracingConfig.setTracingCapacity_pers_per_day(Map.of( - LocalDate.of(2020, 4, 1), 300, - LocalDate.of(2020, 6, 15), 2000, - interventionDate, Integer.MAX_VALUE - )); - } - - else if (params.restriction.equals("schoolClothMasks")) builder.restrict(interventionDate, Restriction.ofMask(FaceMask.CLOTH, 0.9), "educ_primary", "educ_secondary", "educ_tertiary"); - else if (params.restriction.equals("school50")) builder.restrict(interventionDate, 0.5, "educ_primary", "educ_secondary", "educ_tertiary"); - else if (params.restriction.equals("school0")) builder.restrict(interventionDate, 0., "educ_primary", "educ_secondary", "educ_tertiary"); - else if (params.restriction.equals("school50&ClothMasks")) { - builder.restrict(interventionDate, Restriction.ofMask(FaceMask.CLOTH, 0.9), "educ_primary", "educ_secondary", "educ_tertiary"); - builder.restrict(interventionDate, 0.5, "educ_primary", "educ_secondary", "educ_tertiary"); - } - - else if (params.restriction.equals("universities0")) builder.restrict(interventionDate, 0., "educ_higher"); - - else if (params.restriction.equals("kiga50")) builder.restrict(interventionDate, 0.5, "educ_kiga"); - else if (params.restriction.equals("kiga0")) builder.restrict(interventionDate, 0., "educ_kiga"); - - else if (params.restriction.equals("leisure50")) builder.restrict(interventionDate, 0.5, "leisure"); - else if (params.restriction.equals("leisure0")) builder.restrict(interventionDate, 0., "leisure"); - else if (params.restriction.equals("leisureCurfew19-6")) builder.restrict(interventionDate, Restriction.ofClosingHours(19, 6), "leisure"); - else if (params.restriction.equals("leisureCurfew21-6")) builder.restrict(interventionDate, Restriction.ofClosingHours(21, 6), "leisure"); - else if (params.restriction.equals("leisureCurfew23-6")) builder.restrict(interventionDate, Restriction.ofClosingHours(23, 6), "leisure"); - else if (params.restriction.equals("leisure50&Curfew19-6")) { - builder.restrict(interventionDate, Restriction.ofClosingHours(19, 6), "leisure"); - builder.restrict(interventionDate, 0.5, "leisure"); - } - else if (params.restriction.equals("leisure50&Curfew21-6")) { - builder.restrict(interventionDate, Restriction.ofClosingHours(21, 6), "leisure"); - builder.restrict(interventionDate, 0.5, "leisure"); - } - else if (params.restriction.equals("leisure50&Curfew23-6")) { - builder.restrict(interventionDate, Restriction.ofClosingHours(23, 6), "leisure"); - builder.restrict(interventionDate, 0.5, "leisure"); - } - - else if (params.restriction.equals("shop50")) builder.restrict(interventionDate, 0.5, "shop_daily", "shop_other"); - else if (params.restriction.equals("shop0")) builder.restrict(interventionDate, 0., "shop_daily", "shop_other"); - - else if (params.restriction.equals("errands50")) builder.restrict(interventionDate, 0.5, "errands"); - else if (params.restriction.equals("errands0")) builder.restrict(interventionDate, 0., "errands"); - - else if (params.restriction.equals("visit50")) builder.restrict(interventionDate, 0.5, "visit"); - else if (params.restriction.equals("visit0")) builder.restrict(interventionDate, 0., "visit"); - - else if (params.restriction.equals("educ_other50")) builder.restrict(interventionDate, 0.5, "educ_other"); - else if (params.restriction.equals("educ_other0")) builder.restrict(interventionDate, 0., "educ_other"); - - else if (params.restriction.equals("work75")) builder.restrict(interventionDate, 0.75, "work", "business"); - else if (params.restriction.equals("work50")) builder.restrict(interventionDate, 0.5, "work", "business"); - else if (params.restriction.equals("work25")) builder.restrict(interventionDate, 0.25, "work", "business"); - else if (params.restriction.equals("work0")) builder.restrict(interventionDate, 0., "work", "business"); - else if (params.restriction.equals("workN95Masks")) builder.restrict(interventionDate, Restriction.ofMask(FaceMask.N95, 0.9), "work", "business"); - - else throw new RuntimeException("Measure not implemented: " + params.restriction); - } - - episimConfig.setPolicy(FixedPolicy.class, builder.build()); - - return config; - } - - public static final class Params { - - @GenerateSeeds(10) - public long seed; - - @StringParameter({"current", - "tracing-inf-60-4d", "tracing-cap-60-2d", "tracing-inf-60-2d", "tracing-cap-90-4d", "tracing-inf-90-4d", "tracing-cap-90-2d", "tracing-inf-90-2d", - "schoolClothMasks", "school50", "school0", "school50&ClothMasks", - "universities0", - "kiga50", "kiga0", - "leisure50", "leisure0", "leisureCurfew19-6", "leisureCurfew21-6", "leisureCurfew23-6", "leisure50&Curfew19-6", "leisure50&Curfew21-6", "leisure50&Curfew23-6", - "shop50", "shop0", - "errands50", "errands0", - "visit50", "visit0", - "educ_other50", "educ_other0", - "work75", "work50", "work25", "work0", "workN95Masks"}) - public String restriction; - - @StringParameter({"outOfHomeExceptEdu59", "outOfHomeExceptEdu84"}) - public String lockdown; - - } - - -} diff --git a/src/main/java/org/matsim/run/batch/BerlinOutOfSample.java b/src/main/java/org/matsim/run/batch/BerlinOutOfSample.java deleted file mode 100644 index e1839eb0e..000000000 --- a/src/main/java/org/matsim/run/batch/BerlinOutOfSample.java +++ /dev/null @@ -1,250 +0,0 @@ -package org.matsim.run.batch; - -import com.google.inject.AbstractModule; -import org.matsim.core.config.Config; -import org.matsim.core.config.ConfigUtils; -import org.matsim.episim.BatchRun; -import org.matsim.episim.EpisimConfigGroup; -import org.matsim.episim.EpisimUtils; -import org.matsim.episim.TestingConfigGroup; -import org.matsim.episim.VaccinationConfigGroup; -import org.matsim.episim.VirusStrainConfigGroup; -import org.matsim.episim.model.FaceMask; -import org.matsim.episim.model.VirusStrain; -import org.matsim.episim.policy.FixedPolicy; -import org.matsim.episim.policy.FixedPolicy.ConfigBuilder; -import org.matsim.episim.policy.Restriction; -import org.matsim.run.RunParallel; -import org.matsim.run.modules.AbstractSnzScenario2020; -import org.matsim.run.modules.SnzBerlinProductionScenario; - - -import javax.annotation.Nullable; - -import java.io.IOException; -import java.time.LocalDate; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.NavigableMap; - - -/** - * Calibrated until 31.08.20, then prognosis - */ -public class BerlinOutOfSample implements BatchRun { - - @Override - public AbstractModule getBindings(int id, @Nullable Params params) { - return new SnzBerlinProductionScenario.Builder().createSnzBerlinProductionScenario(); - } - - @Override - public Metadata getMetadata() { - return Metadata.of("berlin", "basePaper"); - } - -// @Override -// public int getOffset() { -// return 10000; -// } - - @Override - public Config prepareConfig(int id, Params params) { - - double theta = 0.0; - double activityLevel = 0.0; - double temp1 = 17.5; - String weatherData = "berlinWeather_until20210504.csv"; - SnzBerlinProductionScenario.Masks masks = SnzBerlinProductionScenario.Masks.yes; - SnzBerlinProductionScenario.WeatherModel weatherModel = SnzBerlinProductionScenario.WeatherModel.midpoints_175_250; - - - if (params.run.equals("base")) { - if (params.calibrationUntil.equals("2020-09-01")) theta = 1.3242211858016036e-05; - else if (params.calibrationUntil.equals("2020-08-01")) theta = 1.3003752011694416e-05; - else if (params.calibrationUntil.equals("2020-07-01")) theta = 1.29446361732609e-05; - else if (params.calibrationUntil.equals("2020-06-01")) theta = 1.2681910406410474e-05; - else if (params.calibrationUntil.equals("2020-05-01")) theta = 1.2046242402811963e-05; - else throw new RuntimeException(); - } - else if (params.run.equals("noMasks")) { - masks = SnzBerlinProductionScenario.Masks.no; - if (params.calibrationUntil.equals("2020-09-01")) theta = 1.2487267512614e-05; - else if (params.calibrationUntil.equals("2020-08-01")) theta = 1.2616952113320623e-05; - else if (params.calibrationUntil.equals("2020-07-01")) theta = 1.2729541370386845e-05; - else if (params.calibrationUntil.equals("2020-06-01")) theta = 1.2740569081654608e-05; - else if (params.calibrationUntil.equals("2020-05-01")) theta = 1.2716360988066567e-05; - else throw new RuntimeException(); - - } - else if (params.run.equals("weather-20-25")) { - weatherModel = SnzBerlinProductionScenario.WeatherModel.midpoints_200_250; - temp1 = 20.; - if (params.calibrationUntil.equals("2020-09-01")) theta = 1.1690737081348964e-05; - else if (params.calibrationUntil.equals("2020-08-01")) theta = 1.1763819344130063e-05; - else if (params.calibrationUntil.equals("2020-07-01")) theta = 1.1706179791488293e-05; - else if (params.calibrationUntil.equals("2020-06-01")) theta = 1.1780172463353952e-05; - else if (params.calibrationUntil.equals("2020-05-01")) theta = 1.1101742134854978e-05; - else throw new RuntimeException(); - } - - else throw new RuntimeException(); - - - SnzBerlinProductionScenario module = new SnzBerlinProductionScenario.Builder() - .setMasks(masks) - .setWeatherModel(weatherModel) - .createSnzBerlinProductionScenario(); - Config config = module.config(); - - config.global().setRandomSeed(params.seed); - - EpisimConfigGroup episimConfig = ConfigUtils.addOrGetModule(config, EpisimConfigGroup.class); - - if (params.calibrationUntil.equals("2020-09-01")) { - activityLevel = 0.96; - weatherData = "berlinWeather_until20200831.csv"; - } - else if (params.calibrationUntil.equals("2020-08-01")) { - activityLevel = 0.90; - weatherData = "berlinWeather_until20200731.csv"; - } - else if (params.calibrationUntil.equals("2020-07-01")) { - activityLevel = 0.90; - weatherData = "berlinWeather_until20200630.csv"; - } - else if (params.calibrationUntil.equals("2020-06-01")) { - activityLevel = 0.88; - weatherData = "berlinWeather_until20200531.csv"; - } - else if (params.calibrationUntil.equals("2020-05-01")) { - activityLevel = 0.71; - weatherData = "berlinWeather_until20200430.csv"; - } - else throw new RuntimeException(); - - if (params.avgTemperatures.equals("no")) weatherData = "berlinWeather_until20210504.csv"; - - - episimConfig.setCalibrationParameter(theta); - - ConfigBuilder builder = FixedPolicy.parse(episimConfig.getPolicy()); - - LocalDate calibrationUntil = LocalDate.parse(params.calibrationUntil); - - - if (params.activityLevel.equals("frozen")) { - for (String act : AbstractSnzScenario2020.DEFAULT_ACTIVITIES) { - if (act.startsWith("edu")) continue; - builder.clearAfter(params.calibrationUntil, act); - builder.restrict(calibrationUntil, activityLevel, act); - } - - if (calibrationUntil.equals(LocalDate.parse("2020-05-01")) || calibrationUntil.equals(LocalDate.parse("2020-06-01"))) { - builder.restrict("2020-06-28", activityLevel, "work", "business"); - builder.restrict("2020-07-05", activityLevel, "work", "business"); - builder.restrict("2020-07-12", activityLevel, "work", "business"); - builder.restrict("2020-07-19", activityLevel, "work", "business"); - builder.restrict("2020-07-26", activityLevel, "work", "business"); - builder.restrict("2020-08-02", activityLevel, "work", "business"); - builder.restrict("2020-08-09", activityLevel, "work", "business"); - builder.apply("2020-06-26", "2020-08-07", (d, e) -> e.put("fraction", 0.83 * (double) e.get("fraction")), "work", "business"); - } - - if (calibrationUntil.equals(LocalDate.parse("2020-07-01"))) { - builder.restrict("2020-07-05", activityLevel, "work", "business"); - builder.restrict("2020-07-12", activityLevel, "work", "business"); - builder.restrict("2020-07-19", activityLevel, "work", "business"); - builder.restrict("2020-07-26", activityLevel, "work", "business"); - builder.restrict("2020-08-02", activityLevel, "work", "business"); - builder.restrict("2020-08-09", activityLevel, "work", "business"); - builder.apply("2020-07-01", "2020-08-07", (d, e) -> e.put("fraction", 0.92 * (double) e.get("fraction")), "work", "business"); - } - - if (calibrationUntil.equals(LocalDate.parse("2020-08-01"))) { - builder.restrict("2020-08-02", activityLevel, "work", "business"); - builder.restrict("2020-08-09", activityLevel, "work", "business"); - builder.apply("2020-08-01", "2020-08-07", (d, e) -> e.put("fraction", 0.92 * (double) e.get("fraction")), "work", "business"); - } - - builder.restrict("2020-10-11", activityLevel, "work", "business"); - builder.restrict("2020-10-18", activityLevel, "work", "business"); - builder.restrict("2020-10-25", activityLevel, "work", "business"); - builder.apply("2020-10-09", "2020-10-23", (d, e) -> e.put("fraction", 0.83 * (double) e.get("fraction")), "work", "business"); - - } - - - episimConfig.setPolicy(FixedPolicy.class, builder.build()); - - if (!params.diseaseImport.equals("real")) { - Map diseaseImport = episimConfig.getInfections_pers_per_day().get(VirusStrain.SARS_CoV_2); - Map diseaseImportNew = new HashMap(); - - - for (Entry e : diseaseImport.entrySet()) { - if (e.getKey().isBefore(calibrationUntil)) - diseaseImportNew.put(e.getKey(), e.getValue()); - } - -// if (calibrationUntil.isBefore(LocalDate.parse("2020-06-15"))) - if (params.diseaseImport.equals("1")) { - diseaseImportNew.put(calibrationUntil, 1); - } - - episimConfig.setInfections_pers_per_day(diseaseImportNew); - } - - - try { - Map outdoorFractions = EpisimUtils.getOutdoorFractions2(SnzBerlinProductionScenario.INPUT.resolve(weatherData).toFile(), - SnzBerlinProductionScenario.INPUT.resolve("berlinWeatherAvg2000-2020.csv").toFile(), 0.5, temp1, 25., 5. ); - episimConfig.setLeisureOutdoorFraction(outdoorFractions); - } catch (IOException e) { - e.printStackTrace(); - } - - return config; - } - - public static final class Params { - - @GenerateSeeds(30) - public long seed; - - @StringParameter({"base", "noMasks", "weather-20-25"}) - String run; - - @StringParameter({"real", "frozen"}) - String activityLevel; - - @StringParameter({"2020-09-01", "2020-08-01", "2020-07-01", "2020-06-01", "2020-05-01"}) - String calibrationUntil; - -// @StringParameter({"frozen", "1", "real"}) - @StringParameter({"1", "real"}) - String diseaseImport; - - @StringParameter({"yes", "no"}) - String avgTemperatures; - - } - - public static void main(String[] args) { - String[] args2 = { - RunParallel.OPTION_SETUP, BerlinOutOfSample.class.getName(), - RunParallel.OPTION_PARAMS, Params.class.getName(), - RunParallel.OPTION_TASKS, Integer.toString(1), - RunParallel.OPTION_ITERATIONS, Integer.toString(500), - RunParallel.OPTION_METADATA - }; - - RunParallel.main(args2); - } - - -} - diff --git a/src/main/java/org/matsim/run/batch/BerlinPaperInterventions.java b/src/main/java/org/matsim/run/batch/BerlinPaperInterventions.java deleted file mode 100644 index 6205db390..000000000 --- a/src/main/java/org/matsim/run/batch/BerlinPaperInterventions.java +++ /dev/null @@ -1,190 +0,0 @@ -package org.matsim.run.batch; - -import com.google.inject.AbstractModule; -import org.matsim.core.config.Config; -import org.matsim.core.config.ConfigUtils; -import org.matsim.episim.BatchRun; -import org.matsim.episim.EpisimConfigGroup; -import org.matsim.episim.model.FaceMask; -import org.matsim.episim.policy.FixedPolicy; -import org.matsim.episim.policy.FixedPolicy.ConfigBuilder; -import org.matsim.episim.policy.Restriction; -import org.matsim.run.modules.SnzBerlinProductionScenario; -import org.matsim.run.modules.SnzProductionScenario.*; - -import javax.annotation.Nullable; -import java.util.ArrayList; - - -/** - * Runs for symmetric Berlin week model - */ -public class BerlinPaperInterventions implements BatchRun { - - @Override - public AbstractModule getBindings(int id, @Nullable Params params) { - - if (params == null) return new SnzBerlinProductionScenario.Builder().createSnzBerlinProductionScenario(); - - return getModule(params); - } - - @Override - public Metadata getMetadata() { - return Metadata.of("berlin", "basePaperInterventions"); - } - -// @Override -// public int getOffset() { -// return 1000; -// } - - @Override - public Config prepareConfig(int id, Params params) { - - SnzBerlinProductionScenario module = getModule(params); - Config config = module.config(); - config.global().setRandomSeed(params.seed); - - EpisimConfigGroup episimConfig = ConfigUtils.addOrGetModule(config, EpisimConfigGroup.class); - - episimConfig.setCalibrationParameter(1.7E-5 * params.thetaFactor); - - ConfigBuilder builder = FixedPolicy.parse(episimConfig.getPolicy()); - - String restrictionDate = "2020-04-01"; - ArrayList acts = new ArrayList<>(); - - switch (params.restrictedAct) { - case "home": - acts.add("home"); - break; - case "work_business": - acts.add("work"); - acts.add("business"); - break; - case "schools": - acts.add("educ_primary"); - acts.add("educ_secondary"); - acts.add("educ_tertiary"); - acts.add("educ_other"); - break; - case "shop_errands": - acts.add("errands"); - acts.add("shop_other"); - acts.add("shop_daily"); - break; - case "leisure": - acts.add("leisure"); - break; - case "publicTransport": - acts.add("pt"); - break; - case "university": - acts.add("educ_higher"); - break; - case "dayCare": - acts.add("educ_kiga"); - break; - default: - throw new IllegalArgumentException("Unknown restrictedAct: " + params.restrictedAct); - } - - switch (params.restriction) { - case "75pct": - for (String act : acts) builder.restrict(restrictionDate, 0.75, act); - break; - case "50pct": - for (String act : acts) builder.restrict(restrictionDate, 0.5, act); - break; - case "90pctN95Masks": - for (String act : acts) builder.restrict(restrictionDate, Restriction.ofMask(FaceMask.N95, 0.9), act); - break; - case "90pctClothMasks": - for (String act : acts) builder.restrict(restrictionDate, Restriction.ofMask(FaceMask.CLOTH, 0.9), act); - break; - default: - throw new IllegalArgumentException("Unknown restriction: " + params.restriction); - } - - episimConfig.setPolicy(FixedPolicy.class, builder.build()); - - return config; - } - - private SnzBerlinProductionScenario getModule(Params params) { - DiseaseImport diseaseImport = DiseaseImport.no; - Restrictions restrictions = Restrictions.no; - Masks masks = Masks.no; - Tracing tracing = Tracing.no; - ChristmasModel christmasModel = ChristmasModel.no; - WeatherModel weatherModel = WeatherModel.no; - - if (params.run.contains("2_withSpringImport")) { - diseaseImport = DiseaseImport.onlySpring; - } - if (params.run.contains("3_withRestrictions")) { - diseaseImport = DiseaseImport.onlySpring; - restrictions = Restrictions.yes; - } - if (params.run.contains("4_withWeatherModel_175_175")) { - diseaseImport = DiseaseImport.onlySpring; - restrictions = Restrictions.yes; - weatherModel = WeatherModel.midpoints_175_175; - } - if (params.run.contains("5_withWeatherModel_175_250")) { - diseaseImport = DiseaseImport.onlySpring; - restrictions = Restrictions.yes; - weatherModel = WeatherModel.midpoints_175_250; - } - if (params.run.contains("6_withSummerImport")) { - diseaseImport = DiseaseImport.yes; - restrictions = Restrictions.yes; - weatherModel = WeatherModel.midpoints_175_250; - } - - if (params.withMasks.contains("yes")) { - masks = Masks.yes; - } - if (params.withTracing.contains("yes")) { - tracing = Tracing.yes; - } - - SnzBerlinProductionScenario module = new SnzBerlinProductionScenario.Builder().setDiseaseImport( diseaseImport ).setRestrictions( restrictions ).setMasks( masks ).setTracing( - tracing ).setChristmasModel(christmasModel).setWeatherModel(weatherModel).createSnzBerlinProductionScenario(); - return module; - } - - public static final class Params { - - @GenerateSeeds(10) - public long seed; - -// @Parameter({1.8E-5, 1.7E-5, 1.6E-5, 1.5E-5, 1.4E-5, 1.3E-5, 1.27E-5, 1.1E-5, 1.E-5}) -// double theta; - - @StringParameter({"1_base"}) - public String run; - - @StringParameter({"no"}) - public String withMasks; - - @StringParameter({"no"}) - public String withTracing; - - @StringParameter({"no"}) - public String withLeisureFactor; - - @StringParameter({"home", "work_business", "schools", "shop_errands", "leisure", "publicTransport", "university", "dayCare"}) - public String restrictedAct; - - @StringParameter({"75pct", "50pct", "90pctN95Masks", "90pctClothMasks"}) - public String restriction; - - @Parameter({0.6, 0.8, 1.0, 1.2}) - double thetaFactor; - - } - - -} diff --git a/src/main/java/org/matsim/run/batch/BerlinPercolation.java b/src/main/java/org/matsim/run/batch/BerlinPercolation.java deleted file mode 100644 index cc8f8f585..000000000 --- a/src/main/java/org/matsim/run/batch/BerlinPercolation.java +++ /dev/null @@ -1,214 +0,0 @@ -package org.matsim.run.batch; - -import com.google.inject.AbstractModule; -import com.google.inject.Module; -import com.google.inject.Provides; -import com.google.inject.Singleton; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; -import org.matsim.api.core.v01.Scenario; -import org.matsim.api.core.v01.population.Person; -import org.matsim.core.config.Config; -import org.matsim.core.config.ConfigUtils; -import org.matsim.episim.BatchRun; -import org.matsim.episim.EpisimConfigGroup; -import org.matsim.episim.TracingConfigGroup; -import org.matsim.episim.VaccinationConfigGroup; -import org.matsim.episim.model.*; -import org.matsim.episim.model.progression.AgeDependentDiseaseStatusTransitionModel; -import org.matsim.episim.model.progression.DiseaseStatusTransitionModel; -import org.matsim.episim.policy.FixedPolicy; -import org.matsim.run.RunParallel; -import org.matsim.run.modules.SnzBerlinProductionScenario; -import org.matsim.run.modules.SnzBerlinWeekScenario2020; - -import javax.annotation.Nullable; -import java.time.DayOfWeek; -import java.time.LocalDate; -import java.util.Map; -import java.util.SplittableRandom; - -import static org.matsim.episim.EpisimUtils.nextLogNormalFromMeanAndSigma; -import static org.matsim.episim.model.InfectionModelWithViralLoad.SUSCEPTIBILITY; -import static org.matsim.episim.model.InfectionModelWithViralLoad.VIRAL_LOAD; - -/** - * Percolation runs for berlin - */ -public class BerlinPercolation implements BatchRun { - - private static final Logger log = LogManager.getLogger(BerlinPercolation.class); - - @Override - public LocalDate getDefaultStartDate() { - return LocalDate.of(2021, 1, 3); - } - - @Override - public Metadata getMetadata() { - return Metadata.of("berlin", "percolation"); - } - - - @Nullable - @Override - public Module getBindings(int id, @Nullable Params params) { - /// TODO hardcoded now and needs to be adjusted before runs - /// XXX - return new Binding(Params.CURRENT, true); - } - - @Override - public Config prepareConfig(int id, Params params) { - - Config config = new Binding(params.contactModel, params.superSpreading).config(); - config.global().setRandomSeed(params.seed); - - EpisimConfigGroup episimConfig = ConfigUtils.addOrGetModule(config, EpisimConfigGroup.class); - TracingConfigGroup tracingConfig = ConfigUtils.addOrGetModule(config, TracingConfigGroup.class); - VaccinationConfigGroup vaccinationConfig = ConfigUtils.addOrGetModule(config, VaccinationConfigGroup.class); - - episimConfig.setWriteEvents(EpisimConfigGroup.WriteEvents.none); - - episimConfig.setStartDate(getDefaultStartDate()); - episimConfig.setInfections_pers_per_day(Map.of( - getDefaultStartDate(), 1 - )); - episimConfig.setInitialInfections(1); - episimConfig.setInitialInfectionDistrict(null); - - - if (params.contactModel.equals(Params.OLD)) { - - episimConfig.setCalibrationParameter(1.07e-5 * params.fraction); - - } else { - // adjust calib param - episimConfig.setCalibrationParameter(1.7E-5 * 0.8 * params.fraction); - } - - // no tracing and vaccinations - tracingConfig.setPutTraceablePersonsInQuarantineAfterDay(Integer.MAX_VALUE); - vaccinationConfig.setVaccinationCapacity_pers_per_day(Map.of(getDefaultStartDate(), 0)); - - - FixedPolicy.ConfigBuilder policy = FixedPolicy.parse(episimConfig.getPolicy()); - - // restriction fixed at beginning of january. - - policy.clearAfter(getDefaultStartDate().plusDays(1).toString()); - episimConfig.setPolicy(FixedPolicy.class, policy.build()); - - - return config; - } - - public static final class Params { - - private final static String OLD = "oldSymmetric"; - private final static String CURRENT = "symmetric"; - - @GenerateSeeds(value = 5000, seed = 6) - public long seed; - - public String contactModel = CURRENT; - public boolean superSpreading = true; - - @Parameter({0.8, 0.9, 1.0, 1.1, 1.2}) - //@Parameter({0.5, 0.55, 0.6, 0.65, 0.7}) - public double fraction; - - } - - /** - * Binding for this batch. Also needed for correct input files. - */ - private static final class Binding extends AbstractModule { - - private final AbstractModule delegate; - private final boolean superSpreading; - - public Binding(String contactModel, boolean superSpreading) { - - if (contactModel.equals(Params.OLD)) - delegate = new SnzBerlinWeekScenario2020(25, false, false, OldSymmetricContactModel.class); - else - delegate = new SnzBerlinProductionScenario.Builder() - .setSnapshot(SnzBerlinProductionScenario.Snapshot.no) - .setDiseaseImport(SnzBerlinProductionScenario.DiseaseImport.no) - .setRestrictions(SnzBerlinProductionScenario.Restrictions.yes) - .setTracing(SnzBerlinProductionScenario.Tracing.no) - .setWeatherModel(SnzBerlinProductionScenario.WeatherModel.no) - .setInfectionModel(DefaultInfectionModel.class) - .createSnzBerlinProductionScenario(); - - this.superSpreading = superSpreading; - } - - @Override - protected void configure() { - if (superSpreading) - bind(InfectionModel.class).to(InfectionModelWithViralLoad.class).in(Singleton.class); - else - bind(InfectionModel.class).to(DefaultInfectionModel.class).in(Singleton.class); - - if (delegate instanceof SnzBerlinWeekScenario2020) - bind(ContactModel.class).to(OldSymmetricContactModel.class).in(Singleton.class); - else - bind(ContactModel.class).to(SymmetricContactModel.class).in(Singleton.class); - - bind(DiseaseStatusTransitionModel.class).to(AgeDependentDiseaseStatusTransitionModel.class).in(Singleton.class); - } - - @Provides - @Singleton - public Config config() { - - Config config; - - if (delegate instanceof SnzBerlinWeekScenario2020) - config = ((SnzBerlinWeekScenario2020) delegate).config(); - else - config = ((SnzBerlinProductionScenario) delegate).config(); - - EpisimConfigGroup episimConfig = ConfigUtils.addOrGetModule(config, EpisimConfigGroup.class); - episimConfig.clearInputEventsFiles(); - episimConfig.addInputEventsFile(SnzBerlinProductionScenario.INPUT.resolve("be_2020-week_snz_episim_events_wt_25pt_split.xml.gz").toString()) - .addDays(DayOfWeek.MONDAY, DayOfWeek.TUESDAY, DayOfWeek.WEDNESDAY, DayOfWeek.THURSDAY, DayOfWeek.FRIDAY, DayOfWeek.SATURDAY, DayOfWeek.SUNDAY); - - return config; - } - - @Provides - @Singleton - public Scenario scenario(Config config) { - Scenario scenario; - if (delegate instanceof SnzBerlinWeekScenario2020) - scenario = ((SnzBerlinWeekScenario2020) delegate).scenario(config); - else - scenario = ((SnzBerlinProductionScenario) delegate).scenario(config); - - if (superSpreading) { - SplittableRandom rnd = new SplittableRandom(4715); - for (Person person : scenario.getPopulation().getPersons().values()) { - person.getAttributes().putAttribute(VIRAL_LOAD, nextLogNormalFromMeanAndSigma(rnd, 1, 1)); - person.getAttributes().putAttribute(SUSCEPTIBILITY, nextLogNormalFromMeanAndSigma(rnd, 1, 1)); - } - } - - return scenario; - } - - } - - public static void main(String[] args) { - String[] args2 = { - RunParallel.OPTION_SETUP, BerlinPercolation.class.getName(), - RunParallel.OPTION_PARAMS, BerlinPercolation.Params.class.getName(), - RunParallel.OPTION_TASKS, Integer.toString(2), - RunParallel.OPTION_ITERATIONS, Integer.toString(10000), - }; - - RunParallel.main(args2); - } -} diff --git a/src/main/java/org/matsim/run/batch/BerlinPublicTransport.java b/src/main/java/org/matsim/run/batch/BerlinPublicTransport.java deleted file mode 100644 index 0a42e0537..000000000 --- a/src/main/java/org/matsim/run/batch/BerlinPublicTransport.java +++ /dev/null @@ -1,69 +0,0 @@ -package org.matsim.run.batch; - -import com.google.inject.AbstractModule; -import org.matsim.core.config.Config; -import org.matsim.core.config.ConfigUtils; -import org.matsim.episim.BatchRun; -import org.matsim.episim.EpisimConfigGroup; -import org.matsim.episim.model.FaceMask; -import org.matsim.episim.policy.FixedPolicy; -import org.matsim.episim.policy.Restriction; -import org.matsim.run.modules.SnzBerlinWeekScenario2020; - -import javax.annotation.Nullable; -import java.time.LocalDate; - - -/** - * This batch run executes SnzBerlinWeekScenario25pct2020 with 100 seeds - */ -public class BerlinPublicTransport implements BatchRun { - - - @Override - public AbstractModule getBindings(int id, @Nullable Params params) { - return new SnzBerlinWeekScenario2020(); - } - - @Override - public Metadata getMetadata() { - return Metadata.of("berlin", "base"); - } - - @Override - public Config prepareConfig(int id, Params params) { - - SnzBerlinWeekScenario2020 module = new SnzBerlinWeekScenario2020(); - Config config = module.config(); - - EpisimConfigGroup episimConfig = ConfigUtils.addOrGetModule(config, EpisimConfigGroup.class); - episimConfig.setStartDate("2020-02-16"); -// TracingConfigGroup tracingConfig = ConfigUtils.addOrGetModule(config, TracingConfigGroup.class); - - config.global().setRandomSeed(params.seed); - FixedPolicy.ConfigBuilder builder = FixedPolicy.parse(episimConfig.getPolicy()); - builder.clearAfter("2020-04-01", "pt"); - int introductionPeriod = 14; - LocalDate masksCenterDate = LocalDate.of(2020, 4, 27); - for (int ii = 0; ii <= introductionPeriod; ii++) { - LocalDate date = masksCenterDate.plusDays(-introductionPeriod / 2 + ii); - builder.restrict(date, Restriction.ofMask(FaceMask.valueOf(params.maskType), params.maskCompliance * ii / introductionPeriod), "pt"); - } - episimConfig.setPolicy(FixedPolicy.class, builder.build()); - return config; - } - - public static final class Params { - - @GenerateSeeds(100) - long seed; - - @StringParameter({"CLOTH", "SURGICAL", "N95"}) - String maskType; - - @Parameter({0.0, 0.5, 0.9, 1.0}) - double maskCompliance; - - } - -} diff --git a/src/main/java/org/matsim/run/batch/BerlinQuarantine.java b/src/main/java/org/matsim/run/batch/BerlinQuarantine.java deleted file mode 100644 index 78d875564..000000000 --- a/src/main/java/org/matsim/run/batch/BerlinQuarantine.java +++ /dev/null @@ -1,67 +0,0 @@ -package org.matsim.run.batch; - -import com.google.inject.AbstractModule; - - -import org.matsim.core.config.Config; -import org.matsim.core.config.ConfigUtils; -import org.matsim.episim.BatchRun; -import org.matsim.episim.TracingConfigGroup; -import org.matsim.episim.model.OldSymmetricContactModel; -import org.matsim.run.modules.SnzBerlinWeekScenario2020; - -import javax.annotation.Nullable; -import java.time.LocalDate; -import java.util.Map; - - -/** - * batch class - */ -public class BerlinQuarantine implements BatchRun { - - - @Override - public AbstractModule getBindings(int id, @Nullable Params params) { - return new SnzBerlinWeekScenario2020(25, true, true, OldSymmetricContactModel.class); - } - - @Override - public Metadata getMetadata() { - return Metadata.of("berlin", "quarantine"); - } - - @Override - public Config prepareConfig(int id, Params params) { - - SnzBerlinWeekScenario2020 module = new SnzBerlinWeekScenario2020(25, true, true, OldSymmetricContactModel.class); - Config config = module.config(); - config.global().setRandomSeed(params.seed); - - TracingConfigGroup tracingConfig = ConfigUtils.addOrGetModule(config, TracingConfigGroup.class); - - tracingConfig.setTracingDelay_days(params.tracingDelay); - - tracingConfig.setQuarantineRelease(TracingConfigGroup.QuarantineRelease.valueOf(params.quarantineRelease)); - - tracingConfig.setQuarantineDuration(Map.of(LocalDate.EPOCH, params.quarantineDuration)); - - return config; - } - - public static final class Params { - - @GenerateSeeds(10) - long seed; - - @StringParameter({"NON_SYMPTOMS" , "SUSCEPTIBLE"}) - public String quarantineRelease; - - @IntParameter({14, 10, 7, 5}) - private int quarantineDuration; - - @IntParameter({1, 2, 3}) - private int tracingDelay; - } - -} diff --git a/src/main/java/org/matsim/run/batch/BerlinSchoolClosureAndMasks.java b/src/main/java/org/matsim/run/batch/BerlinSchoolClosureAndMasks.java deleted file mode 100644 index 226974488..000000000 --- a/src/main/java/org/matsim/run/batch/BerlinSchoolClosureAndMasks.java +++ /dev/null @@ -1,152 +0,0 @@ -/*- - * #%L - * MATSim Episim - * %% - * Copyright (C) 2020 matsim-org - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - * #L% - */ -package org.matsim.run.batch; - -import org.matsim.core.config.Config; -import org.matsim.core.config.ConfigUtils; -import org.matsim.episim.BatchRun; -import org.matsim.episim.EpisimConfigGroup; -import org.matsim.episim.model.FaceMask; -import org.matsim.episim.policy.FixedPolicy; -import org.matsim.episim.policy.Restriction; -import org.matsim.run.modules.SnzBerlinScenario25pct2020; - -import java.time.LocalDate; -import java.util.List; - -/** - * Batch run for Berlin using different school closure timing and mask options. - */ -public final class BerlinSchoolClosureAndMasks implements BatchRun { - - public static final List