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

Logistic-sampling estimate of the normalizing constant of a closed product-form network. More...

#include <cmath>
#include <cstddef>
#include <limits>
#include <vector>
#include "line/api/pfqn/pfqn_asympt_common.h"
#include "line/api/pfqn/pfqn_le.h"
#include "line/api/pfqn/pfqn_mc_common.h"
#include "line/num/number.h"
#include "line/util/error.h"
#include "line/util/linalg.h"
#include "line/util/matrix.h"
Include dependency graph for pfqn_ls.h:

Go to the source code of this file.

Classes

struct  line::pfqn::LsResult< T >
 Return value of pfqn_ls, mirroring [Gn, lGn]. More...

Namespaces

namespace  line
namespace  line::pfqn

Functions

template<class T>
LsResult< T > line::pfqn::pfqn_ls (const Matrix< T > &L0, const std::vector< T > &N, const std::vector< T > &Z, std::size_t I, McRng &rng)
 Logistic-sampling estimate of the normalizing constant of a closed product-form network.
template<class T>
LsResult< T > line::pfqn::pfqn_ls (const Matrix< T > &L, const std::vector< T > &N, const std::vector< T > &Z, McRng &rng)
 Reference default of 1e5 samples.

Detailed Description

Logistic-sampling estimate of the normalizing constant of a closed product-form network.

Templated port of matlab/src/api/pfqn/pfqn_ls.m, cross-checked against jar/src/main/java/jline/api/pfqn/nc/Pfqn_ls.java. Reference: G. Casale, "Accelerating performance inference over closed systems by asymptotic methods", ACM SIGMETRICS 2017.

The integral representation used by pfqn_le is estimated by importance sampling rather than by a Laplace expansion: the proposal is the Gaussian N(x0, A^{-1}) whose mode x0 and precision A are exactly the fixed point and Hessian that pfqn_le computes (pfqn_le_fpi / pfqn_le_hessian for Z = 0, pfqn_le_fpiZ / pfqn_le_hessianZ otherwise), and the estimate is the self-normalized average of the log-weights lr = log h(x) - log q(x). Where pfqn_le keeps only the quadratic term of the expansion, pfqn_ls corrects it by Monte Carlo, so it is the same asymptotic device made consistent.

Everything stays in the log domain: exponentiating either the integrand or the normal density overflows once lG reaches a few hundred nats, and the exp(-gammaln) prefactor then underflows, which is the NaN the reference's comments record.

Deviations from the reference, both deliberate:

  • MATLAB routes an all-zero Z to the Z > 0 branch because it tests only isempty(Z). Here an all-zero Z goes to the Z = 0 branch, which is the same integral evaluated without running the fixed point pfqn_le_fpiZ on a degenerate v. This matches the convention already used by pfqn_le in this tree, so the two stay consistent with each other.
  • The proposal draw is z ~ N(0,I) mapped by the Cholesky factor of A^{-1}, which is what MATLAB's mvnrnd does; the factor is computed here rather than delegated, so a non-positive-definite covariance raises a numeric error instead of a library-specific one.

Arithmetic: INEXACT BY CONSTRUCTION. The estimate is a random variable; the proposal is Gaussian, the mode comes from a tolerance-stopped fixed-point iteration, and every weight is a log.

RNG contract: see pfqn_mc_common.h. Comparable to MATLAB only in distribution, never stream for stream; reproducible within this port only when the generator is passed in the same state.

Definition in file pfqn_ls.h.