Class VerboseMode

java.lang.Object
org.ddolib.util.verbosity.VerboseMode

public class VerboseMode extends Object
Utility class for printing detailed information about the search process based on a specified VerbosityLevel.

Depending on the verbosity level, this class can print:

  • No output (SILENT)
  • New best solution values (NORMAL)
  • New best solution values, frontier statistics, and details about each explored subproblem (LARGE)
  • Constructor Summary

    Constructors
    Constructor
    Description
    VerboseMode(VerbosityLevel verbosityLevel, long printInterval)
    Creates a VerboseMode instance with a given verbosity level and interval for printing frontier statistics.
  • Method Summary

    Modifier and Type
    Method
    Description
    <T> void
    currentSubProblem(int nbIter, SubProblem<T> sub)
    Prints message describing the current explored sub problem.
    void
    detailedSearchState(int nbIter, int frontierSize, double bestObj, double bestInFrontier, double gap)
    Prints statistics about the frontier after every half second.
    Returns a writer depending on the verbosity level.
    void
    newBest(double best)
    Prints message when a new best solution is found.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • VerboseMode

      public VerboseMode(VerbosityLevel verbosityLevel, long printInterval)
      Creates a VerboseMode instance with a given verbosity level and interval for printing frontier statistics.
      Parameters:
      verbosityLevel - The level of details to print.
      printInterval - The minimum delay (in milliseconds) between consecutive prints of frontier statistics.
  • Method Details

    • newBest

      public void newBest(double best)
      Prints message when a new best solution is found.
      Parameters:
      best - The value of the new best solution.
    • currentSubProblem

      public <T> void currentSubProblem(int nbIter, SubProblem<T> sub)
      Prints message describing the current explored sub problem.
      Type Parameters:
      T - The type of the state.
      Parameters:
      nbIter - The current iteration number.
      sub - The current sub problem to explore.
    • detailedSearchState

      public void detailedSearchState(int nbIter, int frontierSize, double bestObj, double bestInFrontier, double gap)
      Prints statistics about the frontier after every half second.
      Parameters:
      nbIter - The current iteration number.
      frontierSize - The current size of the frontier.
      bestObj - The current best objective value.
      bestInFrontier - The best value in the frontier
      gap - The current gap0
    • getWriter

      public Writer getWriter()
      Returns a writer depending on the verbosity level.
      Returns:
      If the verbosity level is EXPORT, return of BufferedWriter saving logs into logs.txt. Otherwise, returns a PrintWriter to print logs in the console.