LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
RemovalPolicy.m
1classdef (Sealed) RemovalPolicy
2 % Enumeration of removal policies for negative signals in G-networks.
3 %
4 % When a negative signal (or catastrophe) arrives at a queue and removes
5 % positive customers, the removal policy determines which customers are
6 % selected for removal.
7 %
8 % Policies:
9 % - RANDOM: Uniform random selection from all jobs at the station
10 % - FCFS: Remove oldest jobs first (first-come-first-served order)
11 % - LCFS: Remove newest jobs first (last-come-first-served order)
12 %
13 % Copyright (c) 2012-2026, Imperial College London
14 % All rights reserved.
15
16 properties (Constant)
17 RANDOM = 0; % Uniform random selection
18 FCFS = 1; % Remove oldest jobs first
19 LCFS = 2; % Remove newest jobs first
20 end
21
22 methods (Static)
23 function text = toText(policy)
24 % TEXT = TOTEXT(POLICY) Convert policy to text representation
25 switch policy
26 case RemovalPolicy.RANDOM
27 text = 'random';
28 case RemovalPolicy.FCFS
29 text = 'fcfs';
30 case RemovalPolicy.LCFS
31 text = 'lcfs';
32 otherwise
33 line_error(mfilename, 'Unrecognized removal policy.');
34 end
35 end
36
37 function policy = fromText(text)
38 % POLICY = FROMTEXT(TEXT) Convert text to policy constant
39 if iscell(text)
40 text = text{:};
41 end
42 switch lower(text)
43 case 'random'
44 policy = RemovalPolicy.RANDOM;
45 case 'fcfs'
46 policy = RemovalPolicy.FCFS;
47 case 'lcfs'
48 policy = RemovalPolicy.LCFS;
49 otherwise
50 line_error(mfilename, 'Unrecognized removal policy text.');
51 end
52 end
53 end
54end