Package org.jacop.jasat.modules
Class HeuristicRestartModule
- java.lang.Object
-
- org.jacop.jasat.modules.HeuristicRestartModule
-
- All Implemented Interfaces:
SolverComponent,BackjumpListener,ConflictListener
public final class HeuristicRestartModule extends java.lang.Object implements ConflictListener, BackjumpListener
A module that indicates if a restart would be useful now. Currently based on number of conflicts since last restart. Each restart makes the next restart twice harder to reach.- Version:
- 4.8
-
-
Field Summary
Fields Modifier and Type Field Description private longconflictCountbooleanshouldRestartprivate longthresholdprivate doubleTHRESHOLD_INCREASE_RATE
-
Constructor Summary
Constructors Constructor Description HeuristicRestartModule()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidinitialize(Core core)initializes the component with the given solver.voidonBackjump(int oldLevel, int newLevel)Called when the solver backtracks.voidonConflict(MapClause clause, int level)called when a conflict occursvoidonRestart(int oldLevel)called when the solver restarts.
-
-
-
Method Detail
-
onConflict
public void onConflict(MapClause clause, int level)
Description copied from interface:ConflictListenercalled when a conflict occurs- Specified by:
onConflictin interfaceConflictListener- Parameters:
clause- the conflict (unsatisfiable) clauselevel- the level at which the conflict occurred
-
onBackjump
public void onBackjump(int oldLevel, int newLevel)Description copied from interface:BackjumpListenerCalled when the solver backtracks. It will also be called when the solver restarts.components that want to be warned about backjumps should put themselves in Core.backjumpModules.
- Specified by:
onBackjumpin interfaceBackjumpListener- Parameters:
oldLevel- the level at which the solver was before backtrackingnewLevel- the level to which the solver backtracks
-
onRestart
public void onRestart(int oldLevel)
Description copied from interface:BackjumpListenercalled when the solver restarts.components that want to be warned about restarts should put themselves in Core.restartModules.
- Specified by:
onRestartin interfaceBackjumpListener- Parameters:
oldLevel- the level at which the solver was before restarting
-
initialize
public void initialize(Core core)
Description copied from interface:SolverComponentinitializes the component with the given solver. May be called only once. This method must register the component to the solver for the run.- Specified by:
initializein interfaceSolverComponent- Parameters:
core- core component to initialize
-
-