}, new double[] { 32, 23, 33, 31 });
NonLinearConjugateGradientOptimizer optimizer
= new NonLinearConjugateGradientOptimizer(NonLinearConjugateGradientOptimizer.Formula.POLAK_RIBIERE,
new SimpleValueChecker(1e-13, 1e-13),
1e-15, 1e-15, 1);
PointValuePair optimum1
= optimizer.optimize(new MaxEval(200),
problem1.getObjectiveFunction(),
problem1.getObjectiveFunctionGradient(),
GoalType.MINIMIZE,
new InitialGuess(new double[] { 0, 1, 2, 3 }));
Assert.assertEquals(1.0, optimum1.getPoint()[0], 1.0e-4);
Assert.assertEquals(1.0, optimum1.getPoint()[1], 1.0e-3);
Assert.assertEquals(1.0, optimum1.getPoint()[2], 1.0e-4);
Assert.assertEquals(1.0, optimum1.getPoint()[3], 1.0e-4);
LinearProblem problem2 = new LinearProblem(new double[][] {
{ 10.00, 7.00, 8.10, 7.20 },
{ 7.08, 5.04, 6.00, 5.00 },
{ 8.00, 5.98, 9.89, 9.00 },
{ 6.99, 4.99, 9.00, 9.98 }
}, new double[] { 32, 23, 33, 31 });
PointValuePair optimum2
= optimizer.optimize(new MaxEval(200),
problem2.getObjectiveFunction(),
problem2.getObjectiveFunctionGradient(),
GoalType.MINIMIZE,
new InitialGuess(new double[] { 0, 1, 2, 3 }));
final double[] result2 = optimum2.getPoint();
final double[] expected2 = {-81, 137, -34, 22};
Assert.assertEquals(expected2[0], result2[0], 2);
Assert.assertEquals(expected2[1], result2[1], 4);
Assert.assertEquals(expected2[2], result2[2], 1);