LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
ReplacementStrategy.m
1classdef (Sealed) ReplacementStrategy
2 % Enumeration of cache replacement strategies
3 %
4 % Copyright (c) 2012-2026, Imperial College London
5 % All rights reserved.
6
7 properties (Constant)
8 RR = 0;
9 FIFO = 1;
10 SFIFO = 2; % strict fifo
11 LRU = 3;
12 HLRU = 4; % hierarchical/k-LRU: h lists, LRU discipline, promote i->i+1 on hit
13 CLIMB = 5; % move-up-one-position on hit (transposition rule)
14 QLRU = 6; % q-LRU: LRU discipline with probabilistic admission q on a miss
15 end
16
17 methods (Static)
18
19 function text = toString(type)
20 % TEXT = TOSTRING(ID)
21 text = ReplacementStrategy.toText(type);
22 end
23
24 function text = toText(type)
25 % TEXT = TOTEXT(ID)
26 switch type
27 case ReplacementStrategy.RR
28 text = 'rr';
29 case ReplacementStrategy.FIFO
30 text = 'fifo';
31 case ReplacementStrategy.SFIFO
32 text = 'strict-fifo';
33 case ReplacementStrategy.LRU
34 text = 'lru';
35 case ReplacementStrategy.HLRU
36 text = 'hlru';
37 case ReplacementStrategy.CLIMB
38 text = 'climb';
39 case ReplacementStrategy.QLRU
40 text = 'qlru';
41 end
42 end
43
44 function text = toFeature(type)
45 % TEXT = TOFEATURE(TYPE)
46
47 switch type
48 case ReplacementStrategy.RR
49 text = 'ReplacementStrategy_RR';
50 case ReplacementStrategy.FIFO
51 text = 'ReplacementStrategy_FIFO';
52 case ReplacementStrategy.SFIFO
53 text = 'ReplacementStrategy_SFIFO';
54 case ReplacementStrategy.LRU
55 text = 'ReplacementStrategy_LRU';
56 case ReplacementStrategy.HLRU
57 text = 'ReplacementStrategy_HLRU';
58 case ReplacementStrategy.CLIMB
59 text = 'ReplacementStrategy_CLIMB';
60 case ReplacementStrategy.QLRU
61 text = 'ReplacementStrategy_QLRU';
62 end
63 end
64 end
65end