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