{ 7, 5, 6, 5 },
{ 8, 6, 10, 9 },
{ 7, 5, 9, 10 }
}, new double[] { 32, 23, 33, 31 });
AbstractLeastSquaresOptimizer optimizer = createOptimizer();
PointVectorValuePair optimum1 =
optimizer.optimize(new MaxEval(100),
problem1.getModelFunction(),
problem1.getModelFunctionJacobian(),
problem1.getTarget(),
new Weight(new double[] { 1, 1, 1, 1 }),
new InitialGuess(new double[] { 0, 1, 2, 3 }));
Assert.assertEquals(0, optimizer.getRMS(), 1e-10);
Assert.assertEquals(1, optimum1.getPoint()[0], 1e-10);
Assert.assertEquals(1, optimum1.getPoint()[1], 1e-10);
Assert.assertEquals(1, optimum1.getPoint()[2], 1e-10);
Assert.assertEquals(1, optimum1.getPoint()[3], 1e-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 });
PointVectorValuePair optimum2 =
optimizer.optimize(new MaxEval(100),
problem2.getModelFunction(),
problem2.getModelFunctionJacobian(),
problem2.getTarget(),
new Weight(new double[] { 1, 1, 1, 1 }),
new InitialGuess(new double[] { 0, 1, 2, 3 }));
Assert.assertEquals(0, optimizer.getRMS(), 1e-10);
Assert.assertEquals(-81, optimum2.getPoint()[0], 1e-8);
Assert.assertEquals(137, optimum2.getPoint()[1], 1e-8);
Assert.assertEquals(-34, optimum2.getPoint()[2], 1e-8);
Assert.assertEquals( 22, optimum2.getPoint()[3], 1e-8);
}