diff --git a/.idea/artifacts/SEIR_Simple_SMA_jar.xml b/.idea/artifacts/SEIR_Simple_SMA_jar.xml new file mode 100644 index 0000000000000000000000000000000000000000..8a46cc44084352bb523e8052c274cd5ea84c9637 --- /dev/null +++ b/.idea/artifacts/SEIR_Simple_SMA_jar.xml @@ -0,0 +1,13 @@ +<component name="ArtifactManager"> + <artifact type="jar" build-on-make="true" name="SEIR_Simple_SMA:jar"> + <output-path>$PROJECT_DIR$/out/artifacts/SEIR_Simple_SMA_jar</output-path> + <root id="archive" name="SEIR_Simple_SMA.jar"> + <element id="module-output" name="SEIR_Simple_SMA" /> + <element id="extracted-dir" path="$MAVEN_REPOSITORY$/com/fasterxml/jackson/core/jackson-databind/2.13.2.2/jackson-databind-2.13.2.2.jar" path-in-jar="/" /> + <element id="extracted-dir" path="$MAVEN_REPOSITORY$/com/fasterxml/jackson/dataformat/jackson-dataformat-yaml/2.13.2/jackson-dataformat-yaml-2.13.2.jar" path-in-jar="/" /> + <element id="extracted-dir" path="$MAVEN_REPOSITORY$/com/fasterxml/jackson/core/jackson-annotations/2.13.2/jackson-annotations-2.13.2.jar" path-in-jar="/" /> + <element id="extracted-dir" path="$MAVEN_REPOSITORY$/com/fasterxml/jackson/core/jackson-core/2.13.2/jackson-core-2.13.2.jar" path-in-jar="/" /> + <element id="extracted-dir" path="$MAVEN_REPOSITORY$/org/yaml/snakeyaml/1.30/snakeyaml-1.30.jar" path-in-jar="/" /> + </root> + </artifact> +</component> \ No newline at end of file diff --git a/.idea/artifacts/SMA_SEIR_jar.xml b/.idea/artifacts/SMA_SEIR_jar.xml deleted file mode 100644 index 9c200f562b02db76b7e257405c20e8b73e1ebfef..0000000000000000000000000000000000000000 --- a/.idea/artifacts/SMA_SEIR_jar.xml +++ /dev/null @@ -1,15 +0,0 @@ -<component name="ArtifactManager"> - <artifact build-on-make="true" name="SMA-SEIR:jar"> - <output-path>$PROJECT_DIR$/out/artifacts/SMA_SEIR_jar</output-path> - <root id="root"> - <element id="archive" name="SMA-SEIR.jar"> - <element id="module-output" name="SMA-SEIR" /> - </element> - <element id="library" level="project" name="Maven: com.fasterxml.jackson.core:jackson-core:2.13.2" /> - <element id="library" level="project" name="Maven: org.yaml:snakeyaml:1.30" /> - <element id="library" level="project" name="Maven: com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.13.2" /> - <element id="library" level="project" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.13.2" /> - <element id="library" level="project" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.13.2.2" /> - </root> - </artifact> -</component> \ No newline at end of file diff --git a/.idea/compiler.xml b/.idea/compiler.xml index 45711fc940a0175d5ba269a4abcd78349ac17dfc..9e93a7bdec5e7edb9280aac1640dc0fa41891115 100644 --- a/.idea/compiler.xml +++ b/.idea/compiler.xml @@ -7,6 +7,7 @@ <sourceTestOutputDir name="target/generated-test-sources/test-annotations" /> <outputRelativeToContentRoot value="true" /> <module name="SMA-SEIR" /> + <module name="SEIR_Simple_SMA" /> </profile> </annotationProcessing> </component> diff --git a/.idea/misc.xml b/.idea/misc.xml index 7908772a4b6749c735e4cee6d248876bba03b0fb..b37905cbee66b9e11bfc56f34e4576f2109fe859 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -17,4 +17,9 @@ <component name="ProjectType"> <option name="id" value="jpab" /> </component> + <component name="SwUserDefinedSpecifications"> + <option name="specTypeByUrl"> + <map /> + </option> + </component> </project> \ No newline at end of file diff --git a/outputToGraph.py b/outputToGraph.py index 89e82b86d651844c50812e4528b9915fd6d26f12..a39d9c8e1612ba3740a4ecb1014f52537b6a3b5d 100644 --- a/outputToGraph.py +++ b/outputToGraph.py @@ -4,7 +4,7 @@ import matplotlib.pyplot as plt OUTPUT_FILE_LOCATION = 'src/main/resources/output.csv' OUTPUT_FOLDER = 'src/main/resources/pythonOutput' -JAR_LOCATION = 'out/artifacts/SMA_SEIR_jar/SMA-SEIR.jar' +JAR_LOCATION = 'out/artifacts/SEIR_Simple_SMA_jar/SEIR_Simple_SMA.jar' YAML_FILE = 'src/main/resources/parameters.yaml' diff --git a/src/main/java/scheduler/DeterministScheduler.java b/src/main/java/scheduler/DeterministScheduler.java index 5197f9d2df70fa6cc7f350e53f95899b14026c65..0c243e9b5651516e7ce06a8e29b800c56d622451 100644 --- a/src/main/java/scheduler/DeterministScheduler.java +++ b/src/main/java/scheduler/DeterministScheduler.java @@ -6,14 +6,12 @@ import utils.YamlReader; import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; -import java.util.Arrays; -import java.util.EmptyStackException; -import java.util.Stack; +import java.util.*; public class DeterministScheduler implements Scheduler { private Wakeable[] agents; - private final Stack<String> wakeUpOrder = new Stack<>(); + private final Queue<String> wakeUpOrder = new LinkedList<>(); public DeterministScheduler(String csvFile) { readCSV(csvFile); @@ -36,9 +34,9 @@ public class DeterministScheduler implements Scheduler { @Override public void doNextCycle() { - for (int i = 0 ; i<agents.length-1; i++) { + for (int i = 0 ; i<agents.length; i++) { try { - int next = Integer.parseInt(wakeUpOrder.pop()); + int next = Integer.parseInt(wakeUpOrder.poll()); agents[next-(int)YamlReader.getParams().seed()].wakeUp(); } catch (EmptyStackException e) { System.err.println("Last record entry was read, simulation cannot continue further."); diff --git a/src/main/java/sma/SEIRS_SMA.java b/src/main/java/sma/SEIRS_SMA.java index 5800ced539d566aafb8b40756bf1cff42e060c2d..d6352a8bf78e53fb5af22d12a89dfb81fe6063d1 100644 --- a/src/main/java/sma/SEIRS_SMA.java +++ b/src/main/java/sma/SEIRS_SMA.java @@ -153,8 +153,7 @@ public class SEIRS_SMA extends Randomized implements SMA{ BufferedWriter bw = new BufferedWriter(fw); List<String> executionOrder= environment.getExecutionOrder(); - - for (int i = 0; i < executionOrder.size()-2; i++) { + for (int i = 0; i < executionOrder.size()-1; i++) { bw.write(executionOrder.get(i)+","); } bw.write(executionOrder.get(executionOrder.size()-1)); diff --git a/src/main/resources/META-INF/MANIFEST.MF b/src/main/resources/META-INF/MANIFEST.MF index 3d7eb17a3d3c8de4d3a643342aa15ad64b891abf..2af572db73ecf111750bae8f4d5a884cc5551958 100644 --- a/src/main/resources/META-INF/MANIFEST.MF +++ b/src/main/resources/META-INF/MANIFEST.MF @@ -1,5 +1,3 @@ Manifest-Version: 1.0 -Class-Path: jackson-core-2.13.2.jar snakeyaml-1.30.jar jackson-dataforma - t-yaml-2.13.2.jar jackson-annotations-2.13.2.jar jackson-databind-2.13. - 2.2.jar Main-Class: sma.SEIRS_SMA + diff --git a/src/main/resources/output.png b/src/main/resources/output.png index 5ee4b6be7bf3b0c2de6d0a9bae476cc58ccbdfa0..1d20c171776fa6ac52b3a67ff3a37291c362c6b2 100644 Binary files a/src/main/resources/output.png and b/src/main/resources/output.png differ