LINE Solver (C++)
Templated C++ port of the LINE queueing solver
Loading...
Searching...
No Matches
pfqn_linearizer.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_PFQN_LINEARIZER_H
6#define LINE_API_PFQN_LINEARIZER_H
7
8/**
9 * @file
10 * @ingroup api_pfqn
11 * Chandy-Neuse Linearizer for single-server stations.
12 *
13 * Templated port of matlab/src/api/pfqn/pfqn_linearizer.m, cross-checked
14 * against jar/src/main/java/jline/api/pfqn/mva/Pfqn_linearizer.java. Both
15 * reference implementations are one line: the original Linearizer is the
16 * extended generalized fixed-point Linearizer with every scaling exponent set
17 * to one, so this delegates to pfqn_egflinearizer with alpha == 1.
18 *
19 * Arithmetic: TRANSCENDENTAL-GATED, inherited from pfqn_egflinearizer. At
20 * alpha == 1 the power N_r^alpha_r degenerates to a rational operation, but
21 * the algorithm still stops the inner Core loop on
22 * enorm(Q_{k+1} - Q_k) < tol, so the returned value still depends on the
23 * stopping rule and is not the solution of a finite rational problem.
24 */
25
26#include <cstddef>
27#include <vector>
28
31#include "line/num/number.h"
32#include "line/util/matrix.h"
33
34namespace line {
35namespace pfqn {
36
37/**
38 * @brief Chandy-Neuse Linearizer for single-server stations.
39 *
40 * @param L (M x R) service demands
41 * @param N (R) population per class
42 * @param Z (K x R) think times, summed over rows; may be empty
43 * @param type (M) scheduling discipline; carried, see pfqn_egflinearizer
44 * @param tol convergence tolerance
45 * @param maxiter total inner-iteration budget
46 * @param QN0 (M x R) warm start; may be empty
47 */
48template <class T>
49LinearizerResult<T> pfqn_linearizer(const Matrix<T>& L, const std::vector<int>& N,
50 const Matrix<T>& Z, const std::vector<SchedStrategy>& type,
51 double tol, int maxiter, const Matrix<T>& QN0) {
52 // alpha == 1 makes the real power the identity, so this branch is field
53 // arithmetic throughout; see the gate note in pfqn_egflinearizer.
54 const std::vector<T> alpha(N.size(), num_traits<T>::from_int(1));
55 return pfqn_egflinearizer(L, N, Z, type, tol, maxiter, alpha, QN0);
56}
57
58template <class T>
59LinearizerResult<T> pfqn_linearizer(const Matrix<T>& L, const std::vector<int>& N,
60 const Matrix<T>& Z) {
61 return pfqn_linearizer(L, N, Z, std::vector<SchedStrategy>(), 1e-8, 1000, Matrix<T>());
62}
63
64template <class T>
65LinearizerResult<T> pfqn_linearizer(const Matrix<T>& L, const std::vector<int>& N) {
66 return pfqn_linearizer(L, N, Matrix<T>(), std::vector<SchedStrategy>(), 1e-8, 1000,
67 Matrix<T>());
68}
69
70} // namespace pfqn
71} // namespace line
72
73#endif // LINE_API_PFQN_LINEARIZER_H
Dense matrix and non-owning view.
LinearizerResult< T > pfqn_egflinearizer(const Matrix< T > &L, const std::vector< int > &N, const Matrix< T > &Z, const std::vector< SchedStrategy > &type, double tol, int maxiter, const std::vector< T > &alpha, const Matrix< T > &QN0, int npasses=3)
Extended generalized fixed-point Linearizer (De Souza e Silva and Muntz's generalization of Chandy an...
LinearizerResult< T > pfqn_linearizer(const Matrix< T > &L, const std::vector< int > &N, const Matrix< T > &Z, const std::vector< SchedStrategy > &type, double tol, int maxiter, const Matrix< T > &QN0)
Chandy-Neuse Linearizer for single-server stations.
Number-type abstraction for the templated API port.
Scaffolding shared by the approximate-MVA family.
Extended generalized fixed-point Linearizer (De Souza e Silva and Muntz's generalization of Chandy an...
Return value of the Linearizer family, mirroring [Q,U,W,C,X,totiter].