...
 
Commits (11)
  • Benedikt Kleinmeier's avatar
    Added test scenarios... · a36f7717
    Benedikt Kleinmeier authored
    Added test scenarios "10-RiMEA11-ExitSelection-OSMEventDriven-SBDisabled.scenario" and "11-RiMEA11-ExitSelection-OSMEventDriven-SBEnabled.scenario"
    a36f7717
  • Benedikt Kleinmeier's avatar
    32177977
  • Benedikt Kleinmeier's avatar
    Renamed "PedestrianSpeedInAreaProcessor" to... · 53c4aeb4
    Benedikt Kleinmeier authored
    Renamed "PedestrianSpeedInAreaProcessor" to "PedestrianSpeedInAreaProcessorUsingAgentTrajectory" and implemented "PedestrianSpeedInAreaProcessorUsingAgentVelocity".
    53c4aeb4
  • Benedikt Kleinmeier's avatar
    In "09-OriginalExperimentSetup-OSMEventDriven.scenario", resized measurement... · ca7a6d16
    Benedikt Kleinmeier authored
    In "09-OriginalExperimentSetup-OSMEventDriven.scenario", resized measurement areas and use "PedestrianSpeedInAreaProcessorUsingAgentVelocity".
    ca7a6d16
  • Benedikt Kleinmeier's avatar
    89ca9c72
  • Benedikt Kleinmeier's avatar
    Deleted folder "TestNonWorkingFeatures" and added scenario... · c2048ad0
    Benedikt Kleinmeier authored
    Deleted folder "TestNonWorkingFeatures" and added scenario "TestSalientBehavior/scenarios/12-CounterFlow-SBEnabled.scenario".
    c2048ad0
  • Benedikt Kleinmeier's avatar
    Swap pedestrians based on target gradient instead of "calculateAngleBetweenTargets()". · d6d3e6d1
    Benedikt Kleinmeier authored
    With this change, the scenario "12-CounterFlow-SBEnabled.scenario" works. :)
    d6d3e6d1
  • Benedikt Kleinmeier's avatar
    In "OSMBehaviorController", use "calculateAngleBetweenTargets()" temporarily... · ddddd418
    Benedikt Kleinmeier authored
    In "OSMBehaviorController", use "calculateAngleBetweenTargets()" temporarily to avoid errors in CI pipeline
    ddddd418
  • Benedikt Kleinmeier's avatar
  • Benedikt Kleinmeier's avatar
    Merge branch 'master' into salient_behavior · 9390cc10
    Benedikt Kleinmeier authored
    # Conflicts:
    #	VadereModelTests/TestOSM/scenarios/basic_2_density_discrete_ca.scenario
    #	VadereModelTests/TestOSM/scenarios/basic_2_density_pso.scenario
    #	VadereModelTests/TestOSM/scenarios/chicken_floorfield_displaced_ok.scenario
    #	VadereModelTests/TestOSM/scenarios/chicken_floorfield_ok.scenario
    #	VadereModelTests/TestOSM/scenarios/corner_waiting_time_processor_test.scenario
    #	VadereModelTests/TestOSM/scenarios/narrow_passage_discrete_CA_fail.scenario
    #	VadereModelTests/TestOSM/scenarios/narrow_passage_nelder_mead_ok.scenario
    #	VadereModelTests/TestOSM/scenarios/narrow_passage_pso_ok.scenario
    #	VadereModelTests/TestOSM/scenarios/queueing_dynamic_floorfield_visual_check.scenario
    #	VadereModelTests/TestOSM/scenarios/regular_wall_discrete_ok.scenario
    #	VadereModelTests/TestOSM/scenarios/regular_wall_nelder_mead_ok.scenario
    #	VadereModelTests/TestOSM/scenarios/regular_wall_pso_ok.scenario
    #	VadereModelTests/TestOSM/scenarios/rimea_01_pathway_discrete_brute_force.scenario
    #	VadereModelTests/TestOSM/scenarios/rimea_01_pathway_discrete_ca.scenario
    #	VadereModelTests/TestOSM/scenarios/rimea_04_flow_osm1_025_d.scenario
    #	VadereModelTests/TestOSM/scenarios/rimea_04_flow_osm1_025_up.scenario
    #	VadereModelTests/TestOSM/scenarios/rimea_04_flow_osm1_050_d.scenario
    #	VadereModelTests/TestOSM/scenarios/rimea_04_flow_osm1_050_h.scenario
    #	VadereModelTests/TestOSM/scenarios/rimea_04_flow_osm1_050_up.scenario
    #	VadereModelTests/TestOSM/scenarios/rimea_04_flow_osm1_075_d.scenario
    #	VadereModelTests/TestOSM/scenarios/rimea_04_flow_osm1_075_h.scenario
    #	VadereModelTests/TestOSM/scenarios/rimea_04_flow_osm1_075_up.scenario
    #	VadereModelTests/TestOSM/scenarios/rimea_04_flow_osm1_100_d.scenario
    #	VadereModelTests/TestOSM/scenarios/rimea_04_flow_osm1_100_h.scenario
    #	VadereModelTests/TestOSM/scenarios/rimea_04_flow_osm1_100_up.scenario
    #	VadereModelTests/TestOSM/scenarios/rimea_04_flow_osm1_125_d.scenario
    #	VadereModelTests/TestOSM/scenarios/rimea_04_flow_osm1_125_h.scenario
    #	VadereModelTests/TestOSM/scenarios/rimea_04_flow_osm1_125_up.scenario
    #	VadereModelTests/TestOSM/scenarios/rimea_04_flow_osm1_470_h.scenario
    #	VadereModelTests/TestOSM/scenarios/rimea_04_flow_osm1_550_up.scenario
    #	VadereModelTests/TestOSM/scenarios/rimea_05_react.scenario
    #	VadereModelTests/TestOSM/scenarios/rimea_06_corner.scenario
    #	VadereModelTests/TestOSM/scenarios/rimea_07_speeds_discrete_ca.scenario
    #	VadereModelTests/TestOSM/scenarios/rimea_07_speeds_nelder_mead.scenario
    #	VadereModelTests/TestOSM/scenarios/rimea_07_speeds_pso.scenario
    #	VadereModelTests/TestOSM/scenarios/rimea_08_parameter_variation.scenario
    #	VadereModelTests/TestOSM/scenarios/rimea_09_public_room_2_exits_nelder_mead.scenario
    #	VadereModelTests/TestOSM/scenarios/rimea_09_public_room_2_exits_pso.scenario
    #	VadereModelTests/TestOSM/scenarios/rimea_09_public_room_4_exits_nelder_mead.scenario
    #	VadereModelTests/TestOSM/scenarios/rimea_09_public_room_4_exits_pso.scenario
    #	VadereModelTests/TestOSM/scenarios/rimea_10_pathfinding.scenario
    #	VadereModelTests/TestOSM/scenarios/rimea_11_exit_selection_nelder_mead.scenario
    #	VadereModelTests/TestOSM/scenarios/rimea_11_exit_selection_pso.scenario
    #	VadereModelTests/TestOSM/scenarios/rimea_12_evacuation_nelder_mead.scenario
    #	VadereModelTests/TestOSM/scenarios/rimea_12_evacuation_pso.scenario
    #	VadereModelTests/TestOSM/scenarios/rimea_13_stairs_long_nelder_mead.scenario
    #	VadereModelTests/TestOSM/scenarios/rimea_13_stairs_long_pso.scenario
    #	VadereModelTests/TestOSM/scenarios/rimea_13_stairs_nelder_mead.scenario
    #	VadereModelTests/TestOSM/scenarios/rimea_13_stairs_pso.scenario
    #	VadereModelTests/TestOSM/scenarios/rimea_14_select_route_nelder_mead.scenario
    #	VadereModelTests/TestOSM/scenarios/rimea_14_select_route_pso.scenario
    #	VadereModelTests/TestOSM/scenarios/see_small_wall_nelder_mead_ok.scenario
    #	VadereModelTests/TestOSM/scenarios/see_small_wall_pso_fail.scenario
    #	VadereModelTests/TestOSM/scenarios/thick_wall_discrete_ok.scenario
    #	VadereModelTests/TestOSM/scenarios/thick_wall_nelder_mead_ok.scenario
    #	VadereModelTests/TestOSM/scenarios/thick_wall_pso_ok.scenario
    #	VadereModelTests/TestOSM/scenarios/thin_wall_and_closer_source_discrete_could_fail.scenario
    #	VadereModelTests/TestOSM/scenarios/thin_wall_and_closer_source_nelder_mead_ok.scenario
    #	VadereModelTests/TestOSM/scenarios/thin_wall_and_closer_source_pso_could_fail.scenario
    #	VadereModelTests/TestOSM/scenarios/thin_wall_discrete_ok.scenario
    #	VadereModelTests/TestOSM/scenarios/thin_wall_nelder_mead_ok.scenario
    #	VadereModelTests/TestOSM/scenarios/thin_wall_pso_ok.scenario
    #	VadereSimulator/src/org/vadere/simulator/models/osm/OSMBehaviorController.java
    9390cc10
  • Benedikt Kleinmeier's avatar
Non Working Features
\ No newline at end of file
......@@ -6,7 +6,7 @@
"files" : [ {
"type" : "org.vadere.simulator.projects.dataprocessing.outputfile.TimestepPedestrianIdOutputFile",
"filename" : "postvis.trajectories",
"processors" : [ 1, 2, 6, 7, 9, 10 ]
"processors" : [ 1, 2, 6, 7, 9, 10, 11, 13, 14, 15 ]
}, {
"type" : "org.vadere.simulator.projects.dataprocessing.outputfile.TimestepPedestrianIdOverlapOutputFile",
"filename" : "overlaps.csv",
......@@ -42,23 +42,59 @@
"type" : "org.vadere.simulator.projects.dataprocessing.processor.PedestrianSalientBehaviorProcessor",
"id" : 7
}, {
"type" : "org.vadere.simulator.projects.dataprocessing.processor.PedestrianSpeedInAreaProcessor",
"type" : "org.vadere.simulator.projects.dataprocessing.processor.PedestrianSpeedInAreaProcessorUsingAgentTrajectory",
"id" : 9,
"attributesType" : "org.vadere.state.attributes.processor.AttributesSpeedInAreaProcessor",
"attributesType" : "org.vadere.state.attributes.processor.AttributesSpeedInAreaProcessorUsingAgentTrajectory",
"attributes" : {
"measurementAreaId" : 1,
"pedestrianTrajectoryProcessorId" : 5,
"speedCalculationStrategy" : "BY_MEASUREMENT_AREA_HEIGHT"
}
}, {
"type" : "org.vadere.simulator.projects.dataprocessing.processor.PedestrianSpeedInAreaProcessor",
"type" : "org.vadere.simulator.projects.dataprocessing.processor.PedestrianSpeedInAreaProcessorUsingAgentTrajectory",
"id" : 10,
"attributesType" : "org.vadere.state.attributes.processor.AttributesSpeedInAreaProcessor",
"attributesType" : "org.vadere.state.attributes.processor.AttributesSpeedInAreaProcessorUsingAgentTrajectory",
"attributes" : {
"measurementAreaId" : 2,
"pedestrianTrajectoryProcessorId" : 5,
"speedCalculationStrategy" : "BY_MEASUREMENT_AREA_HEIGHT"
}
}, {
"type" : "org.vadere.simulator.projects.dataprocessing.processor.PedestrianSpeedInAreaProcessorUsingAgentTrajectory",
"id" : 11,
"attributesType" : "org.vadere.state.attributes.processor.AttributesSpeedInAreaProcessorUsingAgentTrajectory",
"attributes" : {
"measurementAreaId" : 3,
"pedestrianTrajectoryProcessorId" : 5,
"speedCalculationStrategy" : "BY_MEASUREMENT_AREA_HEIGHT"
}
}, {
"type" : "org.vadere.simulator.projects.dataprocessing.processor.PedestrianVelocityDefaultProcessor",
"id" : 12
}, {
"type" : "org.vadere.simulator.projects.dataprocessing.processor.PedestrianSpeedInAreaProcessorUsingAgentVelocity",
"id" : 13,
"attributesType" : "org.vadere.state.attributes.processor.AttributesSpeedInAreaProcessorUsingAgentVelocity",
"attributes" : {
"measurementAreaId" : 1,
"pedestrianVelocityDefaultProcessor" : 12
}
}, {
"type" : "org.vadere.simulator.projects.dataprocessing.processor.PedestrianSpeedInAreaProcessorUsingAgentVelocity",
"id" : 14,
"attributesType" : "org.vadere.state.attributes.processor.AttributesSpeedInAreaProcessorUsingAgentVelocity",
"attributes" : {
"measurementAreaId" : 2,
"pedestrianVelocityDefaultProcessor" : 12
}
}, {
"type" : "org.vadere.simulator.projects.dataprocessing.processor.PedestrianSpeedInAreaProcessorUsingAgentVelocity",
"id" : 15,
"attributesType" : "org.vadere.state.attributes.processor.AttributesSpeedInAreaProcessorUsingAgentVelocity",
"attributes" : {
"measurementAreaId" : 3,
"pedestrianVelocityDefaultProcessor" : 12
}
} ],
"isTimestamped" : true,
"isWriteMetaData" : false
......@@ -175,9 +211,18 @@
}, {
"shape" : {
"x" : 0.5,
"y" : 13.1,
"y" : 14.1,
"width" : 4.0,
"height" : 8.0,
"type" : "RECTANGLE"
},
"id" : 3
}, {
"shape" : {
"x" : 0.5,
"y" : 1.9,
"width" : 4.0,
"height" : 9.0,
"height" : 8.0,
"type" : "RECTANGLE"
},
"id" : 1
......
{
"name" : "10-RiMEA11-ExitSelection-OSMEventDriven-SBDisabled",
"description" : "",
"release" : "1.4",
"processWriters" : {
"files" : [ {
"type" : "org.vadere.simulator.projects.dataprocessing.outputfile.TimestepPedestrianIdOutputFile",
"filename" : "postvis.trajectories",
"processors" : [ 1, 2, 3 ]
} ],
"processors" : [ {
"type" : "org.vadere.simulator.projects.dataprocessing.processor.PedestrianPositionProcessor",
"id" : 1
}, {
"type" : "org.vadere.simulator.projects.dataprocessing.processor.PedestrianMostImportantEventProcessor",
"id" : 2
}, {
"type" : "org.vadere.simulator.projects.dataprocessing.processor.PedestrianSalientBehaviorProcessor",
"id" : 3
} ],
"isTimestamped" : true,
"isWriteMetaData" : false
},
"scenario" : {
"mainModel" : "org.vadere.simulator.models.osm.OptimalStepsModel",
"attributesModel" : {
"org.vadere.state.attributes.models.AttributesOSM" : {
"stepCircleResolution" : 4,
"numberOfCircles" : 1,
"optimizationType" : "NELDER_MEAD",
"varyStepDirection" : true,
"movementType" : "ARBITRARY",
"stepLengthIntercept" : 0.4625,
"stepLengthSlopeSpeed" : 0.2345,
"stepLengthSD" : 0.036,
"movementThreshold" : 0.0,
"minStepLength" : 0.1,
"minimumStepLength" : true,
"maxStepDuration" : 1.7976931348623157E308,
"dynamicStepLength" : true,
"updateType" : "EVENT_DRIVEN",
"seeSmallWalls" : false,
"targetPotentialModel" : "org.vadere.simulator.models.potential.fields.PotentialFieldTargetGrid",
"pedestrianPotentialModel" : "org.vadere.simulator.models.potential.PotentialFieldPedestrianCompactSoftshell",
"obstaclePotentialModel" : "org.vadere.simulator.models.potential.PotentialFieldObstacleCompactSoftshell",
"submodels" : [ ]
},
"org.vadere.state.attributes.models.AttributesPotentialCompactSoftshell" : {
"pedPotentialIntimateSpaceWidth" : 0.45,
"pedPotentialPersonalSpaceWidth" : 1.2,
"pedPotentialHeight" : 50.0,
"obstPotentialWidth" : 0.8,
"obstPotentialHeight" : 6.0,
"intimateSpaceFactor" : 1.2,
"personalSpacePower" : 1,
"intimateSpacePower" : 1
},
"org.vadere.state.attributes.models.AttributesFloorField" : {
"createMethod" : "HIGH_ACCURACY_FAST_MARCHING",
"potentialFieldResolution" : 0.1,
"obstacleGridPenalty" : 0.1,
"targetAttractionStrength" : 1.0,
"cacheType" : "NO_CACHE",
"cacheDir" : "",
"timeCostAttributes" : {
"standardDeviation" : 0.7,
"type" : "UNIT",
"obstacleDensityWeight" : 3.5,
"pedestrianSameTargetDensityWeight" : 3.5,
"pedestrianOtherTargetDensityWeight" : 3.5,
"pedestrianWeight" : 3.5,
"queueWidthLoading" : 1.0,
"pedestrianDynamicWeight" : 6.0,
"loadingType" : "CONSTANT",
"width" : 0.2,
"height" : 1.0
}
}
},
"attributesSimulation" : {
"finishTime" : 200.0,
"simTimeStepLength" : 0.4,
"realTimeSimTimeRatio" : 0.0,
"writeSimulationData" : true,
"visualizationEnabled" : true,
"printFPS" : false,
"digitsPerCoordinate" : 2,
"useFixedSeed" : true,
"fixedSeed" : 3213925745664992646,
"simulationSeed" : 1,
"useSalientBehavior" : false
},
"topography" : {
"attributes" : {
"bounds" : {
"x" : 0.0,
"y" : 0.0,
"width" : 14.0,
"height" : 18.0
},
"boundingBoxWidth" : 0.5,
"bounded" : true,
"referenceCoordinateSystem" : null
},
"obstacles" : [ {
"shape" : {
"type" : "POLYGON",
"points" : [ {
"x" : 7.2,
"y" : 5.0
}, {
"x" : 7.2,
"y" : 6.0
}, {
"x" : 0.5,
"y" : 6.0
}, {
"x" : 0.5,
"y" : 5.0
} ]
},
"id" : -1
}, {
"shape" : {
"type" : "POLYGON",
"points" : [ {
"x" : 10.1,
"y" : 5.0
}, {
"x" : 10.1,
"y" : 6.0
}, {
"x" : 7.8,
"y" : 6.0
}, {
"x" : 7.8,
"y" : 5.0
} ]
},
"id" : -1
}, {
"shape" : {
"type" : "POLYGON",
"points" : [ {
"x" : 0.5,
"y" : 14.5
}, {
"x" : 11.6,
"y" : 14.5
}, {
"x" : 11.6,
"y" : 6.000000000000007
}, {
"x" : 10.7,
"y" : 6.0
}, {
"x" : 10.7,
"y" : 5.0
}, {
"x" : 12.6,
"y" : 5.0
}, {
"x" : 12.6,
"y" : 15.600000000000001
}, {
"x" : 0.5,
"y" : 15.600000000000001
} ]
},
"id" : -1
} ],
"measurementAreas" : [ ],
"stairs" : [ ],
"targets" : [ {
"id" : 1,
"absorbing" : true,
"shape" : {
"x" : 6.4,
"y" : 2.4000000000000004,
"width" : 6.0,
"height" : 2.0,
"type" : "RECTANGLE"
},
"waitingTime" : 0.0,
"waitingTimeYellowPhase" : 0.0,
"parallelWaiters" : 0,
"individualWaiting" : true,
"deletionDistance" : 0.1,
"startingWithRedLight" : false,
"nextSpeed" : -1.0
} ],
"absorbingAreas" : [ ],
"sources" : [ {
"id" : -1,
"shape" : {
"x" : 2.5,
"y" : 8.0,
"width" : 3.95,
"height" : 4.74,
"type" : "RECTANGLE"
},
"interSpawnTimeDistribution" : "org.vadere.state.scenario.ConstantDistribution",
"distributionParameters" : [ 1.0 ],
"spawnNumber" : 100,
"maxSpawnNumberTotal" : -1,
"startTime" : 0.0,
"endTime" : 0.0,
"spawnAtRandomPositions" : true,
"useFreeSpaceOnly" : true,
"targetIds" : [ 1 ],
"groupSizeDistribution" : [ 1.0 ],
"dynamicElementType" : "PEDESTRIAN"
} ],
"dynamicElements" : [ ],
"attributesPedestrian" : {
"radius" : 0.195,
"densityDependentSpeed" : false,
"speedDistributionMean" : 1.34,
"speedDistributionStandardDeviation" : 0.26,
"minimumSpeed" : 0.5,
"maximumSpeed" : 2.2,
"acceleration" : 2.0,
"footstepHistorySize" : 4,
"searchRadius" : 1.0,
"angleCalculationType" : "USE_CENTER",
"targetOrientationAngleThreshold" : 45.0
},
"teleporter" : null,
"attributesCar" : null
},
"eventInfos" : [ ]
}
}
\ No newline at end of file
{
"name" : "11-RiMEA11-ExitSelection-OSMEventDriven-SBEnabled",
"description" : "",
"release" : "1.4",
"processWriters" : {
"files" : [ {
"type" : "org.vadere.simulator.projects.dataprocessing.outputfile.TimestepPedestrianIdOutputFile",
"filename" : "postvis.trajectories",
"processors" : [ 1, 2, 3 ]
} ],
"processors" : [ {
"type" : "org.vadere.simulator.projects.dataprocessing.processor.PedestrianPositionProcessor",
"id" : 1
}, {
"type" : "org.vadere.simulator.projects.dataprocessing.processor.PedestrianMostImportantEventProcessor",
"id" : 2
}, {
"type" : "org.vadere.simulator.projects.dataprocessing.processor.PedestrianSalientBehaviorProcessor",
"id" : 3
} ],
"isTimestamped" : true,
"isWriteMetaData" : false
},
"scenario" : {
"mainModel" : "org.vadere.simulator.models.osm.OptimalStepsModel",
"attributesModel" : {
"org.vadere.state.attributes.models.AttributesOSM" : {
"stepCircleResolution" : 4,
"numberOfCircles" : 1,
"optimizationType" : "NELDER_MEAD",
"varyStepDirection" : true,
"movementType" : "ARBITRARY",
"stepLengthIntercept" : 0.4625,
"stepLengthSlopeSpeed" : 0.2345,
"stepLengthSD" : 0.036,
"movementThreshold" : 0.0,
"minStepLength" : 0.1,
"minimumStepLength" : true,
"maxStepDuration" : 1.7976931348623157E308,
"dynamicStepLength" : true,
"updateType" : "EVENT_DRIVEN",
"seeSmallWalls" : false,
"targetPotentialModel" : "org.vadere.simulator.models.potential.fields.PotentialFieldTargetGrid",
"pedestrianPotentialModel" : "org.vadere.simulator.models.potential.PotentialFieldPedestrianCompactSoftshell",
"obstaclePotentialModel" : "org.vadere.simulator.models.potential.PotentialFieldObstacleCompactSoftshell",
"submodels" : [ ]
},
"org.vadere.state.attributes.models.AttributesPotentialCompactSoftshell" : {
"pedPotentialIntimateSpaceWidth" : 0.45,
"pedPotentialPersonalSpaceWidth" : 1.2,
"pedPotentialHeight" : 50.0,
"obstPotentialWidth" : 0.8,
"obstPotentialHeight" : 6.0,
"intimateSpaceFactor" : 1.2,
"personalSpacePower" : 1,
"intimateSpacePower" : 1
},
"org.vadere.state.attributes.models.AttributesFloorField" : {
"createMethod" : "HIGH_ACCURACY_FAST_MARCHING",
"potentialFieldResolution" : 0.1,
"obstacleGridPenalty" : 0.1,
"targetAttractionStrength" : 1.0,
"cacheType" : "NO_CACHE",
"cacheDir" : "",
"timeCostAttributes" : {
"standardDeviation" : 0.7,
"type" : "UNIT",
"obstacleDensityWeight" : 3.5,
"pedestrianSameTargetDensityWeight" : 3.5,
"pedestrianOtherTargetDensityWeight" : 3.5,
"pedestrianWeight" : 3.5,
"queueWidthLoading" : 1.0,
"pedestrianDynamicWeight" : 6.0,
"loadingType" : "CONSTANT",
"width" : 0.2,
"height" : 1.0
}
}
},
"attributesSimulation" : {
"finishTime" : 200.0,
"simTimeStepLength" : 0.4,
"realTimeSimTimeRatio" : 0.0,
"writeSimulationData" : true,
"visualizationEnabled" : true,
"printFPS" : false,
"digitsPerCoordinate" : 2,
"useFixedSeed" : true,
"fixedSeed" : 3213925745664992646,
"simulationSeed" : 1,
"useSalientBehavior" : true
},
"topography" : {
"attributes" : {
"bounds" : {
"x" : 0.0,
"y" : 0.0,
"width" : 14.0,
"height" : 18.0
},
"boundingBoxWidth" : 0.5,
"bounded" : true,
"referenceCoordinateSystem" : null
},
"obstacles" : [ {
"shape" : {
"type" : "POLYGON",
"points" : [ {
"x" : 7.2,
"y" : 5.0
}, {
"x" : 7.2,
"y" : 6.0
}, {
"x" : 0.5,
"y" : 6.0
}, {
"x" : 0.5,
"y" : 5.0
} ]
},
"id" : -1
}, {
"shape" : {
"type" : "POLYGON",
"points" : [ {
"x" : 10.1,
"y" : 5.0
}, {
"x" : 10.1,
"y" : 6.0
}, {
"x" : 7.8,
"y" : 6.0
}, {
"x" : 7.8,
"y" : 5.0
} ]
},
"id" : -1
}, {
"shape" : {
"type" : "POLYGON",
"points" : [ {
"x" : 0.5,
"y" : 14.5
}, {
"x" : 11.6,
"y" : 14.5
}, {
"x" : 11.6,
"y" : 6.000000000000007
}, {
"x" : 10.7,
"y" : 6.0
}, {
"x" : 10.7,
"y" : 5.0
}, {
"x" : 12.6,
"y" : 5.0
}, {
"x" : 12.6,
"y" : 15.600000000000001
}, {
"x" : 0.5,
"y" : 15.600000000000001
} ]
},
"id" : -1
} ],
"measurementAreas" : [ ],
"stairs" : [ ],
"targets" : [ {
"id" : 1,
"absorbing" : true,
"shape" : {
"x" : 6.4,
"y" : 2.4000000000000004,
"width" : 6.0,
"height" : 2.0,
"type" : "RECTANGLE"
},
"waitingTime" : 0.0,
"waitingTimeYellowPhase" : 0.0,
"parallelWaiters" : 0,
"individualWaiting" : true,
"deletionDistance" : 0.1,
"startingWithRedLight" : false,
"nextSpeed" : -1.0
} ],
"absorbingAreas" : [ ],
"sources" : [ {
"id" : -1,
"shape" : {
"x" : 2.5,
"y" : 8.0,
"width" : 3.95,
"height" : 4.74,
"type" : "RECTANGLE"
},
"interSpawnTimeDistribution" : "org.vadere.state.scenario.ConstantDistribution",
"distributionParameters" : [ 1.0 ],
"spawnNumber" : 100,
"maxSpawnNumberTotal" : -1,
"startTime" : 0.0,
"endTime" : 0.0,
"spawnAtRandomPositions" : true,
"useFreeSpaceOnly" : true,
"targetIds" : [ 1 ],
"groupSizeDistribution" : [ 1.0 ],
"dynamicElementType" : "PEDESTRIAN"
} ],
"dynamicElements" : [ ],
"attributesPedestrian" : {
"radius" : 0.195,
"densityDependentSpeed" : false,
"speedDistributionMean" : 1.34,
"speedDistributionStandardDeviation" : 0.26,
"minimumSpeed" : 0.5,
"maximumSpeed" : 2.2,
"acceleration" : 2.0,
"footstepHistorySize" : 4,
"searchRadius" : 1.0,
"angleCalculationType" : "USE_CENTER",
"targetOrientationAngleThreshold" : 45.0
},
"teleporter" : null,
"attributesCar" : null
},
"eventInfos" : [ ]
}
}
\ No newline at end of file
{
"name" : "cooperative_behavior_agents_get_stuck",
"name" : "12-CounterFlow-SBEnabled",
"description" : "",
"release" : "1.4",
"processWriters" : {
"files" : [ {
"type" : "org.vadere.simulator.projects.dataprocessing.outputfile.TimestepPedestrianIdOutputFile",
"filename" : "postvis.trajectories",
"processors" : [ 1, 2 ]
"processors" : [ 1 ]
}, {
"type" : "org.vadere.simulator.projects.dataprocessing.outputfile.PedestrianIdOutputFile",
"filename" : "waitingTimes.txt",
"processors" : [ 2 ]
}, {
"type" : "org.vadere.simulator.projects.dataprocessing.outputfile.TimestepPedestrianIdOverlapOutputFile",
"filename" : "overlaps.csv",
"filename" : "out.txt",
"processors" : [ 3 ]
}, {
"type" : "org.vadere.simulator.projects.dataprocessing.outputfile.NoDataKeyOutputFile",
"filename" : "overlapCount.txt",
"filename" : "out1.txt",
"processors" : [ 4 ]
} ],
"processors" : [ {
"type" : "org.vadere.simulator.projects.dataprocessing.processor.PedestrianPositionProcessor",
"id" : 1
}, {
"type" : "org.vadere.simulator.projects.dataprocessing.processor.PedestrianTargetIdProcessor",
"id" : 2
"type" : "org.vadere.simulator.projects.dataprocessing.processor.PedestrianWaitingTimeProcessor",
"id" : 2,
"attributesType" : "org.vadere.state.attributes.processor.AttributesPedestrianWaitingTimeProcessor",
"attributes" : {
"waitingAreaId" : 1
}
}, {
"type" : "org.vadere.simulator.projects.dataprocessing.processor.PedestrianOverlapProcessor",
"id" : 3
......@@ -32,6 +40,13 @@
"attributes" : {
"pedestrianOverlapProcessorId" : 3
}
}, {
"type" : "org.vadere.simulator.projects.dataprocessing.processor.MaxOverlapProcessor",
"id" : 5,
"attributesType" : "org.vadere.state.attributes.processor.AttributesMaxOverlapProcessor",
"attributes" : {
"pedestrianOverlapProcessorId" : 3
}
} ],
"isTimestamped" : true,
"isWriteMetaData" : false
......@@ -63,7 +78,7 @@
"org.vadere.state.attributes.models.AttributesOSM" : {
"stepCircleResolution" : 18,
"numberOfCircles" : 1,
"optimizationType" : "DISCRETE",
"optimizationType" : "NELDER_MEAD",
"varyStepDirection" : false,
"movementType" : "ARBITRARY",
"stepLengthIntercept" : 0.4625,
......@@ -93,41 +108,77 @@
}
},
"attributesSimulation" : {
"finishTime" : 120.0,
"finishTime" : 200.0,
"simTimeStepLength" : 0.4,
"realTimeSimTimeRatio" : 0.1,
"realTimeSimTimeRatio" : 0.0,
"writeSimulationData" : true,
"visualizationEnabled" : true,
"printFPS" : false,
"digitsPerCoordinate" : 2,
"useFixedSeed" : true,
"fixedSeed" : 8993983048730112153,
"simulationSeed" : 0,
"useSalientBehavior" : false
"fixedSeed" : 1,
"simulationSeed" : 1,
"useSalientBehavior" : true
},
"topography" : {
"attributes" : {
"bounds" : {
"x" : 0.0,
"y" : 0.0,
"width" : 30.0,
"height" : 3.0
"width" : 35.0,
"height" : 60.0
},
"boundingBoxWidth" : 0.5,
"bounded" : true,
"referenceCoordinateSystem" : null
},
"obstacles" : [ ],
"measurementAreas" : [ ],
"obstacles" : [ {
"shape" : {
"x" : 9.0,
"y" : 21.0,
"width" : 1.0,
"height" : 20.0,
"type" : "RECTANGLE"
},
"id" : 5
}, {
"shape" : {
"x" : 25.0,
"y" : 21.0,
"width" : 1.0,
"height" : 20.0,
"type" : "RECTANGLE"
},
"id" : 6
}, {
"shape" : {
"x" : 10.0,
"y" : 40.0,
"width" : 15.0,
"height" : 1.0,
"type" : "RECTANGLE"
},
"id" : 7
} ],
"measurementAreas" : [ {
"shape" : {
"x" : 10.0,
"y" : 32.0,
"width" : 15.0,
"height" : 8.0,
"type" : "RECTANGLE"
},
"id" : 1
} ],
"stairs" : [ ],
"targets" : [ {
"id" : 1,
"absorbing" : true,
"shape" : {
"x" : 0.8,
"y" : 0.7,
"width" : 0.6,
"height" : 1.6,
"x" : 10.0,
"y" : 51.0,
"width" : 15.0,
"height" : 5.0,
"type" : "RECTANGLE"
},
"waitingTime" : 0.0,
......@@ -141,10 +192,10 @@
"id" : 2,
"absorbing" : true,
"shape" : {
"x" : 28.6,
"y" : 0.7,
"width" : 0.6,
"height" : 1.6,
"x" : 14.7,
"y" : 34.5,
"width" : 5.3,
"height" : 2.7,
"type" : "RECTANGLE"
},
"waitingTime" : 0.0,
......@@ -157,32 +208,32 @@
} ],
"absorbingAreas" : [ ],
"sources" : [ {
"id" : -1,
"id" : 3,
"shape" : {
"x" : 1.7,
"y" : 0.7,
"width" : 0.6,
"height" : 1.6,
"x" : 10.0,
"y" : 5.0,
"width" : 15.0,
"height" : 9.0,
"type" : "RECTANGLE"
},
"interSpawnTimeDistribution" : "org.vadere.state.scenario.ConstantDistribution",
"distributionParameters" : [ 1.0 ],
"spawnNumber" : 50,
"spawnNumber" : 300,
"maxSpawnNumberTotal" : -1,
"startTime" : 0.0,
"endTime" : 0.0,
"spawnAtRandomPositions" : false,
"spawnAtRandomPositions" : true,
"useFreeSpaceOnly" : true,
"targetIds" : [ 2 ],
"targetIds" : [ 1 ],
"groupSizeDistribution" : [ 1.0 ],
"dynamicElementType" : "PEDESTRIAN"
}, {
"id" : -1,
"id" : 4,
"shape" : {
"x" : 27.7,
"y" : 0.7,
"width" : 0.6,
"height" : 1.6,
"x" : 2.1,
"y" : 30.2,
"width" : 4.9,
"height" : 3.1,
"type" : "RECTANGLE"
},
"interSpawnTimeDistribution" : "org.vadere.state.scenario.ConstantDistribution",
......@@ -193,7 +244,7 @@
"endTime" : 0.0,
"spawnAtRandomPositions" : false,
"useFreeSpaceOnly" : true,
"targetIds" : [ 1 ],
"targetIds" : [ 2 ],
"groupSizeDistribution" : [ 1.0 ],
"dynamicElementType" : "PEDESTRIAN"
} ],
......@@ -209,7 +260,7 @@
"footstepHistorySize" : 4,
"searchRadius" : 1.0,
"angleCalculationType" : "USE_CENTER",
"targetOrientationAngleThreshold" : 45.0
"targetOrientationAngleThreshold" : 25.0
},
"teleporter" : null,
"attributesCar" : null
......
......@@ -6,7 +6,7 @@
"files" : [ {
"type" : "org.vadere.simulator.projects.dataprocessing.outputfile.TimestepPedestrianIdOutputFile",
"filename" : "postvis.trajectories",
"processors" : [ 1, 2, 6 ]
"processors" : [ 1, 2, 6, 8 ]
}, {
"type" : "org.vadere.simulator.projects.dataprocessing.outputfile.TimestepPedestrianIdOverlapOutputFile",
"filename" : "overlaps.csv",
......@@ -36,14 +36,25 @@
"type" : "org.vadere.simulator.projects.dataprocessing.processor.PedestrianTrajectoryProcessor",
"id" : 5
}, {
"type" : "org.vadere.simulator.projects.dataprocessing.processor.PedestrianSpeedInAreaProcessor",
"type" : "org.vadere.simulator.projects.dataprocessing.processor.PedestrianSpeedInAreaProcessorUsingAgentTrajectory",
"id" : 6,
"attributesType" : "org.vadere.state.attributes.processor.AttributesSpeedInAreaProcessor",
"attributesType" : "org.vadere.state.attributes.processor.AttributesSpeedInAreaProcessorUsingAgentTrajectory",
"attributes" : {
"measurementAreaId" : 1,
"pedestrianTrajectoryProcessorId" : 5,
"speedCalculationStrategy" : "BY_MEASUREMENT_AREA_HEIGHT"
}
}, {
"type" : "org.vadere.simulator.projects.dataprocessing.processor.PedestrianVelocityDefaultProcessor",
"id" : 7
}, {
"type" : "org.vadere.simulator.projects.dataprocessing.processor.PedestrianSpeedInAreaProcessorUsingAgentVelocity",
"id" : 8,
"attributesType" : "org.vadere.state.attributes.processor.AttributesSpeedInAreaProcessorUsingAgentVelocity",
"attributes" : {
"measurementAreaId" : 1,
"pedestrianVelocityDefaultProcessor" : 7
}
} ],
"isTimestamped" : true,
"isWriteMetaData" : false
......
......@@ -6,7 +6,7 @@
"files" : [ {
"type" : "org.vadere.simulator.projects.dataprocessing.outputfile.TimestepPedestrianIdOutputFile",
"filename" : "postvis.trajectories",
"processors" : [ 1, 2, 6 ]
"processors" : [ 1, 2, 6, 8 ]
}, {
"type" : "org.vadere.simulator.projects.dataprocessing.outputfile.TimestepPedestrianIdOverlapOutputFile",
"filename" : "overlaps.csv",
......@@ -36,13 +36,24 @@
"type" : "org.vadere.simulator.projects.dataprocessing.processor.PedestrianTrajectoryProcessor",
"id" : 5
}, {
"type" : "org.vadere.simulator.projects.dataprocessing.processor.PedestrianSpeedInAreaProcessor",
"type" : "org.vadere.simulator.projects.dataprocessing.processor.PedestrianSpeedInAreaProcessorUsingAgentTrajectory",
"id" : 6,
"attributesType" : "org.vadere.state.attributes.processor.AttributesSpeedInAreaProcessor",
"attributesType" : "org.vadere.state.attributes.processor.AttributesSpeedInAreaProcessorUsingAgentTrajectory",
"attributes" : {
"measurementAreaId" : 1,
"pedestrianTrajectoryProcessorId" : 5,
"speedCalculationStrategy" : "BY_TRAJECTORY"
"speedCalculationStrategy" : "BY_MEASUREMENT_AREA_HEIGHT"
}
}, {
"type" : "org.vadere.simulator.projects.dataprocessing.processor.PedestrianVelocityDefaultProcessor",
"id" : 7
}, {
"type" : "org.vadere.simulator.projects.dataprocessing.processor.PedestrianSpeedInAreaProcessorUsingAgentVelocity",
"id" : 8,
"attributesType" : "org.vadere.state.attributes.processor.AttributesSpeedInAreaProcessorUsingAgentVelocity",
"attributes" : {
"measurementAreaId" : 1,
"pedestrianVelocityDefaultProcessor" : 7
}
} ],
"isTimestamped" : true,
......
......@@ -6,7 +6,7 @@
"files" : [ {
"type" : "org.vadere.simulator.projects.dataprocessing.outputfile.TimestepPedestrianIdOutputFile",
"filename" : "postvis.trajectories",
"processors" : [ 1, 2, 6 ]
"processors" : [ 1, 2, 6, 8 ]
}, {
"type" : "org.vadere.simulator.projects.dataprocessing.outputfile.TimestepPedestrianIdOverlapOutputFile",
"filename" : "overlaps.csv",
......@@ -36,13 +36,24 @@
"type" : "org.vadere.simulator.projects.dataprocessing.processor.PedestrianTrajectoryProcessor",
"id" : 5
}, {
"type" : "org.vadere.simulator.projects.dataprocessing.processor.PedestrianSpeedInAreaProcessor",
"type" : "org.vadere.simulator.projects.dataprocessing.processor.PedestrianSpeedInAreaProcessorUsingAgentTrajectory",
"id" : 6,
"attributesType" : "org.vadere.state.attributes.processor.AttributesSpeedInAreaProcessor",
"attributesType" : "org.vadere.state.attributes.processor.AttributesSpeedInAreaProcessorUsingAgentTrajectory",
"attributes" : {
"measurementAreaId" : 1,
"pedestrianTrajectoryProcessorId" : 5,
"speedCalculationStrategy" : "BY_MEASUREMENT_AREA_WIDTH"
"speedCalculationStrategy" : "BY_MEASUREMENT_AREA_HEIGHT"
}
}, {
"type" : "org.vadere.simulator.projects.dataprocessing.processor.PedestrianVelocityDefaultProcessor",
"id" : 7
}, {
"type" : "org.vadere.simulator.projects.dataprocessing.processor.PedestrianSpeedInAreaProcessorUsingAgentVelocity",
"id" : 8,
"attributesType" : "org.vadere.state.attributes.processor.AttributesSpeedInAreaProcessorUsingAgentVelocity",
"attributes" : {
"measurementAreaId" : 1,
"pedestrianVelocityDefaultProcessor" : 7
}
} ],
"isTimestamped" : true,
......
package org.vadere.simulator.entrypoints;
import org.jetbrains.annotations.NotNull;
import java.util.Arrays;
import java.util.Optional;
/**
* Versions in strict order from oldest to newest.
*/
public enum Version {
UNDEFINED("undefined"),
NOT_A_RELEASE("not a release"),
<<<<<<< HEAD
V0_1("0.1"),
V0_2("0.2"),
V0_3("0.3"),
V0_4("0.4"),
V0_5("0.5"),
V0_6("0.6"),
V0_7("0.7"),
V0_8("0.8"),
V0_9("0.9"),
=======
V0_1(0, 1),
V0_2(0, 2),
V0_3(0, 3),
V0_4(0, 4),
V0_5(0, 5),
V0_6(0, 6),
V0_7(0, 7),
V0_8(0, 8),
V0_9(0,9),
>>>>>>> master
;
private String label;
private int major;
private int minor;
Version(String label) {
this.major = -1;
this.minor = -1;
this.label = label;
}
Version(int major, int minor){
this.major = major;
this.minor = minor;
this.label = major + "." + minor;
}
public String label() {
return label;
}
public int major() { return major;}
public int minor() { return minor;}
public String label(char replaceSpaceWith) {
return label.replace(' ', replaceSpaceWith);
}
public static Version fromString(String versionStr) {
versionStr = versionStr.replace('_', ' ');
for (Version v : values()) {
if (v.label.equals(versionStr))
return v;
}
return null;
}
private static int versionId(Version curr) {
Version[] versions = values();
for (int i = 0; i < versions.length; i++) {
if (curr.equals(versions[i])) {
return i;
}
}
throw new IllegalArgumentException("Value not in Version Enumeration " + curr.toString());
}
public static String[] stringValues() {
return Arrays.stream(values()).map(v -> v.label().replace(' ', '_')).toArray(String[]::new);
}
public static String[] stringValues(Version startFrom, boolean descending) {
int min = startFrom.ordinal();
String[] values = Arrays.stream(values()).filter(v -> v.ordinal() >= min).map(v -> v.label().replace(' ', '_')).toArray(String[]::new);
if (descending){
int length = values.length;
for (int i = 0; i < length/2; i++){
int j = length -1 - i;
String tmp = values[i];
values[i] = values[j];
values[j] = tmp;
}
}
return values;
}
public Version nextVersion() {
int nextId = versionId(this) == (values().length - 1) ? versionId(this) : versionId(this) + 1;
return values()[nextId];
}
public Version previousVersion() {
int nextId = versionId(this) == 0 ? versionId(this) : versionId(this) - 1;
return values()[nextId];
}
public static Version[] listVersionFromTo(Version from, Version to){
int start = versionId(from) == (values().length - 1) ? versionId(from) : versionId(from) + 1;
int end = versionId(to);
Version[] ret = new Version[(end - start) + 1];
Version[] values = values();
System.arraycopy(values, start, ret, 0, (end - start)+1);
return ret;
}
public static Version[] listToLatest(Version v) {
int start = versionId(v) == (values().length - 1) ? versionId(v) : versionId(v) + 1;
int end = values().length;
Version[] ret = new Version[end - start];
System.arraycopy(values(), start, ret, 0, end - start);
return ret;
}
public boolean equalOrSmaller(Version test) {
return this.ordinal() <= test.ordinal();
}
public boolean equalOrBigger(Version test) {
return this.ordinal() >= test.ordinal();
}
public static Version latest() {
return values()[values().length - 1];
}
public static Optional<Version> getPrevious(@NotNull final Version successorVersion) {
Version prevVersion = null;
for (Version version : values()) {
if (successorVersion.equals(version)) {
return Optional.ofNullable(prevVersion);
}
prevVersion = version;
}
return Optional.empty();
}
@Override
public String toString() {
return label();
}
}
......@@ -147,8 +147,9 @@ public class OSMBehaviorController {
boolean closestPedIsCooperative = closestPedestrian.getSalientBehavior() == SalientBehavior.COOPERATIVE;
boolean targetOrientationDiffers = false;
// TODO: Use "pedestrian.getTargetGradient()" instead of "calculateAngleBetweenTargets()".
// TODO: Compare both approaches.
double angleInRadian = calculateAngleBetweenTargets(pedestrian, closestPedestrian, topography);
// double angleInRadian = angleInRadian = calculateAngleBetweenTargetGradients(pedestrian, (PedestrianOSM)closestPedestrian);
if (angleInRadian == -1 || Math.toDegrees(angleInRadian) > pedestrian.getAttributes().getTargetOrientationAngleThreshold()) {
targetOrientationDiffers = true;
......@@ -281,6 +282,20 @@ public class OSMBehaviorController {
return vectorPedestrianToTarget;
}
private double calculateAngleBetweenTargetGradients(PedestrianOSM pedestrian1, PedestrianOSM pedestrian2) {
double angleInRadian = -1;
Vector2D targetGradientPedestrian1 = pedestrian1.getTargetGradient(pedestrian1.getPosition());
Vector2D targetGradientPedestrian2 = pedestrian2.getTargetGradient(pedestrian2.getPosition());
double dotProduct = targetGradientPedestrian1.dotProduct(targetGradientPedestrian2);
double multipliedMagnitudes = targetGradientPedestrian1.distanceToOrigin() * targetGradientPedestrian2.distanceToOrigin();
angleInRadian = Math.acos(dotProduct / multipliedMagnitudes);
return angleInRadian;
}
public void swapPedestrians(PedestrianOSM pedestrian1, PedestrianOSM pedestrian2, Topography topography) {
VPoint newPosition = pedestrian2.getPosition().clone();
VPoint oldPosition = pedestrian1.getPosition().clone();
......
package org.vadere.simulator.models.osm.updateScheme;
import org.jetbrains.annotations.NotNull;
import org.vadere.simulator.models.osm.OSMBehaviorController;
import org.vadere.simulator.models.osm.PedestrianOSM;
import org.vadere.simulator.models.potential.combinedPotentials.CombinedPotentialStrategy;
import org.vadere.state.behavior.SalientBehavior;
import org.vadere.state.events.types.*;
import org.vadere.state.scenario.Pedestrian;
import org.vadere.state.scenario.Target;
import org.vadere.state.scenario.Topography;
import org.vadere.util.geometry.shapes.VPoint;
import java.util.Collection;
import java.util.LinkedList;
import java.util.List;
public class UpdateSchemeSequential implements UpdateSchemeOSM {
private final Topography topography;
private final OSMBehaviorController osmBehaviorController;
public UpdateSchemeSequential(@NotNull final Topography topography) {
this.topography = topography;
this.osmBehaviorController = new OSMBehaviorController();
}
@Override
public void update(double timeStepInSec, double currentTimeInSec) {
clearStrides(topography);
update(topography.getElements(Pedestrian.class), timeStepInSec);
}
protected void update(@NotNull final Collection<Pedestrian> pedestrianOSMS, final double timeStepInSec) {
for (Pedestrian pedestrian : pedestrianOSMS) {
update((PedestrianOSM) pedestrian, timeStepInSec);
//pedestrian.update(timeStepInSec, -1, CallMethod.SEQUENTIAL);
}
}
protected void update(@NotNull final PedestrianOSM pedestrian, final double timeStepInSec) {
Event mostImportantEvent = pedestrian.getMostImportantEvent();
if (mostImportantEvent instanceof ElapsedTimeEvent) {
VPoint oldPosition = pedestrian.getPosition();
pedestrian.clearStrides();
pedestrian.setTimeCredit(pedestrian.getTimeCredit() + timeStepInSec);
<<<<<<< HEAD
if (pedestrian.getSalientBehavior() == SalientBehavior.TARGET_ORIENTED) {
while (pedestrian.getTimeCredit() > pedestrian.getDurationNextStep()) {
pedestrian.updateNextPosition();
osmBehaviorController.makeStep(pedestrian, topography, timeStepInSec);
}
} else if (pedestrian.getSalientBehavior() == SalientBehavior.COOPERATIVE) {
osmBehaviorController.swapWithClosestCooperativePedestrian(pedestrian, topography);
=======
while (pedestrian.getTimeCredit() > pedestrian.getDurationNextStep()) {
pedestrian.updateNextPosition();
double stepDuration = pedestrian.getDurationNextStep();
osmBehaviorController.makeStep(pedestrian, topography, timeStepInSec);
pedestrian.setTimeOfNextStep(pedestrian.getTimeOfNextStep() + stepDuration);
>>>>>>> master
}
} else if (mostImportantEvent instanceof WaitEvent || mostImportantEvent instanceof WaitInAreaEvent) {
osmBehaviorController.wait(pedestrian);
} else if (mostImportantEvent instanceof BangEvent) {
osmBehaviorController.reactToBang(pedestrian, topography);
}
}
@Override
public void elementAdded(Pedestrian element) {}
@Override
public void elementRemoved(Pedestrian element) {}
}
......@@ -23,7 +23,7 @@ public class PotentialFieldTargetGrid extends PotentialFieldTarget implements IP
public PotentialFieldTargetGrid(@NotNull final Topography topography,
@NotNull final AttributesAgent attributesPedestrian,
@NotNull final AttributesFloorField attributesPotential) {
super(topography, attributesPedestrian, attributesPotential);
super(topography, attributesPedestrian, attributesPotential);
}
@Override
......@@ -42,10 +42,14 @@ public class PotentialFieldTargetGrid extends PotentialFieldTarget implements IP
return map;
}
@Override
public Vector2D getTargetPotentialGradient(VPoint pos, Agent ped) {
double[] grad = new double[2];
InterpolationUtil.getGradientMollified(getCellGrids().get(ped.getNextTargetId()), new double[]{pos.getX(), pos.getY()}, grad, 0.1);
return new Vector2D(grad[0], grad[1]);
@Override
public Vector2D getTargetPotentialGradient(VPoint pos, Agent ped) {
double[] gradient = { 0.0, 0.0 };
if (ped.getNextTargetId() > -1) {
InterpolationUtil.getGradientMollified(getCellGrids().get(ped.getNextTargetId()), new double[]{pos.getX(), pos.getY()}, gradient, 0.1);
}
return new Vector2D(gradient[0], gradient[1]);
}
}
......@@ -6,7 +6,7 @@ import org.vadere.simulator.projects.dataprocessing.ProcessorManager;
import org.vadere.simulator.projects.dataprocessing.datakey.PedestrianIdKey;
import org.vadere.simulator.projects.dataprocessing.datakey.TimestepPedestrianIdKey;
import org.vadere.state.attributes.processor.AttributesProcessor;
import org.vadere.state.attributes.processor.AttributesSpeedInAreaProcessor;
import org.vadere.state.attributes.processor.AttributesSpeedInAreaProcessorUsingAgentTrajectory;
import org.vadere.state.attributes.processor.enums.SpeedCalculationStrategy;
import org.vadere.state.scenario.MeasurementArea;
import org.vadere.state.scenario.Pedestrian;
......@@ -42,10 +42,12 @@ import java.util.function.BiFunction;
* <pre>
* | timeStep | pedId | ... | M1 | M2 |
* |----------|-------|-----|-----|-----|
* |1 | 1 | | 0.5 | 0 |
* |1 | 2 | | 0 | 0.6 |
* |1 | 1 | | 0.5 | -1 |
* |1 | 2 | | -1 | 0.6 |
* </pre>
*
* Note: If trajectory of pedestrian is empty, log -2.
*
* Use the {@link PedestrianTrajectoryProcessor} to access pedestrian's
* trajectory.
*
......@@ -53,11 +55,9 @@ import java.util.function.BiFunction;
* - ByTrajectory: Use {@link VTrajectory#speed()}, i.e. trajectory.length() / trajectory.duration()
* - ByMeasurementAreaHeight: Use measurementArea.height() / trajectory.duration()
* - ByMeasurementAreaWidth: Use measurementArea.width() / trajectory.duration()
*
* Note: If "trajectory.isEmpty()", log -2.
*/
@DataProcessorClass()
public class PedestrianSpeedInAreaProcessor extends DataProcessor<TimestepPedestrianIdKey, Double> {
public class PedestrianSpeedInAreaProcessorUsingAgentTrajectory extends DataProcessor<TimestepPedestrianIdKey, Double> {
// Static variables
public static double ERROR_PED_NOT_IN_MEASUREMENT_AREA = -1;
......@@ -69,8 +69,8 @@ public class PedestrianSpeedInAreaProcessor extends DataProcessor<TimestepPedest
private BiFunction<VTrajectory, VRectangle, Double> speedCalculationStrategy;
// Constructors
public PedestrianSpeedInAreaProcessor() {
super("speedInArea");
public PedestrianSpeedInAreaProcessorUsingAgentTrajectory() {
super("speedInAreaUsingAgentTrajectory");
// "init()" method is used by processor manager to initialize variables.
}
......@@ -85,7 +85,7 @@ public class PedestrianSpeedInAreaProcessor extends DataProcessor<TimestepPedest
public void init(final ProcessorManager manager) {
super.init(manager);
AttributesSpeedInAreaProcessor processorAttributes = (AttributesSpeedInAreaProcessor) this.getAttributes();
AttributesSpeedInAreaProcessorUsingAgentTrajectory processorAttributes = (AttributesSpeedInAreaProcessorUsingAgentTrajectory) this.getAttributes();
// manager.getMeasurementArea() throws an exception if area is "null" or not rectangular. Though, no checks required here.
boolean rectangularAreaRequired = true;
......@@ -94,13 +94,13 @@ public class PedestrianSpeedInAreaProcessor extends DataProcessor<TimestepPedest
pedestrianTrajectoryProcessor = (PedestrianTrajectoryProcessor) manager.getProcessor(processorAttributes.getPedestrianTrajectoryProcessorId());
if (pedestrianTrajectoryProcessor == null) {
throw new RuntimeException(String.format("PedestrianVelocityProcessor with index %d does not exist.", processorAttributes.getPedestrianTrajectoryProcessorId()));
throw new RuntimeException(String.format("PedestrianTrajectoryProcessor with index %d does not exist.", processorAttributes.getPedestrianTrajectoryProcessorId()));
}
initSpeedCalculationStrategy(processorAttributes);
}
private void initSpeedCalculationStrategy(AttributesSpeedInAreaProcessor processorAttributes) {
private void initSpeedCalculationStrategy(AttributesSpeedInAreaProcessorUsingAgentTrajectory processorAttributes) {
if (processorAttributes.getSpeedCalculationStrategy() == SpeedCalculationStrategy.BY_TRAJECTORY) {
speedCalculationStrategy = this::calculateSpeedByTrajectory;
} else if (processorAttributes.getSpeedCalculationStrategy() == SpeedCalculationStrategy.BY_MEASUREMENT_AREA_HEIGHT) {
......@@ -115,7 +115,7 @@ public class PedestrianSpeedInAreaProcessor extends DataProcessor<TimestepPedest
@Override
public AttributesProcessor getAttributes() {
if (super.getAttributes() == null) {
setAttributes(new AttributesSpeedInAreaProcessor());
setAttributes(new AttributesSpeedInAreaProcessorUsingAgentTrajectory());
}
return super.getAttributes();
......
package org.vadere.simulator.projects.dataprocessing.processor;
import org.vadere.annotation.factories.dataprocessors.DataProcessorClass;
import org.vadere.simulator.control.SimulationState;
import org.vadere.simulator.projects.dataprocessing.ProcessorManager;
import org.vadere.simulator.projects.dataprocessing.datakey.TimestepPedestrianIdKey;
import org.vadere.state.attributes.processor.AttributesProcessor;
import org.vadere.state.attributes.processor.AttributesSpeedInAreaProcessorUsingAgentVelocity;
import org.vadere.state.scenario.MeasurementArea;
import org.vadere.state.scenario.Pedestrian;
/**
* Log for each pedestrian the speed within a measurement area.
*
* <pre>
* +--------------------------------------------------+
* | |
* | M1-------------+ M2-------------+ |
* | +-+ | | | | +-+ |
* | |S| | P1 | | P2 | |T| |
* | +-+ | | | | +-+ |
* | +--------------+ +--------------+ |
* | |
* +--------------------------------------------------+
*
* - S: source
* - T: target
* - Pi: pedestrian i
* - Mj: measurement j
* </pre>
*
* Note: If two measurement areas M1 and M2 are disjoint
* and a pedestrian P1 is located within M1, M2 should
* log a speed of -1 for P1.
*
* <pre>
* | timeStep | pedId | ... | M1 | M2 |
* |----------|-------|-----|-----|-----|
* |1 | 1 | | 0.5 | -1 |
* |1 | 2 | | -1 | 0.6 |
* </pre>
*
* Watch out: This processor uses the {@link PedestrianVelocityDefaultProcessor} internally instead of the
* {@link PedestrianTrajectoryProcessor} which is used by {@link PedestrianSpeedInAreaProcessorUsingAgentTrajectory}.
*/
@DataProcessorClass()
public class PedestrianSpeedInAreaProcessorUsingAgentVelocity extends DataProcessor<TimestepPedestrianIdKey, Double> {
// Static variables
public static double ERROR_PED_NOT_IN_MEASUREMENT_AREA = -1;
// Variables
private MeasurementArea measurementArea;
private PedestrianVelocityDefaultProcessor pedestrianVelocityDefaultProcessor;
// Constructors
public PedestrianSpeedInAreaProcessorUsingAgentVelocity() {
super("speedInAreaUsingAgentVelocity");
// "init()" method is used by processor manager to initialize variables.
}
// Getter
public MeasurementArea getMeasurementArea() {
return this.measurementArea;
}
public PedestrianVelocityDefaultProcessor getPedestrianVelocityDefaultProcessor() { return pedestrianVelocityDefaultProcessor; }
// Methods (overridden)
@Override
public void init(final ProcessorManager manager) {
super.init(manager);
AttributesSpeedInAreaProcessorUsingAgentVelocity processorAttributes = (AttributesSpeedInAreaProcessorUsingAgentVelocity) this.getAttributes();
// manager.getMeasurementArea() throws an exception if area is "null" or not rectangular. Though, no checks required here.
boolean rectangularAreaRequired = true;
measurementArea = manager.getMeasurementArea(processorAttributes.getMeasurementAreaId(), rectangularAreaRequired);
pedestrianVelocityDefaultProcessor = (PedestrianVelocityDefaultProcessor) manager.getProcessor(processorAttributes.getPedestrianVelocityDefaultProcessorId());
if (pedestrianVelocityDefaultProcessor == null) {
throw new RuntimeException(String.format("PedestrianVelocityDefaultProcessor with index %d does not exist.", processorAttributes.getPedestrianVelocityDefaultProcessorId()));
}
}
@Override
public AttributesProcessor getAttributes() {
if (super.getAttributes() == null) {
setAttributes(new AttributesSpeedInAreaProcessorUsingAgentVelocity());
}
return super.getAttributes();
}
@Override
protected void doUpdate(final SimulationState state) {
pedestrianVelocityDefaultProcessor.update(state);
for (Pedestrian pedestrian : state.getTopography().getElements(Pedestrian.class)) {
double speed = ERROR_PED_NOT_IN_MEASUREMENT_AREA;
TimestepPedestrianIdKey rowKey = new TimestepPedestrianIdKey(state.getStep(), pedestrian.getId());
if (measurementArea.getShape().contains(pedestrian.getPosition())) {
speed = pedestrianVelocityDefaultProcessor.getValue(rowKey);
}
this.putValue(rowKey, speed);
}
}
}
......@@ -2,7 +2,7 @@ package org.vadere.state.attributes.processor;
import org.vadere.state.attributes.processor.enums.SpeedCalculationStrategy;
public class AttributesSpeedInAreaProcessor extends AttributesProcessor {
public class AttributesSpeedInAreaProcessorUsingAgentTrajectory extends AttributesProcessor {
// Variables
private int measurementAreaId = -1;
......
package org.vadere.state.attributes.processor;
public class AttributesSpeedInAreaProcessorUsingAgentVelocity extends AttributesProcessor {
// Variables
private int measurementAreaId = -1;
private int pedestrianVelocityDefaultProcessor = -1;
// Getter
public int getMeasurementAreaId() {
return this.measurementAreaId;
}
public int getPedestrianVelocityDefaultProcessorId() {
return this.pedestrianVelocityDefaultProcessor;
}
// Setter
public void setMeasurementAreaId(int measurementAreaId) {
checkSealed();
this.measurementAreaId = measurementAreaId;
}
public void setPedestrianVelocityDefaultProcessorId(int pedestrianVelocityDefaultProcessor) {
checkSealed();
this.pedestrianVelocityDefaultProcessor = pedestrianVelocityDefaultProcessor;
}
}