Package org.ddolib.util.verbosity
Class VerboseMode
java.lang.Object
org.ddolib.util.verbosity.VerboseMode
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
ConstructorsConstructorDescriptionVerboseMode(VerbosityLevel verbosityLevel, long printInterval) Creates aVerboseModeinstance with a given verbosity level and interval for printing frontier statistics. -
Method Summary
Modifier and TypeMethodDescription<T> voidcurrentSubProblem(int nbIter, SubProblem<T> sub) Prints message describing the current explored sub problem.voiddetailedSearchState(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.voidnewBest(double best) Prints message when a new best solution is found.
-
Constructor Details
-
VerboseMode
Creates aVerboseModeinstance 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
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 frontiergap- The current gap0
-
getWriter
Returns a writer depending on the verbosity level.- Returns:
- If the verbosity level is
EXPORT, return ofBufferedWritersaving logs intologs.txt. Otherwise, returns aPrintWriterto print logs in the console.
-