Use message supplier

This commit is contained in:
aherbert 2022-06-07 15:38:40 +01:00
parent 5a536c851a
commit 8ffc31a0fe
1 changed files with 5 additions and 3 deletions

View File

@ -226,13 +226,13 @@ public class SimplexOptimizerTest {
final double funcValue = result.getValue(); final double funcValue = result.getValue();
final double dist = MathArrays.distance(optimum, endPoint); final double dist = MathArrays.distance(optimum, endPoint);
Assertions.assertEquals(0d, dist, pointTolerance, Assertions.assertEquals(0d, dist, pointTolerance,
name + ": distance to optimum" + () -> name + ": distance to optimum" +
" f(" + Arrays.toString(endPoint) + ")=" + " f(" + Arrays.toString(endPoint) + ")=" +
funcValue); funcValue);
final int nEval = optim.getEvaluations(); final int nEval = optim.getEvaluations();
Assertions.assertTrue(nEval < functionEvaluations, Assertions.assertTrue(nEval < functionEvaluations,
name + ": nEval=" + nEval); () -> name + ": nEval=" + nEval);
} }
/** /**
@ -378,8 +378,10 @@ public class SimplexOptimizerTest {
} }
final double tol = 1e-15; final double tol = 1e-15;
final double[] point = minPoint;
final double value = minValue;
Assertions.assertArrayEquals(optimum, minPoint, tol, Assertions.assertArrayEquals(optimum, minPoint, tol,
"Minimum: f(" + Arrays.toString(minPoint) + ")=" + minValue); () -> "Minimum: f(" + Arrays.toString(point) + ")=" + value);
} }
/** /**