LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
example_mm1_exp_impatience.m
1% Example: M/M/1 Queue with Exponential Impatience (Reneging)
2%
3% This example demonstrates customer impatience in a simple M/M/1 queue.
4% Jobs arrive according to a Poisson process and have exponentially
5% distributed service times. If a job waits too long in the queue, it
6% reneges (abandons) according to an exponential patience distribution.
7%
8% Model:
9% - Single queue with FCFS scheduling
10% - Exponential service time (rate = 1.0)
11% - Exponential arrival process (rate = 0.8)
12% - Exponential patience/reneging time (rate = 0.5)
13%
14% Copyright (c) 2012-2026, Imperial College London
15% All rights reserved.
16
17clear node jobclass solver AvgTable
18
19model = Network('M/M/1 with Exponential Impatience');
20
21% Define nodes
22node{1} = Source(model, 'Source');
23node{2} = Queue(model, 'Queue1', SchedStrategy.FCFS);
24node{3} = Sink(model, 'Sink');
25
26% Define job class
27jobclass{1} = OpenClass(model, 'Class1', 0);
28
29% Set service times
30node{2}.setService(jobclass{1}, Exp(1.0)); % Mean service time = 1.0
31
32% Set arrival rate
33node{1}.setArrival(jobclass{1}, Exp(0.8)); % Arrival rate = 0.8
34
35% Set patience distribution (queue-specific)
36% Jobs will renege after an exponentially distributed time with rate 0.5
37node{2}.setPatience(jobclass{1}, Exp(0.5)); % Mean patience = 2.0
38
39% Define routing
40K = model.getNumberOfClasses();
41P = cell(K, K);
42P{1,1} = [0, 1, 0; % Source -> Queue1
43 0, 0, 1; % Queue1 -> Sink
44 0, 0, 0]; % Sink -> nowhere
45
46model.link(P);
47
48%% Solve with JMT
49options = Solver.defaultOptions;
50options.keep = true;
51options.verbose = 1;
52options.samples = 1e5;
53options.seed = 23000;
54
55disp('This example shows a simple M/M/1 queue with exponential impatience.');
56disp('Jobs will abandon (renege) the queue after waiting for an exponential time.');
57disp(' ');
58disp('Model parameters:');
59disp(' - Arrival rate: 0.8');
60disp(' - Service rate: 1.0');
61disp(' - Patience rate: 0.5 (mean patience = 2.0)');
62disp(' ');
63
64solver{1} = JMT(model, options);
65
66fprintf(1, 'SOLVER: %s\n', solver{1}.getName());
67AvgTable{1} = solver{1}.getAvgTable();
68AvgTable{1}
69
70disp(' ');
71disp('Note: The queue length and response time should be lower than a standard M/M/1');
72disp(' due to jobs reneging when their patience expires.');
Definition mmt.m:92