Commit ab209b7c authored by Benedikt Zoennchen's avatar Benedikt Zoennchen
Browse files

remove magic numbers in NelderMeadConvergenceChecker.java.

parent 3c6a10c9
Pipeline #68123 passed with stages
in 58 minutes and 43 seconds
......@@ -24,6 +24,8 @@ public class NelderMeadConvergenceChecker implements RealConvergenceChecker {
private int dimension;
private final int maxIterations;
/**
* Instantiates a new convergence checker for NelderMead.
*/
......@@ -34,6 +36,7 @@ public class NelderMeadConvergenceChecker implements RealConvergenceChecker {
prev = new RealPointValuePair[dimension];
curr = new RealPointValuePair[dimension];
index = 0;
maxIterations = 100;
}
@Override
......@@ -59,7 +62,7 @@ public class NelderMeadConvergenceChecker implements RealConvergenceChecker {
for (int i = 0; i < dimension; i++) {
value += Math.pow(curr[i].getValue() - meanValue, 2);
}
return (value / dimension < threshold || iteration > 100); // earlier 1000 => change to parameter
return (value / dimension < threshold || iteration > maxIterations); // earlier 1000 => change to parameter
} else {
return true;
}
......
......@@ -2,11 +2,9 @@ package org.vadere.util.geometry;
import java.awt.geom.Path2D;
import java.awt.geom.Point2D;
import java.awt.geom.Rectangle2D;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import java.util.Random;
......@@ -79,6 +77,7 @@ public class GeometryUtils {
reachablePositions.add(tmpPos);
}
}
return reachablePositions;
}
......
Supports Markdown
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