LINE Solver (C++)
Templated C++ port of the LINE queueing solver
Loading...
Searching...
No Matches
line::lossn Namespace Reference

Classes

struct  ErlangFpResult
struct  KrAsyResult
 Result of lossn_kr_asy. More...
struct  KrDimResult
 Result of lossn_kr_dim. More...
struct  KrResult
 Result of lossn_kr. More...
struct  LossnAsyResult
 Result of lossn_asy. More...
struct  LossnLinksResult
 Result of lossn_links. More...
struct  LossnManjunathOptions
 Controls of lossn_manjunath. More...
struct  LossnManjunathResult
 Result of lossn_manjunath. More...
struct  LossnMciOptions
 Options of lossn_mci, MATLAB's options struct. More...
struct  LossnMciResult
 Result of lossn_mci. More...
struct  LossnRecResult
 Carried load, blocking, log normalising constant and walk count. More...
struct  LossnRevsensResult
 Result of lossn_revsens. More...

Functions

template<class T>
LossnAsyResult< T > lossn_asy (const std::vector< T > &nu, const Matrix< T > &A, const std::vector< T > &C)
 Fluid (Kelly) limit of a loss network by convex duality.
template<class T>
T erlang_b (const T &nu, int C)
 Erlang's loss formula B(nu, C), evaluated through logs as MATLAB does so the factorials stay in range for large C.
template<class T>
T erlang_b_real (const T &nu, const T &C)
 Erlang B for a REAL capacity, the reference's ErlangB(nu, C) evaluated as it stands: the sum runs over i = 0..floor(C) and factln(C) is lgamma(C+1).
da::FpiOptions lossn_erlangfp_options ()
 The reference's fixed-point settings: iter_max 10000, iter_tol 1e-10, the max-norm of the increment (da_norm = @(d) max(abs(d(:))), the driver's default) and da_nanstop = true.
template<class T>
ErlangFpResult< T > lossn_erlangfp (const std::vector< T > &nu, const Matrix< T > &A, const std::vector< T > &C, const da::FpiOptions &options=lossn_erlangfp_options())
 Erlang fixed-point (reduced-load) approximation for a loss network.
template<class T>
ErlangFpResult< T > lossn_erlangfp (const std::vector< T > &nu, const Matrix< T > &A, const std::vector< int > &C, const da::FpiOptions &options=lossn_erlangfp_options())
 lossn_erlangfp with integer capacities.
template<class T>
KrResult< T > lossn_kr (const std::vector< T > &rho, const std::vector< T > &b, const T &C)
 Exact occupancy distribution and per-class blocking of a stochastic knapsack.
template<class T>
KrResult< T > lossn_kr (const std::vector< T > &rho, const std::vector< T > &b, long C)
 lossn_kr with an integer capacity.
template<class T>
KrDimResult< T > lossn_kr_dim (const std::vector< T > &rho, const std::vector< T > &b, const std::vector< T > &Btarget)
 Smallest link capacity meeting per-class blocking targets.
template<class T>
KrDimResult< T > lossn_kr_dim (const std::vector< T > &rho, const std::vector< T > &b, const T &Btarget)
 lossn_kr_dim with one blocking target shared by every class.
template<class T>
KrAsyResult< T > lossn_kr_asy (const std::vector< T > &rho, const std::vector< T > &b, const T &C)
 Normal approximation of multirate single-link blocking for large C.
template<class T>
LossnLinksResult< T > lossn_links (const std::vector< T > &nu, const Matrix< T > &A, const std::vector< T > &C, const std::string &method="exact", const LossnMciOptions< T > &mciopt=LossnMciOptions< T >(), std::uint64_t seed=0)
 Per-link blocking and occupancy of a loss network.
template<class T>
LossnManjunathResult< T > lossn_manjunath (const std::vector< T > &nu, const Matrix< T > &A, const std::vector< T > &C, const LossnManjunathOptions &options=LossnManjunathOptions())
 Exact normalizing constant, carried load and blocking of a loss network.
template<class T, class Rng>
LossnMciResult< T > 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 > 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.
template<class T>
LossnRecResult< T > lossn_rec (const std::vector< T > &nu, const Matrix< T > &A, const std::vector< T > &C)
 Exact loss-network analysis by MDD-rec.
template<class T>
LossnRevsensResult< T > lossn_revsens (const std::vector< T > &nu, const Matrix< T > &A, const std::vector< T > &C, const std::vector< T > &w, const std::string &method="exact", const LossnMciOptions< T > &mciopt=LossnMciOptions< T >(), std::uint64_t seed=0)
 Revenue sensitivities and implied costs of a loss network.

Function Documentation

◆ erlang_b()

template<class T>
T line::lossn::erlang_b ( const T & nu,
int C )

Erlang's loss formula B(nu, C), evaluated through logs as MATLAB does so the factorials stay in range for large C.

Definition at line 63 of file lossn_erlangfp.h.

References erlang_b(), line::InputError::InputError(), and line::num_factorial().

Referenced by erlang_b().

◆ erlang_b_real()

template<class T>
T line::lossn::erlang_b_real ( const T & nu,
const T & C )

Erlang B for a REAL capacity, the reference's ErlangB(nu, C) evaluated as it stands: the sum runs over i = 0..floor(C) and factln(C) is lgamma(C+1).

Definition at line 84 of file lossn_erlangfp.h.

References erlang_b_real(), and line::num_factorial().

Referenced by erlang_b_real().

◆ lossn_asy()

template<class T>
LossnAsyResult< T > line::lossn::lossn_asy ( const std::vector< T > & nu,
const Matrix< T > & A,
const std::vector< T > & C )

Fluid (Kelly) limit of a loss network by convex duality.

Parameters
nuoffered load of route (class) r (R)
Acapacity requirement of link j for route r (J x R, nonnegative)
Ccapacity of link j (J, nonnegative)

Definition at line 72 of file lossn_asy.h.

References line::lossn::LossnAsyResult< T >::a, line::Matrix< T >::cols(), line::InputError::InputError(), line::lossn::LossnAsyResult< T >::Loss, lossn_asy(), line::lossn::LossnAsyResult< T >::niter, line::lossn::LossnAsyResult< T >::QLen, and line::Matrix< T >::rows().

Referenced by lossn_asy(), lossn_links(), and line::nc::solver_nc_lossn_analyzer().

◆ lossn_erlangfp() [1/2]

template<class T>
ErlangFpResult< T > line::lossn::lossn_erlangfp ( const std::vector< T > & nu,
const Matrix< T > & A,
const std::vector< int > & C,
const da::FpiOptions & options = lossn_erlangfp_options() )

lossn_erlangfp with integer capacities.

Definition at line 257 of file lossn_erlangfp.h.

References lossn_erlangfp(), and lossn_erlangfp_options().

◆ lossn_erlangfp() [2/2]

template<class T>
ErlangFpResult< T > line::lossn::lossn_erlangfp ( const std::vector< T > & nu,
const Matrix< T > & A,
const std::vector< T > & C,
const da::FpiOptions & options = lossn_erlangfp_options() )

Erlang fixed-point (reduced-load) approximation for a loss network.

Parameters
nuoffered load per class (R)
A(J x R) capacity requirement of link j for class r; fractional entries are scaled to integers row by row (see the file comment)
C(J) link capacities
optionsfixed-point options; the default is the reference's (max-norm, iter_tol 1e-10, nanstop), see lossn_erlangfp_options()

Returns the carried traffic QLen_r = nu_r prod_j (1 - B(j,r)), the loss 1 - prod_j (1 - B(j,r)) and the (J x R) blocking matrix E = B.

Definition at line 191 of file lossn_erlangfp.h.

References line::Matrix< T >::cols(), line::da::FpiResult< T >::converged, line::lossn::ErlangFpResult< T >::converged, line::da::da_fpi(), line::lossn::ErlangFpResult< T >::E, line::InputError::InputError(), line::da::FpiResult< T >::iterations, line::lossn::ErlangFpResult< T >::iterations, line::lossn::ErlangFpResult< T >::Loss, lossn_erlangfp(), lossn_erlangfp_options(), line::Matrix< T >::Matrix(), line::lossn::ErlangFpResult< T >::QLen, line::Matrix< T >::rows(), and line::da::FpiResult< T >::x.

Referenced by lossn_erlangfp(), lossn_erlangfp(), lossn_links(), and line::nc::solver_nc_lossn_analyzer().

◆ lossn_erlangfp_options()

da::FpiOptions line::lossn::lossn_erlangfp_options ( )
inline

The reference's fixed-point settings: iter_max 10000, iter_tol 1e-10, the max-norm of the increment (da_norm = @(d) max(abs(d(:))), the driver's default) and da_nanstop = true.

Definition at line 104 of file lossn_erlangfp.h.

References line::da::FpiOptions::iter_max, line::da::FpiOptions::iter_tol, lossn_erlangfp_options(), and line::da::FpiOptions::nanstop.

Referenced by lossn_erlangfp(), lossn_erlangfp(), lossn_erlangfp_options(), and line::nc::solver_nc_lossn_analyzer().

◆ lossn_kr() [1/2]

template<class T>
KrResult< T > line::lossn::lossn_kr ( const std::vector< T > & rho,
const std::vector< T > & b,
const T & C )

Exact occupancy distribution and per-class blocking of a stochastic knapsack.

The result is insensitive to the holding-time distributions beyond their means. A class with b_k = 0 is never blocked; a class with b_k > C always is.

Parameters
rhooffered load of class k (K, nonnegative)
bbandwidth units held by a class-k call (K, nonnegative integers)
Clink capacity in bandwidth units (nonnegative integer)
Returns
q (C+1), B (K) and QLen = rho (1 - B) (K)

Definition at line 147 of file lossn_kr.h.

References line::lossn::KrResult< T >::B, line::InputError::InputError(), lossn_kr(), line::lossn::KrResult< T >::q, and line::lossn::KrResult< T >::QLen.

Referenced by lossn_kr(), and lossn_kr().

◆ lossn_kr() [2/2]

template<class T>
KrResult< T > line::lossn::lossn_kr ( const std::vector< T > & rho,
const std::vector< T > & b,
long C )

lossn_kr with an integer capacity.

Definition at line 197 of file lossn_kr.h.

References lossn_kr().

◆ lossn_kr_asy()

template<class T>
KrAsyResult< T > line::lossn::lossn_kr_asy ( const std::vector< T > & rho,
const std::vector< T > & b,
const T & C )

Normal approximation of multirate single-link blocking for large C.

In the critically loaded regime, where C and the offered loads grow together with sum_k b_k rho_k / C -> 1, the normalized occupancy of a stochastic knapsack converges to a truncated multivariate normal law (Kelly 1991; Ross 1995, Theorem 2.8) and blocking is asymptotically proportional to the call size (Ross 1995, Corollary 2.7). For a knapsack of fixed capacity C

 alpha   = (C - sum_k b_k rho_k) / sqrt(C),
 sigma^2 = sum_k b_k^2 rho_k / C,
 delta   = phi(alpha/sigma) / (sigma Phi(alpha/sigma)),
 B_k     = b_k delta / sqrt(C),

with phi and Phi the standard normal density and distribution function. B_k is capped at 1. The approximation is accurate when |alpha| is small (roughly below 1); far from critical loading use lossn_kr for the exact values, or lossn_asy for the fluid (Kelly) limit.

Parameters
rhooffered load of class k (K, nonnegative)
bbandwidth units held by a class-k call (K, nonnegative)
Clink capacity (positive)

Definition at line 310 of file lossn_kr.h.

References line::lossn::KrAsyResult< T >::alpha, line::lossn::KrAsyResult< T >::B, line::lossn::KrAsyResult< T >::delta, line::InputError::InputError(), lossn_kr_asy(), and line::lossn::KrAsyResult< T >::sigma.

Referenced by lossn_kr_asy().

◆ lossn_kr_dim() [1/2]

template<class T>
KrDimResult< T > line::lossn::lossn_kr_dim ( const std::vector< T > & rho,
const std::vector< T > & b,
const std::vector< T > & Btarget )

Smallest link capacity meeting per-class blocking targets.

Returns the smallest integer capacity C such that every class of the stochastic knapsack has blocking B_k(C) no larger than its target. The unnormalized Kaufman-Roberts terms n q(n) = sum_k b_k rho_k q(n - b_k), q(0) = 1, do not depend on C, so the search extends a single recursion one unit at a time and evaluates B_k(C) = sum_{n>C-b_k} q(n) / sum_{n<=C} q(n) at each step, at a total cost of O(C K). The search scans every C upwards rather than bisecting because the blocking of a wide class need not decrease monotonically in C (Ross 1995, Sec. 2.6).

Parameters
rhooffered load of class k (K, nonnegative)
bbandwidth units held by a class-k call (K, nonnegative integers)
Btargetblocking target per class (K), each in (0,1]

Definition at line 219 of file lossn_kr.h.

References line::lossn::KrDimResult< T >::B, line::lossn::KrDimResult< T >::C, line::InputError::InputError(), lossn_kr_dim(), and line::NumericError::NumericError().

Referenced by lossn_kr_dim(), and lossn_kr_dim().

◆ lossn_kr_dim() [2/2]

template<class T>
KrDimResult< T > line::lossn::lossn_kr_dim ( const std::vector< T > & rho,
const std::vector< T > & b,
const T & Btarget )

lossn_kr_dim with one blocking target shared by every class.

Definition at line 281 of file lossn_kr.h.

References lossn_kr_dim().

◆ lossn_links()

template<class T>
LossnLinksResult< T > line::lossn::lossn_links ( const std::vector< T > & nu,
const Matrix< T > & A,
const std::vector< T > & C,
const std::string & method = "exact",
const LossnMciOptions< T > & mciopt = LossnMciOptions<T>(),
std::uint64_t seed = 0 )

◆ lossn_manjunath()

template<class T>
LossnManjunathResult< T > line::lossn::lossn_manjunath ( const std::vector< T > & nu,
const Matrix< T > & A,
const std::vector< T > & C,
const LossnManjunathOptions & options = LossnManjunathOptions() )

Exact normalizing constant, carried load and blocking of a loss network.

Parameters
nuoffered load of route r, nonnegative (R)
A(J x R) nonnegative integer circuit requirements
C(J) nonnegative integer capacities
optionsthe live-coefficient cap

Definition at line 365 of file lossn_manjunath.h.

References line::Matrix< T >::cols(), line::InputError::InputError(), line::lossn::LossnManjunathResult< T >::lG, line::lossn::LossnManjunathResult< T >::Loss, lossn_manjunath(), line::NumericError::NumericError(), line::lossn::LossnManjunathResult< T >::peak_states, line::lossn::LossnManjunathResult< T >::QLen, and line::Matrix< T >::rows().

Referenced by lossn_links(), lossn_manjunath(), lossn_revsens(), and line::nc::solver_nc_lossn_analyzer().

◆ lossn_mci() [1/2]

◆ lossn_mci() [2/2]

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.

Deterministic in the seed and independent of any global state; the engine is created and destroyed here.

Definition at line 528 of file lossn_mci.h.

References lossn_mci().

◆ lossn_rec()

template<class T>
LossnRecResult< T > line::lossn::lossn_rec ( const std::vector< T > & nu,
const Matrix< T > & A,
const std::vector< T > & C )

Exact loss-network analysis by MDD-rec.

Parameters
nuoffered load per class, length K
AJ x K non-negative resource requirement matrix
Ccapacity vector, length J
Returns
the carried load, the blocking probabilities and the normalising constant

Definition at line 141 of file lossn_rec.h.

References line::Matrix< T >::cols(), line::lossn::LossnRecResult< T >::G, line::InputError::InputError(), line::lossn::LossnRecResult< T >::iterations, line::lossn::LossnRecResult< T >::lG, line::lossn::LossnRecResult< T >::Loss, lossn_rec(), line::mdd::mdd_rec_marginal(), line::lossn::LossnRecResult< T >::QLen, and line::Matrix< T >::rows().

Referenced by lossn_links(), lossn_rec(), lossn_revsens(), and line::nc::solver_nc_lossn_analyzer().

◆ lossn_revsens()

template<class T>
LossnRevsensResult< T > line::lossn::lossn_revsens ( const std::vector< T > & nu,
const Matrix< T > & A,
const std::vector< T > & C,
const std::vector< T > & w,
const std::string & method = "exact",
const LossnMciOptions< T > & mciopt = LossnMciOptions<T>(),
std::uint64_t seed = 0 )

Revenue sensitivities and implied costs of a loss network.

Parameters
nuoffered load of route r (R)
Acapacity requirement of link j for route r (J x R)
Ccapacity of link j (J)
wrevenue rate of a route-r call in progress (R)
method'exact' (default), 'rec', 'erlangfp' or 'mci'
mcioptoptions for 'mci' (samples, alpha, gamma); its revenue field is overwritten with w
seedseed of the 'mci' generator

Definition at line 204 of file lossn_revsens.h.

References line::lossn::LossnRevsensResult< T >::c, line::lossn::LossnRevsensResult< T >::clink, line::Matrix< T >::cols(), line::lossn::LossnRevsensResult< T >::dW, line::lossn::LossnRevsensResult< T >::hasCI, line::lossn::LossnMciResult< T >::impliedCost, line::InputError::InputError(), line::lossn::LossnMciResult< T >::level, line::lossn::LossnRevsensResult< T >::level, line::lossn::LossnMciResult< T >::linkImpliedCost, line::lossn::LossnManjunathResult< T >::Loss, line::lossn::LossnRecResult< T >::Loss, lossn_manjunath(), lossn_mci(), lossn_rec(), lossn_revsens(), line::Matrix< T >::Matrix(), line::lossn::LossnManjunathResult< T >::QLen, line::lossn::LossnRecResult< T >::QLen, line::lossn::LossnMciOptions< T >::revenue, line::lossn::LossnMciResult< T >::revenue, line::lossn::LossnMciResult< T >::revsens, line::lossn::LossnRevsensResult< T >::revsens, line::lossn::LossnMciResult< T >::revsensCI, line::lossn::LossnRevsensResult< T >::revsensCI, line::Matrix< T >::rows(), and line::lossn::LossnRevsensResult< T >::W.

Referenced by lossn_revsens().