LINE Solver (C++)
Templated C++ port of the LINE queueing solver
Loading...
Searching...
No Matches
fj_rmax.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2012-2026, QORE Lab, Imperial College London
3 * All rights reserved.
4 */
5#ifndef LINE_API_FJ_RMAX_H
6#define LINE_API_FJ_RMAX_H
7
8/**
9 * @file
10 * @ingroup api_fj
11 * Pessimistic (independence) fork-join response time: the expected maximum of
12 * K independent M/M/1 response times, each exponential with rate mu - lambda.
13 *
14 * Templated port of matlab/src/api/fj/fj_rmax.m, cross-checked against
15 * FJ_rmax.fj_rmax in jar/src/main/java/jline/api/fj/FJ_rmax.java (identical;
16 * the JAR additionally rejects rho >= 1 explicitly, where MATLAB leaves the
17 * check to qsys_mm1).
18 *
19 * Rmax = H_K R(rho) = H_K / (mu - lambda)
20 *
21 * Rational, hence exact in the field.
22 */
23
27#include "line/num/number.h"
28
29namespace line {
30namespace fj {
31
32/**
33 * @brief Pessimistic (independence) fork-join response time: the expected
34 * maximum of K independent M/M/1 response times, each exponential with
35 * rate mu - lambda.
36 *
37 * @param K number of parallel branches, K >= 1
38 * @param lambda arrival rate
39 * @param mu per-branch service rate
40 * @return H_K / (mu - lambda)
41 */
42template <class T>
43T fj_rmax(unsigned K, const T& lambda, const T& mu) {
44 detail::require_positive_K(K, "fj_rmax");
45 return fj_harmonic<T>(K) * qsys::qsys_mm1(lambda, mu).W;
46}
47
48} // namespace fj
49} // namespace line
50
51#endif // LINE_API_FJ_RMAX_H
Harmonic number H_K = sum_{k=1..K} 1/k.
Shared return types and arithmetic helpers for the templated fork-join port.
T fj_rmax(unsigned K, const T &lambda, const T &mu)
Pessimistic (independence) fork-join response time: the expected maximum of K independent M/M/1 respo...
Definition fj_rmax.h:43
T fj_harmonic(unsigned K)
Harmonic number H_K = sum_{k=1..K} 1/k.
Definition fj_harmonic.h:37
QsysResult< T > qsys_mm1(const T &lambda, const T &mu)
Exact mean response time of the M/M/1 queue.
Definition qsys_mm1.h:35
Number-type abstraction for the templated API port.
Exact mean response time of the M/M/1 queue.