@Test
public void testQuinticMin() {
// The function has local minima at -0.27195613 and 0.82221643.
UnivariateFunction f = new QuinticFunction();
UnivariateOptimizer optimizer = new BrentOptimizer(1e-10, 1e-14);
Assert.assertEquals(-0.27195613, optimizer.optimize(new MaxEval(200),
new UnivariateObjectiveFunction(f),
GoalType.MINIMIZE,
new SearchInterval(-0.3, -0.2)).getPoint(), 1.0e-8);
Assert.assertEquals( 0.82221643, optimizer.optimize(new MaxEval(200),
new UnivariateObjectiveFunction(f),
GoalType.MINIMIZE,
new SearchInterval(0.3, 0.9)).getPoint(), 1.0e-8);
Assert.assertTrue(optimizer.getEvaluations() <= 50);
// search in a large interval
Assert.assertEquals(-0.27195613, optimizer.optimize(new MaxEval(200),
new UnivariateObjectiveFunction(f),
GoalType.MINIMIZE,
new SearchInterval(-1.0, 0.2)).getPoint(), 1.0e-8);
Assert.assertTrue(optimizer.getEvaluations() <= 50);
}