Skip to content
Snippets Groups Projects
Commit 38002536 authored by AxelCarayon's avatar AxelCarayon
Browse files

fixed deterministic scheduler, now working as intended

parent d4754936
Branches
Tags 1.5.1
No related merge requests found
<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
<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
......@@ -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>
......
......@@ -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
......@@ -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'
......
......@@ -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.");
......
......@@ -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));
......
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
src/main/resources/output.png

61.8 KiB | W: | H:

src/main/resources/output.png

58.8 KiB | W: | H:

src/main/resources/output.png
src/main/resources/output.png
src/main/resources/output.png
src/main/resources/output.png
  • 2-up
  • Swipe
  • Onion skin
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment