LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
chooseAvgSolverAI.m
1function solver = chooseAvgSolverAI(self)
2% This function takes as input a QN model defined in LINE and returns
3% a Solver object with the predicted method loaded
4this_model = self.model;
5sn = this_model.getStruct;
6dataVector = zeros(1, 15);
7
8% Station and scheduling information
9dataVector(1) = sum(sn.sched == SchedStrategy.FCFS); % Num FCFS queues
10dataVector(2) = sum(sn.sched == SchedStrategy.PS); % Num PS queues
11dataVector(3) = sum(sn.sched == SchedStrategy.INF); % Num delays
12dataVector(4) = sn.nnodes - sn.nstations; % Num CS nodes
13dataVector(5) = sum(sn.nservers(~isinf(sn.nservers))); % Num queue servers
14
15% Job information
16dataVector(6) = sn.nchains; % Num chains
17dataVector(7) = sn.nclosedjobs; % Number of jobs in the system
18
19% Service process information
20numexp = 0;
21numhyperexp = 0;
22numerlang = 0;
23
24for i = 1 : this_model.getNumberOfStations
25 for j = 1 : this_model.getNumberOfClasses
26 switch this_model.stations{i}.serviceProcess{j}.name
27 case 'Exp'
28 numexp = numexp + 1;
29 case 'HyperExp'
30 numhyperexp = numhyperexp + 1;
31 case 'Erlang'
32 numerlang = numerlang + 1;
33 end
34 end
35end
36
37dataVector(8:10) = [numexp numhyperexp numerlang]; % Num of each distribution type
38dataVector(11) = mean(sn.rates, 'all', 'omitnan'); % Avg service rate
39dataVector(12) = mean(sn.scv, 'all', 'omitnan'); % Avg SCV
40dataVector(13) = mean(sn.phases, 'all', 'omitnan'); % Avg phases
41
42% Misc
43dataVector(14) = sum(sn.nodetype == NodeType.Queue) == 1; % If only 1 Queue, special for nc.mmint
44dataVector(15) = this_model.hasProductFormSolution; % Check if model has product form solution
45
46%Add derived features
47dataVector = [dataVector dataVector(:, 1:3) ./ sum(dataVector(:, 1:3), 2)]; % Percent FCFS, PS, Delay
48dataVector = [dataVector logical(dataVector(:, 4))]; % Has CS or not
49dataVector = [dataVector dataVector(:, 5) ./ sum(dataVector(:, 1:2), 2)]; % Avg svrs per Queue
50dataVector = [dataVector dataVector(:, 7) ./ dataVector(:, 6)]; % Num jobs per chain
51dataVector = [dataVector dataVector(:, 8:10) ./ sum(dataVector(:, 8:10), 2)]; % Percent distributions
52
53load('classifier.mat', 'classifier', 'methodNames', 'selected');
54if isa(classifier, 'cell')
55 chosenMethod = predictEnsemble(classifier, dataVector(selected(1:length(dataVector))));
56else
57 chosenMethod = predict(classifier, dataVector(selected(1:length(dataVector))));
58end
59
60solver = LINE.load(methodNames(chosenMethod), this_model);
61end
62
Definition mmt.m:92