LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
refreshCapacity.m
1function [capacity, classcap, droprule] = refreshCapacity(self)
2% [CAPACITY, CLASSCAP, DROPRULE] = REFRESHCAPACITY()
3
4% Copyright (c) 2012-2026, Imperial College London
5% All rights reserved.
6%I = getNumberOfStatefulNodes(self);
7M = getNumberOfStations(self);
8K = getNumberOfClasses(self);
9C = self.sn.nchains;
10% set zero buffers for classes that are disabled
11classcap = Inf*ones(M,K);
12chaincap = Inf*ones(M,K);
13capacity = zeros(M,1);
14droprule = DropStrategy.WAITQ*ones(M,K);
15sn = self.sn;
16njobs = sn.njobs;
17rates = sn.rates;
18for c = 1:C
19 inchain = sn.inchain{c};
20 for r = inchain
21 chainCap = sum(njobs(inchain));
22 for ist=1:M
23 station = self.getStationByIndex(ist);
24
25 if sn.nodetype(sn.stationToNode(ist)) ~= NodeType.Source
26 % Guard against dropRule array not having entry for class r
27 if length(station.dropRule) >= r && ~isempty(station.dropRule(r))
28 stationDropRule = station.dropRule(r);
29 else
30 stationDropRule = [];
31 end
32 % Default to Drop for finite capacity queues if no explicit drop rule set
33 if isempty(stationDropRule)
34 if ~isinf(station.cap) && station.cap < intmax
35 stationDropRule = DropStrategy.DROP;
36 else
37 stationDropRule = DropStrategy.WAITQ;
38 end
39 end
40 droprule(ist,r) = stationDropRule;
41 end
42 if isnan(rates(ist,r)) && sn.nodetype(sn.stationToNode(ist)) ~= NodeType.Place
43 classcap(ist,r) = 0;
44 chaincap(ist,c) = 0;
45 else
46 chaincap(ist,c) = chainCap;
47 classcap(ist,r) = chainCap;
48 % Guard against classCap array not having entry for class r
49 if length(station.classCap) >= r && station.classCap(r) >= 0
50 classcap(ist,r) = min(classcap(ist,r), station.classCap(r));
51 end
52 if station.cap >= 0
53 classcap(ist,r) = min(classcap(ist,r), station.cap);
54 end
55 end
56 end
57 end
58end
59for ist=1:M
60 capacity(ist,1) = min([sum(chaincap(ist,:)),sum(classcap(ist,:))]);
61end
62self.sn.cap = capacity;
63self.sn.classcap = classcap;
64self.sn.droprule = droprule;
65end