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

Commit 197b5cf9 authored by Benedikt Kleinmeier's avatar Benedikt Kleinmeier

Renamed enum "SocialCategory" to "SelfCategory" and renamed all dependent codeselfCategoryEnumName

parent a53f0162
...@@ -7,8 +7,7 @@ import org.vadere.gui.postvisualization.utils.PotentialFieldContainer; ...@@ -7,8 +7,7 @@ import org.vadere.gui.postvisualization.utils.PotentialFieldContainer;
import org.vadere.simulator.projects.Scenario; import org.vadere.simulator.projects.Scenario;
import org.vadere.state.attributes.AttributesSimulation; import org.vadere.state.attributes.AttributesSimulation;
import org.vadere.state.attributes.scenario.AttributesAgent; import org.vadere.state.attributes.scenario.AttributesAgent;
import org.vadere.state.psychology.cognition.SocialCategory; import org.vadere.state.psychology.cognition.SelfCategory;
import org.vadere.state.psychology.perception.types.Stimulus;
import org.vadere.state.psychology.perception.types.StimulusFactory; import org.vadere.state.psychology.perception.types.StimulusFactory;
import org.vadere.state.scenario.Agent; import org.vadere.state.scenario.Agent;
import org.vadere.state.scenario.Pedestrian; import org.vadere.state.scenario.Pedestrian;
...@@ -232,9 +231,9 @@ public class PostvisualizationModel extends SimulationModel<PostvisualizationCon ...@@ -232,9 +231,9 @@ public class PostvisualizationModel extends SimulationModel<PostvisualizationCon
pedestrian.setMostImportantStimulus(StimulusFactory.stringToStimulus(mostImportantStimulusString)); pedestrian.setMostImportantStimulus(StimulusFactory.stringToStimulus(mostImportantStimulusString));
} }
if(trajectories.socialCategoryCol != -1) { if(trajectories.selfCategoryCol != -1) {
String socialCategoryString = row.getString(trajectories.socialCategoryCol); String selfCategoryString = row.getString(trajectories.selfCategoryCol);
pedestrian.setSocialCategory(SocialCategory.valueOf(socialCategoryString)); pedestrian.setSelfCategory(SelfCategory.valueOf(selfCategoryString));
} }
return pedestrian; return pedestrian;
......
...@@ -6,7 +6,7 @@ import it.unimi.dsi.fastutil.ints.Int2IntMap; ...@@ -6,7 +6,7 @@ import it.unimi.dsi.fastutil.ints.Int2IntMap;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.vadere.simulator.projects.io.ColumnNames; import org.vadere.simulator.projects.io.ColumnNames;
import org.vadere.state.attributes.scenario.AttributesAgent; import org.vadere.state.attributes.scenario.AttributesAgent;
import org.vadere.state.psychology.cognition.SocialCategory; import org.vadere.state.psychology.cognition.SelfCategory;
import org.vadere.state.psychology.perception.types.Stimulus; import org.vadere.state.psychology.perception.types.Stimulus;
import org.vadere.state.psychology.perception.types.StimulusFactory; import org.vadere.state.psychology.perception.types.StimulusFactory;
import org.vadere.state.scenario.Agent; import org.vadere.state.scenario.Agent;
...@@ -55,7 +55,7 @@ public class TableTrajectoryFootStep { ...@@ -55,7 +55,7 @@ public class TableTrajectoryFootStep {
public final int groupSizeCol; public final int groupSizeCol;
public final int mostImportantStimulusCol; public final int mostImportantStimulusCol;
public final int socialCategoryCol; public final int selfCategoryCol;
public static final int agentDFPedIdCol = 0; public static final int agentDFPedIdCol = 0;
public static final int birthTimeCol = 1; public static final int birthTimeCol = 1;
...@@ -85,7 +85,7 @@ public class TableTrajectoryFootStep { ...@@ -85,7 +85,7 @@ public class TableTrajectoryFootStep {
groupIdCol = columnNames.getGroupIdCol(dataFrame); groupIdCol = columnNames.getGroupIdCol(dataFrame);
groupSizeCol = columnNames.getGroupSizeCol(dataFrame); groupSizeCol = columnNames.getGroupSizeCol(dataFrame);
mostImportantStimulusCol = columnNames.getMostImportantStimulusCol(dataFrame); mostImportantStimulusCol = columnNames.getMostImportantStimulusCol(dataFrame);
socialCategoryCol = columnNames.getSocialCategoryCol(dataFrame); selfCategoryCol = columnNames.getSelfCategoryCol(dataFrame);
this.trajectoryDataFrame = dataFrame; this.trajectoryDataFrame = dataFrame;
...@@ -143,10 +143,10 @@ public class TableTrajectoryFootStep { ...@@ -143,10 +143,10 @@ public class TableTrajectoryFootStep {
pedestrian.setMostImportantStimulus(stimulus); pedestrian.setMostImportantStimulus(stimulus);
} }
if(socialCategoryCol != ColumnNames.NOT_SET_COLUMN_INDEX_IDENTIFIER) { if(selfCategoryCol != ColumnNames.NOT_SET_COLUMN_INDEX_IDENTIFIER) {
String socialCategoryEnumName = row.getString(socialCategoryCol); String selfCategoryEnumName = row.getString(selfCategoryCol);
SocialCategory socialCategory = SocialCategory.valueOf(socialCategoryEnumName); SelfCategory selfCategory = SelfCategory.valueOf(selfCategoryEnumName);
pedestrian.setSocialCategory(socialCategory); pedestrian.setSelfCategory(selfCategory);
} }
return pedestrian; return pedestrian;
......
package org.vadere.simulator.control; package org.vadere.simulator.control;
import org.vadere.simulator.control.psychology.cognition.SelfCategoryProcessor;
import org.vadere.simulator.control.psychology.perception.StimulusProcessor; import org.vadere.simulator.control.psychology.perception.StimulusProcessor;
import org.vadere.simulator.control.psychology.cognition.SocialCategoryProcessor;
import org.vadere.simulator.control.psychology.perception.StimulusController; import org.vadere.simulator.control.psychology.perception.StimulusController;
import org.vadere.simulator.control.factory.SourceControllerFactory; import org.vadere.simulator.control.factory.SourceControllerFactory;
import org.vadere.simulator.models.DynamicElementFactory; import org.vadere.simulator.models.DynamicElementFactory;
...@@ -80,7 +80,7 @@ public class Simulation { ...@@ -80,7 +80,7 @@ public class Simulation {
private SimulationResult simulationResult; private SimulationResult simulationResult;
private final StimulusController stimulusController; private final StimulusController stimulusController;
private final StimulusProcessor stimulusProcessor; private final StimulusProcessor stimulusProcessor;
private final SocialCategoryProcessor socialCategoryProcessor; private final SelfCategoryProcessor selfCategoryProcessor;
private final ScenarioCache scenarioCache; private final ScenarioCache scenarioCache;
public Simulation(MainModel mainModel, double startTimeInSec, final String name, ScenarioStore scenarioStore, public Simulation(MainModel mainModel, double startTimeInSec, final String name, ScenarioStore scenarioStore,
...@@ -118,7 +118,7 @@ public class Simulation { ...@@ -118,7 +118,7 @@ public class Simulation {
// "stimulusController" is final. Therefore, create object here and not in helper method. // "stimulusController" is final. Therefore, create object here and not in helper method.
this.stimulusController = new StimulusController(scenarioStore); this.stimulusController = new StimulusController(scenarioStore);
this.stimulusProcessor = new StimulusProcessor(); this.stimulusProcessor = new StimulusProcessor();
this.socialCategoryProcessor = new SocialCategoryProcessor(topography); this.selfCategoryProcessor = new SelfCategoryProcessor(topography);
createControllers(topography, mainModel, random); createControllers(topography, mainModel, random);
...@@ -390,7 +390,7 @@ public class Simulation { ...@@ -390,7 +390,7 @@ public class Simulation {
stimulusProcessor.prioritizeStimuliForPedestrians(stimuli, pedestrians); stimulusProcessor.prioritizeStimuliForPedestrians(stimuli, pedestrians);
if (attributesSimulation.isUsePsychologyLayer()) { if (attributesSimulation.isUsePsychologyLayer()) {
socialCategoryProcessor.setSocialCategoryOfPedestrian(pedestrians, simTimeInSec); selfCategoryProcessor.setSelfCategoryOfPedestrian(pedestrians, simTimeInSec);
} }
for (Model m : models) { for (Model m : models) {
......
package org.vadere.simulator.control.psychology.cognition; package org.vadere.simulator.control.psychology.cognition;
import org.vadere.simulator.control.psychology.perception.StimulusProcessor; import org.vadere.simulator.control.psychology.perception.StimulusProcessor;
import org.vadere.state.psychology.cognition.SocialCategory; import org.vadere.state.psychology.cognition.SelfCategory;
import org.vadere.state.psychology.perception.types.Bang; import org.vadere.state.psychology.perception.types.Bang;
import org.vadere.state.scenario.Pedestrian; import org.vadere.state.scenario.Pedestrian;
import org.vadere.state.scenario.Topography; import org.vadere.state.scenario.Topography;
...@@ -10,26 +10,26 @@ import org.vadere.state.simulation.FootstepHistory; ...@@ -10,26 +10,26 @@ import org.vadere.state.simulation.FootstepHistory;
import java.util.Collection; import java.util.Collection;
/** /**
* The SocialCategoryProcessor class should provide logic to change the social * The SelfCategoryProcessor class should provide logic to change the self
* category of a pedestrian (e.g., change to cooperative if no movement is * category of a pedestrian (see "reicher-2010"). E.g., change to cooperative
* possible for n steps). * if no movement is possible for n steps.
* *
* Watch out: The {@link StimulusProcessor} should be finished before using * Watch out: The {@link StimulusProcessor} should be finished before using
* methods in this class because, usually, first a stimulus is processed and * methods in this class because, usually, first a stimulus is processed and
* then pedestrians decide which behavior to follow. E.g., first a {@link Bang} * then pedestrians decide which behavior to follow. E.g., first a {@link Bang}
* occurs and then a pedestrian decides to follow a {@link SocialCategory#TARGET_ORIENTED} * occurs and then a pedestrian decides to follow a {@link SelfCategory#TARGET_ORIENTED}
* behavior. * behavior.
*/ */
public class SocialCategoryProcessor { public class SelfCategoryProcessor {
/** The social category may also depend on the surrounding environment. */ /** The self category may also depend on the surrounding environment. */
private Topography topography; private Topography topography;
public SocialCategoryProcessor(Topography topography) { public SelfCategoryProcessor(Topography topography) {
this.topography = topography; this.topography = topography;
} }
public void setSocialCategoryOfPedestrian(Collection<Pedestrian> pedestrians, double simTimeInSec) { public void setSelfCategoryOfPedestrian(Collection<Pedestrian> pedestrians, double simTimeInSec) {
// TODO: Include more (pedestrian) attributes into decision process. // TODO: Include more (pedestrian) attributes into decision process.
for (Pedestrian pedestrian : pedestrians) { for (Pedestrian pedestrian : pedestrians) {
...@@ -42,11 +42,11 @@ public class SocialCategoryProcessor { ...@@ -42,11 +42,11 @@ public class SocialCategoryProcessor {
// Adapt category only if we have seen some footsteps in the past // Adapt category only if we have seen some footsteps in the past
if (footstepHistory.size() >= requiredFootSteps) { if (footstepHistory.size() >= requiredFootSteps) {
if (footstepHistory.getAverageSpeedInMeterPerSecond() <= requiredSpeedInMetersPerSecondToBeCooperative) { if (footstepHistory.getAverageSpeedInMeterPerSecond() <= requiredSpeedInMetersPerSecondToBeCooperative) {
pedestrian.setSocialCategory(SocialCategory.COOPERATIVE); pedestrian.setSelfCategory(SelfCategory.COOPERATIVE);
} else { } else {
// TODO: Maybe, check if area directed to target is free for a step // TODO: Maybe, check if area directed to target is free for a step
// (only then change to "TARGET_ORIENTED"). // (only then change to "TARGET_ORIENTED").
pedestrian.setSocialCategory(SocialCategory.TARGET_ORIENTED); pedestrian.setSelfCategory(SelfCategory.TARGET_ORIENTED);
} }
} }
} }
......
...@@ -5,7 +5,7 @@ import org.jetbrains.annotations.NotNull; ...@@ -5,7 +5,7 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import org.vadere.simulator.models.potential.combinedPotentials.CombinedPotentialStrategy; import org.vadere.simulator.models.potential.combinedPotentials.CombinedPotentialStrategy;
import org.vadere.state.attributes.scenario.AttributesAgent; import org.vadere.state.attributes.scenario.AttributesAgent;
import org.vadere.state.psychology.cognition.SocialCategory; import org.vadere.state.psychology.cognition.SelfCategory;
import org.vadere.state.psychology.perception.types.Bang; import org.vadere.state.psychology.perception.types.Bang;
import org.vadere.state.psychology.perception.types.ChangeTarget; import org.vadere.state.psychology.perception.types.ChangeTarget;
import org.vadere.state.psychology.perception.types.Stimulus; import org.vadere.state.psychology.perception.types.Stimulus;
...@@ -133,7 +133,7 @@ public class OSMBehaviorController { ...@@ -133,7 +133,7 @@ public class OSMBehaviorController {
if (closestPedestrians.size() > 0) { if (closestPedestrians.size() > 0) {
for (Pedestrian closestPedestrian : closestPedestrians) { for (Pedestrian closestPedestrian : closestPedestrians) {
if(pedestrian.hasNextTarget()) { if(pedestrian.hasNextTarget()) {
boolean closestPedIsCooperative = closestPedestrian.getSocialCategory() == SocialCategory.COOPERATIVE; boolean closestPedIsCooperative = closestPedestrian.getSelfCategory() == SelfCategory.COOPERATIVE;
boolean targetOrientationDiffers = false; boolean targetOrientationDiffers = false;
// TODO: Use "pedestrian.getTargetGradient()" instead of "calculateAngleBetweenTargets()". // TODO: Use "pedestrian.getTargetGradient()" instead of "calculateAngleBetweenTargets()".
......
...@@ -3,7 +3,7 @@ package org.vadere.simulator.models.osm.updateScheme; ...@@ -3,7 +3,7 @@ package org.vadere.simulator.models.osm.updateScheme;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.vadere.simulator.models.osm.OSMBehaviorController; import org.vadere.simulator.models.osm.OSMBehaviorController;
import org.vadere.simulator.models.osm.PedestrianOSM; import org.vadere.simulator.models.osm.PedestrianOSM;
import org.vadere.state.psychology.cognition.SocialCategory; import org.vadere.state.psychology.cognition.SelfCategory;
import org.vadere.state.psychology.perception.types.*; import org.vadere.state.psychology.perception.types.*;
import org.vadere.state.scenario.Pedestrian; import org.vadere.state.scenario.Pedestrian;
import org.vadere.state.scenario.Topography; import org.vadere.state.scenario.Topography;
...@@ -54,12 +54,12 @@ public class UpdateSchemeEventDriven implements UpdateSchemeOSM { ...@@ -54,12 +54,12 @@ public class UpdateSchemeEventDriven implements UpdateSchemeOSM {
if (mostImportantStimulus instanceof ElapsedTime) { if (mostImportantStimulus instanceof ElapsedTime) {
double stepDuration = pedestrian.getDurationNextStep(); double stepDuration = pedestrian.getDurationNextStep();
if (pedestrian.getSocialCategory() == SocialCategory.TARGET_ORIENTED) { if (pedestrian.getSelfCategory() == SelfCategory.TARGET_ORIENTED) {
// this can cause problems if the pedestrian desired speed is 0 (see speed adjuster) // this can cause problems if the pedestrian desired speed is 0 (see speed adjuster)
pedestrian.updateNextPosition(); pedestrian.updateNextPosition();
osmBehaviorController.makeStep(pedestrian, topography, stepDuration); osmBehaviorController.makeStep(pedestrian, topography, stepDuration);
pedestrian.setTimeOfNextStep(pedestrian.getTimeOfNextStep() + stepDuration); pedestrian.setTimeOfNextStep(pedestrian.getTimeOfNextStep() + stepDuration);
} else if (pedestrian.getSocialCategory() == SocialCategory.COOPERATIVE) { } else if (pedestrian.getSelfCategory() == SelfCategory.COOPERATIVE) {
// this call will also invoke setTimeOfNextStep // this call will also invoke setTimeOfNextStep
PedestrianOSM candidate = osmBehaviorController.findSwapCandidate(pedestrian, topography); PedestrianOSM candidate = osmBehaviorController.findSwapCandidate(pedestrian, topography);
//TODO: Benedikt Kleinmeier: //TODO: Benedikt Kleinmeier:
......
...@@ -3,7 +3,7 @@ package org.vadere.simulator.models.osm.updateScheme; ...@@ -3,7 +3,7 @@ package org.vadere.simulator.models.osm.updateScheme;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.vadere.simulator.models.osm.OSMBehaviorController; import org.vadere.simulator.models.osm.OSMBehaviorController;
import org.vadere.simulator.models.osm.PedestrianOSM; import org.vadere.simulator.models.osm.PedestrianOSM;
import org.vadere.state.psychology.cognition.SocialCategory; import org.vadere.state.psychology.cognition.SelfCategory;
import org.vadere.state.psychology.perception.types.*; import org.vadere.state.psychology.perception.types.*;
import org.vadere.state.scenario.Pedestrian; import org.vadere.state.scenario.Pedestrian;
import org.vadere.state.scenario.Topography; import org.vadere.state.scenario.Topography;
...@@ -55,9 +55,9 @@ public class UpdateSchemeSequential implements UpdateSchemeOSM { ...@@ -55,9 +55,9 @@ public class UpdateSchemeSequential implements UpdateSchemeOSM {
if (mostImportantStimulus instanceof ElapsedTime) { if (mostImportantStimulus instanceof ElapsedTime) {
pedestrian.setTimeCredit(pedestrian.getTimeCredit() + timeStepInSec); pedestrian.setTimeCredit(pedestrian.getTimeCredit() + timeStepInSec);
pedestrian.clearStrides(); pedestrian.clearStrides();
if (pedestrian.getSocialCategory() == SocialCategory.TARGET_ORIENTED) { if (pedestrian.getSelfCategory() == SelfCategory.TARGET_ORIENTED) {
useTimeCredit(pedestrian, timeStepInSec); useTimeCredit(pedestrian, timeStepInSec);
} else if (pedestrian.getSocialCategory() == SocialCategory.COOPERATIVE) { } else if (pedestrian.getSelfCategory() == SelfCategory.COOPERATIVE) {
PedestrianOSM candidate = osmBehaviorController.findSwapCandidate(pedestrian, topography); PedestrianOSM candidate = osmBehaviorController.findSwapCandidate(pedestrian, topography);
if(candidate != null) { if(candidate != null) {
candidate.setTimeCredit(pedestrian.getTimeCredit() + timeStepInSec); candidate.setTimeCredit(pedestrian.getTimeCredit() + timeStepInSec);
......
...@@ -10,14 +10,14 @@ import org.vadere.state.simulation.VTrajectory; ...@@ -10,14 +10,14 @@ import org.vadere.state.simulation.VTrajectory;
import java.util.Collection; import java.util.Collection;
/** /**
* Save social category of a pedestrian in each time step in an own column. * Save self category of a pedestrian in each time step in an own column.
*/ */
@DataProcessorClass() @DataProcessorClass()
public class FootStepSocialCategoryProcessor extends DataProcessor<EventtimePedestrianIdKey, String> { public class FootStepSelfCategoryProcessor extends DataProcessor<EventtimePedestrianIdKey, String> {
public static String HEADER = "socialCategory"; public static String HEADER = "selfCategory";
public FootStepSocialCategoryProcessor() { public FootStepSelfCategoryProcessor() {
super(HEADER); super(HEADER);
} }
...@@ -27,9 +27,9 @@ public class FootStepSocialCategoryProcessor extends DataProcessor<EventtimePede ...@@ -27,9 +27,9 @@ public class FootStepSocialCategoryProcessor extends DataProcessor<EventtimePede
for(Pedestrian p : pedestrians){ for(Pedestrian p : pedestrians){
VTrajectory traj = p.getTrajectory(); VTrajectory traj = p.getTrajectory();
String slaientBehavior = p.getSocialCategory().toString(); String selfCategoryString = p.getSelfCategory().toString();
for(FootStep fs : traj.getFootSteps()){ for(FootStep fs : traj.getFootSteps()){
this.putValue(new EventtimePedestrianIdKey(fs.getStartTime(), p.getId()), slaientBehavior); this.putValue(new EventtimePedestrianIdKey(fs.getStartTime(), p.getId()), selfCategoryString);
} }
} }
} }
......
...@@ -21,7 +21,7 @@ public final class ColumnNames { ...@@ -21,7 +21,7 @@ public final class ColumnNames {
private Set<String> startTimeKeys; private Set<String> startTimeKeys;
private Set<String> endTimeKeys; private Set<String> endTimeKeys;
private Set<String> mostImportantStimulusKeys; private Set<String> mostImportantStimulusKeys;
private Set<String> socialCategoryKeys; private Set<String> selfCategoryKeys;
private List<Set<String>> keys; private List<Set<String>> keys;
public static final int NOT_SET_COLUMN_INDEX_IDENTIFIER = -1; public static final int NOT_SET_COLUMN_INDEX_IDENTIFIER = -1;
...@@ -46,7 +46,7 @@ public final class ColumnNames { ...@@ -46,7 +46,7 @@ public final class ColumnNames {
groupIdKeys = new HashSet<>(); groupIdKeys = new HashSet<>();
groupSizeKeys = new HashSet<>(); groupSizeKeys = new HashSet<>();
mostImportantStimulusKeys = new HashSet<>(); mostImportantStimulusKeys = new HashSet<>();
socialCategoryKeys = new HashSet<>(); selfCategoryKeys = new HashSet<>();
startTimeKeys = new HashSet<>(); startTimeKeys = new HashSet<>();
endTimeKeys = new HashSet<>(); endTimeKeys = new HashSet<>();
...@@ -68,7 +68,7 @@ public final class ColumnNames { ...@@ -68,7 +68,7 @@ public final class ColumnNames {
groupIdKeys.add("groupId"); groupIdKeys.add("groupId");
groupSizeKeys.add("groupSize"); groupSizeKeys.add("groupSize");
mostImportantStimulusKeys.add("mostImportantStimulus"); mostImportantStimulusKeys.add("mostImportantStimulus");
socialCategoryKeys.add("socialCategory"); selfCategoryKeys.add("selfCategory");
keys.add(pedestrianIdKeys); keys.add(pedestrianIdKeys);
keys.add(startX); keys.add(startX);
...@@ -79,13 +79,13 @@ public final class ColumnNames { ...@@ -79,13 +79,13 @@ public final class ColumnNames {
keys.add(groupIdKeys); keys.add(groupIdKeys);
keys.add(groupSizeKeys); keys.add(groupSizeKeys);
keys.add(mostImportantStimulusKeys); keys.add(mostImportantStimulusKeys);
keys.add(socialCategoryKeys); keys.add(selfCategoryKeys);
keys.add(startTimeKeys); keys.add(startTimeKeys);
keys.add(endTimeKeys); keys.add(endTimeKeys);
} }
public int getSocialCategoryCol(@NotNull final Table dataFrame) { public int getSelfCategoryCol(@NotNull final Table dataFrame) {
return getColId(dataFrame, socialCategoryKeys); return getColId(dataFrame, selfCategoryKeys);
} }
public int getMostImportantStimulusCol(@NotNull final Table dataFrame) { public int getMostImportantStimulusCol(@NotNull final Table dataFrame) {
......
...@@ -44,7 +44,7 @@ import org.vadere.simulator.projects.migration.jsontranformation.SimpleJsonTrans ...@@ -44,7 +44,7 @@ import org.vadere.simulator.projects.migration.jsontranformation.SimpleJsonTrans
* Also, rename * Also, rename
* - "useSalientBehavior" to "usePsychologyLayer" under "attributesSimulation" node * - "useSalientBehavior" to "usePsychologyLayer" under "attributesSimulation" node
* - "FootStepMostImportantEventProcessor" to "FootStepMostImportantStimulusProcessor" * - "FootStepMostImportantEventProcessor" to "FootStepMostImportantStimulusProcessor"
* - "FootStepSalientBehaviorProcessor" to "FootStepSocialCategoryProcessor" * - "FootStepSalientBehaviorProcessor" to "FootStepSelfCategoryProcessor"
* - "salientBehavior" in "dynamicElements" node * - "salientBehavior" in "dynamicElements" node
*/ */
@MigrationTransformation(targetVersionLabel = "1.5") @MigrationTransformation(targetVersionLabel = "1.5")
...@@ -182,7 +182,7 @@ public class TargetVersionV1_5 extends SimpleJsonTransformation { ...@@ -182,7 +182,7 @@ public class TargetVersionV1_5 extends SimpleJsonTransformation {
private void renameOutputProcessorSalientBehavior(JsonNode node) throws MigrationException { private void renameOutputProcessorSalientBehavior(JsonNode node) throws MigrationException {
String oldName = "FootStepSalientBehaviorProcessor"; String oldName = "FootStepSalientBehaviorProcessor";
String newName = "FootStepSocialCategoryProcessor"; String newName = "FootStepSelfCategoryProcessor";
renameOutputProcessor(node, oldName, newName); renameOutputProcessor(node, oldName, newName);
} }
...@@ -205,7 +205,7 @@ public class TargetVersionV1_5 extends SimpleJsonTransformation { ...@@ -205,7 +205,7 @@ public class TargetVersionV1_5 extends SimpleJsonTransformation {
private void renameSalientBehaviorInDynamicElements(JsonNode node) throws MigrationException { private void renameSalientBehaviorInDynamicElements(JsonNode node) throws MigrationException {
String oldName = "salientBehavior"; String oldName = "salientBehavior";
String newName = "socialCategory"; String newName = "selfCategory";
JsonNode dynamicElementsNode = path(node, "scenario/topography/dynamicElements"); JsonNode dynamicElementsNode = path(node, "scenario/topography/dynamicElements");
......
package org.vadere.state.psychology.cognition;
/**
* According to the self-categorization theory ("reicher-2010"), people define
* themselves as member of a social category. Often, people act collectively
* when being in the same category. E.g., protesters - which define themselves
* as protesers - walk together during a demonstration.
*
* Our agents can use these categorizations to to derive a specific behavior.
* E.g., if an agents is "COOPERATIVE", the pedestrian swaps places
* with other "COOPERATIVE" pedestrians.
*
* Watch out: The self category of an agent can change during a simulation.
*/
public enum SelfCategory {
TARGET_ORIENTED, COOPERATIVE
}
package org.vadere.state.psychology.cognition;
/**
* A pedestrian uses these social categories to derive a specific behavior.
* E.g., if a pedestrian is "COOPERATIVE", the pedestrian swaps places
* with other "COOPERATIVE" pedestrians.
*
* Watch out: The social category of a pedestrian can change during a simulation.
*/
public enum SocialCategory {
TARGET_ORIENTED, COOPERATIVE
}
package org.vadere.state.scenario; package org.vadere.state.scenario;
import org.vadere.state.attributes.scenario.AttributesAgent; import org.vadere.state.attributes.scenario.AttributesAgent;
import org.vadere.state.psychology.cognition.SocialCategory; import org.vadere.state.psychology.cognition.SelfCategory;
import org.vadere.state.psychology.perception.types.Stimulus; import org.vadere.state.psychology.perception.types.Stimulus;
import org.vadere.state.simulation.FootStep; import org.vadere.state.simulation.FootStep;
import org.vadere.state.simulation.FootstepHistory; import org.vadere.state.simulation.FootstepHistory;
...@@ -25,7 +25,7 @@ public class Pedestrian extends Agent { ...@@ -25,7 +25,7 @@ public class Pedestrian extends Agent {
private boolean isChild; // TODO should actually be an attribute or a member of a subclass private boolean isChild; // TODO should actually be an attribute or a member of a subclass
private boolean isLikelyInjured; // TODO should actually be an attribute or a member of a subclass private boolean isLikelyInjured; // TODO should actually be an attribute or a member of a subclass
private Stimulus mostImportantStimulus; /** Evaluated in each time step in "EventCognition". */ private Stimulus mostImportantStimulus; /** Evaluated in each time step in "EventCognition". */
private SocialCategory socialCategory; private SelfCategory selfCategory;
private LinkedList<Integer> groupIds; // TODO should actually be an attribute or a member of a subclass private LinkedList<Integer> groupIds; // TODO should actually be an attribute or a member of a subclass
/** /**
* trajectory is a list of foot steps a pedestrian made during the duration of one time step. * trajectory is a list of foot steps a pedestrian made during the duration of one time step.
...@@ -59,7 +59,7 @@ public class Pedestrian extends Agent { ...@@ -59,7 +59,7 @@ public class Pedestrian extends Agent {
isChild = false; isChild = false;
isLikelyInjured = false; isLikelyInjured = false;
mostImportantStimulus = null; mostImportantStimulus = null;
socialCategory = SocialCategory.TARGET_ORIENTED; selfCategory = SelfCategory.TARGET_ORIENTED;
groupIds = new LinkedList<>(); groupIds = new LinkedList<>();
groupSizes = new LinkedList<>(); groupSizes = new LinkedList<>();
modelPedestrianMap = new HashMap<>(); modelPedestrianMap = new HashMap<>();
...@@ -74,7 +74,7 @@ public class Pedestrian extends Agent { ...@@ -74,7 +74,7 @@ public class Pedestrian extends Agent {
isChild = other.isChild; isChild = other.isChild;
isLikelyInjured = other.isLikelyInjured; isLikelyInjured = other.isLikelyInjured;
mostImportantStimulus = other.mostImportantStimulus; mostImportantStimulus = other.mostImportantStimulus;
socialCategory = other.socialCategory; selfCategory = other.selfCategory;
if (other.groupIds != null) { if (other.groupIds != null) {
groupIds = new LinkedList<>(other.groupIds); groupIds = new LinkedList<>(other.groupIds);
...@@ -100,7 +100,7 @@ public class Pedestrian extends Agent { ...@@ -100,7 +100,7 @@ public class Pedestrian extends Agent {
return isLikelyInjured; return isLikelyInjured;
}