LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
getAvgChainTable.m
1function [AvgChain,QTc,UTc,RTc,WTc,ATc,TTc] = getAvgChainTable(self,Q,U,R,T)
2% [AVGCHAIN,QTC,UTC,RTC,WTc,TTC] = GETAVGCHAINTABLE(SELF,Q,U,R,T)
3
4% Copyright (c) 2012-2026, Imperial College London
5% All rights reserved.
6
7if GlobalConstants.DummyMode
8 [AvgChain, QTc, UTc, RTc, TTc, WTc, ATc] = deal(Table());
9 AvgChain = IndexedTable(AvgChain);
10 return
11end
12
13sn = self.model.getStruct;
14M = sn.nstations;
15C = sn.nchains;
16if nargin == 1
17 [Q,U,R,T] = getAvgHandles(self);
18end
19if nargin == 2
20 if iscell(Q) && ~isempty(Q)
21 param = Q;
22 [Q, U, R, T] = deal(param{1:4});
23 % case where varargin is passed as input
24 elseif iscell(Q) && isempty(Q)
25 [Q,U,R,T] = getAvgHandles(self);
26 end
27end
28[QNc,UNc,RNc,WNc,ANc,TNc] = self.getAvgChain(Q,U,R,T);
29
30ChainObj = self.model.getChains();
31ChainName = cellfun(@(c) c.name,ChainObj,'UniformOutput',false);
32ChainClasses = cell(1,length(ChainName));
33for c=1:length(ChainName)
34 ChainClasses{c} = ChainObj{c}.classnames;
35end
36if isempty(QNc)
37 [AvgChain, QTc, UTc, RTc, TTc, ATc] = deal(Table());
38 AvgChain = IndexedTable(AvgChain);
39else
40 [Qval, Uval, Rval, Tval, Resval, Aval] = deal(zeros(M, C));
41 Chain = cell(C*M,1);
42 JobClasses = cell(C*M,1);
43 Station = cell(C*M,1);
44 for c=1:sn.nchains
45 for ist=1:M
46 Chain{(ist-1)*C+c} = ChainName{c};
47 JobClasses((ist-1)*C+c,1) = {label(ChainClasses{c}(:))};
48 Station{(ist-1)*C+c} = Q{ist,c}.station.name;
49 Qval((ist-1)*C+c) = QNc(ist,c);
50 Uval((ist-1)*C+c) = UNc(ist,c);
51 Rval((ist-1)*C+c) = RNc(ist,c);
52 Resval((ist-1)*C+c) = WNc(ist,c);
53 Aval((ist-1)*C+c) = ANc(ist,c);
54 Tval((ist-1)*C+c) = TNc(ist,c);
55 end
56 end
57 Chain = label(Chain);
58 Station = label(Station);
59 QLen = Qval(:); % we need to save first in a variable named like the column
60 QTc = Table(Station,Chain,JobClasses,QLen);
61 Util = Uval(:); % we need to save first in a variable named like the column
62 UTc = Table(Station,Chain,JobClasses,Util);
63 RespT = Rval(:); % we need to save first in a variable named like the column
64 RTc = Table(Station,Chain,JobClasses,RespT);
65 ResidT = Resval(:); % we need to save first in a variable named like the column
66 WTc = Table(Station,Chain,JobClasses,ResidT);
67 Tput = Tval(:); % we need to save first in a variable named like the column
68 TTc = Table(Station,Chain,JobClasses,Tput);
69 ArvR = Aval(:); % we need to save first in a variable named like the column
70 ATc = Table(Station,Chain,JobClasses,ArvR);
71 AvgChain = Table(Station,Chain,JobClasses,QLen,Util,RespT,ResidT,ArvR,Tput);
72 AvgChain = IndexedTable(AvgChain);
73end
74end