1classdef SolverSSA < NetworkSolver
2 % Stochastic Simulation Analysis solver
4 % Implements discrete-
event stochastic simulation
for queueing network analysis.
6 % Copyright (c) 2012-2026, Imperial College London
9 function self = SolverSSA(model,varargin)
10 % SOLVERSSA Create an SSA solver instance
12 % @brief Creates a Stochastic Simulation Analysis solver
13 % @param model Network model to be analyzed via simulation
14 % @param varargin Optional parameters (method, samples, seed, etc.)
15 % @
return self SolverSSA instance configured
for simulation
17 self@NetworkSolver(model, mfilename);
18 self.setOptions(Solver.parseOptions(varargin, self.defaultOptions));
22 function sn = getStruct(self)
25 % Get data structure summarizing the model
26 sn = self.model.getStruct(
true);
29 [runtime, tranSysState, tranSync] = run(self, options);
30 Prob = getProb(self, node, state);
31 ProbAggr = getProbAggr(self, node, state);
32 ProbSys = getProbSys(self);
33 ProbSysAggr = getProbSysAggr(self);
34 tranNodeState = sample(self, node, numSamples, markActivePassive);
35 tranNodeStateAggr = sampleAggr(self, node, numSamples, markActivePassive);
36 tranSysStateAggr = sampleSysAggr(self, numSamples, markActivePassive);
37 tranSysState = sampleSys(self, numSamples, markActivePassive);
39 function [allMethods] = listValidMethods(self)
40 % allMethods = LISTVALIDMETHODS()
41 % List valid methods
for this solver
43 %sn = self.model.getStruct();
44 allMethods = {
'default',
'ssa',
'serial',
'para',
'parallel',
'nrm'};
50 function featSupported = getFeatureSet()
51 % FEATSUPPORTED = GETFEATURESET()
53 featSupported = SolverFeatureSet;
54 featSupported.setTrue({
'Sink',
'Source',
'Router',...
55 'ClassSwitch',
'Delay',
'DelayStation',
'Queue',...
56 'Cache',
'CacheClassSwitcher',...
57 'MAP',
'MMPP2',
'APH',
'PH',...
58 'Coxian',
'Erlang',
'Exp',
'HyperExp',...
59 'Det',
'Gamma',
'Lognormal',
'Pareto',
'Uniform',
'Weibull',...
60 'StatelessClassSwitcher',
'InfiniteServer',...
61 'SharedServer',
'Buffer',
'Dispatcher',...
62 'Server',
'JobSink',
'RandomSource',
'ServiceTunnel',...
63 'SchedStrategy_INF',
'SchedStrategy_PS',...
64 'SchedStrategy_DPS',
'SchedStrategy_FCFS',...
65 'SchedStrategy_GPS',
'SchedStrategy_LPS',
'SchedStrategy_SIRO',...
66 'SchedStrategy_HOL',
'SchedStrategy_LCFS',...
67 'SchedStrategy_SEPT',
'SchedStrategy_LEPT',...
68 'SchedStrategy_LCFSPR',...
69 'SchedStrategy_PSPRIO',
'SchedStrategy_DPSPRIO',
'SchedStrategy_GPSPRIO',...
70 'RoutingStrategy_RROBIN',...
71 'RoutingStrategy_PROB',
'RoutingStrategy_RAND',...
72 'ReplacementStrategy_RR',
'ReplacementStrategy_FIFO',
'ReplacementStrategy_SFIFO',
'ReplacementStrategy_LRU',...
73 'SchedStrategy_EXT',
'ClosedClass',
'SelfLoopingClass',
'OpenClass',...
74 'Place',
'Transition',
'Linkage',
'Enabling',
'Timing',
'Firing',
'Storage'});
75 %
'Fork',
'Join',
'Forker',
'Joiner',...
78 function [bool, featSupported] = supports(model)
79 % [BOOL, FEATSUPPORTED] = SUPPORTS(MODEL)
81 featUsed = model.getUsedLangFeatures();
82 featSupported = SolverSSA.getFeatureSet();
83 bool = SolverFeatureSet.supports(featSupported, featUsed);
86 function options = defaultOptions()
87 % OPTIONS = DEFAULTOPTIONS()
89 options = SolverOptions('SSA');
92 function libs = getLibrariesUsed(sn, options)
93 % GETLIBRARIESUSED Get list of external libraries used by SSA solver
94 % SSA uses internal simulation, no external libraries needed