Every once in a while my building time jumps from 5s to around 200. And sometimes I don't get any solution even though I got around 17 in the same time with the same data.
Is it possible to stop the solver, check if there has been a solution and if yes continue, otherwise restart, maybe with changed constraints?
This is what I got so far:
SMF.limitTime(solver, 60000);
solver.set(new ObjectiveManager<IntVar, Integer>(score, ResolutionPolicy.MINIMIZE, false));
solver.findSolution();
if(solver.isFeasible() == ESat.TRUE){
System.out.println("first solution found");
SMF.limitTime(solver, 180000);
solver.nextSolution();
} else {
//restart
}
do{
if(solver.isFeasible() == ESat.TRUE){
System.out.println(score.getValue());
}
}while(solver.nextSolution());
try {
solver.restoreLastSolution();
} catch (ContradictionException e) {
throw new UnsupportedOperationException("restoring the last solution ended in a failure");
} finally {
solver.getEngine().flush();
}
But the limit that is used is still one minute and is not increased to three after the first solution is found.
Is there a way to do that? And how can I restart the solver?
A related question: If I do get a solution, restored that solution but I think with a little bit more time I would get a better one, can I start a solver with this solution as the starting point?