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

Port of @@SolverNC/getCdfRespT.m, and of its two aliases getSjrnT and sjrnT. More...

#include <algorithm>
#include <cmath>
#include <cstddef>
#include <string>
#include <vector>
#include "line/api/mam/map_cdf.h"
#include "line/api/pfqn/pfqn_stdf.h"
#include "line/api/pfqn/pfqn_stdf_heur.h"
#include "line/lang/distribution.h"
#include "line/lang/qn/network_struct.h"
#include "line/solvers/nc/nc_types.h"
#include "line/solvers/nc/sn_pf_params.h"
#include "line/util/error.h"
#include "line/util/matrix.h"
Include dependency graph for solver_nc_cdf.h:

Go to the source code of this file.

Classes

struct  line::nc::CdfRespTResult< T >
 The response-time distributions, station by class. More...

Namespaces

namespace  line
namespace  line::nc

Functions

template<class T>
CdfRespTResult< T > line::nc::solver_nc_cdf_respt (const qn::NetworkStruct< T > &sn, const NcSolverOptions &opt)
 Port of @@SolverNC/getCdfRespT.m.
template<class T>
CdfRespTResult< T > line::nc::solver_nc_sjrnt (const qn::NetworkStruct< T > &sn, const NcSolverOptions &opt)
 Port of @@SolverNC/getSjrnT.m: an alias of getCdfRespT.

Detailed Description

Port of @@SolverNC/getCdfRespT.m, and of its two aliases getSjrnT and sjrnT.

WHAT IT ADDS OVER THE AVERAGE TABLE. getAvg reports E[R]; this reports the whole law Pr[R <= t], which is what a percentile or a service-level target needs. The two are not interchangeable: a product-form response time is not exponential, so E[R] does not determine its tail.

TWO KINDS OF STATION, TWO DIFFERENT LAWS. At an FCFS queue the sojourn time is the tagged-job passage time through a closed network and comes from pfqn_stdf (exact) or pfqn_stdf_heur (the rd heuristic). At a delay station there is no queueing at all, so the sojourn time IS the service time and the law is the distribution's own CDF, taken through map_cdf. The reference computes both and returns them in one station-indexed table.

WHY THE TIME GRID IS WHAT IT IS. The reference builds logspace(0, 2 log10 T, 100) with T = max(sum(N) * mean(1/rates)) over the FCFS stations: the population times the mean service time is the scale on which the FCFS subsystem empties, and squaring it gives a grid that still resolves the tail. It is reproduced exactly, because the grid is part of the answer – the CDF is reported AT these points. Note which axis that mean runs along: sn.rates(fcfsNodeIds,:) is (stations x classes) and MATLAB's mean takes the FIRST NON-SINGLETON dimension, so it averages over STATIONS and max then runs over classes – except with a single FCFS station, where the row is 1xR and the same call averages over CLASSES instead. Both branches are reproduced below; see _kb/06-solver-catalog.md (NC, getCdfRespT).

TWO PROPERTIES OF THAT GRID TO KNOW BEFORE READING ITS OUTPUT, neither of them a porting artifact. It DESCENDS when T < 1, because 2 log10 T is then negative, and it COLLAPSES to a hundred identical points at T = 1 exactly. Delay(1)+FCFS(3) with two classes at N=3 hits the second case: T = 3 * 1/3. The law is still correct at whatever points the grid names.

REFUSED, as the reference refuses it: a model with no FCFS station. MATLAB warns and returns an empty cell array, which reads as a completed analysis with no data; this throws instead.

ARITHMETIC. pfqn_stdf and map_cdf are transcendental, and the grid itself is a logspace, so a non-transcendental backend is refused by name.

Definition in file solver_nc_cdf.h.