1function options = SolverOptions(solverName)
2% SOLVEROPTIONS Create solver configuration options structure
4% @brief Creates a configuration structure with solver-specific
default options
5% @param solverName Optional solver name
for specific configurations (
default:
'Solver')
6% @return options Struct containing solver configuration parameters
8% SolverOptions generates a standardized options structure for configuring
9% LINE
solvers. It provides default values for common parameters like
10% convergence tolerances, iteration limits, ODE
solvers, and solver-specific
11% settings. The function customizes defaults based on
the solver type.
13% Common options include:
14% - Convergence parameters (tol, iter_tol, iter_max)
15% - Analysis parameters (samples, seed, cutoff)
16% - Language selection (MATLAB vs Java)
17% - ODE solver configuration for fluid methods
18% - Verbosity and caching controls
19% - Solver-specific configuration overrides
21% Solver-specific customizations are available for:
22% - CTMC: State space generation and transient analysis
23% - Fluid: ODE solver selection and timespan
24% - JMT: Simulation parameters and confidence intervals
25% - MVA: Method selection and approximation settings
26% - SSA: Sampling and parallel execution options
30% opts = SolverOptions(
'MVA'); % MVA-specific defaults
31% opts.method =
'exact'; % Override method
32% opts.iter_tol = 1e-6; % Tighter tolerance
33% solver = SolverMVA(model, opts); % Use custom options
37 solverName =
'Solver'; % global options unless overridden by a solver
40%% Solver
default options
44options.config =
struct(); % solver specific options
45options.config.highvar =
'default';
46options.config.multiserver =
'default';
47options.config.np_priority =
'default';
48options.config.fork_join =
'default';
49% Resume
the fork-join (MMT) fixed point from
the iterate retained by
the
50% previous runAnalyzer call on
the same solver, instead of restarting from
51% GlobalConstants.FineTol. Only has an effect under an outer iteration such as
52% SolverLN, which re-solves each layer once per outer iteration.
53options.config.fj_warmstart = true;
54options.config.nonmkv =
'bernstein'; % Method
for non-Markovian distribution conversion: 'none', 'bernstein'
55options.config.nonmkvorder = 20; % Order (number of phases)
for non-Markovian distribution approximation
57if ~isempty(LINEDefaultLang)
58 options.lang = LINEDefaultLang;
60 options.lang =
'matlab';
64options.iter_max = 1000;
65options.iter_tol = 1e-4; % convergence tolerance to stop iterations
66options.tol = 1e-4; % tolerance
for all other uses
68options.method =
'default';
69%options.remote =
false;
70%options.remote_endpoint =
'127.0.0.1';
73odesfun.fastOdeSolver = @ode23;
74%odesfun.fastOdeSolver = @lsoda_fast;
75odesfun.accurateOdeSolver = @ode113;
76%odesfun.accurateOdeSolver = @lsoda_accurate;
77odesfun.fastStiffOdeSolver = @ode23s;
78%odesfun.fastStiffOdeSolver = @lsoda_fast_stiff;
79odesfun.accurateStiffOdeSolver = @ode15s;
80%odesfun.accurateStiffOdeSolver = @lsoda_accurate_stiff;
81options.odesolvers = odesfun;
83% options.samples - Statistical sample budget (solver-dependent semantics):
84% JMT: Samples collected per performance metric (min 5000, default 10000);
85% JMT runs with disableStatisticStop, so
this fixes
the run length
86% LDES: Deprecated alias of options.events (service completion events,
88% SSA: Deprecated alias of options.events (reaction firings,
default
89% 10000; immediate events are not counted)
90% NC: Monte Carlo samples for normalization constant (default 100000)
91% LQNS: lqsim run length (remote execution: run_time seconds)
92% Analytical
solvers (MVA, MAM, CTMC, Fluid): Not used
94% options.events - Event budget for discrete-event simulation
solvers:
95% SSA: reaction firings to simulate
96% LDES: service completion events to simulate
97% NaN (default) = unset;
the solver then falls back to options.samples,
98% which remains accepted as a deprecated alias
for the event budget.
100options.seed = randi([1,1e6]);
102options.confint =
false; % confidence interval:
false,
true (95%), or level (0.0-1.0)
103options.timespan = [Inf,Inf];
104options.timestep = [];
105% options.timeout - Wall-clock time budget in seconds from solver launch to
106% end. When elapsed wall-clock time exceeds this value,
the solver stops at
107%
the next cooperative checkpoint and returns either an interim solution (if
108% available) or an empty result with a warning. Default Inf (no budget). This
109%
is wall-clock time, not simulated time (see options.timespan).
110options.timeout = Inf;
111options.verbose = VerboseLevel.STD;
113options.config.num_cdf_pts = 200;
115%% Solver-specific defaults
118 options.cutoff = 10; % finite per-class state-space cutoff for open/mixed models (matches native/JAR)
119 options.timespan = [Inf,Inf];
120 options.timestep = []; % timestep
for fixed time steps in transient analysis
121 options.config.hide_immediate =
true; % hide immediate transitions
if possible
122 %options.config.state_space_gen =
'reachable'; % still buggy
123 options.config.state_space_gen =
'full';
124 options.rewardIterations = 1000; % number of value iterations
for reward computation
125 options.config.qrf_params = []; % blocking config
struct (f, MR, BB, F, MM, MM1, ZZ, ZM)
126 options.config.qrf_alpha = []; % load-dependent rates M x N matrix
128 options.method =
'default';
129 options.init_sol = [];
130 options.iter_max = 100;
131 options.iter_tol = 1e-4;
133 options.verbose = VerboseLevel.SILENT;
134 options.config.da =
'courtois'; % CTMC decomposition/aggregation:
'courtois',
'kms',
'takahashi',
'multi'
135 options.config.da_iter = 10; % Number of iterations
for kms/takahashi
137 options = Solver.defaultOptions();
138 options.config.highvar =
'default';
139 options.config.hide_immediate =
false; % stiff ODE solver handles immediate rates accurately
140 options.iter_max = 200;
141 options.stiff =
true;
142 options.timespan = [0,Inf];
146 options = Solver.defaultOptions();
147 options.config.interlocking =
true;
148 options.config.multiserver =
'default';
149 % Under-relaxation options for convergence improvement
150 options.config.relax = 'fixed'; %
'auto' |
'fixed' |
'adaptive' |
'none'
151 options.config.relax_factor = 0.5; % Relaxation
factor (0 < omega <= 1)
152 options.config.relax_min = 0.1; % Minimum relaxation
factor for adaptive mode
153 options.config.relax_history = 5; % Error history window for adaptive mode
154 % Stochastic iteration options, used when layer
solvers are
155 % simulation-based (JMT, SSA, LDES) and thus return noisy estimates
156 options.config.stochiter = 'auto'; % 'auto' | 'rm' | 'crn' | 'off'
157 options.config.stochiter_alpha = 0.6; % Robbins-Monro step decay exponent, in (0.5,1]
158 options.config.stochiter_a0 = 1.0; % Robbins-Monro initial step after burn-in
159 options.config.stochiter_burnin = 5; % Picard burn-in iterations before step decay starts
160 options.config.stochiter_conseq = 3; % consecutive sub-tolerance iterations required to stop
161 options.timespan = [Inf,Inf];
163 options.verbose = VerboseLevel.STD;
164 options.iter_max = 200; % More iterations for difficult LQN models
165 options.iter_tol = 5e-3; % Convergence tolerance (looser than default for LQN models)
167 % MOL (Method of Layers) options for hierarchical iteration
169 options = Solver.defaultOptions();
170 options.timespan = [Inf,Inf];
172 options.verbose = false;
173 options.config.multiserver = 'default';
174 options.config.remote = false; % Enable remote execution via REST API
175 options.config.remote_url = 'http:
176 options.config.container = ''; % Run lqns/lqsim inside Docker: '' = native (docker only as fallback if native missing), 'auto'/true = prefer docker if available, or an explicit image name (e.g. 'imperialqore/lqns:latest')
178 options.iter_max = 100;
179 options.timespan = [Inf,Inf];
180 % FJ-specific options (used when Fork-Join topology detected)
181 options.config.fj_accuracy = 100; % C parameter for FJ_codes (higher = more accurate)
182 options.config.fj_tmode = 'NARE'; % T matrix computation: 'NARE' or 'Sylves'
183 % num_cdf_pts uses global default of 200
185 options.iter_max = 1000;
186 options.iter_tol = 1e-6;
188 options.samples = 1e5;
189 options.timespan = [Inf,Inf];
190 options.config.highvar = 'interp';
192 options.iter_max = 1000;
193 options.iter_tol = 1e-6;
195 options.config.multiserver = 'default';
197 options.timespan = [0,Inf];
198 options.verbose = true;
199 options.config.state_space_gen = 'none';
200 % Warmup discard: when > 0, drop
the first floor(warmupfrac * samples)
201 % trajectory samples before computing steady-state averages
202 % (solver_ssa) and CI batch means (solver_ssa_analyzer). 0 = no mean
203 % discard (default);
the CI batch means then fall back to their
204 % legacy 10% transient discard. Same semantics in
the JAR and
205 % python-native SSA engines (python exposes it as flat warmupfrac).
206 options.config.warmupfrac = 0.0;
207 % Number of independent replications used by
the 'para'/'parallel'
208 % methods. Fixed (i.e. not tied to
the parallel pool size) so
the
209 % parallel result
is worker-
count invariant: replication r always
210 % simulates ceil(samples/nreplicas) events seeded with (seed+r-1),
211 % regardless of how many workers execute it. The serial methods
213 options.config.nreplicas = 8;
216 options.config.eventcache = true;
218 options.config.eventcache = false;
221 options.samples = 2e5;
222 options.lang = 'java';
223 % Transient detection options
224 options.config.tranfilter = 'mser5'; % 'mser5', 'fixed', or 'none'
225 options.config.mserbatch = 5; % MSER batch size (default: 5)
226 options.config.warmupfrac = 0.2; % Warmup fraction for fixed filter (0.0 to 1.0)
227 % Confidence interval options
228 options.config.cimethod = 'obm'; % overlapping batch means: 'obm', batch mean: 'bm', or 'none'
229 options.config.obmoverlap = 0.5; % OBM overlap fraction (0.0 to 1.0)
230 options.config.ciminbatch = 10; % Minimum batch size for CI
231 options.config.ciminobs = 100; % Minimum observations for CI
232 % Convergence options
233 options.config.cnvgon = false; % Enable convergence-based stopping
234 options.config.cnvgtol = 0.05; % Convergence tolerance (5% relative precision)
235 options.config.cnvgbatch = 20; % Min batches before checking convergence
236 options.config.cnvgchk = 0; % Events between checks (0 = auto)
237 % Discrete-time (slotted) options. When slotted
is true every sampled
238 % interarrival and service time must fall on
the slot lattice; a
239 % non-lattice sample
is an error, not something
the engine rounds.
240 options.config.slotted = false; % Run on a discrete time scale
241 options.config.slotlength = 1; % Slot length in model time units