LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
mqn_basic.m
1clear node jobclass solver AvgTable
2
3model = Network('model');
4
5node{1} = Delay(model, 'Delay');
6node{2} = Queue(model, 'Queue1', SchedStrategy.PS);
7node{3} = Source(model,'Source');
8node{4} = Sink(model,'Sink');
9
10jobclass{1} = ClosedClass(model, 'ClosedClass', 2, node{1}, 0);
11jobclass{2} = OpenClass(model, 'OpenClass', 0);
12
13node{1}.setService(jobclass{1}, Erlang(3,2));
14node{1}.setService(jobclass{2}, HyperExp(0.5,3.0,10.0));
15
16node{2}.setService(jobclass{1}, HyperExp(0.1,1.0,10.0));
17node{2}.setService(jobclass{2}, Exp(1));
18
19node{3}.setArrival(jobclass{2}, Exp(0.1));
20
21M = model.getNumberOfNodes();
22K = model.getNumberOfClasses();
23
24P = model.initRoutingMatrix;
25P{1,1} = zeros(M); P{1,1}(1:2,1:2) = circul(2);
26P{1,2} = zeros(M);
27P{2,2} = [0,1,0,0; 0,0,0,1; 1,0,0,0; 0,0,0,0];
28P{2,1} = zeros(M);
29
30model.link(P);
31%%
32options = Solver.defaultOptions;
33options.keep=true;
34options.verbose=1;
35options.cutoff = 3;
36options.seed = 23000;
37%options.samples=2e4;
38
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
41solver={};
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.
50mvaOptions = options;
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.
56ldesOptions = options;
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);
61for s=1:length(solver)
62 fprintf(1,'SOLVER: %s\n',strrep(solver{s}.getName(),'Solver',''));
63 AvgTable{s} = solver{s}.getAvgTable();
64 AvgTable{s}
65end
Definition Station.m:245