Package org.ddolib.common.util.verbosity
Class VerboseMode
java.lang.Object
org.ddolib.common.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 printprintInterval- 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 numbersub- 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 numberfrontierSize- the current size of the frontierbestObj- the current best objective valuebestInFrontier- 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.
-