Package org.jacop.satwrapper
Class WrapperDebugModule
java.lang.Object
org.jacop.satwrapper.WrapperDebugModule
- All Implemented Interfaces:
SolverComponent
,AssertionListener
,BackjumpListener
,ClauseListener
,ConflictListener
,ExplanationListener
,ForgetListener
,PropagateListener
,SolutionListener
,StartStopListener
,WrapperComponent
public final class WrapperDebugModule
extends Object
implements AssertionListener, BackjumpListener, ConflictListener, PropagateListener, SolutionListener, ForgetListener, ExplanationListener, ClauseListener, StartStopListener, WrapperComponent
a class used to debug, but with additional data
- Version:
- 4.9
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
initialize
(Core core) initializes the component with the given solver.void
initialize
(SatWrapper wrapper) connect the component to the wrappervoid
onAssertion
(int literal, int level) Called when a variable is setvoid
onBackjump
(int oldLevel, int newLevel) Called when the solver backtracks.void
onClauseAdd
(int[] clause, int clauseId, boolean isModelClause) called when the given clause is added.void
onClauseRemoval
(int clauseId) called when the clause with unique Id @param clauseId is removedvoid
onConflict
(MapClause conflictClause, int level) called when a conflict occursvoid
called when the conflict clause is explainedvoid
onForget()
called when the solver's forget() method is applied.void
onPropagate
(int literal, int clauseId) called when a propagation occursvoid
onRestart
(int oldLevel) called when the solver restarts.void
onSolution
(boolean satisfiable) a handler called when a solution is found.void
onStart()
called when the solver starts search.void
onStop()
called when the solver stop search, for any reasonprivate void
private void
printLine
(boolean start) private void
printTrail
(String prefix, MapClause clause)
-
Field Details
-
core
-
mapClause
-
wrapper
-
-
Constructor Details
-
WrapperDebugModule
public WrapperDebugModule()
-
-
Method Details
-
onRestart
public void onRestart(int oldLevel) Description copied from interface:BackjumpListener
called when the solver restarts.components that want to be warned about restarts should put themselves in Core.restartModules.
- Specified by:
onRestart
in interfaceBackjumpListener
- Parameters:
oldLevel
- the level at which the solver was before restarting
-
onConflict
Description copied from interface:ConflictListener
called when a conflict occurs- Specified by:
onConflict
in 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:BackjumpListener
Called 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:
onBackjump
in 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:AssertionListener
Called when a variable is set- Specified by:
onAssertion
in 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:PropagateListener
called when a propagation occurs- Specified by:
onPropagate
in interfacePropagateListener
- Parameters:
literal
- the literal propagatedclauseId
- the unique ID of the unit clause
-
onSolution
public void onSolution(boolean satisfiable) Description copied from interface:SolutionListener
a handler called when a solution is found.- Specified by:
onSolution
in interfaceSolutionListener
- Parameters:
satisfiable
- true when the solution is Satisfiable, false if it is Unsatisfiable.
-
onExplain
Description copied from interface:ExplanationListener
called when the conflict clause is explained- Specified by:
onExplain
in interfaceExplanationListener
- Parameters:
explanation
- the explanation clause
-
onClauseAdd
public void onClauseAdd(int[] clause, int clauseId, boolean isModelClause) Description copied from interface:ClauseListener
called when the given clause is added.- Specified by:
onClauseAdd
in 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:ClauseListener
called when the clause with unique Id @param clauseId is removed- Specified by:
onClauseRemoval
in interfaceClauseListener
- Parameters:
clauseId
- the id
-
onForget
public void onForget()Description copied from interface:ForgetListener
called when the solver's forget() method is applied.- Specified by:
onForget
in interfaceForgetListener
-
onStart
public void onStart()Description copied from interface:StartStopListener
called when the solver starts search. It will be called only once.- Specified by:
onStart
in interfaceStartStopListener
-
onStop
public void onStop()Description copied from interface:StartStopListener
called when the solver stop search, for any reason- Specified by:
onStop
in interfaceStartStopListener
-
printLine
private void printLine(boolean start) -
printBlank
private void printBlank() -
printTrail
-
initialize
Description copied from interface:SolverComponent
initializes 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:
initialize
in interfaceSolverComponent
- Parameters:
core
- core component to initialize
-
initialize
Description copied from interface:WrapperComponent
connect the component to the wrapper- Specified by:
initialize
in interfaceWrapperComponent
- Parameters:
wrapper
- the wrapper
-