Class ResetKeepsLimits

java.lang.Object
org.clafer.choco.ResetKeepsLimits

public final class ResetKeepsLimits extends Object
Stop criteria, for example a time limit, that survive reset(Solver). Choco's reset removes them, but the solvers in Clafer reset the search to find further solutions under the same limits. Choco's solver is final, so the limits are kept in a hook of its model and the solvers in Clafer reset through reset(Solver) instead of Solver.reset(). A time limit is a deadline: it counts from the call to limitTime(Solver, long), not from the last reset, because Choco restarts its clock on reset.
Author:
MichaƂ Antkiewicz
  • Method Details

    • limitTime

      public static void limitTime(org.chocosolver.solver.Solver solver, long ms)
      Stop the search once ms milliseconds have passed, even across resets.
      Parameters:
      solver - the solver
      ms - the time limit in milliseconds
    • reset

      public static void reset(org.chocosolver.solver.Solver solver)
      Reset the search and restore the limits set with limitTime(Solver, long).
      Parameters:
      solver - the solver