LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
refreshRegions.m
1function sn = refreshRegions(self)
2% SN = REFRESHREGIONS() Populate finite capacity region information in sn struct
3%
4% Copyright (c) 2012-2026, Imperial College London
5% All rights reserved.
6
7% Extract finite capacity region information
8% region is a cell array of size F (number of regions)
9% region{f} is Matrix(M, K+1) where:
10% entry (i,r) = max jobs of class r at station i in region f
11% entry (i,K+1) = global max jobs at station i in region f
12% -1 = infinite capacity
13sn = self.sn;
14if ~isempty(self.regions)
15 F = length(self.regions);
16 sn.nregions = F;
17 sn.region = cell(F, 1);
18
19 M = sn.nstations;
20 K = sn.nclasses;
21
22 % regionrule(f, r) = DropStrategy for class r in region f
23 sn.regionrule = DropStrategy.DROP * ones(F, K); % Default to drop
24 % regionweight(f, r) = class weight for class r in region f
25 sn.regionweight = ones(F, K); % Default weight = 1.0
26 % regionsz(f, r) = class size/memory for class r in region f
27 sn.regionsz = ones(F, K); % Default size = 1
28
29 for f = 1:F
30 fcr = self.regions{f};
31 % Matrix with M rows (stations) and K+1 columns (K classes + 1 global)
32 regionMatrix = -1 * ones(M, K + 1); % Initialize all to infinite (-1)
33
34 % Find which stations are in this region and set their capacities
35 for n = 1:length(fcr.nodes)
36 node = fcr.nodes{n};
37 for i = 1:M
38 if self.stations{i} == node
39 % Set per-class max jobs for this station in this region
40 % fcr.classMaxJobs is an array indexed by class index
41 for r = 1:K
42 regionMatrix(i, r) = fcr.classMaxJobs(r);
43 end
44 % Set global max jobs for this station in this region (column K+1)
45 regionMatrix(i, K + 1) = fcr.globalMaxJobs;
46 break;
47 end
48 end
49 end
50
51 % Extract drop rule for each class in this region
52 for r = 1:K
53 % fcr.dropRule is a DropStrategy array indexed by class index
54 sn.regionrule(f, r) = fcr.dropRule(r);
55 end
56
57 % Extract class weights and sizes for this region
58 for r = 1:K
59 sn.regionweight(f, r) = fcr.classWeight(r);
60 sn.regionsz(f, r) = fcr.classSize(r);
61 end
62
63 sn.region{f} = regionMatrix;
64 end
65else
66 sn.nregions = 0;
67 sn.region = {};
68 sn.regionrule = [];
69 sn.regionweight = [];
70 sn.regionsz = [];
71end
72self.sn = sn;
73end
Definition mmt.m:92