Commit be5b5dad authored by Maxim Dudin's avatar Maxim Dudin
Browse files

all ...Nearby... classes changed; first working version

parent dc10c021
Pipeline #236622 failed with stages
in 5 minutes and 18 seconds
{
"name" : "mf_base",
"description" : "",
"release" : "1.10",
"release" : "1.11",
"processWriters" : {
"files" : [ {
"type" : "org.vadere.simulator.projects.dataprocessing.outputfile.EventtimePedestrianIdOutputFile",
......@@ -3199,10 +3199,12 @@
"startTime" : 0.0,
"endTime" : 200.0,
"spawnAtRandomPositions" : false,
"spawnAtGridPositionsCA" : false,
"useFreeSpaceOnly" : true,
"targetIds" : [ 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 ],
"groupSizeDistribution" : [ 1.0 ],
"dynamicElementType" : "PEDESTRIAN"
"dynamicElementType" : "PEDESTRIAN",
"attributesPedestrian" : null
}, {
"id" : 1002,
"shape" : {
......@@ -3228,10 +3230,12 @@
"startTime" : 0.0,
"endTime" : 200.0,
"spawnAtRandomPositions" : false,
"spawnAtGridPositionsCA" : false,
"useFreeSpaceOnly" : true,
"targetIds" : [ 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 ],
"groupSizeDistribution" : [ 1.0 ],
"dynamicElementType" : "PEDESTRIAN"
"dynamicElementType" : "PEDESTRIAN",
"attributesPedestrian" : null
}, {
"id" : 1003,
"shape" : {
......@@ -3257,10 +3261,12 @@
"startTime" : 0.0,
"endTime" : 200.0,
"spawnAtRandomPositions" : false,
"spawnAtGridPositionsCA" : false,
"useFreeSpaceOnly" : true,
"targetIds" : [ 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 ],
"groupSizeDistribution" : [ 1.0 ],
"dynamicElementType" : "PEDESTRIAN"
"dynamicElementType" : "PEDESTRIAN",
"attributesPedestrian" : null
}, {
"id" : 1004,
"shape" : {
......@@ -3286,10 +3292,12 @@
"startTime" : 0.0,
"endTime" : 200.0,
"spawnAtRandomPositions" : false,
"spawnAtGridPositionsCA" : false,
"useFreeSpaceOnly" : true,
"targetIds" : [ 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 ],
"groupSizeDistribution" : [ 1.0 ],
"dynamicElementType" : "PEDESTRIAN"
"dynamicElementType" : "PEDESTRIAN",
"attributesPedestrian" : null
}, {
"id" : 1005,
"shape" : {
......@@ -3315,10 +3323,12 @@
"startTime" : 0.0,
"endTime" : 200.0,
"spawnAtRandomPositions" : false,
"spawnAtGridPositionsCA" : false,
"useFreeSpaceOnly" : true,
"targetIds" : [ 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 ],
"groupSizeDistribution" : [ 1.0 ],
"dynamicElementType" : "PEDESTRIAN"
"dynamicElementType" : "PEDESTRIAN",
"attributesPedestrian" : null
}, {
"id" : 1006,
"shape" : {
......@@ -3344,10 +3354,12 @@
"startTime" : 0.0,
"endTime" : 200.0,
"spawnAtRandomPositions" : false,
"spawnAtGridPositionsCA" : false,
"useFreeSpaceOnly" : true,
"targetIds" : [ 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 ],
"groupSizeDistribution" : [ 1.0 ],
"dynamicElementType" : "PEDESTRIAN"
"dynamicElementType" : "PEDESTRIAN",
"attributesPedestrian" : null
}, {
"id" : 1007,
"shape" : {
......@@ -3373,10 +3385,12 @@
"startTime" : 0.0,
"endTime" : 200.0,
"spawnAtRandomPositions" : false,
"spawnAtGridPositionsCA" : false,
"useFreeSpaceOnly" : true,
"targetIds" : [ 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 ],
"groupSizeDistribution" : [ 1.0 ],
"dynamicElementType" : "PEDESTRIAN"
"dynamicElementType" : "PEDESTRIAN",
"attributesPedestrian" : null
}, {
"id" : 1008,
"shape" : {
......@@ -3402,10 +3416,12 @@
"startTime" : 0.0,
"endTime" : 200.0,
"spawnAtRandomPositions" : false,
"spawnAtGridPositionsCA" : false,
"useFreeSpaceOnly" : true,
"targetIds" : [ 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 ],
"groupSizeDistribution" : [ 1.0 ],
"dynamicElementType" : "PEDESTRIAN"
"dynamicElementType" : "PEDESTRIAN",
"attributesPedestrian" : null
}, {
"id" : 1009,
"shape" : {
......@@ -3431,10 +3447,12 @@
"startTime" : 0.0,
"endTime" : 200.0,
"spawnAtRandomPositions" : false,
"spawnAtGridPositionsCA" : false,
"useFreeSpaceOnly" : true,
"targetIds" : [ 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 ],
"groupSizeDistribution" : [ 1.0 ],
"dynamicElementType" : "PEDESTRIAN"
"dynamicElementType" : "PEDESTRIAN",
"attributesPedestrian" : null
}, {
"id" : 1010,
"shape" : {
......@@ -3460,10 +3478,12 @@
"startTime" : 0.0,
"endTime" : 200.0,
"spawnAtRandomPositions" : false,
"spawnAtGridPositionsCA" : false,
"useFreeSpaceOnly" : true,
"targetIds" : [ 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 ],
"groupSizeDistribution" : [ 1.0 ],
"dynamicElementType" : "PEDESTRIAN"
"dynamicElementType" : "PEDESTRIAN",
"attributesPedestrian" : null
}, {
"id" : 1011,
"shape" : {
......@@ -3489,10 +3509,12 @@
"startTime" : 0.0,
"endTime" : 200.0,
"spawnAtRandomPositions" : false,
"spawnAtGridPositionsCA" : false,
"useFreeSpaceOnly" : true,
"targetIds" : [ 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 ],
"groupSizeDistribution" : [ 1.0 ],
"dynamicElementType" : "PEDESTRIAN"
"dynamicElementType" : "PEDESTRIAN",
"attributesPedestrian" : null
}, {
"id" : 1012,
"shape" : {
......@@ -3518,10 +3540,12 @@
"startTime" : 0.0,
"endTime" : 200.0,
"spawnAtRandomPositions" : false,
"spawnAtGridPositionsCA" : false,
"useFreeSpaceOnly" : true,
"targetIds" : [ 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 ],
"groupSizeDistribution" : [ 1.0 ],
"dynamicElementType" : "PEDESTRIAN"
"dynamicElementType" : "PEDESTRIAN",
"attributesPedestrian" : null
}, {
"id" : 1013,
"shape" : {
......@@ -3547,10 +3571,12 @@
"startTime" : 0.0,
"endTime" : 200.0,
"spawnAtRandomPositions" : false,
"spawnAtGridPositionsCA" : false,
"useFreeSpaceOnly" : true,
"targetIds" : [ 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 ],
"groupSizeDistribution" : [ 1.0 ],
"dynamicElementType" : "PEDESTRIAN"
"dynamicElementType" : "PEDESTRIAN",
"attributesPedestrian" : null
} ],
"dynamicElements" : [ ],
"attributesPedestrian" : {
......
{
"name" : "mf_detailed",
"description" : "",
"release" : "1.10",
"release" : "1.11",
"processWriters" : {
"files" : [ {
"type" : "org.vadere.simulator.projects.dataprocessing.outputfile.EventtimePedestrianIdOutputFile",
......@@ -6520,10 +6520,12 @@
"startTime" : 0.0,
"endTime" : 0.0,
"spawnAtRandomPositions" : false,
"spawnAtGridPositionsCA" : false,
"useFreeSpaceOnly" : true,
"targetIds" : [ 33 ],
"groupSizeDistribution" : [ 1.0 ],
"dynamicElementType" : "PEDESTRIAN"
"dynamicElementType" : "PEDESTRIAN",
"attributesPedestrian" : null
} ],
"dynamicElements" : [ ],
"attributesPedestrian" : {
......
{
"name" : "mf_underground",
"description" : "",
"release" : "1.10",
"release" : "1.11",
"processWriters" : {
"files" : [ {
"type" : "org.vadere.simulator.projects.dataprocessing.outputfile.EventtimePedestrianIdOutputFile",
......@@ -962,10 +962,12 @@
"startTime" : 0.0,
"endTime" : 0.0,
"spawnAtRandomPositions" : false,
"spawnAtGridPositionsCA" : false,
"useFreeSpaceOnly" : true,
"targetIds" : [ 12 ],
"groupSizeDistribution" : [ 1.0 ],
"dynamicElementType" : "PEDESTRIAN"
"dynamicElementType" : "PEDESTRIAN",
"attributesPedestrian" : null
}, {
"id" : 2,
"shape" : {
......@@ -991,10 +993,12 @@
"startTime" : 0.0,
"endTime" : 0.0,
"spawnAtRandomPositions" : false,
"spawnAtGridPositionsCA" : false,
"useFreeSpaceOnly" : true,
"targetIds" : [ 14 ],
"groupSizeDistribution" : [ 1.0 ],
"dynamicElementType" : "PEDESTRIAN"
"dynamicElementType" : "PEDESTRIAN",
"attributesPedestrian" : null
}, {
"id" : 3,
"shape" : {
......@@ -1023,10 +1027,12 @@
"startTime" : 0.0,
"endTime" : 0.0,
"spawnAtRandomPositions" : false,
"spawnAtGridPositionsCA" : false,
"useFreeSpaceOnly" : true,
"targetIds" : [ 17 ],
"groupSizeDistribution" : [ 1.0 ],
"dynamicElementType" : "PEDESTRIAN"
"dynamicElementType" : "PEDESTRIAN",
"attributesPedestrian" : null
}, {
"id" : 4,
"shape" : {
......@@ -1055,10 +1061,12 @@
"startTime" : 0.0,
"endTime" : 0.0,
"spawnAtRandomPositions" : false,
"spawnAtGridPositionsCA" : false,
"useFreeSpaceOnly" : true,
"targetIds" : [ 18 ],
"groupSizeDistribution" : [ 1.0 ],
"dynamicElementType" : "PEDESTRIAN"
"dynamicElementType" : "PEDESTRIAN",
"attributesPedestrian" : null
}, {
"id" : 5,
"shape" : {
......@@ -1087,10 +1095,12 @@
"startTime" : 0.0,
"endTime" : 0.0,
"spawnAtRandomPositions" : false,
"spawnAtGridPositionsCA" : false,
"useFreeSpaceOnly" : true,
"targetIds" : [ 10 ],
"groupSizeDistribution" : [ 1.0 ],
"dynamicElementType" : "PEDESTRIAN"
"dynamicElementType" : "PEDESTRIAN",
"attributesPedestrian" : null
}, {
"id" : 6,
"shape" : {
......@@ -1116,10 +1126,12 @@
"startTime" : 0.0,
"endTime" : 0.0,
"spawnAtRandomPositions" : false,
"spawnAtGridPositionsCA" : false,
"useFreeSpaceOnly" : true,
"targetIds" : [ 12 ],
"groupSizeDistribution" : [ 1.0 ],
"dynamicElementType" : "PEDESTRIAN"
"dynamicElementType" : "PEDESTRIAN",
"attributesPedestrian" : null
}, {
"id" : 7,
"shape" : {
......@@ -1148,10 +1160,12 @@
"startTime" : 0.0,
"endTime" : 0.0,
"spawnAtRandomPositions" : false,
"spawnAtGridPositionsCA" : false,
"useFreeSpaceOnly" : true,
"targetIds" : [ 11 ],
"groupSizeDistribution" : [ 1.0 ],
"dynamicElementType" : "PEDESTRIAN"
"dynamicElementType" : "PEDESTRIAN",
"attributesPedestrian" : null
}, {
"id" : 8,
"shape" : {
......@@ -1177,10 +1191,12 @@
"startTime" : 0.0,
"endTime" : 0.0,
"spawnAtRandomPositions" : false,
"spawnAtGridPositionsCA" : false,
"useFreeSpaceOnly" : true,
"targetIds" : [ 11 ],
"groupSizeDistribution" : [ 1.0 ],
"dynamicElementType" : "PEDESTRIAN"
"dynamicElementType" : "PEDESTRIAN",
"attributesPedestrian" : null
}, {
"id" : 9,
"shape" : {
......@@ -1209,10 +1225,12 @@
"startTime" : 0.0,
"endTime" : 0.0,
"spawnAtRandomPositions" : false,
"spawnAtGridPositionsCA" : false,
"useFreeSpaceOnly" : true,
"targetIds" : [ 10 ],
"groupSizeDistribution" : [ 1.0 ],
"dynamicElementType" : "PEDESTRIAN"
"dynamicElementType" : "PEDESTRIAN",
"attributesPedestrian" : null
} ],
"dynamicElements" : [ ],
"attributesPedestrian" : {
......
{
"name" : "roVerTest002",
"description" : "",
"release" : "1.10",
"release" : "1.11",
"processWriters" : {
"files" : [ {
"type" : "org.vadere.simulator.projects.dataprocessing.outputfile.EventtimePedestrianIdOutputFile",
......@@ -257,10 +257,12 @@
"startTime" : 0.0,
"endTime" : 10.0,
"spawnAtRandomPositions" : false,
"spawnAtGridPositionsCA" : false,
"useFreeSpaceOnly" : true,
"targetIds" : [ 8 ],
"groupSizeDistribution" : [ 1.0 ],
"dynamicElementType" : "PEDESTRIAN"
"dynamicElementType" : "PEDESTRIAN",
"attributesPedestrian" : null
}, {
"id" : 2,
"shape" : {
......@@ -277,10 +279,12 @@
"startTime" : 0.0,
"endTime" : 15.0,
"spawnAtRandomPositions" : false,
"spawnAtGridPositionsCA" : false,
"useFreeSpaceOnly" : true,
"targetIds" : [ 10, 6 ],
"groupSizeDistribution" : [ 1.0 ],
"dynamicElementType" : "PEDESTRIAN"
"dynamicElementType" : "PEDESTRIAN",
"attributesPedestrian" : null
}, {
"id" : 5,
"shape" : {
......@@ -297,10 +301,12 @@
"startTime" : 5.0,
"endTime" : 10.0,
"spawnAtRandomPositions" : false,
"spawnAtGridPositionsCA" : false,
"useFreeSpaceOnly" : true,
"targetIds" : [ 9, 7 ],
"groupSizeDistribution" : [ 1.0 ],
"dynamicElementType" : "PEDESTRIAN"
"dynamicElementType" : "PEDESTRIAN",
"attributesPedestrian" : null
} ],
"dynamicElements" : [ ],
"attributesPedestrian" : {
......
{
"name" : "scenario001",
"description" : "",
"release" : "1.10",
"release" : "1.11",
"processWriters" : {
"files" : [ {
"type" : "org.vadere.simulator.projects.dataprocessing.outputfile.EventtimePedestrianIdOutputFile",
......@@ -15,6 +15,10 @@
"type" : "org.vadere.simulator.projects.dataprocessing.outputfile.NoDataKeyOutputFile",
"filename" : "overlapCount.txt",
"processors" : [ 4 ]
}, {
"type" : "org.vadere.simulator.projects.dataprocessing.outputfile.TimestepPedestriansNearbyIdOutputFile",
"filename" : "pedsNearby.txt",
"processors" : [ 8 ]
} ],
"processors" : [ {
"type" : "org.vadere.simulator.projects.dataprocessing.processor.PedestrianOverlapProcessor",
......@@ -32,6 +36,9 @@
}, {
"type" : "org.vadere.simulator.projects.dataprocessing.processor.FootStepTargetIDProcessor",
"id" : 6
}, {
"type" : "org.vadere.simulator.projects.dataprocessing.processor.PedestriansNearbyProcessor",
"id" : 8
} ],
"isTimestamped" : true,
"isWriteMetaData" : false
......@@ -180,10 +187,12 @@
"startTime" : 0.0,
"endTime" : 50.0,
"spawnAtRandomPositions" : true,
"spawnAtGridPositionsCA" : false,
"useFreeSpaceOnly" : true,
"targetIds" : [ 2 ],
"groupSizeDistribution" : [ 1.0 ],
"dynamicElementType" : "PEDESTRIAN"
"dynamicElementType" : "PEDESTRIAN",
"attributesPedestrian" : null
} ],
"dynamicElements" : [ ],
"attributesPedestrian" : {
......
{
"name" : "scenario002",
"description" : "",
"release" : "1.10",
"release" : "1.11",
"processWriters" : {
"files" : [ {
"type" : "org.vadere.simulator.projects.dataprocessing.outputfile.EventtimePedestrianIdOutputFile",
......@@ -257,10 +257,12 @@
"startTime" : 0.0,
"endTime" : 50.0,
"spawnAtRandomPositions" : true,
"spawnAtGridPositionsCA" : false,
"useFreeSpaceOnly" : true,
"targetIds" : [ 2 ],
"groupSizeDistribution" : [ 1.0 ],
"dynamicElementType" : "PEDESTRIAN"
"dynamicElementType" : "PEDESTRIAN",
"attributesPedestrian" : null
} ],
"dynamicElements" : [ ],
"attributesPedestrian" : {
......
......@@ -2,7 +2,6 @@
"name" : "separation_slow_fast",
"description" : "",
"release" : "1.11",
"commithash" : "f1fb53d68af6f8f4b84898b4e1c6a4be0bc89982",
"processWriters" : {
"files" : [ {
"type" : "org.vadere.simulator.projects.dataprocessing.outputfile.EventtimePedestrianIdOutputFile",
......
package org.vadere.simulator.projects.dataprocessing.datakey;
import org.jetbrains.annotations.NotNull;
import org.vadere.state.scenario.DynamicElement;
public class PedestiansNearbyData {
public class PedestriansNearbyData {
public static final PedestiansNearbyData noOverLap = new PedestiansNearbyData();
public static final PedestriansNearbyData noOverLap = new PedestriansNearbyData();
private final int ped1Id;
private final int ped2Id;
private final Double dist;
private final Double overlap;
private final int durationTimesteps;
private PedestiansNearbyData() {
private PedestriansNearbyData() {
this.ped1Id = -1;
this.ped2Id = -1;
this.dist = Double.POSITIVE_INFINITY;
this.overlap = 0.0;
this.durationTimesteps = 1;
}
public PedestiansNearbyData(final DynamicElement ped1, final DynamicElement ped2, final double minDist){
public PedestriansNearbyData(final DynamicElement ped1, final DynamicElement ped2, final int durationTimesteps){
this.ped1Id = ped1.getId();
this.ped2Id = ped2.getId();
this.dist = ped1.getPosition().distance(ped2.getPosition());
this.overlap = minDist - dist;
this.durationTimesteps = durationTimesteps;
}
public boolean isOverlap(){
/*public boolean isOverlap(){
return overlap > 0;
}
}*/
public boolean isNotSelfOverlap(){
/*public boolean isNotSelfOverlap(){
return !(ped1Id == ped2Id);
}
}*/
public int getPed1Id() {
return ped1Id;
......@@ -43,15 +40,15 @@ public class PedestiansNearbyData {
return ped2Id;
}
public Double getOverlap() {
/*public Double getOverlap() {
return overlap;
}
}*/
public String[] toStrings(){
return new String[]{Double.toString(dist), Double.toString(overlap)};
return new String[]{Integer.toString(durationTimesteps)};
}
public int maxDist(@NotNull PedestiansNearbyData o) {
/*public int maxDist(@NotNull PedestiansNearbyData o) {
return Double.compare(overlap, o.getOverlap());
}
}*/
}
......@@ -3,6 +3,7 @@ package org.vadere.simulator.projects.dataprocessing.datakey;
import org.jetbrains.annotations.NotNull;
import org.vadere.simulator.projects.dataprocessing.outputfile.TimestepPedestrianIdOverlapOutputFile;
import org.vadere.simulator.projects.dataprocessing.outputfile.TimestepPedestriansNearbyIdOutputFile;
import org.vadere.state.attributes.AttributesSimulation;
import java.util.Objects;
......@@ -12,15 +13,21 @@ public class TimestepPedestriansNearbyIdKey implements DataKey<TimestepPedestria
private final int timeStep;
private final int pedId1; //smaller id
private final int pedId2; //bigger id
private final int durationTimesteps;
public TimestepPedestriansNearbyIdKey(int timeStep, int pedA, int pedB) {
this.timeStep = timeStep;
this.pedId1 = (pedA <= pedB) ? pedA : pedB;
this.pedId2 = (pedA > pedB) ? pedA : pedB;
this.pedId1 = Math.min(pedA, pedB);
this.pedId2 = Math.max(pedA, pedB);
this.durationTimesteps = 1; //todo simulation step length
}
public double getDuration() {
return durationTimesteps;
}
public static String[] getHeaders(){
return new String[]{TimestepKey.getHeader(), PedestrianIdKey.getHeader(), "overlapPedestrianId"};
return new String[]{TimestepKey.getHeader(), PedestrianIdKey.getHeader(), "pedestrianNearbyId"};
}
public int getTimeStep() {
......@@ -46,6 +53,9 @@ public class TimestepPedestriansNearbyIdKey implements DataKey<TimestepPedestria
result = Integer.compare(this.pedId1, o.pedId1);
if (result == 0){
result = Integer.compare(this.pedId2, o.pedId2);
if (result == 0) {
result = Integer.compare(this.durationTimesteps, o.durationTimesteps);
}
}
}
return result;
......@@ -58,13 +68,14 @@ public class TimestepPedestriansNearbyIdKey implements DataKey<TimestepPedestria
TimestepPedestriansNearbyIdKey that = (TimestepPedestriansNearbyIdKey) o;
return timeStep == that.timeStep &&
pedId1 == that.pedId1 &&
pedId2 == that.pedId2;
pedId2 == that.pedId2 &&
durationTimesteps == that.durationTimesteps;
}
@Override
public int hashCode() {
return Objects.hash(timeStep, pedId1, pedId2);
return Objects.hash(timeStep, pedId1, pedId2, durationTimesteps);
}
@Override
......@@ -73,6 +84,7 @@ public class TimestepPedestriansNearbyIdKey implements DataKey<TimestepPedestria
"timeStep=" + timeStep +
", pedId1=" + pedId1 +
", pedId2=" + pedId2 +
", durationTimesteps=" + durationTimesteps +
'}';
}
}
......@@ -2,10 +2,8 @@ package org.vadere.simulator.projects.dataprocessing.processor;
import org.vadere.annotation.factories.dataprocessors.DataProcessorClass;
import org.vadere.simulator.control.simulation.SimulationState;
import org.vadere.simulator.models.osm.CellularAutomaton;
import org.vadere.simulator.projects.dataprocessing.ProcessorManager;
import org.vadere.simulator.projects.dataprocessing.datakey.OverlapData;
import org.vadere.simulator.projects.dataprocessing.datakey.PedestiansNearbyData;
import org.vadere.simulator.projects.dataprocessing.datakey.PedestriansNearbyData;
import org.vadere.simulator.projects.dataprocessing.datakey.TimestepPedestrianIdOverlapKey;
import org.vadere.simulator.projects.dataprocessing.datakey.TimestepPedestriansNearbyIdKey;
import org.vadere.state.scenario.DynamicElement;
......@@ -23,17 +21,31 @@ import java.util.stream.Collectors;