new ObjectiveFunction(fitnessFunction),
GoalType.MINIMIZE,
SimpleBounds.unbounded(1),
new CMAESOptimizer.PopulationSize(5),
new CMAESOptimizer.Sigma(new double[] { 1e-1 }),
new InitialGuess(start));
final double resNoBound = result.getPoint()[0];
// Optimum is near the lower bound.
final double[] lower = { -20 };
final double[] upper = { 5e16 };
final double[] sigma = { 10 };
result = optimizer.optimize(new MaxEval(100000),
new ObjectiveFunction(fitnessFunction),
GoalType.MINIMIZE,
new CMAESOptimizer.PopulationSize(5),
new CMAESOptimizer.Sigma(sigma),
new InitialGuess(start),
new SimpleBounds(lower, upper));
final double resNearLo = result.getPoint()[0];
// Optimum is near the upper bound.
lower[0] = -5e16;
upper[0] = 20;
result = optimizer.optimize(new MaxEval(100000),
new ObjectiveFunction(fitnessFunction),
GoalType.MINIMIZE,
new CMAESOptimizer.PopulationSize(5),
new CMAESOptimizer.Sigma(sigma),
new InitialGuess(start),
new SimpleBounds(lower, upper));
final double resNearHi = result.getPoint()[0];
// System.out.println("resNoBound=" + resNoBound +
// " resNearLo=" + resNearLo +