1classdef (Sealed) BalkingStrategy
2 % Enumeration of balking strategies.
4 % BalkingStrategy defines how customers decide whether to balk (refuse
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)
10 % Copyright (c) 2012-2026, Imperial College London
11 % All rights reserved.
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)
20 function text = toText(type)
23 % Convert balking strategy constant to text description
25 case BalkingStrategy.QUEUE_LENGTH
26 text =
'queue length';
27 case BalkingStrategy.EXPECTED_WAIT
28 text =
'expected wait';
29 case BalkingStrategy.COMBINED
32 line_error(mfilename,
'Unrecognized balking strategy type.');
36 function
id = toId(type)
39 % Convert balking strategy constant to numeric ID
43 function type = fromId(
id)
46 % Convert numeric ID to balking strategy constant
49 type = BalkingStrategy.QUEUE_LENGTH;
51 type = BalkingStrategy.EXPECTED_WAIT;
53 type = BalkingStrategy.COMBINED;
55 line_error(mfilename, sprintf(
'Unrecognized balking strategy ID: %d',
id));