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

Commit 8a297938 authored by Daniel Lehmberg's avatar Daniel Lehmberg
Browse files

finalize computing the metric and setting the metric bounds

parent a9f6a29e
Pipeline #131439 failed with stages
in 68 minutes and 41 seconds
......@@ -12,14 +12,14 @@
"expectedResult" : "SUCCESS",
"optimizationMetricProcessorId" : 2,
"testEvacuationProcessorId" : 3,
"maxMeanPointDistance" : 0.11587864045699435,
"maxMeanDifferenceFuncValue" : 0.04361768439961036,
"maxMeanPointDistance" : 0.11637874817308734,
"maxMeanDifferenceFuncValue" : 0.04086533272032428,
"infoMinPointDistanceL2" : 0.0,
"infoMaxPointDistanceL2" : 1.3811487909016231,
"infoMinFuncDifference" : -5.75750936526731E-6,
"infoMaxFuncDifference" : 0.6140615296568299,
"infoStddevPointDistance" : 0.13855327312344268,
"infoStddevDifferenceFuncValue" : 0.05671472149876091
"infoMaxPointDistanceL2" : 1.4027595875238072,
"infoMinFuncDifference" : -6.450105858060162E-4,
"infoMaxFuncDifference" : 0.8011193645851016,
"infoStddevPointDistance" : 0.14227951170241054,
"infoStddevDifferenceFuncValue" : 0.054445311463520295
}
}, {
"type" : "org.vadere.simulator.projects.dataprocessing.processor.PedestrianMetricOptimizationProcessor",
......@@ -118,8 +118,8 @@
"printFPS" : false,
"digitsPerCoordinate" : 2,
"useFixedSeed" : true,
"fixedSeed" : 6138355022448163583,
"simulationSeed" : 6138355022448163583,
"fixedSeed" : 1,
"simulationSeed" : 1,
"useSalientBehavior" : false
},
"topography" : {
......
......@@ -12,14 +12,14 @@
"expectedResult" : "SUCCESS",
"optimizationMetricProcessorId" : 2,
"testEvacuationProcessorId" : 3,
"maxMeanPointDistance" : 0.10747320917296704,
"maxMeanDifferenceFuncValue" : 0.06089881379635064,
"maxMeanPointDistance" : 0.12097956548754923,
"maxMeanDifferenceFuncValue" : 0.06502552049091297,
"infoMinPointDistanceL2" : 0.0,
"infoMaxPointDistanceL2" : 1.050866878969745,
"infoMinFuncDifference" : -9.391696791638537E-5,
"infoMaxFuncDifference" : 1.2287247872104103,
"infoStddevPointDistance" : 0.1585299970292929,
"infoStddevDifferenceFuncValue" : 0.07793837122135712
"infoMaxPointDistanceL2" : 1.3058118129359295,
"infoMinFuncDifference" : -0.0012764912109695103,
"infoMaxFuncDifference" : 0.5078355644650969,
"infoStddevPointDistance" : 0.18731508797737528,
"infoStddevDifferenceFuncValue" : 0.0836097016329198
}
}, {
"type" : "org.vadere.simulator.projects.dataprocessing.processor.PedestrianMetricOptimizationProcessor",
......@@ -118,8 +118,8 @@
"printFPS" : false,
"digitsPerCoordinate" : 2,
"useFixedSeed" : true,
"fixedSeed" : -3213925745664992646,
"simulationSeed" : 0,
"fixedSeed" : 1,
"simulationSeed" : 1,
"useSalientBehavior" : false
},
"topography" : {
......@@ -141,7 +141,7 @@
"height" : 1.0,
"type" : "RECTANGLE"
},
"id" : -1
"id" : 3
}, {
"shape" : {
"x" : 1.3,
......@@ -150,7 +150,7 @@
"height" : 1.0,
"type" : "RECTANGLE"
},
"id" : -1
"id" : 4
}, {
"shape" : {
"x" : 1.3,
......@@ -159,7 +159,7 @@
"height" : 19.5,
"type" : "RECTANGLE"
},
"id" : -1
"id" : 5
}, {
"shape" : {
"x" : 1.3,
......@@ -168,7 +168,7 @@
"height" : 1.0,
"type" : "RECTANGLE"
},
"id" : -1
"id" : 6
}, {
"shape" : {
"x" : 32.5,
......@@ -177,7 +177,7 @@
"height" : 13.8,
"type" : "RECTANGLE"
},
"id" : -1
"id" : 7
}, {
"shape" : {
"x" : 3.1,
......@@ -186,7 +186,7 @@
"height" : 1.0,
"type" : "RECTANGLE"
},
"id" : -1
"id" : 8
}, {
"shape" : {
"x" : 3.1,
......@@ -195,7 +195,7 @@
"height" : 15.8,
"type" : "RECTANGLE"
},
"id" : -1
"id" : 9
}, {
"shape" : {
"x" : 3.1,
......@@ -204,7 +204,7 @@
"height" : 1.0,
"type" : "RECTANGLE"
},
"id" : -1
"id" : 10
}, {
"shape" : {
"x" : 24.1,
......@@ -213,7 +213,7 @@
"height" : 11.0,
"type" : "RECTANGLE"
},
"id" : -1
"id" : 11
}, {
"shape" : {
"x" : 20.1,
......@@ -222,7 +222,7 @@
"height" : 11.4,
"type" : "RECTANGLE"
},
"id" : -1
"id" : 12
} ],
"measurementAreas" : [ ],
"stairs" : [ ],
......@@ -246,7 +246,7 @@
} ],
"absorbingAreas" : [ ],
"sources" : [ {
"id" : -1,
"id" : 2,
"shape" : {
"x" : 16.0,
"y" : 2.0,
......
......@@ -12,14 +12,14 @@
"expectedResult" : "SUCCESS",
"optimizationMetricProcessorId" : 2,
"testEvacuationProcessorId" : 3,
"maxMeanPointDistance" : 0.10320735815457976,
"maxMeanDifferenceFuncValue" : 0.06573000624569796,
"infoMinPointDistanceL2" : 0.0,
"infoMaxPointDistanceL2" : 1.4137730000637334,
"infoMinFuncDifference" : -0.0061021424381255684,
"infoMaxFuncDifference" : 3.1035982147173797,
"infoStddevPointDistance" : 0.1390008307897397,
"infoStddevDifferenceFuncValue" : 0.1659699405499854
"maxMeanPointDistance" : 0.10117727754291686,
"maxMeanDifferenceFuncValue" : 0.06578728725037036,
"infoMinPointDistanceL2" : 1.9860273225978185E-15,
"infoMaxPointDistanceL2" : 1.381287718714383,
"infoMinFuncDifference" : -0.004389072407133376,
"infoMaxFuncDifference" : 2.685622269103443,
"infoStddevPointDistance" : 0.14060838183188207,
"infoStddevDifferenceFuncValue" : 0.1714766405903272
}
}, {
"type" : "org.vadere.simulator.projects.dataprocessing.processor.PedestrianMetricOptimizationProcessor",
......@@ -61,7 +61,7 @@
"org.vadere.state.attributes.models.AttributesOSM" : {
"stepCircleResolution" : 4,
"numberOfCircles" : 1,
"optimizationType" : "NELDER_MEAD_CIRCLE",
"optimizationType" : "NELDER_MEAD",
"varyStepDirection" : true,
"movementType" : "ARBITRARY",
"stepLengthIntercept" : 0.4625,
......@@ -118,7 +118,7 @@
"printFPS" : false,
"digitsPerCoordinate" : 2,
"useFixedSeed" : true,
"fixedSeed" : 3213925745664992646,
"fixedSeed" : 1,
"simulationSeed" : 1,
"useSalientBehavior" : false
},
......@@ -150,7 +150,7 @@
"y" : 5.0
} ]
},
"id" : -1
"id" : 3
}, {
"shape" : {
"type" : "POLYGON",
......@@ -168,7 +168,7 @@
"y" : 5.0
} ]
},
"id" : -1
"id" : 4
}, {
"shape" : {
"type" : "POLYGON",
......@@ -198,7 +198,7 @@
"y" : 15.600000000000001
} ]
},
"id" : -1
"id" : 5
} ],
"measurementAreas" : [ ],
"stairs" : [ ],
......@@ -222,7 +222,7 @@
} ],
"absorbingAreas" : [ ],
"sources" : [ {
"id" : -1,
"id" : 2,
"shape" : {
"x" : 2.5,
"y" : 8.0,
......
......@@ -12,14 +12,14 @@
"expectedResult" : "SUCCESS",
"optimizationMetricProcessorId" : 2,
"testEvacuationProcessorId" : 3,
"maxMeanPointDistance" : 0.10022407400619819,
"maxMeanDifferenceFuncValue" : 0.0290377478254851,
"infoMinPointDistanceL2" : 0.0013923666721278889,
"infoMaxPointDistanceL2" : 0.8023722950469786,
"infoMinFuncDifference" : 5.782711474324742E-4,
"infoMaxFuncDifference" : 0.25073794045603925,
"infoStddevPointDistance" : 0.06922123874051399,
"infoStddevDifferenceFuncValue" : 0.02692125553243474
"maxMeanPointDistance" : 0.10834411214886479,
"maxMeanDifferenceFuncValue" : 0.028939284596679084,
"infoMinPointDistanceL2" : 0.0047852776238586315,
"infoMaxPointDistanceL2" : 0.5644439334256358,
"infoMinFuncDifference" : 1.0201430488976371E-4,
"infoMaxFuncDifference" : 0.18037735004502053,
"infoStddevPointDistance" : 0.06414657689116453,
"infoStddevDifferenceFuncValue" : 0.023724652000537107
}
}, {
"type" : "org.vadere.simulator.projects.dataprocessing.processor.PedestrianMetricOptimizationProcessor",
......@@ -118,8 +118,8 @@
"printFPS" : false,
"digitsPerCoordinate" : 2,
"useFixedSeed" : true,
"fixedSeed" : -3213925745664992646,
"simulationSeed" : 0,
"fixedSeed" : 1,
"simulationSeed" : 1,
"useSalientBehavior" : false
},
"topography" : {
......@@ -204,7 +204,7 @@
"y" : 49.5
} ]
},
"id" : -1
"id" : 4
} ],
"measurementAreas" : [ ],
"stairs" : [ ],
......@@ -237,7 +237,7 @@
} ],
"absorbingAreas" : [ ],
"sources" : [ {
"id" : -1,
"id" : 3,
"shape" : {
"x" : 24.300000000046566,
"y" : 44.5,
......
......@@ -2,7 +2,6 @@ package org.vadere.simulator.models.osm.optimization;
import java.awt.Shape;
import java.util.ArrayList;
import java.util.Random;
import org.vadere.simulator.models.osm.PedestrianOSM;
import org.vadere.util.config.VadereConfig;
......@@ -26,7 +25,7 @@ public abstract class StepCircleOptimizer {
protected StepCircleOptimizer(){
this.computeMetric = VadereConfig.getConfig().getBoolean("Testing.compareBruteForceSolution");
this.computeMetric = VadereConfig.getConfig().getBoolean("Testing.stepCircleOptimization.compareBruteForceSolution");
if(this.computeMetric){
this.currentMetricValues = new ArrayList<>();
......@@ -62,9 +61,8 @@ public abstract class StepCircleOptimizer {
final SolutionPair foundSolution){
var bruteForceSolution = new
StepCircleOptimizerDiscrete(0.0, new Random()).computeBruteForceSolution(pedestrian);
StepCircleOptimizerDiscrete(0.0, null).computeBruteForceSolution(pedestrian);
// TODO: maybe time of nextStep is not the actual correct one, possibly adapt , see #242 and !66
var optimizationMetric = new OptimizationMetric(pedestrian.getId(), pedestrian.getTimeOfNextStep(),
bruteForceSolution.point, bruteForceSolution.funcValue, foundSolution.point, foundSolution.funcValue);
......
......@@ -27,7 +27,7 @@ public class StepCircleOptimizerDiscrete extends StepCircleOptimizer {
private final Random random;
private final static Logger log = Logger.getLogger(StepCircleOptimizerDiscrete.class);
public StepCircleOptimizerDiscrete(final double movementThreshold, @NotNull final Random random) {
public StepCircleOptimizerDiscrete(final double movementThreshold, final Random random) {
this.movementThreshold = movementThreshold;
this.random = random;
}
......@@ -62,9 +62,14 @@ public class StepCircleOptimizerDiscrete extends StepCircleOptimizer {
try {
currentPotential = potentialEvaluationFunction.getPotential(currentPosition);
// DL: it is not exactly clear how this condition works (where is the value 0.0001 coming from?, Why
// is there a random boolean?
boolean fineTuneCondition = (Math.abs(currentPotential - potential) <= 0.0001 && random.nextBoolean());
boolean fineTuneCondition;
if(bruteForce){
fineTuneCondition = false;
}else{
// DL: it is not exactly clear how this condition works (where is the value 0.0001 coming from?, Why
// is there a random boolean?
fineTuneCondition = (Math.abs(currentPotential - potential) <= 0.0001 && random.nextBoolean());
}
if(bruteForce && currentPotential < potential) {
potential = currentPotential;
......
......@@ -6,28 +6,15 @@ import org.vadere.simulator.control.SimulationState;
import org.vadere.simulator.models.osm.optimization.OptimizationMetric;
import org.vadere.simulator.projects.dataprocessing.ProcessorManager;
import org.vadere.simulator.projects.dataprocessing.datakey.EventtimePedestrianIdKey;
import org.vadere.simulator.projects.dataprocessing.datakey.PedestrianIdKey;
import org.vadere.simulator.projects.dataprocessing.processor.PedestrianEvacuationTimeProcessor;
import org.vadere.simulator.projects.dataprocessing.processor.PedestrianMetricOptimizationProcessor;
import org.vadere.simulator.projects.migration.MigrationLogger;
import org.vadere.state.attributes.processor.AttributesTestNumberOverlapsProcessor;
import org.vadere.state.attributes.processor.AttributesTestOptimizationMetricProcessor;
import org.vadere.state.attributes.processor.AttributesTestPedestrianEvacuationTimeProcessor;
import org.vadere.util.geometry.shapes.VPoint;
import org.vadere.util.logging.Logger;
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import static java.util.Map.entry;
/**
*
*
*/
@DataProcessorClass()
public class TestOptimizationMetricNelderMeadProcessor extends TestProcessor {
......@@ -148,6 +135,12 @@ public class TestOptimizationMetricNelderMeadProcessor extends TestProcessor {
System.out.println("INFORMATION FROM TestOptimizationMetricNelderMeadProcessor");
System.out.println();
System.out.println("Main metric:");
System.out.println(getCompareValuesString("mean function difference", statistics.get("meanDifferenceFuncValue"), attr.getMaxMeanDifferenceFuncValue()));
System.out.println(getCompareValuesString("mean point distance", statistics.get("meanPointDistance"), attr.getMaxMeanPointDistance()));
System.out.println();
System.out.println("Further information:");
System.out.println(getCompareValuesString("minimum point distance", statistics.get("minPointDistanceL2"), attr.getInfoMinPointDistanceL2()));
System.out.println(getCompareValuesString("maximum point distance", statistics.get("maxPointDistanceL2"), attr.getInfoMaxPointDistanceL2()));
System.out.println(getCompareValuesString("standard deviation point distance", statistics.get("stddevPointDistance"), attr.getInfoStddevPointDistance()));
......@@ -156,6 +149,17 @@ public class TestOptimizationMetricNelderMeadProcessor extends TestProcessor {
System.out.println(getCompareValuesString("maximum function difference", statistics.get("maxDifferenceFuncValue"), attr.getInfoMaxFuncDifference()));
System.out.println(getCompareValuesString("standard deviation function difference", statistics.get("stddevDifferenceFuncValue"), attr.getInfoStddevDifferenceFuncValue()));
System.out.println("\n In JSON format (for copying into TestProcessor");
System.out.println("\"maxMeanPointDistance\" : " + statistics.get("meanPointDistance") + ",");
System.out.println("\"maxMeanDifferenceFuncValue\" : " + statistics.get("meanDifferenceFuncValue") + ",");
System.out.println("\"infoMinPointDistanceL2\" : " + statistics.get("minPointDistanceL2") + ",");
System.out.println("\"infoMaxPointDistanceL2\" : " + statistics.get("maxPointDistanceL2") + ",");
System.out.println("\"infoMinFuncDifference\" : " + statistics.get("minDifferenceFuncValue") + ",");
System.out.println("\"infoMaxFuncDifference\" : " + statistics.get("maxDifferenceFuncValue") + ",");
System.out.println("\"infoStddevPointDistance\" : " + statistics.get("stddevPointDistance") + ",");
System.out.println("\"infoStddevDifferenceFuncValue\" : " + statistics.get("stddevDifferenceFuncValue"));
System.out.println("######################################################################################");
System.out.println("######################################################################################");
......
......@@ -152,7 +152,7 @@ public class VadereConfig {
defaultConfig.put("SettingsDialog.outputDirectory.path", ".");
defaultConfig.put("SettingsDialog.snapshotDirectory.path", ".");
defaultConfig.put("SettingsDialog.showLogo", "false");
defaultConfig.put("Testing.compareBruteForceSolution", "false");
defaultConfig.put("Testing.stepCircleOptimization.compareBruteForceSolution", "false");
defaultConfig.put("TopographyCreator.dotRadius", "0.5");
return defaultConfig;
......
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