LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
SolverOptions.m
1function options = SolverOptions(solverName)
2% SOLVEROPTIONS Create solver configuration options structure
3%
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
7%
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.
12%
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
20%
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
27%
28% Example:
29% @code
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
34% @endcode
35
36if nargin < 1
37 solverName = 'Solver'; % global options unless overridden by a solver
38end
39
40%% Solver default options
41options = struct();
42options.cache = true;
43options.cutoff = Inf;
44options.config = struct(); % solver specific options
45options.config.highvar = 'default';
46options.config.multiserver = 'default';
47options.config.np_priority = 'default';
48options.config.fork_join = 'default';
49options.config.nonmkv = 'bernstein'; % Method for non-Markovian distribution conversion: 'none', 'bernstein'
50options.config.nonmkvorder = 20; % Order (number of phases) for non-Markovian distribution approximation
51global LINEDefaultLang
52if ~isempty(LINEDefaultLang)
53 options.lang = LINEDefaultLang;
54else
55 options.lang = 'matlab';
56end
57options.force = false;
58options.init_sol = [];
59options.iter_max = 1000;
60options.iter_tol = 1e-4; % convergence tolerance to stop iterations
61options.tol = 1e-4; % tolerance for all other uses
62options.keep = true;
63options.method = 'default';
64%options.remote = false;
65%options.remote_endpoint = '127.0.0.1';
66
67odesfun = struct();
68odesfun.fastOdeSolver = @ode23;
69odesfun.accurateOdeSolver = @ode113;
70odesfun.fastStiffOdeSolver = @ode23s;
71odesfun.accurateStiffOdeSolver = @ode15s;
72options.odesolvers = odesfun;
73
74% options.samples - Simulation length (solver-dependent semantics):
75% JMT: Samples per metric for confidence interval estimation (min 5000, default 10000)
76% DES: Service completion events to simulate (default 200000)
77% SSA: RNG operations in Gillespie algorithm (~2 per event) (default 10000)
78% NC: Monte Carlo samples for normalization constant (default 100000)
79% Analytical solvers (MVA, MAM, CTMC, Fluid): Not used
80options.samples = 1e4;
81options.seed = randi([1,1e6]);
82options.stiff = true;
83options.confint = false; % confidence interval: false, true (95%), or level (0.0-1.0)
84options.timespan = [Inf,Inf];
85options.timestep = [];
86options.verbose = VerboseLevel.STD;
87
88options.config.num_cdf_pts = 200;
89
90%% Solver-specific defaults
91switch solverName
92 case 'CTMC'
93 options.timespan = [Inf,Inf];
94 options.timestep = []; % timestep for fixed time steps in transient analysis
95 options.config.hide_immediate = true; % hide immediate transitions if possible
96 %options.config.state_space_gen = 'reachable'; % still buggy
97 options.config.state_space_gen = 'full';
98 options.rewardIterations = 1000; % number of value iterations for reward computation
99 options.config.qrf_params = []; % blocking config struct (f, MR, BB, F, MM, MM1, ZZ, ZM)
100 options.config.qrf_alpha = []; % load-dependent rates M x N matrix
101 case 'Env'
102 options.method = 'default';
103 options.init_sol = [];
104 options.iter_max = 100;
105 options.iter_tol = 1e-4;
106 options.tol = 1e-4;
107 options.verbose = VerboseLevel.SILENT;
108 options.config.da = 'courtois'; % CTMC decomposition/aggregation: 'courtois', 'kms', 'takahashi', 'multi'
109 options.config.da_iter = 10; % Number of iterations for kms/takahashi
110 case 'Fluid'
111 options = Solver.defaultOptions();
112 options.config.highvar = 'default';
113 options.config.hide_immediate = true; % eliminate immediate transitions by default
114 options.iter_max = 200;
115 options.stiff = true;
116 options.timespan = [0,Inf];
117 case 'JMT'
118 % use default
119 case 'LN'
120 options = Solver.defaultOptions();
121 options.config.interlocking = false; % do not change, true unstable as of 2.0.38
122 options.config.multiserver = 'default';
123 % Under-relaxation options for convergence improvement
124 options.config.relax = 'auto'; % 'auto' | 'fixed' | 'adaptive' | 'none'
125 options.config.relax_factor = 0.1; % Relaxation factor when enabled (0 < omega <= 1)
126 options.config.relax_min = 0.1; % Minimum relaxation factor for adaptive mode
127 options.config.relax_history = 5; % Error history window for adaptive mode
128 options.timespan = [Inf,Inf];
129 options.keep = true;
130 options.verbose = VerboseLevel.STD;
131 options.iter_max = 200; % More iterations for difficult LQN models
132 options.iter_tol = 5e-3; % Convergence tolerance (looser than default for LQN models)
133 options.tol = 1e-4;
134 % MOL (Method of Layers) options for hierarchical iteration
135 options.config.mol_task_inner_max = 50; % Max task inner iterations per host outer iteration
136 options.config.mol_task_inner_tol = 1e-4; % Task layer convergence tolerance (utilization delta)
137 options.config.mol_host_outer_tol = 1e-4; % Host layer convergence tolerance (utilization delta)
138 options.config.mol_min_steps = 2; % Minimum outer iterations before checking host convergence
139 case 'LQNS'
140 options = Solver.defaultOptions();
141 options.timespan = [Inf,Inf];
142 options.keep = true;
143 options.verbose = false;
144 options.config.multiserver = 'default';
145 options.config.remote = false; % Enable remote execution via REST API
146 options.config.remote_url = 'http://localhost:8080'; % URL of lqns-rest server
147 case 'MAM'
148 options.iter_max = 100;
149 options.timespan = [Inf,Inf];
150 % FJ-specific options (used when Fork-Join topology detected)
151 options.config.fj_accuracy = 100; % C parameter for FJ_codes (higher = more accurate)
152 options.config.fj_tmode = 'NARE'; % T matrix computation: 'NARE' or 'Sylves'
153 % num_cdf_pts uses global default of 200
154 case 'MVA'
155 options.iter_max = 1000;
156 options.iter_tol = 1e-6;
157 case 'NC'
158 options.samples = 1e5;
159 options.timespan = [Inf,Inf];
160 options.config.highvar = 'interp';
161 case 'NN'
162 options.iter_max = 1000;
163 options.iter_tol = 1e-6;
164 case 'QNS'
165 options.config.multiserver = 'default';
166 case 'SSA'
167 options.timespan = [0,Inf];
168 options.verbose = true;
169 options.config.state_space_gen = 'none';
170 switch options.lang
171 case 'java'
172 options.config.eventcache = true;
173 otherwise
174 options.config.eventcache = false;
175 end
176 case 'DES'
177 options.samples = 1e5;
178 options.lang = 'java';
179 % Transient detection options
180 options.config.tranfilter = 'mser5'; % 'mser5', 'fixed', or 'none'
181 options.config.mserbatch = 5; % MSER batch size (default: 5)
182 options.config.warmupfrac = 0.2; % Warmup fraction for fixed filter (0.0 to 1.0)
183 % Confidence interval options
184 options.config.cimethod = 'obm'; % overlapping batch means: 'obm', batch mean: 'bm', or 'none'
185 options.config.obmoverlap = 0.5; % OBM overlap fraction (0.0 to 1.0)
186 options.config.ciminbatch = 10; % Minimum batch size for CI
187 options.config.ciminobs = 100; % Minimum observations for CI
188 % Convergence options
189 options.config.cnvgon = false; % Enable convergence-based stopping
190 options.config.cnvgtol = 0.05; % Convergence tolerance (5% relative precision)
191 options.config.cnvgbatch = 20; % Min batches before checking convergence
192 options.config.cnvgchk = 0; % Events between checks (0 = auto)
193end
194end