Commit 83cb5e48 authored by hm-schuhba1's avatar hm-schuhba1

remove possible performance problems based on measurementArea

parents 6523d610 de166cff
Pipeline #102623 passed with stages
in 127 minutes
{
"name" : "Neues_Szenario",
"description" : "",
"release" : "0.7",
"release" : "0.8",
"commithash" : "warning: no commit hash",
"processWriters" : {
"files" : [ {
......@@ -75,20 +75,8 @@
"id" : 6,
"attributesType" : "org.vadere.state.attributes.processor.AttributesAreaDensityVoronoiProcessor",
"attributes" : {
"measurementArea" : {
"x" : 5.0,
"y" : 2.0,
"width" : 1.0,
"height" : 1.0,
"type" : "RECTANGLE"
},
"voronoiArea" : {
"x" : 5.0,
"y" : 2.0,
"width" : 1.0,
"height" : 1.0,
"type" : "RECTANGLE"
}
"measurementAreaId" : 1,
"voronoiMeasurementAreaId" : 1
}
}, {
"type" : "org.vadere.simulator.projects.dataprocessing.processor.AreaSpeedProcessor",
......@@ -148,26 +136,14 @@
"id" : 15,
"attributesType" : "org.vadere.state.attributes.processor.AttributesPedestrianWaitingTimeProcessor",
"attributes" : {
"waitingArea" : {
"x" : 5.0,
"y" : 2.0,
"width" : 1.0,
"height" : 1.0,
"type" : "RECTANGLE"
}
"waitingAreaId" : 1
}
}, {
"type" : "org.vadere.simulator.projects.dataprocessing.processor.PedestrianWaitingEndTimeProcessor",
"id" : 16,
"attributesType" : "org.vadere.state.attributes.processor.AttributesPedestrianWaitingEndTimeProcessor",
"attributes" : {
"waitingArea" : {
"x" : 5.0,
"y" : 2.0,
"width" : 1.0,
"height" : 1.0,
"type" : "RECTANGLE"
}
"waitingAreaId" : 1
}
}, {
"type" : "org.vadere.simulator.projects.dataprocessing.processor.PedestrianOSMStrideLengthProcessor",
......@@ -341,7 +317,17 @@
"acceleration" : 2.0
},
"dynamicElements" : [ ],
"attributesCar" : null
"attributesCar" : null,
"measurementAreas" : [ {
"shape" : {
"x" : 5.0,
"y" : 2.0,
"width" : 1.0,
"height" : 1.0,
"type" : "RECTANGLE"
},
"id" : 1
} ]
}
}
}
\ No newline at end of file
......@@ -13,6 +13,7 @@ import org.vadere.state.scenario.MeasurementArea;
import org.vadere.state.scenario.Topography;
import org.vadere.state.simulation.VTrajectory;
import org.vadere.util.factory.processors.Flag;
import org.vadere.util.geometry.shapes.VRectangle;
import org.vadere.util.logging.Logger;
import java.util.HashMap;
......@@ -40,6 +41,7 @@ public class FundamentalDiagramBProcessor extends DataProcessor<PedestrianIdKey,
private static Logger logger = Logger.getLogger(Topography.class);
private MeasurementArea measurementArea;
private VRectangle measurementAreaVRec;
private PedestrianTrajectoryProcessor pedestrianTrajectoryProcessor;
public FundamentalDiagramBProcessor() {
......@@ -56,6 +58,7 @@ public class FundamentalDiagramBProcessor extends DataProcessor<PedestrianIdKey,
throw new RuntimeException(String.format("MeasurementArea with index %d does not exist.", att.getMeasurementAreaId()));
if (!measurementArea.isRectangular())
throw new RuntimeException("DataProcessor only supports Rectangular measurement areas.");
measurementAreaVRec = measurementArea.asVRectangle();
}
@Override
......@@ -89,7 +92,7 @@ public class FundamentalDiagramBProcessor extends DataProcessor<PedestrianIdKey,
for(Map.Entry<PedestrianIdKey, VTrajectory> trajectoryEntry : trajectoryMap.entrySet()) {
PedestrianIdKey key = trajectoryEntry.getKey();
VTrajectory trajectory = trajectoryEntry.getValue();
VTrajectory clone = trajectory.cut(measurementArea.asVRectangle());
VTrajectory clone = trajectory.cut(measurementAreaVRec);
cutTrajectoryMap.put(key, clone);
}
......@@ -120,7 +123,7 @@ public class FundamentalDiagramBProcessor extends DataProcessor<PedestrianIdKey,
.sum();
densityIntegral /= duration;
densityIntegral /= measurementArea.asVRectangle().getArea();
densityIntegral /= measurementAreaVRec.getArea();
return densityIntegral;
/*List<Triple<Double, Double, Integer>> integralValues = new LinkedList<>();
......
......@@ -12,6 +12,7 @@ import org.vadere.state.attributes.processor.AttributesFundamentalDiagramCProces
import org.vadere.state.attributes.processor.AttributesProcessor;
import org.vadere.state.scenario.MeasurementArea;
import org.vadere.util.factory.processors.Flag;
import org.vadere.util.geometry.shapes.VRectangle;
import java.util.List;
......@@ -30,6 +31,7 @@ import java.util.List;
public class FundamentalDiagramCProcessor extends AreaDataProcessor<Pair<Double, Double>> implements UsesMeasurementArea {
private MeasurementArea measurementArea;
private VRectangle measurementAreaVRec;
private APedestrianVelocityProcessor pedestrianVelocityProcessor;
......@@ -47,6 +49,7 @@ public class FundamentalDiagramCProcessor extends AreaDataProcessor<Pair<Double,
throw new RuntimeException(String.format("MeasurementArea with index %d does not exist.", att.getMeasurementAreaId()));
if (!measurementArea.isRectangular())
throw new RuntimeException("DataProcessor only supports Rectangular measurement areas.");
measurementAreaVRec = measurementArea.asVRectangle();
}
@Override
......@@ -67,11 +70,11 @@ public class FundamentalDiagramCProcessor extends AreaDataProcessor<Pair<Double,
pedestrianVelocityProcessor.update(state);
long N = state.getTopography().getPedestrianDynamicElements().getElements()
.stream()
.filter(pedestrian -> measurementArea.asVRectangle().contains(pedestrian.getPosition()))
.filter(pedestrian -> measurementAreaVRec.contains(pedestrian.getPosition()))
.count();
double velocity = state.getTopography().getPedestrianDynamicElements().getElements()
.stream()
.filter(pedestrian -> measurementArea.asVRectangle().contains(pedestrian.getPosition()))
.filter(pedestrian -> measurementAreaVRec.contains(pedestrian.getPosition()))
.mapToDouble(pedestrian ->
//pedestrian.getVelocity().getLength()
pedestrianVelocityProcessor.getValue(new TimestepPedestrianIdKey(state.getStep(), pedestrian.getId()))
......@@ -85,7 +88,7 @@ public class FundamentalDiagramCProcessor extends AreaDataProcessor<Pair<Double,
velocity /= N;
}
double density = N / measurementArea.asVRectangle().getArea();
double density = N / measurementAreaVRec.getArea();
putValue(new TimestepKey(state.getStep()), Pair.of(velocity, density));
}
......
......@@ -13,6 +13,7 @@ import org.vadere.state.scenario.MeasurementArea;
import org.vadere.state.scenario.Pedestrian;
import org.vadere.state.simulation.FootStep;
import org.vadere.util.factory.processors.Flag;
import org.vadere.util.geometry.shapes.VRectangle;
import org.vadere.util.logging.Logger;
import java.util.Collection;
......@@ -23,6 +24,8 @@ import java.util.List;
public class PedestrianCrossingTimeProcessor extends DataProcessor<PedestrianIdKey, Pair<Double, Double>> implements UsesMeasurementArea {
private MeasurementArea measurementArea;
private VRectangle measurementAreaVRec;
private static Logger logger = Logger.getLogger(PedestrianCrossingTimeProcessor.class);
public PedestrianCrossingTimeProcessor() {
......@@ -38,9 +41,9 @@ public class PedestrianCrossingTimeProcessor extends DataProcessor<PedestrianIdK
PedestrianIdKey key = new PedestrianIdKey(ped.getId());
for(FootStep footStep : ped.getFootSteps()) {
if(footStep.intersects(measurementArea.asVRectangle())) {
if(footStep.intersects(measurementAreaVRec)) {
double intersectionTime = footStep.computeIntersectionTime(measurementArea.asVRectangle());
double intersectionTime = footStep.computeIntersectionTime(measurementAreaVRec);
if(!hasCrossStartTime(key)) {
setStartTime(key, intersectionTime);
}
......@@ -83,7 +86,7 @@ public class PedestrianCrossingTimeProcessor extends DataProcessor<PedestrianIdK
throw new RuntimeException(String.format("MeasurementArea with index %d does not exist.", att.getMeasurementAreaId()));
if (!measurementArea.isRectangular())
throw new RuntimeException("DataProcessor and IntegralVoronoiAlgorithm only supports Rectangular measurement areas.");
measurementAreaVRec = measurementArea.asVRectangle();
}
......
......@@ -11,6 +11,7 @@ import org.vadere.state.scenario.MeasurementArea;
import org.vadere.state.scenario.Pedestrian;
import org.vadere.util.factory.processors.Flag;
import org.vadere.util.geometry.shapes.VPoint;
import org.vadere.util.geometry.shapes.VRectangle;
import java.util.Collection;
import java.util.List;
......@@ -21,6 +22,7 @@ import java.util.List;
@DataProcessorClass()
public class PedestrianWaitingEndTimeProcessor extends DataProcessor<PedestrianIdKey, Double> implements UsesMeasurementArea {
private MeasurementArea waitingArea;
private VRectangle waitingAreaVRec;
public PedestrianWaitingEndTimeProcessor() {
super("waitingEndTime");
......@@ -34,7 +36,7 @@ public class PedestrianWaitingEndTimeProcessor extends DataProcessor<PedestrianI
int pedId = p.getId();
VPoint pos = p.getPosition();
if (this.waitingArea.asVRectangle().contains(pos)) {
if (this.waitingAreaVRec.contains(pos)) {
PedestrianIdKey key = new PedestrianIdKey(pedId);
this.putValue(key, state.getSimTimeInSec());
}
......@@ -50,7 +52,7 @@ public class PedestrianWaitingEndTimeProcessor extends DataProcessor<PedestrianI
throw new RuntimeException(String.format("MeasurementArea with index %d does not exist.", att.getWaitingAreaId()));
if (!waitingArea.isRectangular())
throw new RuntimeException("DataProcessor and IntegralVoronoiAlgorithm only supports Rectangular measurement areas.");
waitingAreaVRec = waitingArea.asVRectangle();
}
@Override
......
......@@ -11,6 +11,7 @@ import org.vadere.state.scenario.MeasurementArea;
import org.vadere.state.scenario.Pedestrian;
import org.vadere.util.factory.processors.Flag;
import org.vadere.util.geometry.shapes.VPoint;
import org.vadere.util.geometry.shapes.VRectangle;
import java.util.Collection;
import java.util.List;
......@@ -22,6 +23,7 @@ import java.util.List;
public class PedestrianWaitingTimeProcessor extends DataProcessor<PedestrianIdKey, Double> implements UsesMeasurementArea {
private double lastSimTime;
private MeasurementArea waitingArea;
private VRectangle waitingAreaRec;
public PedestrianWaitingTimeProcessor() {
super("waitingTimeStart");
......@@ -39,7 +41,7 @@ public class PedestrianWaitingTimeProcessor extends DataProcessor<PedestrianIdKe
int pedId = p.getId();
VPoint pos = p.getPosition();
if (this.waitingArea.asVRectangle().contains(pos)) {
if (this.waitingAreaRec.contains(pos)) {
PedestrianIdKey key = new PedestrianIdKey(pedId);
this.putValue(key, (this.hasValue(key) ? this.getValue(key) : 0.0) + dt);
}
......@@ -57,7 +59,7 @@ public class PedestrianWaitingTimeProcessor extends DataProcessor<PedestrianIdKe
throw new RuntimeException(String.format("MeasurementArea with index %d does not exist.", att.getWaitingAreaId()));
if (!waitingArea.isRectangular())
throw new RuntimeException("DataProcessor and IntegralVoronoiAlgorithm only supports Rectangular measurement areas.");
waitingAreaRec = waitingArea.asVRectangle();
this.lastSimTime = 0.0;
}
......
{
"name" : "TopographyCheckerTest",
"description" : "",
"release" : "0.7",
"release" : "0.8",
"commithash" : "warning: no commit hash",
"processWriters" : {
"files" : [ {
......
{
"name" : "Test1",
"description" : "",
"release" : "0.7",
"release" : "0.8",
"commithash" : "c45f1d26328baaec22418c15e6351a059e910f5f",
"processWriters" : {
"files" : [ {
......
{
"name" : "Test1",
"description" : "",
"release" : "0.7",
"release" : "0.8",
"commithash" : "c45f1d26328baaec22418c15e6351a059e910f5f",
"processWriters" : {
"files" : [ {
......
{
"name" : "Test2",
"description" : "",
"release" : "0.7",
"release" : "0.8",
"commithash" : "c45f1d26328baaec22418c15e6351a059e910f5f",
"processWriters" : {
"files" : [ {
......
{
"name" : "Test1",
"description" : "",
"release" : "0.7",
"release" : "0.8",
"commithash" : "c45f1d26328baaec22418c15e6351a059e910f5f",
"processWriters" : {
"files" : [ {
......
{
"name" : "Test1",
"description" : "",
"release" : "0.7",
"release" : "0.8",
"commithash" : "c45f1d26328baaec22418c15e6351a059e910f5f",
"processWriters" : {
"files" : [ {
......
{
"name" : "Test2",
"description" : "",
"release" : "0.7",
"release" : "0.8",
"commithash" : "c45f1d26328baaec22418c15e6351a059e910f5f",
"processWriters" : {
"files" : [ {
......
{
"name" : "basic_1_chicken_osm1",
"description" : "",
"release" : "0.7",
"release" : "0.8",
"commithash" : "warning: no commit hash",
"processWriters" : {
"files" : [ {
......@@ -172,4 +172,4 @@
"attributesCar" : null
}
}
}
}
\ No newline at end of file
{
"name" : "test_postvis",
"description" : "",
"release" : "0.7",
"release" : "0.8",
"commithash" : "warning: no commit hash",
"processWriters" : {
"files" : [ {
......
{
"name" : "test_postvis",
"description" : "",
"release" : "0.7",
"release" : "0.8",
"commithash" : "warning: no commit hash",
"processWriters" : {
"files" : [ {
......
{
"name" : "test_postvis",
"description" : "",
"release" : "0.7",
"release" : "0.8",
"commithash" : "warning: no commit hash",
"processWriters" : {
"files" : [ {
......
{
"name" : "test_postvis",
"description" : "",
"release" : "0.7",
"release" : "0.8",
"commithash" : "warning: no commit hash",
"processWriters" : {
"files" : [ {
......
{
"name" : "test_postvis",
"description" : "",
"release" : "0.7",
"release" : "0.8",
"commithash" : "warning: no commit hash",
"processWriters" : {
"files" : [ {
......
{
"name" : "test_postvis",
"description" : "",
"release" : "0.7",
"release" : "0.8",
"commithash" : "warning: no commit hash",
"processWriters" : {
"files" : [ {
......
{
"name" : "test_postvis",
"description" : "",
"release" : "0.7",
"release" : "0.8",
"commithash" : "warning: no commit hash",
"processWriters" : {
"files" : [ {
......
{
"name" : "test_postvis",
"description" : "",
"release" : "0.7",
"release" : "0.8",
"commithash" : "warning: no commit hash",
"processWriters" : {
"files" : [ {
......
{
"name" : "test_postvis",
"description" : "",
"release" : "0.7",
"release" : "0.8",
"commithash" : "warning: no commit hash",
"processWriters" : {
"files" : [ {
......
{
"name" : "test_postvis",
"description" : "",
"release" : "0.7",
"release" : "0.8",
"commithash" : "warning: no commit hash",
"processWriters" : {
"files" : [ {
......
{
"name" : "test_postvis",
"description" : "",
"release" : "0.7",
"release" : "0.8",
"commithash" : "warning: no commit hash",
"processWriters" : {
"files" : [ {
......
{
"name" : "test_postvis",
"description" : "",
"release" : "0.7",
"release" : "0.8",
"commithash" : "warning: no commit hash",
"processWriters" : {
"files" : [ {
......
{
"name" : "test_postvis",
"description" : "",
"release" : "0.7",
"release" : "0.8",
"commithash" : "warning: no commit hash",
"processWriters" : {
"files" : [ {
......
{
"name" : "test_postvis",
"description" : "",
"release" : "0.7",
"release" : "0.8",
"commithash" : "warning: no commit hash",
"processWriters" : {
"files" : [ {
......
{
"name" : "test_postvis",
"description" : "",
"release" : "0.7",
"release" : "0.8",
"commithash" : "warning: no commit hash",
"processWriters" : {
"files" : [ {
......
{
"name" : "test_postvis",
"description" : "",
"release" : "0.7",
"release" : "0.8",
"commithash" : "warning: no commit hash",
"processWriters" : {
"files" : [ {
......
{
"name" : "test_postvis",
"description" : "",
"release" : "0.7",
"release" : "0.8",
"commithash" : "warning: no commit hash",
"processWriters" : {
"files" : [ {
......
{
"name" : "warteschlange_ein_ziel",
"description" : "",
"release" : "0.7",
"release" : "0.8",
"commithash" : "warning: no commit hash",
"processWriters" : {
"files" : [ {
......
{
"name" : "test_postvis",
"description" : "",
"release" : "0.7",
"release" : "0.8",
"commithash" : "warning: no commit hash",
"processWriters" : {
"files" : [ {
......
{
"name" : "basic_1_chicken_osm1",
"description" : "",
"release" : "0.7",
"release" : "0.8",
"commithash" : "warning: no commit hash",
"processWriters" : {
"files" : [ {
......
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