![]() |
LINE Solver (C++)
Templated C++ port of the LINE queueing solver
|
Normalizing constant of a product-form queueing network: the dispatcher. More...
#include <cmath>#include <cstddef>#include <string>#include <vector>#include "line/api/pfqn/pfqn_ca.h"#include "line/api/pfqn/pfqn_clw.h"#include "line/api/pfqn/pfqn_comomrm.h"#include "line/api/pfqn/pfqn_cub.h"#include "line/api/pfqn/pfqn_cub_evals.h"#include "line/api/pfqn/pfqn_gerasimov.h"#include "line/api/pfqn/pfqn_is.h"#include "line/api/pfqn/pfqn_bk.h"#include "line/api/pfqn/pfqn_kt.h"#include "line/api/pfqn/pfqn_bkt.h"#include "line/api/pfqn/pfqn_lekt.h"#include "line/api/pfqn/pfqn_le.h"#include "line/api/pfqn/pfqn_aghq.h"#include "line/api/pfqn/pfqn_ble.h"#include "line/api/pfqn/pfqn_ls.h"#include "line/api/pfqn/pfqn_mci.h"#include "line/api/pfqn/pfqn_mcmc.h"#include "line/api/pfqn/pfqn_mmint2.h"#include "line/api/pfqn/pfqn_mmsample2.h"#include "line/api/pfqn/pfqn_mva.h"#include "line/api/pfqn/pfqn_panacea.h"#include "line/api/pfqn/pfqn_propfair.h"#include "line/api/pfqn/pfqn_recal.h"#include "line/api/pfqn/pfqn_explicit.h"#include "line/api/pfqn/pfqn_rgf.h"#include "line/api/pfqn/pfqn_rgfmc.h"#include "line/num/number.h"#include "line/util/error.h"#include "line/util/matrix.h"#include "line/util/population.h"Go to the source code of this file.
Classes | |
| struct | line::pfqn::NcOptions |
| The options fields compute_norm_const reads beyond the method itself. More... | |
| struct | line::pfqn::NcDispatchResult< T > |
Namespaces | |
| namespace | line |
| namespace | line::pfqn |
Enumerations | |
| enum class | line::pfqn::NcMethod { line::pfqn::Default , line::pfqn::Adaptive , line::pfqn::Ca , line::pfqn::Exact , line::pfqn::Recal , line::pfqn::Mva , line::pfqn::Comom , line::pfqn::Clw , line::pfqn::Cub , line::pfqn::Gm , line::pfqn::Kt , line::pfqn::Bkt , line::pfqn::Lekt , line::pfqn::Bk , line::pfqn::Bkue , line::pfqn::Lc , line::pfqn::LcUe , line::pfqn::Le , line::pfqn::Ble , line::pfqn::Aghq , line::pfqn::Ls , line::pfqn::Is , line::pfqn::Mci , line::pfqn::Imci , line::pfqn::Mcmc , line::pfqn::Sampling , line::pfqn::Mmint2 , line::pfqn::Gleint , line::pfqn::Pana , line::pfqn::Propfair , line::pfqn::Rgf , line::pfqn::Divdiff , line::pfqn::Ger } |
| The methods this port dispatches, one per compute_norm_const case. More... | |
Functions | |
| const char * | line::pfqn::nc_method_name (NcMethod m) |
| NcMethod | line::pfqn::nc_method_of (const std::string &s) |
| Map a method name to its enum; throws UnsupportedError on an unknown one. | |
| void | line::pfqn::pfqn_nc_refuse (const std::string &method) |
| Refuse a method in an arithmetic it has no meaning in. | |
| template<class T> | |
| NcDispatchResult< T > | line::pfqn::pfqn_nc (const std::vector< T > &lambda, const Matrix< T > &L, const std::vector< int > &N, const Matrix< T > &Z, NcMethod method, const T &atol, const NcOptions &nopt) |
| Normalizing constant of a product-form queueing network: the dispatcher. | |
| template<class T> | |
| NcDispatchResult< T > | line::pfqn::pfqn_nc (const std::vector< T > &lambda, const Matrix< T > &L, const std::vector< int > &N, const Matrix< T > &Z, NcMethod method, const T &atol) |
| Overload with the reference's default sample count, seed and tolerance. | |
| template<class T> | |
| NcDispatchResult< T > | line::pfqn::pfqn_nc (const Matrix< T > &L, const std::vector< int > &N, const Matrix< T > &Z, NcMethod method) |
| Overload with the exact (zero-tolerance) filters and no open classes. | |
Normalizing constant of a product-form queueing network: the dispatcher.
Templated port of matlab/src/api/pfqn/pfqn_nc.m. The routine is two things at once, and they are kept separate here:
OPEN CLASSES. MATLAB marks an open class by N_r = Inf. There is no infinity in an exact field, so this port marks it by a NEGATIVE population, which is also what the .qn interchange format uses. Each station's demands are inflated by 1/(1 - sum_r lambda_r L(i,r)) and the open queue lengths are read off directly, exactly as in the reference. Note that the reference leaves lGopen at zero (the line accumulating sum log Ut is commented out), so the returned constant is the CLOSED-CONDITIONAL one; that convention is preserved, because changing it would silently rescale every caller's result.
ARITHMETIC, NOT ALGORITHMS, IS WHAT IS REFUSED. The whole ladder of compute_norm_const is dispatched here: ca, clw, cub/gm, kt, bkt, lekt, le, ble, dir, aghq, ls, is, mci, imci, sampling, mmint2/gleint, pana, propfair, rgf, mva, exact, comom and recal. Every one of them but ca / exact / recal / mva / comom is an asymptotic or Monte Carlo estimator formed in logarithms, so it is compiled only when num_traits<T>::has_transcendental and refused BY NAME otherwise rather than silently redirected to the convolution: a normalizing constant computed by an algorithm the caller did not ask for is indistinguishable from the right answer until it is wrong. NcMethod::Default's multi-station branch (cub for sum(N) < 1e3, le above it) is refused on the same grounds in exact arithmetic. rgf is the one two-sided name: on a SINGLE-CLASS model it is the log-domain generating-function recursion and is refused in an exact field, while a multiclass request reduces to ca and stays exact, reported as 'rgf/ca'.
Arithmetic: EXACT-CAPABLE for methods Ca, Exact, Recal, Mva, Comom and for the whole reduction. The reference's tolerance-based filters (options.tol, GlobalConstants.FineTol) become exact zero tests, for the same reason as in pfqn_unique: a tolerant filter perturbs the constant and has no meaning in the rational field. Pass a positive atol to recover the tolerant behaviour in any arithmetic.
WHY THE INEXACT BRANCHES REPORT lG AND NOT G. An estimator returns the LOG constant; exponentiating it and taking the log again loses the answer outright once lG passes ~709. Those branches therefore accumulate lG additively (log Gscale + log Gzdem + lG_core) and derive G from it, while the exact branches keep the exact product and take its log, as before.
Definition in file pfqn_nc.h.