diff --git a/.github/dependabot.yml b/.github/dependabot.yml
new file mode 100644
index 000000000..5ac9f4dee
--- /dev/null
+++ b/.github/dependabot.yml
@@ -0,0 +1,30 @@
+# To get started with Dependabot version updates, you'll need to specify which
+# package ecosystems to update and where the package manifests are located.
+# Please see the documentation for all configuration options:
+# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
+
+version: 2
+updates:
+ - package-ecosystem: "maven" # See documentation for possible values
+ directory: "/" # Location of package manifests
+ schedule:
+ interval: "daily"
+ target-branch: "dev"
+ open-pull-requests-limit: 10
+ groups:
+ standard-plugins:
+ patterns:
+ - "org.codehaus.mojo:flatten-maven-plugin"
+ - "org.apache.maven.plugins*"
+ deploy-plugins:
+ patterns:
+ - "org.sonatype.central"
+ dependencies:
+ patterns:
+ - "org.apache.commons:commons-math3"
+ - "net.jcip:jcip-annotations"
+ - "gov.hhs.aspr.ms.util"
+ test-dependencies:
+ patterns:
+ - "org.jacoco*"
+ - "org.junit.jupiter*"
diff --git a/.github/workflows/release_build.yml b/.github/workflows/release_build.yml
index 4f4c16445..0ce262cad 100644
--- a/.github/workflows/release_build.yml
+++ b/.github/workflows/release_build.yml
@@ -31,9 +31,9 @@ jobs:
distribution: 'temurin'
- name: Build GCM
- run: mvn clean install -Prelease --file pom.xml
+ run: mvn clean install -Pjavadoc --file pom.xml
- - name: Get Version
+ - name: Get GCM Version
run: |
echo "version=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout --file pom.xml)" >> "$GITHUB_ENV"
diff --git a/.github/workflows/release_pr_build.yml b/.github/workflows/release_pr_build.yml
index 607679e56..f7c4478be 100644
--- a/.github/workflows/release_pr_build.yml
+++ b/.github/workflows/release_pr_build.yml
@@ -25,19 +25,19 @@ jobs:
java-version: '17'
distribution: 'temurin'
- - name: Get Version
+ - name: Get GCM Version
run: |
echo "version=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout --file pom.xml)" >> "$GITHUB_ENV"
- name: Version Is Snapshot
if: ${{ endsWith(env.version, 'SNAPSHOT') }}
run: |
- echo "::error Version is a SNAPSHOT. Update version to proper version."
+ echo "Version is a SNAPSHOT version. Update version to proper version."
exit 1
- name: Build GCM
- run: mvn clean install -Prelease --file pom.xml
-
+ run: mvn clean install -Pjavadoc,jacoco --file pom.xml
+
# Optional: Uploads the full dependency graph to GitHub to improve the quality of Dependabot alerts this repository can receive
# - name: Update dependency graph
# uses: advanced-security/maven-dependency-submission-action@571e99aab1055c2e71a1e2309b9691de18d6b7d6
diff --git a/demos/gcm-taskit/.gitignore b/demos/gcm-taskit/.gitignore
deleted file mode 100644
index b554593a2..000000000
--- a/demos/gcm-taskit/.gitignore
+++ /dev/null
@@ -1,327 +0,0 @@
-###################################
-# START Custom
-###################################
-
-.classpath
-.project
-.idea
-
-# Specifically for intelliJ. Duplicative with part of the intelliJ section, but not a full replacement
-.idea/
-*.iml
-
-###################################
-# END Custom
-###################################
-
-###################################
-# START Java
-# https://github.com/github/gitignore/blob/master/Java.gitignore
-###################################
-
-# Compiled class file
-*.class
-
-# Log file
-*.log
-
-# BlueJ files
-*.ctxt
-
-# Mobile Tools for Java (J2ME)
-.mtj.tmp/
-
-# Package Files #
-*.jar
-*.war
-*.ear
-*.zip
-*.tar.gz
-*.rar
-
-# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
-hs_err_pid*
-
-###################################
-# END Java
-###################################
-
-###################################
-# START R
-# https://github.com/github/gitignore/blob/master/R.gitignore
-###################################
-
-# History files
-.Rhistory
-.Rapp.history
-
-# Session Data files
-.RData
-
-# Example code in package build process
-*-Ex.R
-
-# Output files from R CMD build
-/*.tar.gz
-
-# Output files from R CMD check
-/*.Rcheck/
-
-# RStudio files
-.Rproj.user/
-
-# produced vignettes
-vignettes/*.html
-vignettes/*.pdf
-
-# OAuth2 token, see https://github.com/hadley/httr/releases/tag/v0.3
-.httr-oauth
-
-# knitr and R markdown default cache directories
-/*_cache/
-/cache/
-
-# Temporary files created by R markdown
-*.utf8.md
-*.knit.md
-
-###################################
-# END R
-###################################
-
-###################################
-# START Eclipse
-# https://github.com/github/gitignore/blob/master/Global/Eclipse.gitignore
-###################################
-
-.metadata
-bin/
-tmp/
-*.tmp
-*.bak
-*.swp
-*~.nib
-local.properties
-.settings/
-.loadpath
-.recommenders
-
-# External tool builders
-.externalToolBuilders/
-
-# Locally stored "Eclipse launch configurations"
-*.launch
-
-# PyDev specific (Python IDE for Eclipse)
-*.pydevproject
-
-# CDT-specific (C/C++ Development Tooling)
-.cproject
-
-# Java annotation processor (APT)
-.factorypath
-
-# PDT-specific (PHP Development Tools)
-.buildpath
-
-# sbteclipse plugin
-.target
-
-# Tern plugin
-.tern-project
-
-# TeXlipse plugin
-.texlipse
-
-# STS (Spring Tool Suite)
-.springBeans
-
-# Code Recommenders
-.recommenders/
-
-# Scala IDE specific (Scala & Java development for Eclipse)
-.cache-main
-.scala_dependencies
-.worksheet
-
-###################################
-# END Eclipse
-###################################
-
-###################################
-# START JetBrains
-# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
-# https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
-# https://github.com/github/gitignore/blob/master/Global/JetBrains.gitignore
-###################################
-
-# User-specific stuff:
-.idea/**/workspace.xml
-.idea/**/tasks.xml
-.idea/dictionaries
-
-# Sensitive or high-churn files:
-.idea/**/dataSources/
-.idea/**/dataSources.ids
-.idea/**/dataSources.xml
-.idea/**/dataSources.local.xml
-.idea/**/sqlDataSources.xml
-.idea/**/dynamic.xml
-.idea/**/uiDesigner.xml
-
-# Gradle:
-.idea/**/gradle.xml
-.idea/**/libraries
-
-# CMake
-cmake-build-debug/
-
-# Mongo Explorer plugin:
-.idea/**/mongoSettings.xml
-
-## File-based project format:
-*.iws
-
-## Plugin-specific files:
-
-# IntelliJ
-out/
-
-# mpeltonen/sbt-idea plugin
-.idea_modules/
-
-# JIRA plugin
-atlassian-ide-plugin.xml
-
-# Cursive Clojure plugin
-.idea/replstate.xml
-
-# Crashlytics plugin (for Android Studio and IntelliJ)
-com_crashlytics_export_strings.xml
-crashlytics.properties
-crashlytics-build.properties
-fabric.properties
-
-###################################
-# END JetBrains
-###################################
-
-###################################
-# START Maven
-# https://github.com/github/gitignore/blob/master/Maven.gitignore
-###################################
-
-target/
-pom.xml.tag
-pom.xml.releaseBackup
-pom.xml.versionsBackup
-pom.xml.next
-release.properties
-dependency-reduced-pom.xml
-buildNumber.properties
-.mvn/timing.properties
-
-# Avoid ignoring Maven wrapper jar file (.jar files are usually ignored)
-!/.mvn/wrapper/maven-wrapper.jar
-
-###################################
-# END Maven
-###################################
-
-###################################
-# START Windows
-# https://github.com/github/gitignore/blob/master/Global/Windows.gitignore
-###################################
-
-# Windows thumbnail cache files
-Thumbs.db
-ehthumbs.db
-ehthumbs_vista.db
-
-# Dump file
-*.stackdump
-
-# Folder config file
-Desktop.ini
-
-# Recycle Bin used on file shares
-$RECYCLE.BIN/
-
-# Windows Installer files
-*.cab
-*.msi
-*.msm
-*.msp
-
-# Windows shortcuts
-*.lnk
-
-###################################
-# END Windows
-###################################
-
-###################################
-# START MS Office
-# https://github.com/github/gitignore/blob/master/Global/MicrosoftOffice.gitignore
-###################################
-
-*.tmp
-
-# Word temporary
-~$*.doc*
-
-# Excel temporary
-~$*.xls*
-
-# Excel Backup File
-*.xlk
-
-# PowerPoint temporary
-~$*.ppt*
-
-# Visio autosave temporary files
-*.~vsd*
-
-###################################
-# END MS Office
-###################################
-
-###################################
-# START MacOS
-# https://github.com/github/gitignore/blob/master/Global/macOS.gitignore
-###################################
-
-# General
-.DS_Store
-.AppleDouble
-.LSOverride
-
-# Icon must end with two \r
-Icon
-
-
-# Thumbnails
-._*
-
-# Files that might appear in the root of a volume
-.DocumentRevisions-V100
-.fseventsd
-.Spotlight-V100
-.TemporaryItems
-.Trashes
-.VolumeIcon.icns
-.com.apple.timemachine.donotpresent
-
-# Directories potentially created on remote AFP share
-.AppleDB
-.AppleDesktop
-Network Trash Folder
-Temporary Items
-.apdisk
-
-###################################
-# END MacOS
-###################################
-
-
-.vscode
\ No newline at end of file
diff --git a/demos/gcm-taskit/pom.xml b/demos/gcm-taskit/pom.xml
deleted file mode 100644
index 545a85129..000000000
--- a/demos/gcm-taskit/pom.xml
+++ /dev/null
@@ -1,126 +0,0 @@
-
-
- 4.0.0
-
-
- gov.hhs.aspr.ms.gcm.demos
- parent
- ${revision}
-
-
-
- gcm-taskit-demo
- GCM Serialization Demo
- Demonstrate serialization integration with simulation
-
-
-
- 1.7.0
- 3.3.0
- 1.3.0
- 0.6.1
- 1.3.2
- 3.2.1
-
-
- 2.6.3-SNAPSHOT
- 3.21.12
-
-
-
-
-
- gov.hhs.aspr.ms.gcm.taskit
- protobuf
- ${gcm-taskit.version}
-
-
-
-
-
-
-
- kr.motd.maven
- os-maven-plugin
- ${os-maven-plugin.version}
-
-
- initialize
-
- detect
-
-
-
-
-
-
- org.codehaus.mojo
- build-helper-maven-plugin
- ${build-helper-maven-plugin.version}
-
-
- generate-sources
-
- add-source
-
-
-
-
-
-
-
-
-
-
-
- org.xolstice.maven.plugins
- protobuf-maven-plugin
- ${protobuf-maven-plugin.version}
-
-
-
- compile
- test-compile
-
-
-
-
- com.google.protobuf:protoc:${protoc.version}:exe:${os.detected.classifier}
- ${project.basedir}/src/main/proto
-
-
-
-
- com.google.code.maven-replacer-plugin
- maven-replacer-plugin
- ${maven-replacer-plugin.version}
-
-
- prepare-package
-
- replace
-
-
-
-
-
- target/generated-sources/**/*.java
-
- true
-
- MULTILINE
-
-
-
- ^(@SuppressWarnings\(.*?\)\s+)?public final class
- @SuppressWarnings("all") public final class
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/demos/gcm-taskit/src/main/java/lesson/SerializationDemonstration.java b/demos/gcm-taskit/src/main/java/lesson/SerializationDemonstration.java
deleted file mode 100644
index 36cf498d5..000000000
--- a/demos/gcm-taskit/src/main/java/lesson/SerializationDemonstration.java
+++ /dev/null
@@ -1,438 +0,0 @@
-package lesson;
-
-import java.net.URISyntaxException;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.commons.math3.random.RandomGenerator;
-
-import gov.hhs.aspr.ms.gcm.nucleus.Dimension;
-import gov.hhs.aspr.ms.gcm.nucleus.Experiment;
-import gov.hhs.aspr.ms.gcm.nucleus.ExperimentContext;
-import gov.hhs.aspr.ms.gcm.nucleus.ExperimentParameterData;
-import gov.hhs.aspr.ms.gcm.nucleus.Plugin;
-import gov.hhs.aspr.ms.gcm.nucleus.PluginData;
-import gov.hhs.aspr.ms.gcm.nucleus.SimulationState;
-import gov.hhs.aspr.ms.gcm.nucleus.SimulationStateCollector;
-import gov.hhs.aspr.ms.gcm.plugins.globalproperties.GlobalPropertiesPlugin;
-import gov.hhs.aspr.ms.gcm.plugins.globalproperties.datamanagers.GlobalPropertiesPluginData;
-import gov.hhs.aspr.ms.gcm.plugins.globalproperties.support.GlobalPropertyDimension;
-import gov.hhs.aspr.ms.gcm.plugins.globalproperties.support.GlobalPropertyId;
-import gov.hhs.aspr.ms.gcm.plugins.people.PeoplePlugin;
-import gov.hhs.aspr.ms.gcm.plugins.people.datamanagers.PeoplePluginData;
-import gov.hhs.aspr.ms.gcm.plugins.personproperties.PersonPropertiesPlugin;
-import gov.hhs.aspr.ms.gcm.plugins.personproperties.datamanagers.PersonPropertiesPluginData;
-import gov.hhs.aspr.ms.gcm.plugins.properties.support.PropertyDefinition;
-import gov.hhs.aspr.ms.gcm.plugins.regions.RegionsPlugin;
-import gov.hhs.aspr.ms.gcm.plugins.regions.datamanagers.RegionsPluginData;
-import gov.hhs.aspr.ms.gcm.plugins.reports.ReportsPlugin;
-import gov.hhs.aspr.ms.gcm.plugins.reports.support.NIOReportItemHandler;
-import gov.hhs.aspr.ms.gcm.plugins.stochastics.StochasticsPlugin;
-import gov.hhs.aspr.ms.gcm.plugins.stochastics.datamanagers.StochasticsPluginData;
-import gov.hhs.aspr.ms.gcm.plugins.stochastics.support.WellState;
-import gov.hhs.aspr.ms.gcm.taskit.protobuf.nucleus.NucleusTranslator;
-import gov.hhs.aspr.ms.gcm.taskit.protobuf.plugins.globalproperties.GlobalPropertiesTranslator;
-import gov.hhs.aspr.ms.gcm.taskit.protobuf.plugins.globalproperties.data.input.GlobalPropertiesPluginDataInput;
-import gov.hhs.aspr.ms.gcm.taskit.protobuf.plugins.people.PeopleTranslator;
-import gov.hhs.aspr.ms.gcm.taskit.protobuf.plugins.people.data.input.PeoplePluginDataInput;
-import gov.hhs.aspr.ms.gcm.taskit.protobuf.plugins.personproperties.PersonPropertiesTranslator;
-import gov.hhs.aspr.ms.gcm.taskit.protobuf.plugins.properties.PropertiesTranslator;
-import gov.hhs.aspr.ms.gcm.taskit.protobuf.plugins.regions.RegionsTranslator;
-import gov.hhs.aspr.ms.gcm.taskit.protobuf.plugins.regions.data.input.RegionsPluginDataInput;
-import gov.hhs.aspr.ms.gcm.taskit.protobuf.plugins.reports.ReportsTranslator;
-import gov.hhs.aspr.ms.gcm.taskit.protobuf.plugins.stochastics.StochasticsTranslator;
-import gov.hhs.aspr.ms.taskit.core.TranslationController;
-import gov.hhs.aspr.ms.taskit.core.TranslationEngineType;
-import gov.hhs.aspr.ms.taskit.protobuf.ProtobufTranslationEngine;
-import gov.hhs.aspr.ms.util.random.RandomGeneratorProvider;
-import gov.hhs.aspr.ms.util.resourcehelper.ResourceHelper;
-import gov.hhs.aspr.ms.util.time.Stopwatch;
-import lesson.plugins.model.GlobalProperty;
-import lesson.plugins.model.ModelPlugin;
-import lesson.plugins.model.ModelReportLabel;
-import lesson.plugins.model.PersonProperty;
-import lesson.plugins.model.Region;
-
-public final class SerializationDemonstration {
-
- private final String personPropertiesOutputFileName = "personPropertiesOutput.json";
- private final String globalPropertiesOutputFileName = "globalPropertiesOutput.json";
- private final String regionsOutputFileName = "regionsOutput.json";
- private final String peopleOutputFileName = "peopleOutput.json";
- private final String stochasticsOutputFileName = "stochasticsOutput.json";
- private final String simStateOutputFileName = "simStateOutput.json";
- private final String peopleInputFileName = "/peopleInput.json";
- private final String regionsInputFileName = "/regionsInput.json";
- private final String globalPropertiesInputFileName = "/globalPropertiesInput.json";
-
- private final Path outputDirectory;
- private TranslationController writingTranslationController;
- private TranslationController readingTranslationController;
-
- // test
- private SerializationDemonstration(Path outputDirectory) {
- this.outputDirectory = outputDirectory;
-
- Path peopleInputPath;
- Path regionsInputPath;
- Path globalPropsInputPath;
-
- try {
- peopleInputPath = Paths.get(this.getClass().getResource(peopleInputFileName).toURI());
- regionsInputPath = Paths.get(this.getClass().getResource(regionsInputFileName).toURI());
- globalPropsInputPath = Paths.get(this.getClass().getResource(globalPropertiesInputFileName).toURI());
-
- this.readingTranslationController = TranslationController
- .builder()
- .addTranslationEngine(getTranslationEngine())
- .addInputFilePath(peopleInputPath,
- PeoplePluginDataInput.class, TranslationEngineType.PROTOBUF)
- .addInputFilePath(regionsInputPath,
- RegionsPluginDataInput.class, TranslationEngineType.PROTOBUF)
- .addInputFilePath(globalPropsInputPath,
- GlobalPropertiesPluginDataInput.class, TranslationEngineType.PROTOBUF)
- .build();
- } catch (URISyntaxException e) {
- e.printStackTrace();
- }
-
- }
-
- private ProtobufTranslationEngine getTranslationEngine() {
- return ProtobufTranslationEngine.builder()
- .addTranslator(PersonPropertiesTranslator.getTranslator())
- .addTranslator(GlobalPropertiesTranslator.getTranslator())
- .addTranslator(RegionsTranslator.getTranslator())
- .addTranslator(PeopleTranslator.getTranslator())
- .addTranslator(StochasticsTranslator.getTranslator())
- .addTranslator(PropertiesTranslator.getTranslator())
- .addTranslator(ReportsTranslator.getTranslator())
- .addTranslator(NucleusTranslator.getTranslator())
- .build();
- }
-
- private RandomGenerator randomGenerator = RandomGeneratorProvider.getRandomGenerator(524055747550937602L);
-
- private NIOReportItemHandler getNIOReportItemHandler() {
- return NIOReportItemHandler.builder()//
- .addReport(ModelReportLabel.PERSON_PROPERTY_REPORT, //
- outputDirectory.resolve("person_property_report.xls"))//
- .addReport(ModelReportLabel.VACCINATION, //
- outputDirectory.resolve("vaccination_report.xls"))//
- .build();
- }
-
- private Plugin getPeoplePlugin() {
- PeoplePluginData peoplePluginData = PeoplePluginData.builder().build();
- return PeoplePlugin.getPeoplePlugin(peoplePluginData);
- }
-
- private Plugin getRegionsPlugin() {
- RegionsPluginData.Builder regionsPluginDataBuilder = RegionsPluginData.builder();
-
- for (int i = 0; i < 5; i++) {
- regionsPluginDataBuilder.addRegion(new Region(i));
- }
- RegionsPluginData regionsPluginData = regionsPluginDataBuilder.build();
- return RegionsPlugin.builder().setRegionsPluginData(regionsPluginData).getRegionsPlugin();
- }
-
- private Plugin getPersonPropertiesPlugin() {
- PersonPropertiesPluginData.Builder builder = PersonPropertiesPluginData.builder();
- PropertyDefinition propertyDefinition = PropertyDefinition.builder()//
- .setType(Integer.class)//
- .setDefaultValue(0)//
- .build();
- builder.definePersonProperty(PersonProperty.EDUCATION_ATTEMPTS,
- propertyDefinition, 0.0, false);
- builder.definePersonProperty(PersonProperty.VACCINE_ATTEMPTS,
- propertyDefinition, 0.0, false);
-
- propertyDefinition = PropertyDefinition.builder()//
- .setType(Boolean.class)//
- .build();
- builder.definePersonProperty(PersonProperty.REFUSES_VACCINE,
- propertyDefinition, 0.0, false);
-
- propertyDefinition = PropertyDefinition.builder()//
- .setType(Boolean.class)//
- .setDefaultValue(false)//
- .build();
- builder.definePersonProperty(PersonProperty.VACCINATED, propertyDefinition, 0.0, false);
-
- PersonPropertiesPluginData personPropertiesPluginData = builder.build();
- return PersonPropertiesPlugin.builder().setPersonPropertiesPluginData(personPropertiesPluginData)
- .getPersonPropertyPlugin();
- }
-
- private Plugin getStochasticsPlugin() {
- StochasticsPluginData stochasticsPluginData = StochasticsPluginData.builder()//
-
- .setMainRNGState(WellState.builder().setSeed(randomGenerator.nextLong()).build())//
- .build();
-
- return StochasticsPlugin.getStochasticsPlugin(stochasticsPluginData);
- }
-
- private Dimension getGlobalPropertyDimension(GlobalPropertyId globalPropertyId, String header, double[] values) {
- GlobalPropertyDimension.Builder dimensionBuilder = GlobalPropertyDimension.builder();//
-
- dimensionBuilder.setGlobalPropertyId(globalPropertyId)
- .setAssignmentTime(0.0);
-
- for (Double val : values) {
- dimensionBuilder.addValue(val);
- }
- return dimensionBuilder.build();
- }
-
- private Dimension getVaccineRefusalProbabilityDimension() {
- double[] values = new double[] { 0.0, 0.25, 0.5, 0.75, 1.0 };
- return getGlobalPropertyDimension(GlobalProperty.VACCINE_REFUSAL_PROBABILITY,
- "intial_refusal_probability",
- values);
- }
-
- private Dimension getImmunityStartTimeDimension() {
- double[] values = new double[] { 120.0, 180.0 };
- return getGlobalPropertyDimension(GlobalProperty.IMMUNITY_START_TIME,
- "immunity_start_time", values);
- }
-
- private Dimension getImmunityProbabilityDimension() {
- double[] values = new double[] { 0.0, 0.1, 0.2, 0.5 };
- return getGlobalPropertyDimension(GlobalProperty.IMMUNITY_PROBABILITY,
- "immunity_probabilty", values);
- }
-
- private Dimension getVaccineAttemptIntervalDimension() {
- double[] values = new double[] { 30.0, 45.0, 60.0 };
-
- return getGlobalPropertyDimension(GlobalProperty.VACCINE_ATTEMPT_INTERVAL,
- "vaccine_atttempt_interval", values);
- }
-
- private Dimension getEducationAttemptIntervalDimension() {
- double[] values = new double[] { 30.0, 60.0, 180.0 };
- return getGlobalPropertyDimension(GlobalProperty.EDUCATION_ATTEMPT_INTERVAL,
- "education_attempt_interval",
- values);
- }
-
- private Dimension getEducationSuccessRatedimension() {
- double[] values = new double[] { 0.0, 0.1, 0.2 };
- return getGlobalPropertyDimension(GlobalProperty.EDUCATION_SUCCESS_RATE,
- "education_success_rate", values);
- }
-
- private Plugin getGlobalPropertiesPlugin() {
- GlobalPropertiesPluginData.Builder builder = GlobalPropertiesPluginData.builder();//
-
- PropertyDefinition propertyDefinition = PropertyDefinition.builder()//
- .setType(Double.class)//
- .setDefaultValue(0.0)//
- .setPropertyValueMutability(false)//
- .build();
-
- builder.defineGlobalProperty(GlobalProperty.IMMUNITY_START_TIME,
- propertyDefinition, 0.0);
- builder.defineGlobalProperty(GlobalProperty.VACCINE_ATTEMPT_INTERVAL,
- propertyDefinition, 0.0);
- builder.defineGlobalProperty(GlobalProperty.EDUCATION_ATTEMPT_INTERVAL,
- propertyDefinition, 0.0);
- builder.defineGlobalProperty(GlobalProperty.EDUCATION_SUCCESS_RATE,
- propertyDefinition, 0.0);
- builder.defineGlobalProperty(GlobalProperty.VACCINE_REFUSAL_PROBABILITY,
- propertyDefinition, 0.0);
- builder.defineGlobalProperty(GlobalProperty.IMMUNITY_PROBABILITY,
- propertyDefinition, 0.0);
-
- propertyDefinition = PropertyDefinition.builder()//
- .setType(Double.class)//
- .setDefaultValue(365.0)//
- .setPropertyValueMutability(false)//
- .build();
- builder.defineGlobalProperty(GlobalProperty.SIMULATION_DURATION,
- propertyDefinition, 0.0);
-
- propertyDefinition = PropertyDefinition.builder()//
- .setType(Integer.class)//
- .setDefaultValue(1000)//
- .setPropertyValueMutability(false)//
- .build();
-
- builder.defineGlobalProperty(GlobalProperty.POPULATION_SIZE,
- propertyDefinition, 0.0);
-
- GlobalPropertiesPluginData globalPropertiesPluginData = builder.build();
-
- return GlobalPropertiesPlugin.builder().setGlobalPropertiesPluginData(globalPropertiesPluginData)
- .getGlobalPropertiesPlugin();
- }
-
- private void execute() {
- /*
- * Create the people plugin filled with 1000 people
- */
- Plugin peoplePlugin = getPeoplePlugin();
-
- // Create the person properties plugin
- Plugin personPropertiesPlugin = getPersonPropertiesPlugin();
-
- /*
- * Create the region plugin 5 regions, each having a lat and lon and
- * assign the people to random regions.
- *
- */
- Plugin regionsPlugin = getRegionsPlugin();
-
- /*
- * Create the global properties plugin
- */
- Plugin globalPropertiesPlugin = getGlobalPropertiesPlugin();
-
- /*
- * create the stochastics plugin
- */
- Plugin stochasticsPlugin = getStochasticsPlugin();
-
- Stopwatch stopwatch = new Stopwatch();
-
- stopwatch.start();
-
- this.readingTranslationController.readInput();
-
- stopwatch.stop();
- System.out.println("Read input took: " + stopwatch.getElapsedMilliSeconds() + "ms");
-
- List pluginDatas = this.readingTranslationController.getObjects(PluginData.class);
-
- for (PluginData pluginData : pluginDatas) {
- if (pluginData instanceof PeoplePluginData) {
- peoplePlugin = PeoplePlugin.getPeoplePlugin((PeoplePluginData) pluginData);
- continue;
- }
- if (pluginData instanceof PersonPropertiesPluginData) {
- personPropertiesPlugin = PersonPropertiesPlugin.builder()
- .setPersonPropertiesPluginData((PersonPropertiesPluginData) pluginData)
- .getPersonPropertyPlugin();
- continue;
- }
-
- if (pluginData instanceof RegionsPluginData) {
- regionsPlugin = RegionsPlugin.builder().setRegionsPluginData((RegionsPluginData) pluginData)
- .getRegionsPlugin();
- continue;
- }
-
- if (pluginData instanceof GlobalPropertiesPluginData) {
- globalPropertiesPlugin = GlobalPropertiesPlugin.builder()
- .setGlobalPropertiesPluginData((GlobalPropertiesPluginData) pluginData)
- .getGlobalPropertiesPlugin();
- continue;
- }
-
- if (pluginData instanceof StochasticsPluginData) {
- stochasticsPlugin = StochasticsPlugin.getStochasticsPlugin((StochasticsPluginData) pluginData);
- continue;
- }
-
- }
-
- /*
- * Create the reports
- */
- NIOReportItemHandler nioReportItemHandler = getNIOReportItemHandler();
-
- Plugin modelPlugin = ModelPlugin.getModelPlugin();
-
- /*
- * Assemble and execute the experiment
- */
-
- Experiment.builder()//
-
- .addPlugin(personPropertiesPlugin)//
- .addPlugin(globalPropertiesPlugin)//
- .addPlugin(modelPlugin)//
- .addPlugin(regionsPlugin)//
- .addPlugin(peoplePlugin)//
- .addPlugin(stochasticsPlugin)//
- .addPlugin(ReportsPlugin.getReportsPlugin())
-
- .addDimension(getImmunityStartTimeDimension())//
- .addDimension(getImmunityProbabilityDimension())//
- .addDimension(getVaccineAttemptIntervalDimension())//
- .addDimension(getEducationAttemptIntervalDimension())//
- .addDimension(getEducationSuccessRatedimension())//
- .addDimension(getVaccineRefusalProbabilityDimension())//
- .addExperimentContextConsumer(nioReportItemHandler)//
- .setExperimentParameterData(ExperimentParameterData.builder()
- .setRecordState(true)
- .setSimulationHaltTime(10.0)
- .setThreadCount(8)
- .build())
- .addExperimentContextConsumer(new SimulationStateCollector(this::handleSimulationStateCollection,
- this::handleExperiementOpen))
- .build()//
- .execute();//
-
- }
-
- private void handleExperiementOpen(ExperimentContext experimentContext) {
-
- TranslationController.Builder translationControllerBuilder = TranslationController.builder();
-
- translationControllerBuilder.addTranslationEngine(this.getTranslationEngine());
-
- List scenarioIds = new ArrayList<>();
- for (int i = 0; i < experimentContext.getScenarioCount(); i++) {
- scenarioIds.add(i);
- }
-
- scenarioIds.parallelStream().forEach(scenarioId -> {
- Path scenarioOutputDir = this.outputDirectory.resolve("scenario_" + scenarioId);
- ResourceHelper.makeOutputDir(scenarioOutputDir);
-
- translationControllerBuilder
- .addOutputFilePath(scenarioOutputDir.resolve(personPropertiesOutputFileName),
- PersonPropertiesPluginData.class, scenarioId, TranslationEngineType.PROTOBUF)
- .addOutputFilePath(scenarioOutputDir.resolve(globalPropertiesOutputFileName),
- GlobalPropertiesPluginData.class, scenarioId, TranslationEngineType.PROTOBUF)
- .addOutputFilePath(scenarioOutputDir.resolve(regionsOutputFileName), RegionsPluginData.class,
- scenarioId, TranslationEngineType.PROTOBUF)
- .addOutputFilePath(scenarioOutputDir.resolve(peopleOutputFileName), PeoplePluginData.class,
- scenarioId, TranslationEngineType.PROTOBUF)
- .addOutputFilePath(scenarioOutputDir.resolve(stochasticsOutputFileName),
- StochasticsPluginData.class, scenarioId, TranslationEngineType.PROTOBUF)
- .addOutputFilePath(scenarioOutputDir.resolve(simStateOutputFileName), SimulationState.class,
- scenarioId, TranslationEngineType.PROTOBUF);
- });
-
- this.writingTranslationController = translationControllerBuilder.build();
- }
-
- private void handleSimulationStateCollection(Integer scenarioId, List