Class LineConsole
The console narrates what a solver is doing while it does it: reading the model, compiling the network structure, computing chains, visits and demands, resolving the method, iterating, and closing with the figures of merit. Each line carries the elapsed time since the run started:
[ 0.014s] compiling the network structure of model 'cqn' [ 0.031s] solving the routing DTMC for the visit ratios [ 0.052s] recognized a closed queueing network: 3 stations, 1 class, 1 chain [ 0.061s] AMVA sweep 10: queue-length residual 1.11e-01, X = 1.2225
It prints no tables: the result table stays the caller's own
getAvgTable. THE CONSOLE IS VerboseLevel.DEBUG: it narrates
exactly when the run is at DEBUG and is silent at every lower level, and it
never alters a numerical result. There is no separate console switch -- the
console was one, until it became clear that a running progress log IS what a
debug verbosity is for, and two switches for one channel only let a session
ask for DEBUG and get nothing.
Typical use: GlobalConstants.setVerbose(VerboseLevel.DEBUG) for
the session, or options.verbose = VerboseLevel.DEBUG for one run.
Nested runs (an inner solver driven by SolverLN, SolverENV or the UQ
ensemble) do not narrate: only the outermost run writes, so several inner
solves cannot interleave their lines. Use isActive() to suppress a
legacy print, ownsLog() to emit.
Mirrors MATLAB matlab/src/io/LineConsole.m and python
line_solver/api/io/console.py.
-
Method Summary
Modifier and TypeMethodDescriptionstatic booleanbeginRun(Object solver, SolverOptions options) Open a console run.static voidClose the innermost open run, writing the closing lines.static voidcompileDetail(String fmt, Object... args) One stage line of a structure compile.static voidAnnounce the compilation of a model structure.static voiddeferPrint(String fmt, Object... args) Queue a legacy line for after the run closes.static voidReport a solver's own debug message as a substep.static booleanisActive()static voidReport iterationkof the current loop.static voidAnnounce an iteration loop and reset its reporting budget.static booleanownsLog()static StringCount with an agreeing noun, e.g.static voidpopQuiet()End onepushQuiet()scope.static voidSuppress structure-compile detail untilpopQuiet().static voidreset()Forget any open run (used after an interrupted solve).static voidWrite one progress line.static voidWrite one indented progress line.static booleanwanted(SolverOptions options) Resolve whether a run with these options should narrate.static booleanwrites()
-
Method Details
-
reset
public static void reset()Forget any open run (used after an interrupted solve). -
wanted
Resolve whether a run with these options should narrate.THE CONSOLE IS DEBUG, and this is the whole rule: a run narrates when it is at
VerboseLevel.DEBUGand at no lower level. The run's ownoptions.verbosedecides when it carries one, otherwise the session level does; there is no third switch that could put the two out of step. -
isActive
public static boolean isActive()- Returns:
- true while a run is narrating; gates SUPPRESSION of legacy prints
-
deferPrint
Queue a legacy line for after the run closes.The console owns the log while a run narrates, so a solver's standard completion message is held here and written once the closing DONE line has gone out, reading as it would with the console off.
-
ownsLog
public static boolean ownsLog()- Returns:
- true only inside the OUTERMOST open run; gates EMISSION
-
writes
public static boolean writes()- Returns:
- true when a progress line should be printed: either the outermost run is narrating, or no run is open and the session is at DEBUG -- the second case is what lets model construction narrate before any solver exists.
-
beginRun
Open a console run.The caller MUST pair this with
closeRun(java.lang.Object)in a finally block, so that a failed analysis still reports what it had reached.- Parameters:
solver- the solver about to run (read for its model and result)options- its options- Returns:
- true when this call opened the outermost run
-
closeRun
Close the innermost open run, writing the closing lines.- Parameters:
solver- the solver whose result is reported, or null
-
step
Write one progress line. -
substep
Write one indented progress line. -
compileDetail
One stage line of a structure compile.Silenced inside a
pushQuiet()scope, and inside an open run, where the structures being compiled are those of auxiliary models (SolverLN layers) rather than of the model under study. -
compiling
Announce the compilation of a model structure. -
detail
Report a solver's own debug message as a substep.InputOutput.line_debugroutes here while a run narrates. Consecutive repeats are dropped, at most three messages of the same SHAPE (the text with its numbers masked) are reported, and the channel is capped per run, since a message inside a loop would bury the narration. -
loop
Announce an iteration loop and reset its reporting budget.Re-announcing the SAME text (a solver that restarts its loop) neither reprints the header nor refills the budget.
-
iter
Report iterationkof the current loop.Lines are decimated: the first 20 iterations report in full, then every 10th, and the loop stops reporting after 30 lines, so that a long run cannot bury the rest of the narration.
-
pushQuiet
public static void pushQuiet()Suppress structure-compile detail untilpopQuiet(). -
popQuiet
public static void popQuiet()End onepushQuiet()scope. -
plural
Count with an agreeing noun, e.g. "1 chain" or "3 chains".
-