LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
FiniteCapacityRegion.m
1classdef FiniteCapacityRegion < handle
2 % A finite capacity region
3 %
4 % Copyright (c) 2012-2026, Imperial College London
5 % All rights reserved.
6
7 properties (Constant)
8 UNBOUNDED = -1;
9 end
10
11 properties
12 name;
13 classes;
14 nodes;
15 globalMaxJobs;
16 globalMaxMemory;
17 classMaxJobs;
18 classMaxMemory;
19 dropRule;
20 classWeight;
21 classSize;
22 end
23
24 methods
25 function self = FiniteCapacityRegion(nodes,classes)
26 self.name = '';
27 self.nodes = {nodes{:}}';
28 self.classes = classes;
29 self.globalMaxJobs = FiniteCapacityRegion.UNBOUNDED;
30 self.globalMaxMemory = FiniteCapacityRegion.UNBOUNDED;
31 self.classWeight = ones(1,length(self.classes));
32 self.dropRule = DropStrategy.WAITQ * ones(1,length(self.classes));
33 self.classSize = ones(1,length(self.classes));
34 self.classMaxJobs = FiniteCapacityRegion.UNBOUNDED * ones(1,length(self.classes));
35 self.classMaxMemory = FiniteCapacityRegion.UNBOUNDED * ones(1,length(self.classes));
36 end
37
38 function self = setGlobalMaxJobs(self, njobs)
39 self.globalMaxJobs = njobs;
40 end
41
42 function self = setGlobalMaxMemory(self, memlim)
43 self.globalMaxMemory = memlim;
44 end
45
46 function self = setClassMaxJobs(self, class, njobs)
47 self.classMaxJobs(class.index) = njobs;
48 end
49
50 function self = setClassWeight(self, class, weight)
51 self.classWeight(class.index) = weight;
52 end
53
54 function self = setDropRule(self, class, dropStrategy)
55 % SELF = SETDROPRULE(CLASS, DROPSTRATEGY)
56 % Set the drop rule for a class.
57 % dropStrategy can be:
58 % - A boolean: true = DROP, false = WAITQ (for backwards compatibility)
59 % - A DropStrategy enum value: DROP, WAITQ, BAS, BBS, RSRD
60 if islogical(dropStrategy)
61 if dropStrategy
62 self.dropRule(class.index) = DropStrategy.DROP;
63 else
64 self.dropRule(class.index) = DropStrategy.WAITQ;
65 end
66 else
67 self.dropRule(class.index) = dropStrategy;
68 end
69 end
70
71 function strategy = getDropRule(self, class)
72 % STRATEGY = GETDROPRULE(CLASS)
73 % Get the drop strategy for a class.
74 strategy = self.dropRule(class.index);
75 end
76
77 function self = setClassSize(self, class, size)
78 self.classSize(class.index) = size;
79 end
80
81 function self = setClassMaxMemory(self, class, memlim)
82 self.classMaxMemory(class.index) = memlim;
83 end
84
85 function self = setName(self, name)
86 self.name = name;
87 end
88
89 function name = getName(self)
90 name = self.name;
91 end
92 end
93
94end
Definition mmt.m:92