@Ignore @Test(timeout = 5 * 60 * 1000) public final void testDeJong_big() { final int dim = 40; final double bound = 100; long start = System.currentTimeMillis(); FunctionNEW f = new Function_DeJong_nD(dim); System.out.println(System.currentTimeMillis() - start); /* * 20 40 80 160 * 600 2500 8000 65000 */ Box area = new Box(dim, new RealInterval(-bound, bound)); solver = new SteepestDescent(f, area); start = System.currentTimeMillis(); double res = solver.localMinimum(area); System.out.println(System.currentTimeMillis() - start); assertTrue(res < 1e-4); // start from 0 area = new Box(dim, new RealInterval(-bound - bound / 2.0, bound - bound / 5.0)); res = solver.localMinimum(area); assertTrue(res < 1); area = new Box(dim, new RealInterval(-10, -9)); // bad point... res = solver.localMinimum(area); assertTrue(res < 1); }
// @Ignore @Test public final void testDeJong_small() { final int dim = 2; final double bound = 100; FunctionNEW f = new Function_DeJong_nD(dim); Box area = new Box(dim, new RealInterval(-bound, bound)); solver = new SteepestDescent(); solver.setProblem(f, area); double res = solver.localMinimum(area); assertTrue(res < 1e-4); // start from 0 area = new Box(dim, new RealInterval(-bound - 10, bound + 2)); res = solver.localMinimum(area); assertTrue(res < 1e-4); }