LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
SolverDES.m
1classdef SolverDES < NetworkSolver
2 % SolverDES Discrete Event Simulation solver using SSJ library
3 %
4 % SolverDES implements a discrete-event simulation solver that uses the SSJ
5 % (Stochastic Simulation in Java) library to analyze queueing networks.
6 % It supports open and closed networks with various service distributions,
7 % scheduling strategies, and advanced node types.
8 %
9 % For LayeredNetwork (LQN) models, SolverDES also supports DES simulation.
10 %
11 % @brief Discrete-event simulation solver using SSJ library
12 %
13 % Example:
14 % @code
15 % solver = SolverDES(model, 'samples', 1000000, 'seed', 23000);
16 % solver.getAvg(); % Run DES simulation
17 % @endcode
18 %
19 % Copyright (c) 2012-2026, Imperial College London
20 % All rights reserved.
21
22 methods
23 function self = SolverDES(model, varargin)
24 % SOLVERDES Create a DES solver instance
25 %
26 % @brief Creates a Discrete Event Simulation solver
27 % @param model Network model to be analyzed via DES simulation
28 % @param varargin Optional parameters (samples, seed, method, etc.)
29 % @return self SolverDES instance configured for simulation
30
31 self@NetworkSolver(model, mfilename);
32 self.setOptions(Solver.parseOptions(varargin, self.defaultOptions));
33 % SolverDES only supports Java backend - force lang to 'java'
34 self.options.lang = 'java';
35 self.setLang();
36 end
37
38 function sn = getStruct(self)
39 % QN = GETSTRUCT()
40
41 % Get data structure summarizing the model
42 sn = self.model.getStruct(true);
43 end
44
45 function [allMethods] = listValidMethods(self)
46 % allMethods = LISTVALIDMETHODS()
47 % List valid methods for this solver
48
49 allMethods = {'default'};
50 end
51 end
52
53 methods (Static)
54
55 function featSupported = getFeatureSet()
56 % FEATSUPPORTED = GETFEATURESET()
57
58 featSupported = SolverFeatureSet;
59 featSupported.setTrue({'Sink', 'Source', ...
60 'Queue', 'Delay', ...
61 'Fork', 'Join', 'Forker', 'Joiner', ... % Fork-Join node support
62 'Linkage', 'Enabling', 'Timing', 'Firing', 'Storage', ... % Petri net section support
63 'Logger', 'LogTunnel', ... % Logger node support
64 'Buffer', ... % Finite buffer capacity support
65 'Region', ... % Finite capacity region support
66 'Exp', 'Erlang', 'HyperExp', 'PH', 'APH', 'Coxian', 'Cox2', 'MAP', 'MMPP2', 'Replayer', ...
67 'Det', 'Uniform', 'Gamma', 'Pareto', 'Weibull', 'Lognormal', ... % Additional continuous distributions
68 'Server', 'RandomSource', ...
69 'SchedStrategy_FCFS', 'SchedStrategy_INF', ...
70 'SchedStrategy_HOL', ... % Priority scheduling (FCFS with priorities)
71 'SchedStrategy_PS', ... % Processor Sharing
72 'SchedStrategy_DPS', ... % Discriminatory Processor Sharing
73 'SchedStrategy_GPS', ... % Generalized Processor Sharing
74 'SchedStrategy_LCFS', ... % Last Come First Served (non-preemptive)
75 'SchedStrategy_LCFSPR', ... % LCFS Preemptive Resume
76 'SchedStrategy_LCFSPI', ... % LCFS Preemptive Independent
77 'SchedStrategy_SIRO', ...
78 'SchedStrategy_SJF', 'SchedStrategy_LJF', ...
79 'SchedStrategy_LEPT', ...
80 'SchedStrategy_SEPT', ...
81 'SchedStrategy_SRPT', ... % Shortest Remaining Processing Time (preemptive)
82 'SchedStrategy_SRPTPRIO', ... % SRPT with priorities
83 'SchedStrategy_PSJF', ... % Preemptive Shortest Job First
84 'SchedStrategy_FB', ... % Feedback / Least Attained Service
85 'SchedStrategy_LRPT', ... % Longest Remaining Processing Time
86 'SchedStrategy_EXT', ...
87 'SchedStrategy_POLLING', ... % Polling scheduling (GATED, EXHAUSTIVE, KLIMITED)
88 'Router', ... % Router node support
89 'ClassSwitch', 'StatelessClassSwitcher', ... % Class switching node support
90 'Cache', 'CacheClassSwitcher', ... % Cache node support with replacement policies (LRU, FIFO, Strict FIFO, RR)
91 'RoutingStrategy_PROB', 'RoutingStrategy_RAND', ...
92 'RoutingStrategy_RROBIN', 'RoutingStrategy_WRROBIN', ...
93 'RoutingStrategy_KCHOICES', ... % Power of K Choices routing
94 'OpenClass', ...
95 'ClosedClass', ...
96 'ReplacementStrategy_RR', 'ReplacementStrategy_FIFO', 'ReplacementStrategy_SFIFO', 'ReplacementStrategy_LRU'});
97 end
98
99 function [bool, featSupported] = supports(model)
100 % [BOOL, FEATSUPPORTED] = SUPPORTS(MODEL)
101
102 if isa(model, 'LayeredNetwork')
103 % LayeredNetwork not supported - use SolverLDES from line-apps
104 bool = false;
105 featSupported = SolverFeatureSet;
106 line_warning(mfilename, 'SolverDES does not support LayeredNetwork models. Use SolverLDES from line-apps.');
107 return;
108 end
109
110 % Regular Network support
111 featUsed = model.getUsedLangFeatures();
112 featSupported = SolverDES.getFeatureSet();
113 bool = SolverFeatureSet.supports(featSupported, featUsed);
114 end
115
116 function options = defaultOptions()
117 % OPTIONS = DEFAULTOPTIONS()
118
119 options = SolverOptions('DES');
120 end
121
122 end
123end