3model = Network(
'model');
5node{1} = Delay(model,
'Delay');
6node{2} = Queue(model,
'Queue1', SchedStrategy.PS);
7node{3} = Queue(model,
'Queue2', SchedStrategy.PS);
8node{3}.setNumServers(2);
11jobclass{1} = ClosedClass(model,
'Class1', N(1), node{1}, 0);
12jobclass{2} = ClosedClass(model,
'Class2', N(2), node{1}, 0);
14node{1}.setService(
jobclass{1}, Exp(1));
15node{1}.setService(
jobclass{2}, Exp(1));
17node{2}.setService(
jobclass{1}, Exp(3));
18node{2}.setService(
jobclass{2}, Exp(4));
20node{3}.setService(
jobclass{1}, Exp(1));
21node{3}.setService(
jobclass{2}, Exp(3));
24P = model.initRoutingMatrix;
26P{1,1} = [0,1,0; 0,0,0; 1,0,0];
27P{1,2} = [0,0,0; 0,0,1; 0,0,0];
28P{2,1} = [0,1,0; 0,0,0; 1,0,0];
29P{2,2} = [0,0,0; 0,0,1; 0,0,0];
33M = model.getNumberOfStations();
34K = model.getNumberOfClasses();
36%This part illustrates the execution of different solvers
37fprintf(1,
'This example illustrates the calculation of probabilities via normalizing constants.\n')
39options = Solver.defaultOptions;
43% set a custom initial state
49 node{i}.setState(n(i,:));
51state = model.getState;
54% marginal probabilities
for the aggregated state space where station i
55%
is specified by a tuple (nir), r=1,...R, R being the number of
classes.
56solver = CTMC(model,options);
57Pr = solver.getProbAggr(node{M});
58fprintf(1,
'Station %d is in state %s with probability %d\n',i,mat2str(state{i}),Pr);
61solver = NC(model,options);
62Pr = solver.getProbAggr(node{M});
63fprintf(1,
'Station %d is in state %s with probability %d\n',i,mat2str(state{i}),Pr);
66solver = SSA(model,options);
67Pr = solver.getProbAggr(node{M});
68fprintf(1,
'Station %d is in state %s with probability %d\n',i,mat2str(state{i}),Pr);
71solver = JMT(model,options);
72Pr = solver.getProbAggr(node{M});
73fprintf(1,
'Station %d is in state %s with probability %d\n',i,mat2str(state{i}),Pr);
77% marginal probabilities
for the detailed state space, which tracks also
78% the phases of service
79solver = CTMC(model,options);
80Pr = solver.getProb(node{M});
81fprintf(1,
'Station %d is in state %s with probability %d\n',i,mat2str(state{i}),Pr);
84% solver = NC(model,options);
85% Pr = solver.getProb(node{M});
88solver = SSA(model,options);
89Pr = solver.getProb(node{M});
90fprintf(1,
'Station %d is in state %s with probability %d\n',i,mat2str(state{i}),Pr);
94% joint state probabilities
for the aggregated state space where station i
95%
is specified by a tuple (nir), r=1,...R, R being the number of
classes.
96solver = CTMC(model,options);
97Pr = solver.getProbSysAggr();
100solver = NC(model,options);
101Pr = solver.getProbSysAggr();
104solver = SSA(model,options);
105Pr = solver.getProbSysAggr();
108solver = JMT(model,options);
109Pr = solver.getProbSysAggr();
113% joint state probabilities
for the detailed state space, which tracks also
114% the phases of service
115solver = CTMC(model,options);
116Pr = solver.getProbSys();
119% solver = NC(model,options);
120% Pr = solver.getProbSys();
123solver = SSA(model,options);
124Pr = solver.getProbSys();
127% options.samples = 3e5;
128% solver = JMT(model,options);
129% Pr = solver.getProbSys();