LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
oqn_basic.m
1clear node jobclass solver AvgTable
2
3model = Network('model');
4
5node{1} = Delay(model, 'Delay');
6node{2} = Queue(model, 'Queue1', SchedStrategy.FCFS);
7node{3} = Source(model,'Source');
8node{4} = Sink(model,'Sink');
9
10jobclass{1} = OpenClass(model, 'Class1', 0);
11
12node{1}.setService(jobclass{1}, HyperExp(0.5,3.0,10.0));
13node{2}.setService(jobclass{1}, Exp(1));
14node{3}.setArrival(jobclass{1}, Exp(0.1));
15
16M = model.getNumberOfStations();
17K = model.getNumberOfClasses();
18
19P = cell(K,K);
20P{1,1} = [0,1,0,0; 0,0,0,1; 1,0,0,0; 0,0,0,0];
21
22model.link(P);
23%%
24options = Solver.defaultOptions;
25options.keep=true;
26options.verbose=1;
27options.cutoff = 10;
28options.seed = 23000;
29options.iter_max = 200;
30%options.samples=2e4;
31
32disp('This example shows the execution of the solver on a 1-class 2-node open model.')
33% This part illustrates the execution of different solvers
34solver={};
35solver{end+1} = CTMC(model,options); % CTMC is infinite on this model
36solver{end+1} = FLD(model,options);
37% Solver.defaultOptions carries the GENERIC iter_tol (1e-4), which overrides
38% SolverMVA's own default (1e-6) and stops the AMVA fixed point early: on this
39% suite that costs up to 2.3e-4 of relative accuracy and makes the MATLAB row
40% disagree with the Python row, which passes no options and keeps 1e-6.
41mvaOptions = options;
42mvaOptions.iter_tol = SolverMVA.defaultOptions.iter_tol;
43solver{end+1} = MVA(model,mvaOptions);
44solver{end+1} = MAM(model,options);
45solver{end+1} = NC(model,options);
46solver{end+1} = JMT(model,options);
47% SSA needs a larger budget than the other solvers here: at 1e4 events the
48% standard error of Util/Tput on this rho=0.1 queue is ~4%, which is the same
49% size as the cross-codebase parity tolerance, so no two RNG streams can be
50% expected to agree. 5e4 brings it to ~1.4%. Only SSA is raised, so the JMT and
51% LDES sample budgets (and their baselines) are unchanged.
52ssaOptions = options;
53ssaOptions.samples = 5e4;
54solver{end+1} = SSA(model,ssaOptions);
55% Solver.defaultOptions carries the GENERIC samples budget (1e4), which
56% overrides SolverLDES's own default (2e5) and leaves the simulation 20x
57% shorter than the solver asks for. Restore the solver's own default.
58ldesOptions = options;
59ldesOptions.samples = SolverLDES.defaultOptions.samples;
60solver{end+1} = LDES(model,ldesOptions);
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