Commit d668add0 authored by Daniel Lehmberg's avatar Daniel Lehmberg
Browse files

adapt Nelder mead tests that appear after bugfixes in commit...

adapt Nelder mead tests that appear after bugfixes in commit 65f369b8 (minor changes)
parent ceb5b820
......@@ -256,12 +256,7 @@ if __name__ == "__main__":
if args.scenario is None:
passed_and_failed_scenarios_model = run_all_model_tests()
if not result_dict_has_failed_tests(passed_and_failed_scenarios_model):
passed_and_failed_scenarios_optimization = run_all_optimization_tests()
else:
print("Skipping optimization tests...")
passed_and_failed_scenarios_optimization = {"failed": [], "passed": [], "failed_summary": []} # empty
passed_and_failed_scenarios_optimization = run_all_optimization_tests()
# Make a summery of all scenario files
all_passed_and_failed_scenarios = result_dict_merge(passed_and_failed_scenarios_model,
......
......@@ -12,14 +12,14 @@
"expectedResult" : "SUCCESS",
"optimizationMetricProcessorId" : 2,
"testEvacuationProcessorId" : 3,
"maxMeanPointDistance" : 0.07522399192836575,
"maxMeanDifferenceFuncValue" : 0.023848826871958207,
"maxMeanPointDistance" : 0.07720166933228925,
"maxMeanDifferenceFuncValue" : 0.02530975248920717,
"infoMinPointDistanceL2" : 0.0,
"infoMaxPointDistanceL2" : 1.564386140233547,
"infoMinFuncDifference" : -7.357495880544462E-6,
"infoMaxFuncDifference" : 0.33222591981368765,
"infoStddevPointDistance" : 0.09544596760319345,
"infoStddevDifferenceFuncValue" : 0.0336543527990736
"infoMaxPointDistanceL2" : 1.243960344866288,
"infoMinFuncDifference" : -6.8591881827728685E-6,
"infoMaxFuncDifference" : 0.2874895188283819,
"infoStddevPointDistance" : 0.10083846350068452,
"infoStddevDifferenceFuncValue" : 0.032918942463911124
}
}, {
"type" : "org.vadere.simulator.projects.dataprocessing.processor.PedestrianMetricOptimizationProcessor",
......
......@@ -12,14 +12,14 @@
"expectedResult" : "SUCCESS",
"optimizationMetricProcessorId" : 2,
"testEvacuationProcessorId" : 3,
"maxMeanPointDistance" : 0.06743253584052734,
"maxMeanDifferenceFuncValue" : 0.03762845011019873,
"maxMeanPointDistance" : 0.0709316978693857,
"maxMeanDifferenceFuncValue" : 0.034637431592363405,
"infoMinPointDistanceL2" : 0.0,
"infoMaxPointDistanceL2" : 1.1908766074958799,
"infoMinFuncDifference" : -0.007825774248588324,
"infoMaxFuncDifference" : 3.1836042315887085,
"infoStddevPointDistance" : 0.11888918094737598,
"infoStddevDifferenceFuncValue" : 0.14690668533173323
"infoMaxPointDistanceL2" : 1.326056350852655,
"infoMinFuncDifference" : -0.010140720593533104,
"infoMaxFuncDifference" : 2.113085584226426,
"infoStddevPointDistance" : 0.12198739340543781,
"infoStddevDifferenceFuncValue" : 0.09742478889202222
}
}, {
"type" : "org.vadere.simulator.projects.dataprocessing.processor.PedestrianMetricOptimizationProcessor",
......
......@@ -124,24 +124,26 @@ public final class FootStep {
return intersectionTime;
}
static public VPoint interpolateFootStep(FootStep footStep, double time){
double startTime = footStep.getStartTime();
double endTime = footStep.getEndTime();
double duration = footStep.duration();
static public VPoint interpolateFootStep(final FootStep footStep, final double time){
final double startTime = footStep.getStartTime();
final double endTime = footStep.getEndTime();
final double duration = footStep.duration();
if(startTime > time || endTime < time || startTime < 0 ){
throw new IllegalArgumentException("Requested time " + time + " outside of valid region. Outside of " +
"FootStep [start=" + startTime + ", end=" + endTime + "] time (no extrapolation!) or smaller than " +
"zero;");
throw new IllegalArgumentException("Requested time " + time + " outside of valid time " +
"region (no extrapolation!). Value outside of FootStep " +
"[start=" + startTime + ", end=" + endTime + "] time or smaller than zero. " +
"\n FootStep=" + footStep.toString());
}
VPoint interpolationResult;
if(duration < 1E-14){
// to avoid problems with division by very small number, simply return the start point
// to avoid problems with division by "very small number", simply return the start point
interpolationResult = footStep.getStart();
}else{
double linearTime = (time - startTime) / duration;
VPoint diffPoint = footStep.getEnd().subtract(footStep.getStart());
diffPoint.x = diffPoint.x * linearTime;
......@@ -156,7 +158,7 @@ public final class FootStep {
@Override
public String toString() {
return start + "->" + end;
return "start=" + start + "(t=" + startTime + ")" + "->" + "end=" + end + "(t=" + endTime + ")";
}
@Override
......
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