LINE Solver (C++)
Templated C++ port of the LINE queueing solver
Loading...
Searching...
No Matches
pfqn_nc_sanitize.h File Reference

Preprocessing shared by the normalizing-constant solvers: drop the classes that cannot contribute, rescale the demands per class, and order the classes so that the zero-think-time ones come first. More...

#include <algorithm>
#include <cstddef>
#include <numeric>
#include <vector>
#include "line/num/number.h"
#include "line/util/error.h"
#include "line/util/matrix.h"
Include dependency graph for pfqn_nc_sanitize.h:

Go to the source code of this file.

Classes

struct  line::pfqn::NcSanitizeResult< T >

Namespaces

namespace  line
 Conservation laws of a layered queueing network, enumerated from its structure.
namespace  line::pfqn

Functions

template<class T>
NcSanitizeResult< T > line::pfqn::pfqn_nc_sanitize (const std::vector< T > &lambda, const Matrix< T > &L, const std::vector< int > &N, const Matrix< T > &Z, const T &atol)
 Preprocessing shared by the normalizing-constant solvers: drop the classes that cannot contribute, rescale the demands per class, and order the classes so that the zero-think-time ones come first.
template<class T>
NcSanitizeResult< T > line::pfqn::pfqn_nc_sanitize (const Matrix< T > &L, const std::vector< int > &N, const Matrix< T > &Z)
 Overload with the exact (zero-tolerance) tests.

Detailed Description

Preprocessing shared by the normalizing-constant solvers: drop the classes that cannot contribute, rescale the demands per class, and order the classes so that the zero-think-time ones come first.

Templated port of matlab/src/api/pfqn/pfqn_nc_sanitize.m.

The transformation is a change of variables on G, not an approximation: dividing every demand and think time of class r by Lmax_r divides G(N) by exactly Lmax_r^{N_r}, and removing a class whose demands are all zero factors out the delay term Z_r^{N_r}/N_r!. Both are returned, so the caller recovers G(N) of the original model as

G_original(N) = Gremaind * G_sanitized(N_sanitized).

MATLAB returns only the LOGARITHM lGremaind of that factor, which is what forces every downstream CoMoM routine into log space. Here the factor itself is returned as a value of T, so the rational path never leaves the field, and lGremaind is provided alongside for the double callers.

Two invariants the reference once broke, kept here because both fail silently:

  1. The delay term of a class confined to the think-time node is Z_r^{N_r}/N_r!, so its log subtracts factln(N_r), not log(N_r); the two agree only at N_r = 1 and 2.
  2. The zero-demand and zero-think-time tests are PER CLASS, on the column sums of L and Z. find() on the matrix itself returns linear indices, which equal column indices only when L has a single row.

Arithmetic: EXACT-CAPABLE. Every operation is a comparison, a division or a multiplication in the field of the inputs. Pass atol = 0 at T = Rational to get the exact "is identically zero" tests; a positive atol reproduces the reference's tolerant filtering in any arithmetic.

Definition in file pfqn_nc_sanitize.h.