Hi Luc, Luc Maisonobe wrote:
> Jörg Schaible a écrit : >> Hi Luc, >> [snip] >> we're definitely on the right track. After changing the loop in >> TestProblem3 the tests run through. However, now I have two failing >> tests: > > The two tests are in fact the same test repeated. The first occurrence > is in the deprecated package estimation which will be removed at some > point in the future and the second test is in the new > optimization.general package. > > Could you change in the MinPackTest.java from either package the > checkTheoreticalMinCost method to add a print statement as in the > example below and send the result you get when running MinPackTest ? > > > public boolean checkTheoreticalMinCost(double rms) { > double threshold = costAccuracy * (1.0 + theoreticalMinCost); > if (Math.abs(Math.sqrt(m) * rms - theoreticalMinCost) > threshold) { > System.out.println("rms = " + rms + > ", m = " + m + > ", sqrt(m)*rms = " + > Math.abs(Math.sqrt(m) * rms) + > ", threshold = " + threshold + > ", delta = " + > Math.abs(Math.sqrt(m) * rms - > theoreticalMinCost)); > } > return Math.abs(Math.sqrt(m) * rms - theoreticalMinCost) <= > threshold; > } > > I guess I simply put too tight thresholds in the tests and that > numerical instability or different optimizations in JVMs may change the > result and break the test. The previous print statement would allow me > to compare the numerical values with what I get here and decide if the > results are acceptable and the test threshold must be enlarged or if > there is a real problem here. rms = 65.50657291427613, m = 20, sqrt(m)*rms = 292.9543000187359, threshold = 2.93954306151134E-6, delta = 6.132398084446322E-6 Hope this helps, Jörg --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org For additional commands, e-mail: dev-h...@commons.apache.org