LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
removeClass.m
1function self = removeClass(self, jobclass)
2% SELF = REMOVECLASS(SELF, CLASS)
3%
4% Remove the specified CLASS from the model. Each node drops its own
5% per-class configuration through Node.removeJobClass and its overrides
6% (service, capacity, arrival, class switching), mirroring
7% Network.removeClass in the JAR and Network.remove_class in python.
8%
9% Copyright (c) 2012-2026, Imperial College London
10% All rights reserved.
11
12% Resolve the class on THIS model: a caller holding the class object of
13% another model (ModelAdapter.removeClass works on a copy, whose class
14% objects are distinct) must still resolve, hence the lookup by name.
15target = self.getClassByName(jobclass.name);
16if isempty(target) || (isobject(target) && isnan(target.index))
17 return
18end
19
20if hasSingleClass(self)
21 line_error(mfilename,'The network has a single class, it cannot be removed from the model.');
22end
23
24r = target.index;
25remaining = setdiff(1:length(self.classes), r);
26
27for i=1:length(self.nodes)
28 self.nodes{i}.removeJobClass(target);
29end
30
31self.classes = self.classes(remaining);
32% The class-switching mask cached by link() is (K x K): leaving it at the
33% old size makes getRoutingMatrix return chains over classes that no longer
34% exist, and refreshRoutingMatrix then indexes sn.refstat out of range
35% instead of reporting a model error.
36if ~isempty(self.csMatrix)
37 self.csMatrix = self.csMatrix(remaining, remaining);
38end
39self.reset(true); % require a complete re-initialization including state
40end
Definition fjtag.m:161