LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
statepr_aggr.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} = Queue(model, 'Queue2', SchedStrategy.PS);
8node{3}.setNumServers(2);
9
10N=[2,0];
11jobclass{1} = ClosedClass(model, 'Class1', N(1), node{1}, 0);
12jobclass{2} = ClosedClass(model, 'Class2', N(2), node{1}, 0);
13
14node{1}.setService(jobclass{1}, Exp(1));
15node{1}.setService(jobclass{2}, Exp(1));
16
17node{2}.setService(jobclass{1}, Exp(3));
18node{2}.setService(jobclass{2}, Exp(4));
19
20node{3}.setService(jobclass{1}, Exp(1));
21node{3}.setService(jobclass{2}, Exp(3));
22
23K = length(jobclass);
24P = cell(K,K);
25
26P{1} = [0,1,0; 0,0,1; 1,0,0];
27P{2} = [0,1,0; 0,0,1; 1,0,0];
28
29model.link(P);
30
31M = model.getNumberOfStations();
32K = model.getNumberOfClasses();
33
34% This part illustrates the execution of different solvers
35fprintf(1,'This example illustrates the calculation of probabilities via normalizing constants.\n')
36
37options = Solver.defaultOptions;
38options.verbose=1;
39options.seed=23000;
40%options.samples=1e5;
41
42n=[-1,-1;
43 -1,-1;
44 0, 0]; % rows set to -1 are ignored in the calculation of the marginal probabilities
45
46for i=1:M
47 node{i}.setState(n(i,:));
48end
49state = model.getState;
50
51%%
52i=M;
53solver = CTMC(model,options);
54Pr = solver.getProbAggr(node{i});
55fprintf(1,'Station %d is in state %s with probability %d\n',i,mat2str(state{i}),Pr);
56Pmarg_ctmc = Pr
57
58solver = NC(model,options);
59Pr = solver.getProbAggr(node{i});
60fprintf(1,'Station %d is in state %s with probability %d\n',i,mat2str(state{i}),Pr);
61Pmarg_nc = Pr