Package org.jacop.jasat.modules
Class DebugModule
- java.lang.Object
-
- org.jacop.jasat.modules.DebugModule
-
- All Implemented Interfaces:
SolverComponent,AssertionListener,BackjumpListener,ClauseListener,ConflictListener,ExplanationListener,ForgetListener,PropagateListener,SolutionListener,StartStopListener
public final class DebugModule extends java.lang.Object implements AssertionListener, BackjumpListener, ConflictListener, PropagateListener, SolutionListener, ForgetListener, ExplanationListener, ClauseListener, StartStopListener
module used for debug : it logs every event it is informed of- Version:
- 4.8
-
-
Constructor Summary
Constructors Constructor Description DebugModule()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidinitialize(Core core)initializes the component with the given solver.voidonAssertion(int literal, int level)Called when a variable is setvoidonBackjump(int oldLevel, int newLevel)Called when the solver backtracks.voidonClauseAdd(int[] clause, int clauseId, boolean isModelClause)called when the given clause is added.voidonClauseRemoval(int clauseId)called when the clause with unique Id @param clauseId is removedvoidonConflict(MapClause conflictClause, int level)called when a conflict occursvoidonExplain(MapClause explanation)called when the conflict clause is explainedvoidonForget()called when the solver's forget() method is applied.voidonPropagate(int literal, int clauseId)called when a propagation occursvoidonRestart(int level)called when the solver restarts.voidonSolution(boolean satisfiable)a handler called when a solution is found.voidonStart()called when the solver starts search.voidonStop()called when the solver stop search, for any reasonprivate voidprintBlank()private voidprintClause(java.lang.String prefix, MapClause mapClause)private voidprintLine(boolean start)private voidprintTrail(java.lang.String prefix, MapClause clause)
-
-
-
Method Detail
-
onRestart
public void onRestart(int level)
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:
level- the level at which the solver was before restarting
-
onConflict
public void onConflict(MapClause conflictClause, int level)
Description copied from interface:ConflictListenercalled when a conflict occurs- Specified by:
onConflictin interfaceConflictListener- Parameters:
conflictClause- 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
-
onAssertion
public void onAssertion(int literal, int level)Description copied from interface:AssertionListenerCalled when a variable is set- Specified by:
onAssertionin interfaceAssertionListener- Parameters:
literal- the literal that is set propagation, false otherwiselevel- the search level
-
onPropagate
public void onPropagate(int literal, int clauseId)Description copied from interface:PropagateListenercalled when a propagation occurs- Specified by:
onPropagatein interfacePropagateListener- Parameters:
literal- the literal propagatedclauseId- the unique ID of the unit clause
-
onSolution
public void onSolution(boolean satisfiable)
Description copied from interface:SolutionListenera handler called when a solution is found.- Specified by:
onSolutionin interfaceSolutionListener- Parameters:
satisfiable- true when the solution is Satisfiable, false if it is Unsatisfiable.
-
onExplain
public void onExplain(MapClause explanation)
Description copied from interface:ExplanationListenercalled when the conflict clause is explained- Specified by:
onExplainin interfaceExplanationListener- Parameters:
explanation- the explanation clause
-
onClauseAdd
public void onClauseAdd(int[] clause, int clauseId, boolean isModelClause)Description copied from interface:ClauseListenercalled when the given clause is added.- Specified by:
onClauseAddin interfaceClauseListener- Parameters:
clause- the clauseclauseId- the clause's unique IdisModelClause- is this clause a model clause ?
-
onClauseRemoval
public void onClauseRemoval(int clauseId)
Description copied from interface:ClauseListenercalled when the clause with unique Id @param clauseId is removed- Specified by:
onClauseRemovalin interfaceClauseListener- Parameters:
clauseId- the id
-
onForget
public void onForget()
Description copied from interface:ForgetListenercalled when the solver's forget() method is applied.- Specified by:
onForgetin interfaceForgetListener
-
onStart
public void onStart()
Description copied from interface:StartStopListenercalled when the solver starts search. It will be called only once.- Specified by:
onStartin interfaceStartStopListener
-
onStop
public void onStop()
Description copied from interface:StartStopListenercalled when the solver stop search, for any reason- Specified by:
onStopin interfaceStartStopListener
-
printLine
private void printLine(boolean start)
-
printBlank
private void printBlank()
-
printTrail
private void printTrail(java.lang.String prefix, MapClause clause)
-
printClause
private void printClause(java.lang.String prefix, MapClause mapClause)
-
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
-
-