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

Monte Carlo importance-sampling summation for product-form loss networks. More...

#include <cmath>
#include <cstddef>
#include <cstdint>
#include <limits>
#include <random>
#include <vector>
#include "line/num/number.h"
#include "line/util/error.h"
#include "line/util/matrix.h"
Include dependency graph for lossn_mci.h:

Go to the source code of this file.

Classes

struct  line::lossn::LossnMciOptions< T >
 Options of lossn_mci, MATLAB's options struct. More...
struct  line::lossn::LossnMciResult< T >
 Result of lossn_mci. More...

Namespaces

namespace  line
namespace  line::lossn

Functions

template<class T, class Rng>
LossnMciResult< T > line::lossn::lossn_mci (const std::vector< T > &nu, const Matrix< T > &A, const std::vector< T > &C, const LossnMciOptions< T > &opt, Rng &gen)
 Estimate the normalizing constant and the blocking probabilities.
template<class T>
LossnMciResult< T > line::lossn::lossn_mci (const std::vector< T > &nu, const Matrix< T > &A, const std::vector< T > &C, const LossnMciOptions< T > &opt, std::uint64_t seed)
 Overload seeding a local engine.

Detailed Description

Monte Carlo importance-sampling summation for product-form loss networks.

Templated port of matlab/src/api/lossn/lossn_mci.m, implementing Ross and Wang, "Monte Carlo Summation Applied to Product-Form Loss Networks", Probability in the Engineering and Informational Sciences 6 (1992), 323-348.

Links j = 1..J carry capacity C(j), routes r = 1..R carry offered load nu(r) and need A(j, r) circuits on link j. The state n is feasible iff A n <= C, the equilibrium law is product form with normalizing constant g(C) = sum_{n feasible} prod_r nu_r^{n_r} / n_r!, and the class-r acceptance probability is g(C - A(:, r)) / g(C). States are drawn from the truncated Poisson importance law (Eq. 6) over {0..N_1} x ... x {0..N_R} with N_r = min_j floor(C_j / A_jr), and the ratio estimators (Eq. 8) give g and the blocking probabilities with delta-method confidence intervals.

RANDOMNESS. There is no global generator here and no hidden seeding. The caller passes its own engine by reference, or a seed, and the uniforms are drawn as (gen() >> 11) * 2^-53 rather than through a distribution object, so a given engine and seed reproduce the same estimate on every standard library. The draw order mirrors the reference (all S samples of route 1, then of route 2, and so on) so that the two implementations traverse the same importance law in the same order, though their engines differ and their sample paths therefore cannot be compared point by point. What CAN be compared, and is, is convergence to a closed form: a single link with unit circuit requirements is an Erlang loss system and its blocking probability is Erlang B.

ARITHMETIC. The importance weights are formed in log space, exactly as in the reference, so log, exp, lgamma and the inverse error function are all unavoidable; the header is gated on num_traits<T>::has_transcendental and is instantiated at double and Real only. An exact instantiation would be meaningless in any case: the estimate is a random variable.

REFERENCE NOTE. MATLAB's var normalizes by S - 1 and so does the port, and the covariance is likewise the S - 1 form; with S below 2 the estimator is undefined and the port rejects it rather than dividing by zero, which the reference does silently.

Definition in file lossn_mci.h.