LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
SolverSSA.m
1classdef SolverSSA < NetworkSolver
2 % Stochastic Simulation Analysis solver
3 %
4 % Implements discrete-event stochastic simulation for queueing network analysis.
5 %
6 % Copyright (c) 2012-2026, Imperial College London
7 % All rights reserved.
8 methods
9 function self = SolverSSA(model,varargin)
10 % SOLVERSSA Create an SSA solver instance
11 %
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
16
17 % An auxiliary solver passed as first optional argument requests a
18 % warm start: its steady-state solution decides the initial state
19 % of the simulated trajectory (see NetworkSolver.initFromSolver).
20 initSolver = [];
21 if ~isempty(varargin) && isa(varargin{1}, 'NetworkSolver')
22 initSolver = varargin{1};
23 varargin(1) = [];
24 end
25 self@NetworkSolver(model, mfilename);
26 self.setOptions(Solver.parseOptions(varargin, self.defaultOptions));
27 self.setLang();
28 if ~isempty(initSolver)
29 self.initFromSolver(initSolver);
30 end
31 end
32
33 function sn = getStruct(self)
34 % QN = GETSTRUCT()
35
36 % Get data structure summarizing the model
37 sn = self.model.getStruct(true);
38 end
39
40 [runtime, tranSysState, tranSync] = run(self, options);
41 Prob = getProb(self, node, state);
42 ProbAggr = getProbAggr(self, node, state);
43 ProbSys = getProbSys(self);
44 ProbSysAggr = getProbSysAggr(self);
45 tranNodeState = sample(self, node, numEvents, markActivePassive);
46 tranNodeStateAggr = sampleAggr(self, node, numEvents, markActivePassive);
47 tranSysStateAggr = sampleSysAggr(self, numEvents, markActivePassive);
48 tranSysState = sampleSys(self, numEvents, markActivePassive);
49
50 function [allMethods] = listValidMethods(self)
51 % allMethods = LISTVALIDMETHODS()
52 % List valid methods for this solver
53
54 %sn = self.model.getStruct();
55 allMethods = {'default','ssa','serial', 'para','parallel','nrm'};
56 end
57
58 function bool = isStochasticMethod(self, method) %#ok<INUSD>
59 % BOOL = ISSTOCHASTICMETHOD(METHOD)
60 % All SSA methods are stochastic simulation.
61 bool = true;
62 end
63 end
64
65 methods (Static)
66
67 function featSupported = getFeatureSet()
68 % FEATSUPPORTED = GETFEATURESET()
69
70 featSupported = SolverFeatureSet;
71 featSupported.setTrue({'Sink','Source','Router',...
72 'ClassSwitch','Delay','DelayStation','Queue',...
73 'Cache','CacheClassSwitcher',...
74 'CacheRetrieval', ...
75 'MAP','MMPP2','MMAP', 'APH', 'PH', 'Replayer',...
76 'Coxian','Erlang','Exp','HyperExp',...
77 'Det','Gamma','Lognormal','Pareto','Uniform','Weibull',...
78 'StatelessClassSwitcher','InfiniteServer',...
79 'SharedServer','Buffer','Dispatcher',...
80 'Server','JobSink','RandomSource','ServiceTunnel',...
81 'SchedStrategy_INF','SchedStrategy_PS',...
82 'SchedStrategy_DPS','SchedStrategy_FCFS',...
83 'SchedStrategy_GPS','SchedStrategy_LPS','SchedStrategy_SIRO',...
84 'SchedStrategy_HOL','SchedStrategy_LCFS',...
85 'SchedStrategy_SEPT','SchedStrategy_LEPT',...
86 'SchedStrategy_LCFSPR',...
87 'SchedStrategy_PSPRIO','SchedStrategy_DPSPRIO','SchedStrategy_GPSPRIO',...
88 'SchedStrategy_LCFSPRPRIO','SchedStrategy_FCFSPRPRIO',...
89 'SchedStrategy_PAS',...
90 'SchedStrategy_OI',...
91 'SchedStrategy_POLLING',...
92 'RoutingStrategy_RROBIN',...
93 'RoutingStrategy_WRROBIN',...
94 'RoutingStrategy_JSQ',...
95 'RoutingStrategy_KCHOICES',...
96 'RoutingStrategy_RL',...
97 'RoutingStrategy_PROB','RoutingStrategy_RAND',...
98 'ReplacementStrategy_RR', 'ReplacementStrategy_FIFO','ReplacementStrategy_SFIFO','ReplacementStrategy_LRU',...
99 'ReplacementStrategy_HLRU','ReplacementStrategy_CLIMB','ReplacementStrategy_QLRU',...
100 'SchedStrategy_EXT','ClosedClass','SelfLoopingClass','OpenClass',...
101 'OpenSignal','ClosedSignal',...
102 'SignalType_NEGATIVE','SignalType_CATASTROPHE',...
103 'SignalBatchRemoval','SignalRemovalPolicy',...
104 'Fork','Join','Forker','Joiner',...
105 'Place', 'Transition', 'Linkage', 'Enabling', 'Inhibiting', 'Timing', 'Firing', 'Storage',...
106 'Balking','Reneging','Retrial',...
107 'LoadDependence','ClassDependence'});
108 end
109
110 function [bool, featSupported] = supports(model)
111 % [BOOL, FEATSUPPORTED] = SUPPORTS(MODEL)
112
113 featUsed = model.getUsedLangFeatures();
114 featSupported = SolverSSA.getFeatureSet();
115 bool = SolverFeatureSet.supports(featSupported, featUsed);
116 end
117
118 function options = defaultOptions()
119 % OPTIONS = DEFAULTOPTIONS()
120
121 options = SolverOptions('SSA');
122 end
123
124 function libs = getLibrariesUsed(sn, options)
125 % GETLIBRARIESUSED Get list of external libraries used by SSA solver
126 % SSA uses internal simulation, no external libraries needed
127 libs = {};
128 end
129
130 end
131end
Definition Station.m:245