10.12., 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

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

parent 790cd246
......@@ -98,7 +98,8 @@
"digitsPerCoordinate" : 2,
"useFixedSeed" : true,
"fixedSeed" : 6138355022448163583,
"simulationSeed" : 0
"simulationSeed" : 0,
"useSalientBehavior" : true
},
"topography" : {
"attributes" : {
......
......@@ -98,7 +98,8 @@
"digitsPerCoordinate" : 2,
"useFixedSeed" : true,
"fixedSeed" : 6138355022448163583,
"simulationSeed" : 0
"simulationSeed" : 0,
"useSalientBehavior" : true
},
"topography" : {
"attributes" : {
......
......@@ -98,7 +98,8 @@
"digitsPerCoordinate" : 2,
"useFixedSeed" : true,
"fixedSeed" : 6138355022448163583,
"simulationSeed" : 0
"simulationSeed" : 0,
"useSalientBehavior" : true
},
"topography" : {
"attributes" : {
......
......@@ -98,7 +98,8 @@
"digitsPerCoordinate" : 2,
"useFixedSeed" : true,
"fixedSeed" : 6138355022448163583,
"simulationSeed" : 6138355022448163583
"simulationSeed" : 6138355022448163583,
"useSalientBehavior" : true
},
"topography" : {
"attributes" : {
......
......@@ -322,7 +322,10 @@ public class Simulation {
Collection<Pedestrian> pedestrians = topography.getElements(Pedestrian.class);
eventCognition.prioritizeEventsForPedestrians(events, pedestrians);
salientBehaviorCognition.setSalientBehaviorForPedestrians(pedestrians, simTimeInSec);
if (attributesSimulation.isUseSalientBehavior()) {
salientBehaviorCognition.setSalientBehaviorForPedestrians(pedestrians, simTimeInSec);
}
for (Model m : models) {
List<SourceController> stillSpawningSource = this.sourceControllers.stream().filter(s -> !s.isSourceFinished(simTimeInSec)).collect(Collectors.toList());
......
......@@ -21,6 +21,8 @@ public class AttributesSimulation extends Attributes {
private boolean useFixedSeed = true;
private long fixedSeed = new Random().nextLong();
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...
......@@ -48,7 +50,6 @@ public class AttributesSimulation extends Attributes {
return printFPS;
}
public int getDigitsPerCoordinate() {
return digitsPerCoordinate;
}
......@@ -65,6 +66,12 @@ public class AttributesSimulation extends Attributes {
return simulationSeed;
}
public boolean isUseSalientBehavior() {
return useSalientBehavior;
}
// Setters...
public void setFinishTime(double finishTime) {
checkSealed();
this.finishTime = finishTime;
......@@ -116,6 +123,10 @@ public class AttributesSimulation extends Attributes {
this.simulationSeed = simulationSeed;
}
public void setUseSalientBehavior(boolean useSalientBehavior) {
this.useSalientBehavior = useSalientBehavior;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
......@@ -130,12 +141,12 @@ public class AttributesSimulation extends Attributes {
digitsPerCoordinate == that.digitsPerCoordinate &&
useFixedSeed == that.useFixedSeed &&
fixedSeed == that.fixedSeed &&
simulationSeed == that.simulationSeed;
simulationSeed == that.simulationSeed &&
useSalientBehavior == that.useSalientBehavior;
}
@Override
public int hashCode() {
return Objects.hash(finishTime, simTimeStepLength, realTimeSimTimeRatio, writeSimulationData, visualizationEnabled, printFPS, digitsPerCoordinate, useFixedSeed, fixedSeed, simulationSeed);
return Objects.hash(finishTime, simTimeStepLength, realTimeSimTimeRatio, writeSimulationData, visualizationEnabled, printFPS, digitsPerCoordinate, useFixedSeed, fixedSeed, simulationSeed, useSalientBehavior);
}
}
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