@Test(groups = "1s") public void testBacktrack() { Solver s = modelit(); long bl = 50; SearchMonitorFactory.limitBacktrack(s, bl); s.findAllSolutions(); long bc = s.getMeasures().getBackTrackCount(); Assert.assertEquals(bc, bl); }
@Test(groups = "1s") public void testNode() { Solver s = modelit(); long nl = 50; SearchMonitorFactory.limitNode(s, nl); s.findAllSolutions(); long nc = s.getMeasures().getNodeCount(); Assert.assertEquals(nc, nl); }
@Test(groups = "1s") public void testThreadTime() { Solver s = modelit(); long tl = 500; SearchMonitorFactory.limitThreadTime(s, tl); s.findAllSolutions(); float tc = s.getMeasures().getTimeCount(); Assert.assertTrue(tl - (tl * 10 / 100) <= tc && tc <= tl + (tl * 10 / 100), tl + " vs. " + tc); }
@Test(groups = "1s") public void testSolution() { Solver s = modelit(); long sl = 50; SearchMonitorFactory.limitSolution(s, sl); s.findAllSolutions(); long sc = s.getMeasures().getSolutionCount(); Assert.assertEquals(sc, sl); }
@Test(groups = "1s") public void testFail() { Solver s = modelit(); long fl = 50; SearchMonitorFactory.limitFail(s, fl); s.findAllSolutions(); long fc = s.getMeasures().getFailCount(); Assert.assertEquals(fc, fl); }
@Override public void configureSearch() { solver.set(new AssignmentInterval(vars, new Cyclic(vars), new RealDomainMiddle())); SearchMonitorFactory.limitTime(solver, 10000); }