2model = Network(
'model');
4node{1} = Delay(model,
'InfiniteServer');
5node{2} = Queue(model,
'Queue1', SchedStrategy.PS);
6node{2}.setNumServers(2);
8jobclass{1} = ClosedClass(model,
'Class1', 3, node{1}, 0);
9jobclass{2} = ClosedClass(model,
'Class2', 1, node{1}, 0);
11node{1}.setService(
jobclass{1}, Exp(3));
12node{1}.setService(
jobclass{2}, Exp(0.5));
14node{2}.setService(
jobclass{1}, Exp(0.1));
15node{2}.setService(
jobclass{2}, Exp(1));
17M = model.getNumberOfStations();
18K = model.getNumberOfClasses();
21P{1,1} = [0.3,0.1; 0.2,0];
22P{1,2} = [0.6,0; 0.8,0];
27model.initFromMarginalAndStarted([2,1;1,0],[0,0;1,0]);
29options = Solver.defaultOptions;
34disp(
'This example shows the execution of the solver on a 2-class 2-node class-switching model with specified initial state.')
35% This part illustrates
the execution of different
solvers
36solver{1} = CTMC(model,options);
37solver{end+1} = JMT(model,options);
38solver{end+1} = SSA(model,options);
39solver{end+1} = FLD(model,options);
40% Solver.defaultOptions carries
the GENERIC iter_tol (1e-4), which overrides
41% SolverMVA
's own default (1e-6) and stops the AMVA fixed point early: on this
42% suite that costs up to 2.3e-4 of relative accuracy and makes the MATLAB row
43% disagree with the Python row, which passes no options and keeps 1e-6.
45mvaOptions.iter_tol = SolverMVA.defaultOptions.iter_tol;
46solver{end+1} = MVA(model,mvaOptions);
47solver{end+1} = NC(model,options);
49 fprintf(1,'SOLVER: %s\n
',strrep(solver{s}.getName(),'Solver
',''));
50 AvgTable{s} = solver{s}.getAvgTable();