LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
init_state_fcfs_exp.m
1clear node jobclass solver;
2
3model = Network('model');
4
5node{1} = Delay(model, 'Delay');
6node{2} = Queue(model, 'Queue1', SchedStrategy.FCFS);
7jobclass{1} = ClosedClass(model, 'Class1', 5, node{2}, 0);
8
9node{1}.setService(jobclass{1}, Exp(1));
10node{2}.setService(jobclass{1}, Exp(0.7));
11
12M = model.getNumberOfStations();
13K = model.getNumberOfClasses();
14
15P = cell(K,K);
16P{1} = circul(2);
17
18model.link(P);
19[Qt,Ut,Tt] = model.getTranHandles();
20options = Solver.defaultOptions;
21options.verbose=0;
22options.samples=1e4;
23options.stiff=true;
24options.timespan = [0,40];
25
26%% This part illustrates the execution of different solvers
27solver={};
28solver{end+1} = CTMC(model,options);
29%solver{end+1} = JMT(model,options);
30%solver{end+1} = SSA(model,options);
31solver{end+1} = FLD(model,options);
32%solver{end+1} = MVA(model,options);
33dashing = {'-','+'};
34
35%%
36model.initDefault;
37disp('Prior 1: prior all on default initialization')
38disp('Initial state is:')
39state=model.getState();
40[state{1}(1,:),state{2}(1,:)]
41for s=1:length(solver)
42 fprintf(1,'SOLVER: %s\n',solver{s}.getName());
43 [QNt,UNt,TNt] = solver{s}.getTranAvg(Qt,Ut,Tt);
44 subplot(1,2,1);
45 plot(QNt{2,1}.t,QNt{2,1}.metric,dashing{s}); hold on
46 solver{s}.reset();
47end
48title('Prior on default state');
49ylabel('Queue length - station 2, class 1');
50ylim([3,5])
51xlabel('Time t');
52xlim(options.timespan)
53legend('ctmc','fluid','Location','SouthEast')
54
55%%
56model.initFromMarginal([2;3]);
57disp('Prior 2: prior all on first found state with given marginal')
58disp('Initial state is:')
59state=model.getState();
60[state{1}(1,:),state{2}(1,:)]
61for s=1:length(solver)
62 solver{s}.reset();
63 fprintf(1,'SOLVER: %s\n',solver{s}.getName());
64 [QNt_marg,UNt_marg,TNt_marg] = solver{s}.getTranAvg(Qt,Ut,Tt);
65 subplot(1,2,2);
66 plot(QNt_marg{2,1}.t,QNt_marg{2,1}.metric,dashing{s}); hold on
67 solver{s}.reset();
68end
69title('Prior on state with 3 jobs in station 2');
70ylabel('Queue length - station 2, class 1');
71ylim([3,5])
72xlabel('Time t');
73xlim(options.timespan)
74%legend('ctmc','fluid')