LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
BalkingStrategy.m
1classdef (Sealed) BalkingStrategy
2 % Enumeration of balking strategies.
3 %
4 % BalkingStrategy defines how customers decide whether to balk (refuse
5 % to join a queue):
6 % QUEUE_LENGTH - Balk based on current queue length ranges
7 % EXPECTED_WAIT - Balk based on expected waiting time
8 % COMBINED - Balk if either condition is met (OR logic)
9 %
10 % Copyright (c) 2012-2026, Imperial College London
11 % All rights reserved.
12
13 properties (Constant)
14 QUEUE_LENGTH = 1; % Balk based on queue length ranges with probability
15 EXPECTED_WAIT = 2; % Balk based on expected waiting time
16 COMBINED = 3; % Both conditions (OR logic)
17 end
18
19 methods (Static)
20 function text = toText(type)
21 % TEXT = TOTEXT(TYPE)
22 %
23 % Convert balking strategy constant to text description
24 switch type
25 case BalkingStrategy.QUEUE_LENGTH
26 text = 'queue length';
27 case BalkingStrategy.EXPECTED_WAIT
28 text = 'expected wait';
29 case BalkingStrategy.COMBINED
30 text = 'combined';
31 otherwise
32 line_error(mfilename, 'Unrecognized balking strategy type.');
33 end
34 end
35
36 function id = toId(type)
37 % ID = TOID(TYPE)
38 %
39 % Convert balking strategy constant to numeric ID
40 id = type;
41 end
42
43 function type = fromId(id)
44 % TYPE = FROMID(ID)
45 %
46 % Convert numeric ID to balking strategy constant
47 switch id
48 case 1
49 type = BalkingStrategy.QUEUE_LENGTH;
50 case 2
51 type = BalkingStrategy.EXPECTED_WAIT;
52 case 3
53 type = BalkingStrategy.COMBINED;
54 otherwise
55 line_error(mfilename, sprintf('Unrecognized balking strategy ID: %d', id));
56 end
57 end
58 end
59end