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

Port of solver_nc_lossn_analyzer.m: the open LOSS NETWORK, which is a Source, ONE multiclass Delay sitting inside a Finite Capacity Region under a DROP rule, and a Sink. More...

#include <cctype>
#include <cmath>
#include <cstddef>
#include <cstdint>
#include <limits>
#include <string>
#include <vector>
#include "line/api/da/da_fpi.h"
#include "line/api/lossn/lossn_erlangfp.h"
#include "line/api/lossn/lossn_mci.h"
#include "line/api/lossn/lossn_manjunath.h"
#include "line/api/lossn/lossn_rec.h"
#include "line/lang/qn/network_struct.h"
#include "line/solvers/nc/nc_types.h"
#include "line/util/error.h"
#include "line/util/matrix.h"
Include dependency graph for solver_nc_lossn.h:

Go to the source code of this file.

Classes

struct  line::nc::NcLossnSolution< T >
 What the loss-network analyzer returns beyond the usual metric table. More...

Namespaces

namespace  line
namespace  line::nc

Functions

template<class T>
bool line::nc::nc_has_lossn_shape (const qn::NetworkStruct< T > &sn)
 True when the model has the SHAPE of a loss network – open, one region, one member station, that station an infinite server – whatever admission rule the region applies.
template<class T>
bool line::nc::nc_is_lossn_model (const qn::NetworkStruct< T > &sn)
 True when the model is a loss network: the shape above, with EVERY class dropped at the region.
template<class T>
NcLossnSolution< T > line::nc::solver_nc_lossn_analyzer (const qn::NetworkStruct< T > &sn, const NcSolverOptions &opt)
 Port of solver_nc_lossn_analyzer.m.

Detailed Description

Port of solver_nc_lossn_analyzer.m: the open LOSS NETWORK, which is a Source, ONE multiclass Delay sitting inside a Finite Capacity Region under a DROP rule, and a Sink.

WHAT THE ANALYZER ACTUALLY COMPUTES. There is no queueing: the single station is an infinite server, so a job that is admitted never waits and leaves after one service time. The only question is which arrivals are ADMITTED, and the region answers it through a linear admission rule A n <= C on the per-class occupancy vector n. Everything else – carried throughput, mean population, response time – follows from the per-class blocking probability by Little's law at the infinite server.

WHERE THE ROWS OF A COME FROM, in the order the simulation engines test them: the global job cap, the memory budget weighted by the per-class sizes, the per-class job caps, and any explicit linear constraint. A row left unbounded (the -1 sentinel) is DROPPED rather than given a surrogate capacity, because a large finite surrogate would report a small but non-zero blocking where the truth is none. A region that declares no bounded row at all has no admission rule and is refused rather than solved as an unconstrained delay.

Every row is a function of the per-class occupancy of the REGION only, which is all the FiniteCapacityRegion API can express, so no row can distinguish the stations inside the region. That is why a second member station would change nothing in A and yet would break the Little's-law recovery below, which attributes the whole carried load to one infinite server; a region with more than one member station is therefore refused rather than collapsed.

THE THREE METHODS, ALL PORTED.

exact / ms lossn_manjunath, the Manjunath-Sikdar contour-integral transform, and the default on integral constraints as in the reference. EXACT: g(C) is a residue, i.e. a coefficient of a truncated multivariate power series, so the answer carries neither an iteration tolerance nor a sampling error. It is the only one of the three that runs under exact arithmetic, since every step is rational and the metrics are ratios. Cost is the product of (C_j+1) over the simultaneously live rows, so it is exact but not unconditionally cheap. erlangfp lossn_erlangfp, the Erlang fixed-point (reduced-load) approximation. IT IS AN APPROXIMATION: it assumes the links block INDEPENDENTLY, which is false whenever two rows of A share a class, and it is exact only in the single-row case where the assumption is vacuous and the fixed point collapses to Erlang's loss formula. Never compare it to an exact solver at a tight tolerance on a multi-row region. mci lossn_mci, Ross-Wang importance sampling. Unbiased, with a confidence interval, and it carries a normalizing constant. The method to reach for when the exact transform's live-grid product is prohibitive.

rec lossn_rec, MDD-rec: the same constant as the exact sum over the admissible set, obtained by one memoised walk of the decision diagram holding it. It places no integrality demand on A or C, which is why it – and not 'erlangfp', which this port refuses there – is what 'default' takes on a FRACTIONAL region. Before it existed a fractional region had no exact route here at all, only the Monte Carlo 'mci' whose answer is a random variable.

WHY 'erlangfp' NEEDS INTEGRAL A AND C AND 'mci' DOES NOT. The ported lossn_erlangfp raises (1-E_i) to the power A(i,r) through num_pow_int, which takes an unsigned exponent, and calls erlang_b with an int capacity; a fractional entry would be TRUNCATED silently, solving a different region. The reference evaluates both through factln, i.e. a gamma function, so it accepts fractional arguments – which is exactly why its 'default' falls back to 'erlangfp' when the region declares fractional class sizes. The port cannot follow that fallback and refuses it by name. lossn_mci sums over an integer lattice of states but compares in real arithmetic, so it has no such restriction and is the method to use on a fractional region. lossn_manjunath needs integral rows for a different reason – the residue argument counts whole units of capacity – so an EXPLICIT 'exact' on a fractional region is refused by lossn_manjunath itself rather than downgraded here, exactly as the reference does; only 'default' falls back.

ARITHMETIC. There is no blanket transcendental gate: under exact arithmetic the 'exact' method answers exactly and the other two refuse by name, which is strictly more useful than refusing the whole analyzer. lG is a double in every arithmetic, because it is a logarithm.

Definition in file solver_nc_lossn.h.