private void checker() { s.solveAll(); // checkSolution enbaled by assertion // s.solve(); // if(Boolean.TRUE.equals(s.isFeasible())){ // do{ // Assert.assertTrue(s.checkSolution()); // }while(s.nextSolution()); // } Assert.assertEquals("feasibility incoherence", pe.solver.isFeasible(), s.isFeasible()); Assert.assertEquals("nb sol incoherence", pe.solver.getNbSolutions(), s.getNbSolutions()); }
/* * One potential issue is determining the best way to build constraints. * Currently the model is reset after solving, and the solver * is reset right before solving. Is this the best way to do this? * We could alternatively pop constraints when backtracking, * though this would require some changes to how ProblemGeneral * is interfaced. * */ public Boolean solve() { solver.read(model); System.out.println("Model:" + model.constraintsToString()); solver.setTimeLimit(timeBound); Boolean solved = solver.solve(); boolean feasible = solver.isFeasible(); System.out.println("Solved: " + solved); System.out.println("Feasible: " + feasible); return solved; }