LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
runAnalyzerPreamble.m
1function [handled, options, runtime] = runAnalyzerPreamble(self, options, tag)
2% [HANDLED, OPTIONS, RUNTIME] = RUNANALYZERPREAMBLE(OPTIONS, TAG)
3%
4% Common opening of every runAnalyzer: stamp the wall-clock budget marker,
5% delegate to native python when options.lang says so and seed the RNG.
6%
7% The library attribution is NOT printed here: it is pull-based, like Sage's
8% sage.misc.citation.get_systems. Call solver.getLibrariesUsed() to obtain the
9% list, or solver.showLibraryAttribution() to print it; lineStart reminds the
10% user that it exists. The wrapper acknowledgement (line_ack) follows the same
11% rule: it prints only at VerboseLevel.DEBUG.
12%
13% HANDLED is true when the call was served by the python delegation, in which
14% case the results are already set and the caller must return RUNTIME
15% immediately. TAG is the short solver name used in the debug line (e.g. 'MVA').
16%
17% Every solver carried its own copy of this block: six copies of the
18% lang='python' guard and seven of the attribution print. The RNG seed
19% inside the python branch is load-bearing and must stay BEFORE the early
20% return: MATLAB-side samplers invoked after the delegated call (sampleSysAggr,
21% sample, the getCdfRespT Monte Carlo) draw from MATLAB's stream, so skipping
22% it made a seeded example reproducible under lang='matlab' but not under
23% lang='python'.
24%
25% Copyright (c) 2012-2026, Imperial College London
26% All rights reserved.
27
28handled = false;
29runtime = 0;
30if nargin < 3 || isempty(tag)
31 tag = class(self);
32end
33
34% Wall-clock time-budget launch marker (see options.timeout / lineTimeoutExceeded)
35if ~isfield(options,'timeout_tic') || isempty(options.timeout_tic)
36 options.timeout_tic = tic;
37end
38
39if strcmp(options.lang,'python')
40 line_debug(options, '%s: using lang=python, delegating to native line_solver', tag);
41 Solver.resetRandomGeneratorSeed(options.seed);
42 [QN,UN,RN,TN,AN,WN,runtime] = PYLINE.getAvg(self.name, self.model, options);
43 self.setAvgResults(QN,UN,RN,TN,AN,WN,[],[],runtime,options.method,NaN);
44 handled = true;
45 return
46end
47
48Solver.resetRandomGeneratorSeed(options.seed);
49end