2.12.2021, 9:00 - 11:00: Due to updates GitLab may be unavailable for some minutes between 09:00 and 11:00.

Commit 3928a03f authored by Benedikt Kleinmeier's avatar Benedikt Kleinmeier
Browse files

Added boolean flag "useSalientBehavior" to "AttributesSimulation" and use it in "Simulation".

parent 790cd246
...@@ -98,7 +98,8 @@ ...@@ -98,7 +98,8 @@
"digitsPerCoordinate" : 2, "digitsPerCoordinate" : 2,
"useFixedSeed" : true, "useFixedSeed" : true,
"fixedSeed" : 6138355022448163583, "fixedSeed" : 6138355022448163583,
"simulationSeed" : 0 "simulationSeed" : 0,
"useSalientBehavior" : true
}, },
"topography" : { "topography" : {
"attributes" : { "attributes" : {
......
...@@ -98,7 +98,8 @@ ...@@ -98,7 +98,8 @@
"digitsPerCoordinate" : 2, "digitsPerCoordinate" : 2,
"useFixedSeed" : true, "useFixedSeed" : true,
"fixedSeed" : 6138355022448163583, "fixedSeed" : 6138355022448163583,
"simulationSeed" : 0 "simulationSeed" : 0,
"useSalientBehavior" : true
}, },
"topography" : { "topography" : {
"attributes" : { "attributes" : {
......
...@@ -98,7 +98,8 @@ ...@@ -98,7 +98,8 @@
"digitsPerCoordinate" : 2, "digitsPerCoordinate" : 2,
"useFixedSeed" : true, "useFixedSeed" : true,
"fixedSeed" : 6138355022448163583, "fixedSeed" : 6138355022448163583,
"simulationSeed" : 0 "simulationSeed" : 0,
"useSalientBehavior" : true
}, },
"topography" : { "topography" : {
"attributes" : { "attributes" : {
......
...@@ -98,7 +98,8 @@ ...@@ -98,7 +98,8 @@
"digitsPerCoordinate" : 2, "digitsPerCoordinate" : 2,
"useFixedSeed" : true, "useFixedSeed" : true,
"fixedSeed" : 6138355022448163583, "fixedSeed" : 6138355022448163583,
"simulationSeed" : 6138355022448163583 "simulationSeed" : 6138355022448163583,
"useSalientBehavior" : true
}, },
"topography" : { "topography" : {
"attributes" : { "attributes" : {
......
...@@ -322,7 +322,10 @@ public class Simulation { ...@@ -322,7 +322,10 @@ public class Simulation {
Collection<Pedestrian> pedestrians = topography.getElements(Pedestrian.class); Collection<Pedestrian> pedestrians = topography.getElements(Pedestrian.class);
eventCognition.prioritizeEventsForPedestrians(events, pedestrians); eventCognition.prioritizeEventsForPedestrians(events, pedestrians);
salientBehaviorCognition.setSalientBehaviorForPedestrians(pedestrians, simTimeInSec);
if (attributesSimulation.isUseSalientBehavior()) {
salientBehaviorCognition.setSalientBehaviorForPedestrians(pedestrians, simTimeInSec);
}
for (Model m : models) { for (Model m : models) {
List<SourceController> stillSpawningSource = this.sourceControllers.stream().filter(s -> !s.isSourceFinished(simTimeInSec)).collect(Collectors.toList()); List<SourceController> stillSpawningSource = this.sourceControllers.stream().filter(s -> !s.isSourceFinished(simTimeInSec)).collect(Collectors.toList());
......
...@@ -21,6 +21,8 @@ public class AttributesSimulation extends Attributes { ...@@ -21,6 +21,8 @@ public class AttributesSimulation extends Attributes {
private boolean useFixedSeed = true; private boolean useFixedSeed = true;
private long fixedSeed = new Random().nextLong(); private long fixedSeed = new Random().nextLong();
private long simulationSeed; private long simulationSeed;
/** Allows agent to change their behavior (e.g. from TARGET_ORIENTIED to COOPERATIVE if it is too dense) */
private boolean useSalientBehavior = false;
// Getter... // Getter...
...@@ -48,7 +50,6 @@ public class AttributesSimulation extends Attributes { ...@@ -48,7 +50,6 @@ public class AttributesSimulation extends Attributes {
return printFPS; return printFPS;
} }
public int getDigitsPerCoordinate() { public int getDigitsPerCoordinate() {
return digitsPerCoordinate; return digitsPerCoordinate;
} }
...@@ -65,6 +66,12 @@ public class AttributesSimulation extends Attributes { ...@@ -65,6 +66,12 @@ public class AttributesSimulation extends Attributes {
return simulationSeed; return simulationSeed;
} }
public boolean isUseSalientBehavior() {
return useSalientBehavior;
}
// Setters...
public void setFinishTime(double finishTime) { public void setFinishTime(double finishTime) {
checkSealed(); checkSealed();
this.finishTime = finishTime; this.finishTime = finishTime;
...@@ -116,6 +123,10 @@ public class AttributesSimulation extends Attributes { ...@@ -116,6 +123,10 @@ public class AttributesSimulation extends Attributes {
this.simulationSeed = simulationSeed; this.simulationSeed = simulationSeed;
} }
public void setUseSalientBehavior(boolean useSalientBehavior) {
this.useSalientBehavior = useSalientBehavior;
}
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {
if (this == o) return true; if (this == o) return true;
...@@ -130,12 +141,12 @@ public class AttributesSimulation extends Attributes { ...@@ -130,12 +141,12 @@ public class AttributesSimulation extends Attributes {
digitsPerCoordinate == that.digitsPerCoordinate && digitsPerCoordinate == that.digitsPerCoordinate &&
useFixedSeed == that.useFixedSeed && useFixedSeed == that.useFixedSeed &&
fixedSeed == that.fixedSeed && fixedSeed == that.fixedSeed &&
simulationSeed == that.simulationSeed; simulationSeed == that.simulationSeed &&
useSalientBehavior == that.useSalientBehavior;
} }
@Override @Override
public int hashCode() { public int hashCode() {
return Objects.hash(finishTime, simTimeStepLength, realTimeSimTimeRatio, writeSimulationData, visualizationEnabled, printFPS, digitsPerCoordinate, useFixedSeed, fixedSeed, simulationSeed, useSalientBehavior);
return Objects.hash(finishTime, simTimeStepLength, realTimeSimTimeRatio, writeSimulationData, visualizationEnabled, printFPS, digitsPerCoordinate, useFixedSeed, fixedSeed, simulationSeed);
} }
} }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment