LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
statepr_aggr_large.m
1clear node jobclass solver
2
3model = Network('model');
4
5node{1} = Delay(model, 'Delay');
6node{2} = Queue(model, 'Queue1', SchedStrategy.PS);
7node{3} = Queue(model, 'Queue2', SchedStrategy.PS);
8
9node{3}.setNumServers(2);
10
11N=[1,0,4,0];
12jobclass{1} = ClosedClass(model, 'Class1', N(1), node{1}, 0);
13jobclass{2} = ClosedClass(model, 'Class2', N(2), node{1}, 0);
14jobclass{3} = ClosedClass(model, 'Class3', N(3), node{1}, 0);
15jobclass{4} = ClosedClass(model, 'Class4', N(4), node{1}, 0);
16
17node{1}.setService(jobclass{1}, Exp(1));
18node{1}.setService(jobclass{2}, Exp(2));
19node{1}.setService(jobclass{3}, Exp(1));
20node{1}.setService(jobclass{4}, Exp(1));
21
22node{2}.setService(jobclass{1}, Exp(3));
23node{2}.setService(jobclass{2}, Exp(4));
24node{2}.setService(jobclass{3}, Exp(5));
25node{2}.setService(jobclass{4}, Exp(1));
26
27node{3}.setService(jobclass{1}, Exp(1));
28node{3}.setService(jobclass{2}, Exp(3));
29node{3}.setService(jobclass{3}, Exp(5));
30node{3}.setService(jobclass{4}, Exp(2));
31
32K = length(jobclass);
33P = cell(K,K);
34
35P{1,1} = [0,1,0; 0,0,1; 0,0,0];
36P{1,2} = [0,0,0; 0,0,0; 1,0,0];
37P{1,3} = [0,0,0; 0,0,0; 0,0,0];
38P{1,4} = [0,0,0; 0,0,0; 0,0,0];
39
40P{2,1} = [0,0,0; 0,0,0; 1,0,0];
41P{2,2} = [0,1,0; 0,0,1; 0,0,0];
42P{2,3} = [0,0,0; 0,0,0; 0,0,0];
43P{2,4} = [0,0,0; 0,0,0; 0,0,0];
44
45P{3,1} = [0,0,0; 0,0,0; 0,0,0];
46P{3,2} = [0,0,0; 0,0,0; 0,0,0];
47P{3,3} = [0,1,0; 0,0,1; 0,0,0];
48P{3,4} = [0,0,0; 0,0,0; 1,0,0];
49
50P{4,1} = [0,0,0; 0,0,0; 0,0,0];
51P{4,2} = [0,0,0; 0,0,0; 0,0,0];
52P{4,3} = [0,0,0; 0,0,0; 1,0,0];
53P{4,4} = [0,0,1; 0,0,0; 0,0,0];
54
55%%pause
56model.link(P);
57
58M = model.getNumberOfStations();
59K = model.getNumberOfClasses();
60
61% This part illustrates the execution of different solvers
62fprintf(1,'This example illustrates the calculation of probabilities via normalizing constants.\n')
63
64
65solver={};
66options = Solver.defaultOptions;
67options.verbose=1;
68options.seed=23000;
69%options.samples=1e5;
70
71n=[-1,-1,-1,-1;
72 -1,-1,-1,-1;
73 1, 0, 2, 1];% rows set to -1 are ignored in the calculation of the marginal probabilities
74for i=1:M
75 node{i}.setState(n(i,:));
76end
77state = model.getState;
78
79solver = CTMC(model,options);
80for i=M
81 Pr = solver.getProbAggr(node{i});
82 fprintf(1,'Station %d is in state %s with probability %d\n',i,mat2str(state{i}),Pr);
83end
84Pr_ctmc = Pr
85
86solver = NC(model,options);
87for i=M
88 Pr = solver.getProbAggr(node{i});
89 fprintf(1,'Station %d is in state %s with probability %d\n',i,mat2str(state{i}),Pr);
90end
91Pr_nc = Pr