LINE Solver (C++)
Templated C++ port of the LINE queueing solver
Loading...
Searching...
No Matches
pfqn_is.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_IS_H
6#define LINE_API_PFQN_IS_H
7
8/**
9 * @file
10 * @ingroup api_pfqn
11 * Importance-sampling estimate of the normalizing constant of a closed
12 * LOAD-INDEPENDENT product-form network.
13 *
14 * Templated port of matlab/src/api/pfqn/pfqn_is.m, which is one line: the
15 * load-independent case mu_i(k) = 1 of pfqn_ld_is. This header keeps the same
16 * shape so that the two entry points stay in step, rather than duplicating the
17 * estimator.
18 *
19 * Arithmetic: INEXACT BY CONSTRUCTION, gated on has_transcendental for the
20 * same reason as pfqn_ld_is (a random output, plus lG = log(G)).
21 *
22 * RNG contract: see pfqn_mc_common.h. Comparable to MATLAB only in
23 * distribution, never stream for stream; reproducible within this port only
24 * when the generator is passed in the same state.
25 */
26
27#include <cstddef>
28#include <vector>
29
33#include "line/num/number.h"
34#include "line/util/matrix.h"
35
36namespace line {
37namespace pfqn {
38
39/**
40 * @brief Importance-sampling estimate of the normalizing constant of a closed
41 * LOAD-INDEPENDENT product-form network.
42 *
43 * @param L (M x R) per-class demands at the M single-server queues
44 * @param N (R) closed population vector
45 * @param Z (R) aggregated think times; empty or all zero for no delay
46 * @param samples number of importance samples
47 * @param rng explicit generator, advanced by the call
48 */
49template <class T>
50NcResult<T> pfqn_is(const Matrix<T>& L, const std::vector<int>& N, const std::vector<T>& Z,
51 std::size_t samples, McRng& rng) {
53 "pfqn_is requires transcendental arithmetic: it is a Monte Carlo estimator, "
54 "inexact by construction, and reports the log of its own estimate");
55 return pfqn_ld_is(L, N, Z, Matrix<T>(), samples, rng);
56}
57
58/** Reference default of 1e4 samples. */
59template <class T>
60NcResult<T> pfqn_is(const Matrix<T>& L, const std::vector<int>& N, const std::vector<T>& Z,
61 McRng& rng) {
62 return pfqn_is(L, N, Z, static_cast<std::size_t>(10000), rng);
63}
64
65} // namespace pfqn
66} // namespace line
67
68#endif // LINE_API_PFQN_IS_H
Dense matrix and non-owning view.
NcResult< T > pfqn_ld_is(const Matrix< T > &L, const std::vector< int > &N, const std::vector< T > &Z, const Matrix< T > &mu, std::size_t samples, McRng &rng)
Importance-sampling estimate of the normalizing constant of a closed LOAD-DEPENDENT product-form netw...
Definition pfqn_ld_is.h:81
std::mt19937_64 McRng
The generator type every Monte Carlo entry point in this tree accepts.
NcResult< T > pfqn_is(const Matrix< T > &L, const std::vector< int > &N, const std::vector< T > &Z, std::size_t samples, McRng &rng)
Importance-sampling estimate of the normalizing constant of a closed LOAD-INDEPENDENT product-form ne...
Definition pfqn_is.h:50
Number-type abstraction for the templated API port.
Convolution algorithm for the exact normalizing constant of a closed product-form network (Buzen 1973...
Importance-sampling estimate of the normalizing constant of a closed LOAD-DEPENDENT product-form netw...
Randomness scaffolding shared by the Monte Carlo normalizing-constant estimators (pfqn_mci,...
Return value of the normalizing-constant family, mirroring Ret.pfqnNc.
Definition pfqn_ca.h:44