Class DebugModule

java.lang.Object
org.jacop.jasat.modules.DebugModule
All Implemented Interfaces:
SolverComponent, AssertionListener, BackjumpListener, ClauseListener, ConflictListener, ExplanationListener, ForgetListener, PropagateListener, SolutionListener, StartStopListener

module used for debug : it logs every event it is informed of
Version:
4.8
  • Field Details

    • core

      private Core core
    • mapClause

      private MapClause mapClause
  • Constructor Details

    • DebugModule

      public DebugModule()
  • Method Details

    • onRestart

      public void onRestart(int level)
      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 interface BackjumpListener
      Parameters:
      level - the level at which the solver was before restarting
    • onConflict

      public void onConflict(MapClause conflictClause, int level)
      Description copied from interface: ConflictListener
      called when a conflict occurs
      Specified by:
      onConflict in interface ConflictListener
      Parameters:
      conflictClause - the conflict (unsatisfiable) clause
      level - 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 interface BackjumpListener
      Parameters:
      oldLevel - the level at which the solver was before backtracking
      newLevel - 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 interface AssertionListener
      Parameters:
      literal - the literal that is set propagation, false otherwise
      level - 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 interface PropagateListener
      Parameters:
      literal - the literal propagated
      clauseId - 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 interface SolutionListener
      Parameters:
      satisfiable - true when the solution is Satisfiable, false if it is Unsatisfiable.
    • onExplain

      public void onExplain(MapClause explanation)
      Description copied from interface: ExplanationListener
      called when the conflict clause is explained
      Specified by:
      onExplain in interface ExplanationListener
      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 interface ClauseListener
      Parameters:
      clause - the clause
      clauseId - the clause's unique Id
      isModelClause - 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 interface ClauseListener
      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 interface ForgetListener
    • 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 interface StartStopListener
    • onStop

      public void onStop()
      Description copied from interface: StartStopListener
      called when the solver stop search, for any reason
      Specified by:
      onStop in interface StartStopListener
    • printLine

      private void printLine(boolean start)
    • printBlank

      private void printBlank()
    • printTrail

      private void printTrail(String prefix, MapClause clause)
    • printClause

      private void printClause(String prefix, MapClause mapClause)
    • initialize

      public void initialize(Core core)
      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 interface SolverComponent
      Parameters:
      core - core component to initialize