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

Classes

struct  Distrib
struct  GlobalConstants
 The MATLAB GlobalConstants, as reported by lineStart at its defaults. More...
struct  LayerResult
 Per-layer results of one iteration, the [QN,UN,RN,TN,AN,WN] of getAvg. More...
struct  LnCdf
 A CDF sampled on a grid, the [F, t] pair MATLAB's evalCDF returns. More...
struct  LnLayerBlocks
 LayeredNetwork.layerBlocks: where each layer's block sits in the aggregate. More...
struct  LnOptions
 Options of SolverLN. More...
struct  LnSensTable
 getSensitivityTable of the ensemble: the layer tables under a Layer column. More...
struct  LnSolution
 The LQN-level answer, indexed by element 1..nidx. More...
struct  LnStochConfig
 options.config.stochiter_* of SolverOptions.m, with its defaults. More...
class  LnStochController
 Convergence controller for an ensemble whose layers are solved by a NOISY method (simulation, or Monte Carlo normalizing constants). More...
struct  LnTranLayer
 One layer's block of the layered transient. More...
struct  LnTranSolution
 The layered transient: one block per layer, plus how it was produced. More...
struct  LqnCallGroup
 One routed call group: an activity, the strategy that picks among its targets, and the target ENTRIES in declaration order. More...
struct  LqnStruct
struct  OvertakeCtmcState
 Stationary law of the three-state overtaking chain, in its own order. More...
class  SolverLN

Typedefs

using FluidRateSched = fluid::FluidOptions::RateSched
 One (station, class) rate trajectory injected into a layer's closing ODE.

Enumerations

enum class  CallType
 Call kinds, with the values of MATLAB CallType. More...
enum class  CallType
 Call kinds, with the values of MATLAB CallType. More...
enum class  CallType
 Call kinds, with the values of MATLAB CallType. More...
enum class  JobClassType
 Job class kinds, with the values of MATLAB JobClassType. More...
enum class  LqnElement
 LQN element kinds, with the values of MATLAB LayeredNetworkElement. More...
enum class  NodeType
 Node kinds, with the values of MATLAB NodeType. More...
enum class  PrecedenceType
 Activity precedence kinds, with the values of MATLAB ActivityPrecedenceType. More...
enum class  RoutingStrategy
 Routing strategies, with the values of MATLAB RoutingStrategy. More...
enum class  SchedStrategy
 Scheduling disciplines, with the values of MATLAB SchedStrategy. More...

Functions

template<class T>
OvertakeCtmcState< T > lqn_overtake_ctmc (const T &S1, const T &S2, const T &lambda)
 Stationary law of the reduced overtaking chain of overtake_prob.m.
template<class T>
lqn_overtake_prob (const T &S1, const T &S2, const T &lambda, double mult)
 Probability that an arrival at an entry finds the server in phase 2.
template<class T>
lqn_overtake_prob_markov (const LqnStruct< T > &lqn, const std::vector< T > &servt, const std::vector< T > &callresidt, const std::vector< T > &tput, std::size_t eidx, const T &xj)
 Overtaking probability at a server entry, through the LQNS phased-server chain rather than the reduced CTMC above.
template<class T>
LnSensTable< T > lqn_sensitivity_table (SolverLN< T > &solver, const sens::SensOptions &opt)
 @SolverLN/getSensitivityTable.m: solve the ensemble, then concatenate each LAYER solver's own sensitivity table under a leading Layer column.
template<class T>
LnTranSolution lqn_tran_avg (SolverLN< T > &solver)
 @SolverLN/getTranAvg.m: the block-diagonal aggregate transient over the LQN layers, in whichever coupling LnOptions::ln_transient names.
template<class T>
std::vector< LnCdflqn_cdf_respt (SolverLN< T > &solver)
 @SolverLN/getCdfRespT.m: the per-entry response-time distribution, which only the moment3 method produces.
template<class T>
void lqn_fwd_rendezvous (LqnStruct< T > &lqn)
 Replace every forwarding chain reachable from a synchronous call by caller-side pseudo rendezvous calls to the forwarding targets.
template<class T>
lqn_overtake_markov (const Matrix< T > &clientPhases, const T &prVisit, const T &xj, const std::vector< T > &y_aj)
 Overtaking probability from the LQNS phased-server Markov chain.

Typedef Documentation

◆ FluidRateSched

One (station, class) rate trajectory injected into a layer's closing ODE.

Definition at line 145 of file solver_ln.h.

Enumeration Type Documentation

◆ CallType [1/3]

enum class line::lang::CallType
strong

Call kinds, with the values of MATLAB CallType.

Definition at line 467 of file lang_types.h.

◆ CallType [2/3]

enum class line::lang::CallType
strong

Call kinds, with the values of MATLAB CallType.

Definition at line 467 of file lang_types.h.

◆ CallType [3/3]

enum class line::lang::CallType
strong

Call kinds, with the values of MATLAB CallType.

Definition at line 467 of file lang_types.h.

◆ JobClassType

enum class line::lang::JobClassType
strong

Job class kinds, with the values of MATLAB JobClassType.

Definition at line 367 of file lang_types.h.

◆ LqnElement

enum class line::lang::LqnElement
strong

LQN element kinds, with the values of MATLAB LayeredNetworkElement.

Definition at line 464 of file lang_types.h.

◆ NodeType

enum class line::lang::NodeType
strong

Node kinds, with the values of MATLAB NodeType.

Definition at line 324 of file lang_types.h.

◆ PrecedenceType

enum class line::lang::PrecedenceType
strong

Activity precedence kinds, with the values of MATLAB ActivityPrecedenceType.

Definition at line 470 of file lang_types.h.

◆ RoutingStrategy

enum class line::lang::RoutingStrategy
strong

Routing strategies, with the values of MATLAB RoutingStrategy.

Definition at line 389 of file lang_types.h.

◆ SchedStrategy

enum class line::lang::SchedStrategy
strong

Scheduling disciplines, with the values of MATLAB SchedStrategy.

Definition at line 181 of file lang_types.h.

Function Documentation

◆ lqn_cdf_respt()

template<class T>
std::vector< LnCdf > line::ln::lqn_cdf_respt ( SolverLN< T > & solver)

@SolverLN/getCdfRespT.m: the per-entry response-time distribution, which only the moment3 method produces.

Definition at line 492 of file lqn_analyzers.h.

References line::ln::SolverLN< T >::get_cdf_respt(), and lqn_cdf_respt().

Referenced by lqn_cdf_respt().

◆ lqn_fwd_rendezvous()

template<class T>
void line::ln::lqn_fwd_rendezvous ( LqnStruct< T > & lqn)

Replace every forwarding chain reachable from a synchronous call by caller-side pseudo rendezvous calls to the forwarding targets.

Port of LQNS Phase::addForwardingRendezvous (phase.cc). A forwarded call blocks the original caller until the LAST task in the chain replies, so the caller's blocking time spans the chain, not just the entry it named. Rather than teach every downstream stage what a FWD arc means, the chain is flattened here into ordinary SYNC arcs from the original calling activity to each entry on the chain, each with mean equal to the original call mean times the product of the forwarding probabilities on the path to it. Layer construction, think times, populations and the interlock analysis then see plain rendezvous arcs and need no forwarding case at all. This is also what LQNS does: interlock.cc drops FWD arcs outright ("Drop forward -- keep rnv") and accounts for forwarding only through these pseudo arcs.

The FWD calls survive in the struct but must not contribute blocking anywhere after this point, or the chain is charged twice.

Asynchronous calls into a forwarding chain are left alone: LQNS breaks the backward search at a send-no-reply, since nobody is blocked waiting for it.

The MATLAB version also rebuilds the Geometric process descriptor of each rewritten call. There is nothing to port: LqnStruct carries only callproc_mean, which is the only field SolverLN reads.

Definition at line 76 of file lqn_helpers.h.

References lqn_fwd_rendezvous().

Referenced by lqn_fwd_rendezvous().

◆ lqn_overtake_ctmc()

template<class T>
OvertakeCtmcState< T > line::ln::lqn_overtake_ctmc ( const T & S1,
const T & S2,
const T & lambda )

Stationary law of the reduced overtaking chain of overtake_prob.m.

The chain is the cycle idle -> phase 1 -> phase 2 -> idle, with rates lambda, 1/S1 and 1/S2. A cycle visits every state exactly once per traversal, so the stationary probabilities are proportional to the mean holding times (1/lambda, S1, S2); the reference reaches the same numbers by solving the augmented singular system in least squares, which is the same answer arrived at less directly and only for a floating T. Scaling the ratios by lambda removes the reciprocal, so nothing here divides by a rate.

The caller must have established lambda > 0; at lambda = 0 the chain is absorbed in idle and has no unique stationary law.

Definition at line 100 of file lqn_analyzers.h.

References line::ln::OvertakeCtmcState< T >::idle, lqn_overtake_ctmc(), line::ln::OvertakeCtmcState< T >::phase1, and line::ln::OvertakeCtmcState< T >::phase2.

Referenced by lqn_overtake_ctmc(), and lqn_overtake_prob().

◆ lqn_overtake_markov()

template<class T>
T line::ln::lqn_overtake_markov ( const Matrix< T > & clientPhases,
const T & prVisit,
const T & xj,
const std::vector< T > & y_aj )

Overtaking probability from the LQNS phased-server Markov chain.

Layer-1 port of LQNS V6 (slice.cc setRates and prOvertakingStates, overtake.cc computeOvertaking) for the single-conditioning case, where the calling entry and the conditioning entry coincide. Overtaking is the event that a client's next request reaches the server while the server is still running the second phase of the PREVIOUS request from the same client: the early reply released the client, so two of its requests can be in flight at once and the later one can pass the earlier one. lqns -t overtaking prints the same quantity; on its 31-overtaking model, phase 2 of the server gives 0.5.

The chain is over client phases 0..maxPhaseA, phase 0 being the client's think slice. Row p of clientPhases is [nSlices, service, y_ij, y_ik, t_k] with nSlices = 1 + the rendezvous calls made in phase p (the slice count the phase is chopped into), service = total host residence of the phase, y_ij = calls to the tested server's task, y_ik = calls to any other task, and t_k = mean time spent at those other tasks. Row 0's service is the think time. xj is the server's residence time in the phase being tested, prVisit the client entry's visit probability, and y_aj[0] the client's total calls to the server with y_aj[i] the calls made in client phase i.

Every rate is a ratio of times (xj/(xj+slice) and so on), so the result is invariant to a common rescaling of all the time inputs, as a probability must be.

Reference: Franks and Woodside, "Effectiveness of early replies in client-server systems", Perf. Eval. 36 (1999).

Definition at line 265 of file lqn_helpers.h.

References line::Matrix< T >::cols(), line::InputError::InputError(), lqn_overtake_markov(), and line::Matrix< T >::rows().

Referenced by lqn_overtake_markov(), and lqn_overtake_prob_markov().

◆ lqn_overtake_prob()

template<class T>
T line::ln::lqn_overtake_prob ( const T & S1,
const T & S2,
const T & lambda,
double mult )

Probability that an arrival at an entry finds the server in phase 2.

Port of @SolverLN/overtake_prob.m. S1 and S2 are the entry's phase-1 and phase-2 service times, lambda the arrival rate at the entry (the reference falls back to the task throughput when the entry's own is not yet resolved, which is the caller's choice to make) and mult the task multiplicity.

PASTA is what licenses reading the answer off the time-stationary law: the arrival stream is Poisson, so arrivals see time averages and the probability an arrival finds phase 2 is the probability the chain is in phase 2.

The multi-server branch is an APPROXIMATION in the reference and stays one here (overtake_prob.m, lines 77 to 91): the phase-2 fraction of a busy server scaled by the utilization, saturating at the bare phase-2 fraction once the offered load reaches one server's worth. It is not a c-server chain and does not converge to one.

Definition at line 129 of file lqn_analyzers.h.

References line::ln::GlobalConstants::FineTol, lqn_overtake_ctmc(), and lqn_overtake_prob().

Referenced by lqn_overtake_prob().

◆ lqn_overtake_prob_markov()

template<class T>
T line::ln::lqn_overtake_prob_markov ( const LqnStruct< T > & lqn,
const std::vector< T > & servt,
const std::vector< T > & callresidt,
const std::vector< T > & tput,
std::size_t eidx,
const T & xj )

Overtaking probability at a server entry, through the LQNS phased-server chain rather than the reduced CTMC above.

Overtaking probability at a server entry, defined in lqn_analyzers.h.

Port of @SolverLN/overtake_prob_markov.m: the input-mapping layer that turns the LayeredNetworkStruct plus the current fixed-point iterate into the per-client-phase slice parameters lqn_overtake_markov consumes, one client entry at a time, summing the contributions and truncating to 1 as LQNS does in Markov_Phased_Server::PrOT_e.

xj is the tested server phase's residence time, self.servt_ph2(eidx) in the reference. It is a parameter because the C++ SolverLN has no phase split to read it from; see the file header.

servt and tput are indexed by element 1..nidx and callresidt by call 1..ncalls, which is exactly the layout SolverLN::state_servt, state_tput and state_callresidt return.

A trap worth naming: the reference's own comment says the caller activities are the SYNCHRONOUS ones, but the selection it writes is unfiltered, so an asynchronous or forwarding caller into the same entry also contributes a client entry. That is reproduced here; the per-phase call scan below does filter to SYNC, which is where the distinction actually bites.

DECLARED, not included: lqn_analyzers.h needs LayerResult and SolverLN complete (LnStochController holds a vector of the first and two refusals take the second), so it must be parsed AFTER this class. The definition arrives through the include at the foot of this file, which is why the declaration has to stand here – an unqualified call from a member function would otherwise find nothing, LqnStruct's associated namespace being line::lqn.

Definition at line 197 of file lqn_analyzers.h.

References line::lang::Distrib< T >::disabled, line::ln::GlobalConstants::FineTol, line::InputError::InputError(), lqn_overtake_markov(), lqn_overtake_prob_markov(), and line::lang::Distrib< T >::mean.

Referenced by lqn_overtake_prob_markov().

◆ lqn_sensitivity_table()

template<class T>
LnSensTable< T > line::ln::lqn_sensitivity_table ( SolverLN< T > & solver,
const sens::SensOptions & opt )

@SolverLN/getSensitivityTable.m: solve the ensemble, then concatenate each LAYER solver's own sensitivity table under a leading Layer column.

The work is SolverLN::get_sensitivity_table, which has to be a member – it perturbs each layer in place and re-enters solve_layer for that layer, so it needs the fork views, the region routing and the cache refresh that only the solver holds. This wrapper exists so that the operation is reachable under the name the reference gives it.

Definition at line 474 of file lqn_analyzers.h.

References line::ln::SolverLN< T >::get_sensitivity_table(), and lqn_sensitivity_table().

Referenced by lqn_sensitivity_table().

◆ lqn_tran_avg()

template<class T>
LnTranSolution line::ln::lqn_tran_avg ( SolverLN< T > & solver)

@SolverLN/getTranAvg.m: the block-diagonal aggregate transient over the LQN layers, in whichever coupling LnOptions::ln_transient names.

Definition at line 483 of file lqn_analyzers.h.

References line::ln::SolverLN< T >::get_tran_avg(), and lqn_tran_avg().

Referenced by lqn_tran_avg().