// fails because MultiDirectional.iterateSimplex is looping forever
// the while(true) should be replaced with a convergence check
SimplexOptimizer optimizer = new SimplexOptimizer(1e-14, 1e-14);
optimizer.setSimplex(new MultiDirectionalSimplex(2));
final Gaussian2D function = new Gaussian2D(0, 0, 1);
PointValuePair estimate = optimizer.optimize(1000, function,
GoalType.MAXIMIZE, function.getMaximumPosition());
final double EPSILON = 1e-5;
final double expectedMaximum = function.getMaximum();
final double actualMaximum = estimate.getValue();
Assert.assertEquals(expectedMaximum, actualMaximum, EPSILON);
final double[] expectedPosition = function.getMaximumPosition();
final double[] actualPosition = estimate.getPoint();
Assert.assertEquals(expectedPosition[0], actualPosition[0], EPSILON );
Assert.assertEquals(expectedPosition[1], actualPosition[1], EPSILON );
}