Class StatModule

    • Constructor Summary

      Constructors 
      Constructor Description
      StatModule​(boolean threaded)
      Create a StatModule.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void initialize​(Core core)
      initializes the component with the given solver.
      private void logStat​(java.lang.String stat, long num, long timeDiff)
      logs one line of stat (for one parameter)
      void logStats()
      print current stats with solver's logc2 method
      void onAssertion​(int literal, int level)
      Called when a variable is set
      void 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 removed
      void onConflict​(MapClause clause, int level)
      called when a conflict occurs
      void onForget()
      called when the solver's forget() method is applied.
      void onPropagate​(int literal, int clauseId)
      called when a propagation occurs
      void onRestart​(int oldLevel)
      called when the solver restarts.
      void onStart()
      called when the solver starts search.
      void onStop()
      called when the solver stop search, for any reason
      private void printBlank()  
      private void printLine​(boolean start)
      prints a line, starting a block if @param start is true, ending the block otherwise
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • core

        private Core core
      • numRestarts

        private long numRestarts
      • numConflicts

        private long numConflicts
      • numBackjumps

        private long numBackjumps
      • numAssertions

        private long numAssertions
      • numForget

        private long numForget
      • numClauseAdd

        private long numClauseAdd
      • numLearntClauses

        private long numLearntClauses
      • numClauseRemoved

        private long numClauseRemoved
      • numPropagate

        private long numPropagate
      • threaded

        private final boolean threaded
      • task

        private java.util.TimerTask task
    • Constructor Detail

      • StatModule

        public StatModule​(boolean threaded)
        Create a StatModule. It can schedule
        Parameters:
        threaded - true if threaded
    • Method Detail

      • 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 interface BackjumpListener
        Parameters:
        oldLevel - the level at which the solver was before restarting
      • onConflict

        public void onConflict​(MapClause clause,
                               int level)
        Description copied from interface: ConflictListener
        called when a conflict occurs
        Specified by:
        onConflict in interface ConflictListener
        Parameters:
        clause - 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
      • onForget

        public void onForget()
        Description copied from interface: ForgetListener
        called when the solver's forget() method is applied.
        Specified by:
        onForget in interface ForgetListener
      • 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
      • 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
      • 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
      • logStats

        public final void logStats()
        print current stats with solver's logc2 method
      • logStat

        private final void logStat​(java.lang.String stat,
                                   long num,
                                   long timeDiff)
        logs one line of stat (for one parameter)
      • printLine

        private void printLine​(boolean start)
        prints a line, starting a block if @param start is true, ending the block otherwise
      • printBlank

        private void printBlank()
      • 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