{ 7.0, 5.0, 9.0, 10.0 }
}, new double[] { 32, 23, 33, 31 });
GaussNewtonOptimizer optimizer = new GaussNewtonOptimizer(true);
optimizer.setMaxIterations(100);
optimizer.setConvergenceChecker(new SimpleVectorialValueChecker(1.0e-6, 1.0e-6));
VectorialPointValuePair optimum1 =
optimizer.optimize(problem1, problem1.target, new double[] { 1, 1, 1, 1 },
new double[] { 0, 1, 2, 3 });
assertEquals(0, optimizer.getRMS(), 1.0e-10);
assertEquals(1.0, optimum1.getPoint()[0], 1.0e-10);
assertEquals(1.0, optimum1.getPoint()[1], 1.0e-10);
assertEquals(1.0, optimum1.getPoint()[2], 1.0e-10);
assertEquals(1.0, optimum1.getPoint()[3], 1.0e-10);
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 });
VectorialPointValuePair optimum2 =
optimizer.optimize(problem2, problem2.target, new double[] { 1, 1, 1, 1 },
new double[] { 0, 1, 2, 3 });
assertEquals(0, optimizer.getRMS(), 1.0e-10);
assertEquals(-81.0, optimum2.getPoint()[0], 1.0e-8);
assertEquals(137.0, optimum2.getPoint()[1], 1.0e-8);
assertEquals(-34.0, optimum2.getPoint()[2], 1.0e-8);
assertEquals( 22.0, optimum2.getPoint()[3], 1.0e-8);
}