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

Laplace approximation of the normalizing constant of a repairman (single-queue, multiclass) model. More...

#include <cmath>
#include <cstddef>
#include <vector>
#include "line/api/pfqn/pfqn_asympt_common.h"
#include "line/num/number.h"
#include "line/util/error.h"
Include dependency graph for pfqn_lap.h:

Go to the source code of this file.

Namespaces

namespace  line
namespace  line::pfqn

Functions

template<class T>
line::pfqn::finish_lap (const std::vector< T > &L, const std::vector< T > &N, const std::vector< T > &Z, const T &Ntot, const T &u0)
 Assembly of the expansion at the saddle point; defined below.
template<class T>
line::pfqn::pfqn_lap (const std::vector< T > &L, const std::vector< T > &N, const std::vector< T > &Z)
 Laplace approximation of the normalizing constant of a repairman (single-queue, multiclass) model.

Detailed Description

Laplace approximation of the normalizing constant of a repairman (single-queue, multiclass) model.

Templated port of matlab/src/api/pfqn/pfqn_lap.m. The McKenna-Mitra integral for a single queueing station is reduced to a one-dimensional Laplace integral whose saddle point u0 solves

f(u) = 1 - sum_r N_r L_r / (Z_r + Ntot L_r u) = 0

after which

log I = log Ntot - sum_r factln(N_r) - Ntot u0 + sum_r N_r log(Z_r + L_r u0 Ntot)

  • (1/2) log(2 pi) - (1/2) log(sum_r (N_r/Ntot)/(Z_r/(Ntot L_r) + u0)^2)
  • (1/2) log Ntot.

ROOT FINDING. MATLAB calls fzero from the initial guess 1, and falls back to a 1e-4 grid scan over (0,10] when fzero returns a non-finite root. f is strictly increasing in u on u > 0 (each term N_r L_r/(Z_r + Ntot L_r u) is decreasing), so the port brackets the root by doubling from 1 and then bisects, which lands on the same root fzero converges to but without a derivative or a Newton step that could leave the domain. The fallback scan is kept for the case where no sign change exists on any bracket, exactly as MATLAB's is.

MATLAB returns NaN when the root is negative. The port throws instead: a NaN normalizing constant propagates silently through a solver, whereas the condition it signals (no admissible saddle point) is a modelling error.

ARITHMETIC. Laplace's method plus logarithms, so gated on num_traits<T>::has_transcendental.

Definition in file pfqn_lap.h.