Commit 498ebb00 authored by Benedikt Zoennchen's avatar Benedikt Zoennchen
Browse files

add further zhang-2011 scenarios.

parent f86292a8
......@@ -12,11 +12,12 @@
sns.set_context("notebook", font_scale=1.5, rc={"lines.linewidth": 2.0})
def plotEvolution(vproject, ending, yval, ylabel):
plots = []
i = 1
plt.figure(1, figsize=(30, 10))
rows = len(vproject.output_dirs);
plt.figure(1, figsize=(30, 10*rows))
for outStr in project.output_dirs :
out = project.output_dirs[outStr]
dataFrames = []
for fileStr in out.files :
if fileStr.endswith(ending) :
......@@ -27,11 +28,11 @@
ndf['velocity'] = df.velocity.astype(float)
ndf['timeStep'] = df.timeStep.astype(int)
ndf['scenario'] = [out.scenario['name']] * len(df.density)
dataFrames.append(ndf)
#concatFrames = pd.concat(dataFrames)
plt.subplot(2, 1, i)
plt.subplot(rows, 1, i)
plt.title(out.scenario['name'])
plt.xlabel('timeStep')
plt.ylabel(ylabel)
sns.lineplot(x='timeStep', y=yval, data=pd.concat(dataFrames))
i = i + 1
......@@ -44,17 +45,22 @@
if fileStr.endswith(ending) :
ndf = pd.DataFrame();
df = out.files[fileStr]()
ndf['density'] = df.density.astype(float)
ndf['velocity'] = df.velocity.astype(float)
ndf['scenario'] = [outStr] * len(df.velocity)
ndf['timeStep'] = df.timeStep.astype(int)
ndf['scenario'] = [fileStr] * len(df.velocity)
#ndf = ndf[ndf.timeStep > 100]
#ndf = ndf[ndf.timeStep < 500]
ndf = ndf[ndf.density < 4]
ndf = ndf[ndf.velocity > 0]
dataFrames.append(ndf)
concatFrames = pd.concat(dataFrames)
g = sns.relplot(x="density", y="velocity", hue="scenario", data=concatFrames,
height=10, aspect=1)
g.set(xticks=[0,0.5,1,1.5,2,2.5,3,3.5,4], yticks=[0,0.5,1,1.5,2,2.5]);
g.savefig("./"+vproject.project_name+"_"+ending+"_fd"+".pdf", bbox_inches='tight')
#axis = g.axes
#axes.set_xticks([0,1,2,3,4,5,6])
#axes.set_yticks([0,0.5,1,1.5,2,2.5])
#axes.set_xlim(0,6)
#axes.set_ylim(0,2.5)
......@@ -78,12 +84,15 @@
fig.add_axes(axes)
ndf = pd.DataFrame();
df = out.files[fileStr]()
ndf['density'] = df.density.astype(float)
ndf['velocity'] = df.velocity.astype(float)
ndf['timeStep'] = df.timeStep.astype(int)
ndf['scenario'] = [out.scenario['name']] * len(df.velocity)
#ndf = ndf[ndf.density < 7]
ndf = ndf[ndf.density < 4]
#ndf = ndf[ndf.timeStep > 100]
#ndf = ndf[ndf.timeStep < 300]
#plt.scatter()
#axes.set_title(out.scenario['name'])
axes.set_xlabel('density')
axes.set_ylabel('velocity')
axes.set_xticks([0,1,2,3,4,5,6])
......@@ -98,14 +107,14 @@
yy = kladek(xx, *popt)
axes.plot(xx, yy, '--', c=sns.color_palette().as_hex()[1])
axes.legend(['Weidmann', 'regression', 'Simulated data'])
index = index + 1;
if sep :
fig.savefig("./"+out.scenario['name']+"_fundamental_diagram"+".png", bbox_inches='tight')
fig.savefig("./"+out.scenario['name']+"_"+ending+"_fd"+".pdf", bbox_inches='tight')
plt.show()
if not sep :
fig.savefig("./"+vproject.project_name+"_fundamental_diagrams"+".png", bbox_inches='tight')
fig.savefig("./"+vproject.project_name+"_"+ending+"_fd"+".pdf", bbox_inches='tight')
```
%% Cell type:markdown id: tags:
......@@ -130,11 +139,11 @@
plotFundamentalDiagram(project, "aTimeStep.fundamentalDiagram")
```
%% Cell type:markdown id: tags:
## Method B Plots
#### Method B Plots
%% Cell type:code id: tags:
``` python
plotFundamentalDiagram(project, "bPedestrian.fundamentalDiagram")
......@@ -171,11 +180,11 @@
```
%% Cell type:code id: tags:
``` python
np.linspace(0, 200, num=201).tolist()
plotEvolution(project, "aTimeStep.fundamentalDiagram", 'density', 'density')
```
%% Cell type:code id: tags:
``` python
......
......@@ -307,7 +307,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.5"
"version": "3.6.8"
}
},
"nbformat": 4,
......
......@@ -12,11 +12,12 @@
sns.set_context("notebook", font_scale=1.5, rc={"lines.linewidth": 2.0})
def plotEvolution(vproject, ending, yval, ylabel):
plots = []
i = 1
plt.figure(1, figsize=(30, 10))
rows = len(vproject.output_dirs);
plt.figure(1, figsize=(30, 10*rows))
for outStr in project.output_dirs :
out = project.output_dirs[outStr]
dataFrames = []
for fileStr in out.files :
if fileStr.endswith(ending) :
......@@ -27,11 +28,11 @@
ndf['velocity'] = df.velocity.astype(float)
ndf['timeStep'] = df.timeStep.astype(int)
ndf['scenario'] = [out.scenario['name']] * len(df.density)
dataFrames.append(ndf)
#concatFrames = pd.concat(dataFrames)
plt.subplot(2, 1, i)
plt.subplot(rows, 1, i)
plt.title(out.scenario['name'])
plt.xlabel('timeStep')
plt.ylabel(ylabel)
sns.lineplot(x='timeStep', y=yval, data=pd.concat(dataFrames))
i = i + 1
......@@ -44,17 +45,22 @@
if fileStr.endswith(ending) :
ndf = pd.DataFrame();
df = out.files[fileStr]()
ndf['density'] = df.density.astype(float)
ndf['velocity'] = df.velocity.astype(float)
ndf['scenario'] = [outStr] * len(df.velocity)
ndf['timeStep'] = df.timeStep.astype(int)
ndf['scenario'] = [fileStr] * len(df.velocity)
#ndf = ndf[ndf.timeStep > 100]
#ndf = ndf[ndf.timeStep < 500]
ndf = ndf[ndf.density < 4]
ndf = ndf[ndf.velocity > 0]
dataFrames.append(ndf)
concatFrames = pd.concat(dataFrames)
g = sns.relplot(x="density", y="velocity", hue="scenario", data=concatFrames,
height=10, aspect=1)
g.set(xticks=[0,0.5,1,1.5,2,2.5,3,3.5,4], yticks=[0,0.5,1,1.5,2,2.5]);
g.savefig("./"+vproject.project_name+"_"+ending+"_fd"+".pdf", bbox_inches='tight')
#axis = g.axes
#axes.set_xticks([0,1,2,3,4,5,6])
#axes.set_yticks([0,0.5,1,1.5,2,2.5])
#axes.set_xlim(0,6)
#axes.set_ylim(0,2.5)
......@@ -78,12 +84,15 @@
fig.add_axes(axes)
ndf = pd.DataFrame();
df = out.files[fileStr]()
ndf['density'] = df.density.astype(float)
ndf['velocity'] = df.velocity.astype(float)
ndf['timeStep'] = df.timeStep.astype(int)
ndf['scenario'] = [out.scenario['name']] * len(df.velocity)
#ndf = ndf[ndf.density < 7]
ndf = ndf[ndf.density < 4]
#ndf = ndf[ndf.timeStep > 100]
#ndf = ndf[ndf.timeStep < 300]
#plt.scatter()
#axes.set_title(out.scenario['name'])
axes.set_xlabel('density')
axes.set_ylabel('velocity')
axes.set_xticks([0,1,2,3,4,5,6])
......@@ -98,14 +107,14 @@
yy = kladek(xx, *popt)
axes.plot(xx, yy, '--', c=sns.color_palette().as_hex()[1])
axes.legend(['Weidmann', 'regression', 'Simulated data'])
index = index + 1;
if sep :
fig.savefig("./"+out.scenario['name']+"_fundamental_diagram"+".png", bbox_inches='tight')
fig.savefig("./"+out.scenario['name']+"_"+ending+"_fd"+".pdf", bbox_inches='tight')
plt.show()
if not sep :
fig.savefig("./"+vproject.project_name+"_fundamental_diagrams"+".png", bbox_inches='tight')
fig.savefig("./"+vproject.project_name+"_"+ending+"_fd"+".pdf", bbox_inches='tight')
```
%% Cell type:markdown id: tags:
......@@ -130,11 +139,11 @@
plotFundamentalDiagram(project, "aTimeStep.fundamentalDiagram")
```
%% Cell type:markdown id: tags:
## Method B Plots
#### Method B Plots
%% Cell type:code id: tags:
``` python
plotFundamentalDiagram(project, "bPedestrian.fundamentalDiagram")
......@@ -171,11 +180,11 @@
```
%% Cell type:code id: tags:
``` python
np.linspace(0, 200, num=201).tolist()
plotEvolution(project, "aTimeStep.fundamentalDiagram", 'density', 'density')
```
%% Cell type:code id: tags:
``` python
......
......@@ -49,22 +49,25 @@ public class CLGaussianCalculator {
int width = Math.max(filterObstacles.getMatrixWidth(), filterPedestrians.getMatrixWidth());
int height = Math.max(filterObstacles.getMatrixHeight(), filterPedestrians.getMatrixHeight());
BufferedImage image = createImage(width, height);
int maxColorValue = 255 * 255 * 255;
int maxColorValue = 20;
ColorHelper colorHelper = new ColorHelper(maxColorValue);
// double bound = filter.getMaxFilteredValue();
double max = 1.00;
double factor = maxColorValue / max;
//System.out.println(filterPedestrians.getMaxFilteredValue()); // 0.1259
double maxValue = Double.MIN_VALUE;
for (int x = 0; x < filterPedestrians.getMatrixWidth(); x++) {
for (int y = 0; y < filterPedestrians.getMatrixHeight(); y++) {
double pedValue = filterPedestrians.getFilteredValue(x, y);
double obsValue = filterObstacles.getFilteredValue(x, y);
double value = pedValue + obsValue;
// value = pedValue;
image.setRGB(x, y, colorHelper.numberToColor(value * factor).getRGB());
/*
image.setRGB(x, y, colorHelper.numberToColor(value ).getRGB());
if(maxValue < value) {
maxValue = value;
}
/*
* if(value <= 0.0) {
* image.setRGB(x, y, Color.WHITE.getRGB());
* } else {
......@@ -73,6 +76,7 @@ public class CLGaussianCalculator {
*/
}
}
System.out.println(maxValue);
return image;
}
......
......@@ -192,32 +192,32 @@
"targetAttractionStrength" : 1.0,
"timeCostAttributes" : {
"standardDeviation" : 0.7,
"type" : "OBSTACLES",
"obstacleDensityWeight" : 3.5,
"type" : "UNIT",
"obstacleDensityWeight" : 0.0,
"pedestrianSameTargetDensityWeight" : 3.5,
"pedestrianOtherTargetDensityWeight" : 3.5,
"pedestrianWeight" : 3.5,
"queueWidthLoading" : 1.0,
"queueWidthLoading" : 0.1,
"pedestrianDynamicWeight" : 6.0,
"loadingType" : "CONSTANT"
}
},
"org.vadere.state.attributes.models.AttributesOSM" : {
"stepCircleResolution" : 4,
"numberOfCircles" : 1,
"optimizationType" : "NELDER_MEAD",
"stepCircleResolution" : 30,
"numberOfCircles" : 6,
"optimizationType" : "DISCRETE",
"varyStepDirection" : true,
"movementType" : "ARBITRARY",
"stepLengthIntercept" : 0.4625,
"stepLengthSlopeSpeed" : 0.2345,
"stepLengthSD" : 0.0,
"movementThreshold" : 0.0,
"minStepLength" : 0.3,
"minStepLength" : 0.1,
"minimumStepLength" : true,
"maxStepDuration" : 1.7976931348623157E308,
"dynamicStepLength" : false,
"updateType" : "EVENT_DRIVEN",
"seeSmallWalls" : false,
"seeSmallWalls" : true,
"targetPotentialModel" : "org.vadere.simulator.models.potential.fields.PotentialFieldTargetGrid",
"pedestrianPotentialModel" : "org.vadere.simulator.models.potential.PotentialFieldPedestrianCompactSoftshell",
"obstaclePotentialModel" : "org.vadere.simulator.models.potential.PotentialFieldObstacleCompactSoftshell",
......@@ -226,12 +226,12 @@
"org.vadere.state.attributes.models.AttributesPotentialCompactSoftshell" : {
"pedPotentialIntimateSpaceWidth" : 0.45,
"pedPotentialPersonalSpaceWidth" : 1.2,
"pedPotentialHeight" : 50.0,
"pedPotentialHeight" : 35.0,
"obstPotentialWidth" : 0.8,
"obstPotentialHeight" : 6.0,
"intimateSpaceFactor" : 1.2,
"obstPotentialHeight" : 4.0,
"intimateSpaceFactor" : 2.0,
"personalSpacePower" : 1,
"intimateSpacePower" : 1
"intimateSpacePower" : 2
}
},
"attributesSimulation" : {
......@@ -340,12 +340,13 @@
"startingWithRedLight" : false,
"nextSpeed" : -1.0
} ],
"absorbingAreas" : [ ],
"sources" : [ {
"id" : -1,
"shape" : {
"x" : 0.8,
"y" : 6.4,
"width" : 15.0,
"width" : 10.0,
"height" : 8.0,
"type" : "RECTANGLE"
},
......@@ -363,10 +364,10 @@
} ],
"dynamicElements" : [ ],
"attributesPedestrian" : {
"radius" : 0.195,
"radius" : 0.2,
"densityDependentSpeed" : false,
"speedDistributionMean" : 1.55,
"speedDistributionStandardDeviation" : 0.26,
"speedDistributionStandardDeviation" : 0.15,
"minimumSpeed" : 1.37,
"maximumSpeed" : 1.73,
"acceleration" : 2.0
......
......@@ -324,6 +324,7 @@
"startingWithRedLight" : false,
"nextSpeed" : -1.0
} ],
"absorbingAreas" : [ ],
"sources" : [ {
"id" : -1,
"shape" : {
......
{
"name" : "C-050-180-180_long",
"name" : "C-050-180-180_Q",
"description" : "",
"release" : "0.7",
"processWriters" : {
......@@ -61,7 +61,7 @@
"attributesType" : "org.vadere.state.attributes.processor.AttributesFundamentalDiagramAProcessor",
"attributes" : {
"pedestrianLineCrossProcessorId" : 8,
"pedestrianVelocityProcessorId" : 13,
"pedestrianVelocityProcessorId" : 7,
"deltaTime" : 10.0
}
}, {
......@@ -70,7 +70,7 @@
"attributesType" : "org.vadere.state.attributes.processor.AttributesPedestrianVelocityProcessor",
"attributes" : {
"pedestrianPositionProcessorId" : 1,
"backSteps" : 1
"backSteps" : 3
}
}, {
"type" : "org.vadere.simulator.projects.dataprocessing.processor.PedestrianLineCrossProcessor",
......@@ -155,7 +155,7 @@
"attributesType" : "org.vadere.state.attributes.processor.AttributesPedestrianVelocityByTrajectoryProcessor",
"attributes" : {
"pedestrianTrajectoryProcessorId" : 10,
"backSteps" : 1
"backSteps" : 3
}
}, {
"type" : "org.vadere.simulator.projects.dataprocessing.processor.FundamentalDiagramEProcessor",
......@@ -192,32 +192,32 @@
"targetAttractionStrength" : 1.0,
"timeCostAttributes" : {
"standardDeviation" : 0.7,
"type" : "OBSTACLES",
"obstacleDensityWeight" : 3.5,
"type" : "QUEUEING",
"obstacleDensityWeight" : 0.1,
"pedestrianSameTargetDensityWeight" : 3.5,
"pedestrianOtherTargetDensityWeight" : 3.5,
"pedestrianWeight" : 3.5,
"queueWidthLoading" : 1.0,
"queueWidthLoading" : 3.0,
"pedestrianDynamicWeight" : 6.0,
"loadingType" : "CONSTANT"
}
},
"org.vadere.state.attributes.models.AttributesOSM" : {
"stepCircleResolution" : 4,
"numberOfCircles" : 1,
"optimizationType" : "NELDER_MEAD",
"stepCircleResolution" : 30,
"numberOfCircles" : 5,
"optimizationType" : "DISCRETE",
"varyStepDirection" : true,
"movementType" : "ARBITRARY",
"stepLengthIntercept" : 0.4625,
"stepLengthSlopeSpeed" : 0.2345,
"stepLengthSD" : 0.036,
"stepLengthSD" : 0.0,
"movementThreshold" : 0.0,
"minStepLength" : 0.3,
"minStepLength" : 0.1,
"minimumStepLength" : true,
"maxStepDuration" : 1.7976931348623157E308,
"dynamicStepLength" : false,
"updateType" : "EVENT_DRIVEN",
"seeSmallWalls" : false,
"seeSmallWalls" : true,
"targetPotentialModel" : "org.vadere.simulator.models.potential.fields.PotentialFieldTargetGrid",
"pedestrianPotentialModel" : "org.vadere.simulator.models.potential.PotentialFieldPedestrianCompactSoftshell",
"obstaclePotentialModel" : "org.vadere.simulator.models.potential.PotentialFieldObstacleCompactSoftshell",
......@@ -226,12 +226,12 @@
"org.vadere.state.attributes.models.AttributesPotentialCompactSoftshell" : {
"pedPotentialIntimateSpaceWidth" : 0.45,
"pedPotentialPersonalSpaceWidth" : 1.2,
"pedPotentialHeight" : 50.0,
"pedPotentialHeight" : 35.0,
"obstPotentialWidth" : 0.8,
"obstPotentialHeight" : 6.0,
"intimateSpaceFactor" : 1.2,
"obstPotentialHeight" : 4.0,
"intimateSpaceFactor" : 2.0,
"personalSpacePower" : 1,
"intimateSpacePower" : 1
"intimateSpacePower" : 2
}
},
"attributesSimulation" : {
......@@ -340,21 +340,22 @@
"startingWithRedLight" : false,
"nextSpeed" : -1.0
} ],
"absorbingAreas" : [ ],
"sources" : [ {
"id" : -1,
"shape" : {
"x" : 0.8,
"y" : 6.4,
"width" : 15.0,
"width" : 10.0,
"height" : 8.0,
"type" : "RECTANGLE"
},
"interSpawnTimeDistribution" : "org.vadere.state.scenario.ConstantDistribution",
"distributionParameters" : [ 1.0 ],
"spawnNumber" : 4,
"maxSpawnNumberTotal" : 2000,
"spawnNumber" : 61,
"maxSpawnNumberTotal" : 61,
"startTime" : 0.0,
"endTime" : 200.0,
"endTime" : 0.0,
"spawnAtRandomPositions" : true,
"useFreeSpaceOnly" : true,
"targetIds" : [ 1 ],
......@@ -363,10 +364,10 @@
} ],
"dynamicElements" : [ ],
"attributesPedestrian" : {
"radius" : 0.195,
"radius" : 0.2,
"densityDependentSpeed" : false,
"speedDistributionMean" : 1.55,
"speedDistributionStandardDeviation" : 0.26,
"speedDistributionStandardDeviation" : 0.15,
"minimumSpeed" : 1.37,
"maximumSpeed" : 1.73,
"acceleration" : 2.0
......
......@@ -192,32 +192,32 @@
"targetAttractionStrength" : 1.0,
"timeCostAttributes" : {
"standardDeviation" : 0.7,
"type" : "OBSTACLES",
"obstacleDensityWeight" : 3.5,
"type" : "UNIT",
"obstacleDensityWeight" : 0.0,
"pedestrianSameTargetDensityWeight" : 3.5,
"pedestrianOtherTargetDensityWeight" : 3.5,
"pedestrianWeight" : 3.5,
"queueWidthLoading" : 1.0,
"queueWidthLoading" : 0.1,
"pedestrianDynamicWeight" : 6.0,
"loadingType" : "CONSTANT"
}
},
"org.vadere.state.attributes.models.AttributesOSM" : {
"stepCircleResolution" : 4,
"numberOfCircles" : 1,
"optimizationType" : "NELDER_MEAD",
"stepCircleResolution" : 30,
"numberOfCircles" : 6,
"optimizationType" : "DISCRETE",
"varyStepDirection" : true,
"movementType" : "ARBITRARY",
"stepLengthIntercept" : 0.4625,
"stepLengthSlopeSpeed" : 0.2345,
"stepLengthSD" : 0.0,
"movementThreshold" : 0.0,
"minStepLength" : 0.3,
"minStepLength" : 0.1,
"minimumStepLength" : true,
"maxStepDuration" : 1.7976931348623157E308,
"dynamicStepLength" : false,
"updateType" : "EVENT_DRIVEN",
"seeSmallWalls" : false,
"seeSmallWalls" : true,
"targetPotentialModel" : "org.vadere.simulator.models.potential.fields.PotentialFieldTargetGrid",
"pedestrianPotentialModel" : "org.vadere.simulator.models.potential.PotentialFieldPedestrianCompactSoftshell",
"obstaclePotentialModel" : "org.vadere.simulator.models.potential.PotentialFieldObstacleCompactSoftshell",
......@@ -226,12 +226,12 @@
"org.vadere.state.attributes.models.AttributesPotentialCompactSoftshell" : {
"pedPotentialIntimateSpaceWidth" : 0.45,
"pedPotentialPersonalSpaceWidth" : 1.2,
"pedPotentialHeight" : 50.0,
"pedPotentialHeight" : 35.0,
"obstPotentialWidth" : 0.8,
"obstPotentialHeight" : 6.0,
"intimateSpaceFactor" : 1.2,
"obstPotentialHeight" : 4.0,
"intimateSpaceFactor" : 2.0,
"personalSpacePower" : 1,
"intimateSpacePower" : 1
"intimateSpacePower" : 2
}
},
"attributesSimulation" : {
......@@ -340,12 +340,13 @@
"startingWithRedLight" : false,
"nextSpeed" : -1.0
} ],
"absorbingAreas" : [ ],
"sources" : [ {
"id" : -1,
"shape" : {
"x" : 0.8,
"y" : 6.4,
"width" : 15.0,
"width" : 10.0,
"height" : 8.0,
"type" : "RECTANGLE"
},
......@@ -363,10 +364,10 @@
} ],
"dynamicElements" : [ ],
"attributesPedestrian" : {
"radius" : 0.195,
"radius" : 0.2,
"densityDependentSpeed" : false,
"speedDistributionMean" : 1.55,
"speedDistributionStandardDeviation" : 0.26,
"speedDistributionStandardDeviation" : 0.15,
"minimumSpeed" : 1.37,
"maximumSpeed" : 1.73,
"acceleration" : 2.0
......
{
"name" : "C-060-180-180_long",
"name" : "C-060-180-180_Q",
"description" : "",
"release" : "0.7",
"processWriters" : {
......@@ -192,32 +192,32 @@
"targetAttractionStrength" : 1.0,
"timeCostAttributes" : {