3model = Network(
'model');
5node{1} = Delay(model,
'Delay');
6node{2} = Queue(model,
'Queue1', SchedStrategy.PS);
7node{3} = Source(model,
'Source');
8node{4} = Sink(model,
'Sink');
10jobclass{1} = ClosedClass(model,
'ClosedClass', 2, node{1}, 0);
11jobclass{2} = OpenClass(model,
'OpenClass', 0);
13node{1}.setService(
jobclass{1}, Erlang(3,2));
14node{1}.setService(
jobclass{2}, HyperExp(0.5,3.0,10.0));
16node{2}.setService(
jobclass{1}, HyperExp(0.1,1.0,10.0));
17node{2}.setService(
jobclass{2}, Exp(1));
19node{3}.setArrival(
jobclass{2}, Exp(0.1));
21M = model.getNumberOfNodes();
22K = model.getNumberOfClasses();
24P = model.initRoutingMatrix;
25P{1,1} = zeros(M);
P{1,1}(1:2,1:2) = circul(2);
27P{2,2} = [0,1,0,0; 0,0,0,1; 1,0,0,0; 0,0,0,0];
32options = Solver.defaultOptions;
39disp(
'This example shows the execution of the solver on a 2-class 2-node mixed model.')
40% This part illustrates
the execution of different
solvers
42solver{end+1} = CTMC(model,options); % CTMC
is infinite on
this model
43solver{end+1} = JMT(model,options);
44solver{end+1} = SSA(model,options);
45%solver{end+1} = FLD(model,options);
46% Solver.defaultOptions carries
the GENERIC iter_tol (1e-4), which overrides
47% SolverMVA
's own default (1e-6) and stops the AMVA fixed point early: on this
48% suite that costs up to 2.3e-4 of relative accuracy and makes the MATLAB row
49% disagree with the Python row, which passes no options and keeps 1e-6.
51mvaOptions.iter_tol = SolverMVA.defaultOptions.iter_tol;
52solver{end+1} = MVA(model,mvaOptions);
53% Solver.defaultOptions carries the GENERIC samples budget (1e4), which
54% overrides SolverLDES's own
default (2e5) and leaves
the simulation 20x
55% shorter than
the solver asks
for. Restore
the solver
's own default.
57ldesOptions.samples = SolverLDES.defaultOptions.samples;
58solver{end+1} = LDES(model,ldesOptions);
59%solver{end+1} = NC(model,options);
60%solver{end+1} = MAM(model,options);
62 fprintf(1,'SOLVER: %s\n
',strrep(solver{s}.getName(),'Solver
',''));
63 AvgTable{s} = solver{s}.getAvgTable();