![]() |
LINE Solver (C++)
Templated C++ port of the LINE queueing solver
|
Classes | |
| struct | QrfAlpha |
| The scaling, the utilization normalizer, and why they may not exist. More... | |
| struct | QrfBlocking |
| The derived blocking tables, in the reference's 1-based queue indexing. More... | |
| struct | QrfCapacity |
| Per-station occupancy bounds, and which of them bind. More... | |
| struct | RoutingErgodicityInfo |
| The reducibility structure of a routing matrix, the MATLAB info struct. More... | |
| struct | ScheduleNominal |
| What sn_schedule_nominal returns, in the reference's own output order. More... | |
Functions | |
| template<class T> | |
| T | sn_gd_balance (const std::function< std::vector< T >(const std::vector< T > &)> &phi, const std::vector< std::size_t > &cutoffs) |
| Worst relative violation of the balance property over the given lattice. | |
| template<class T> | |
| double | sn_get_buffer_size (const qn::NetworkStruct< T > &sn, std::size_t ist) |
| Physical buffer size of a station, in jobs, the one in service included. | |
| template<class T> | |
| std::size_t | sn_join_quorum (const qn::NetworkStruct< T > &sn, std::size_t joinNode, std::size_t nbranches) |
| The number of siblings the Join node joinNode (1-based) fires on, out of nbranches forked. | |
| template<class T> | |
| Matrix< T > | sn_join_droprate (const qn::NetworkStruct< T > &sn, const Matrix< T > &TN, const Matrix< T > &AN) |
| Rate at which sibling tasks are discarded at each Join, as an (nstations x nclasses) matrix that is zero away from the Join rows. | |
| template<class T> | |
| RoutingErgodicityInfo | sn_is_routing_ergodic (const qn::NetworkStruct< T > &sn) |
| Ergodicity of the routing, with the structure behind the verdict. | |
| template<class T> | |
| RoutingErgodicityInfo | sn_reducibility_info (const qn::NetworkStruct< T > &sn) |
| The reducibility structure plus a suggested repair per absorbing station. | |
| template<class T> | |
| std::vector< std::size_t > | sn_absorbing_stations (const qn::NetworkStruct< T > &sn) |
| NODE indices, 1-based, of the absorbing stations. | |
| template<class T> | |
| std::map< std::pair< std::size_t, std::size_t >, Matrix< T > > | sn_make_ergodic (const qn::NetworkStruct< T > &sn, const std::string &targetName=std::string()) |
| A routing map that makes the network ergodic, by redirecting every absorbing station to TARGETNAME (empty for the default: the first Delay, else the first non-absorbing station). | |
| template<class T> | |
| bool | sn_has_schedule (const qn::NetworkStruct< T > &sn, std::size_t ist, std::size_t r) |
| True when (ist, r) carries a MAPt / PHt / NHPP schedule. | |
| template<class T> | |
| ScheduleNominal< T > | sn_schedule_nominal (const qn::NetworkStruct< T > &sn, std::size_t ist, std::size_t r) |
| Port of sn_schedule_nominal(sn, ist, r); ist and r are 0-based here. | |
| template<class T> | |
| QrfAlpha | sn_to_qrf_alpha (const qn::NetworkStruct< T > &L) |
| ld stays TRUE through a refusal: the model IS load dependent, and the caller has to tell "no arm serves this" from "the arm you asked for does
not". | |
| template<class T> | |
| QrfCapacity | sn_to_qrf_capacity (const qn::NetworkStruct< T > &sn) |
| F is an OCCUPANCY BOUND, not a declared capacity: the station's buffer where that buffer BINDS, and the population N everywhere else, since no queue of a closed model can hold more than N jobs. | |
| template<class T> | |
| QrfBlocking | sn_to_qrf_blocking (const qn::NetworkStruct< T > &sn, int Ktot, double max_vars=kQrfDefaultMaxVars) |
| The QRF BAS blocking tables (f, MR, BB, MM, ZZ, MM1), derived from an sn. | |
Variables | |
| const double | kQrfDefaultMaxVars = 5e5 |
| Variable-count ceiling of the derived LP. | |
| std::vector< std::size_t > line::sn::sn_absorbing_stations | ( | const qn::NetworkStruct< T > & | sn | ) |
NODE indices, 1-based, of the absorbing stations.
Definition at line 183 of file sn_routing_ergodic.h.
References line::sn::RoutingErgodicityInfo::absorbingStations, sn_absorbing_stations(), and sn_is_routing_ergodic().
Referenced by sn_absorbing_stations().
| T line::sn::sn_gd_balance | ( | const std::function< std::vector< T >(const std::vector< T > &)> & | phi, |
| const std::vector< std::size_t > & | cutoffs ) |
Worst relative violation of the balance property over the given lattice.
| phi | scaling evaluated on an (nstations) population vector, returning one scalar (broadcast) or one entry per station |
| cutoffs | per-station lattice bound, one entry per station |
Definition at line 53 of file sn_gd_balance.h.
References line::InputError::InputError(), and sn_gd_balance().
Referenced by sn_gd_balance().
| double line::sn::sn_get_buffer_size | ( | const qn::NetworkStruct< T > & | sn, |
| std::size_t | ist ) |
Physical buffer size of a station, in jobs, the one in service included.
| ist | 1-based station index. |
Definition at line 51 of file sn_get_buffer_size.h.
References sn_get_buffer_size().
Referenced by sn_get_buffer_size(), and sn_to_qrf_capacity().
| bool line::sn::sn_has_schedule | ( | const qn::NetworkStruct< T > & | sn, |
| std::size_t | ist, | ||
| std::size_t | r ) |
True when (ist, r) carries a MAPt / PHt / NHPP schedule.
Both 0-based.
Definition at line 56 of file sn_schedule_nominal.h.
References sn_has_schedule().
Referenced by sn_has_schedule(), sn_schedule_nominal(), and line::fluid::solver_fluid_kp_core().
| RoutingErgodicityInfo line::sn::sn_is_routing_ergodic | ( | const qn::NetworkStruct< T > & | sn | ) |
Ergodicity of the routing, with the structure behind the verdict.
Definition at line 117 of file sn_routing_ergodic.h.
References line::sn::RoutingErgodicityInfo::absorbingStations, line::sn::RoutingErgodicityInfo::isReducible, line::sn::RoutingErgodicityInfo::isRoutingErgodic, line::mc::SccResult::numSCC(), line::sn::RoutingErgodicityInfo::numSCCs, line::mc::SccResult::recurrent, line::mc::SccResult::scc, line::lang::Sink, sn_is_routing_ergodic(), line::mc::stronglyconncomp(), and line::sn::RoutingErgodicityInfo::transientStations.
Referenced by sn_absorbing_stations(), sn_is_routing_ergodic(), sn_make_ergodic(), and sn_reducibility_info().
| Matrix< T > line::sn::sn_join_droprate | ( | const qn::NetworkStruct< T > & | sn, |
| const Matrix< T > & | TN, | ||
| const Matrix< T > & | AN ) |
Rate at which sibling tasks are discarded at each Join, as an (nstations x nclasses) matrix that is zero away from the Join rows.
Port of matlab/src/api/fj/sn_join_droprate.m.
A Join is the one station where the loss identity ArvR - Tput does NOT hold, because the two rates are in different units: AN counts the SIBLINGS offered to the join (N per parent job) while TN counts the PARENT jobs released by it (one per synchronisation). Reading ArvR - Tput there reports (N-1)/N of the offered traffic as lost at every join, standard joins included, when a standard join loses nothing at all.
The siblings a join actually consumes are K per synchronisation, where K is the quorum (K = N on a standard join), so
DropRateJoin = max(0, AN - K*TN)
which is 0 for a standard join and (N-K)*TN for a quorum, the rate at which the stragglers of an already-fired parent are discarded on arrival.
This is the DERIVED value, exact given TN and AN. A solver that MEASURES the discards on its own sample path reports its own: the LDES engine fills LdesResult::DropRateJoin from the sibling it actually threw away, and a measured zero is a better answer than this one, which carries the finite-sample gap between the two rates.
Definition at line 86 of file sn_join_droprate.h.
References line::Matrix< T >::cols(), line::Matrix< T >::rows(), sn_join_droprate(), and sn_join_quorum().
Referenced by sn_join_droprate().
| std::size_t line::sn::sn_join_quorum | ( | const qn::NetworkStruct< T > & | sn, |
| std::size_t | joinNode, | ||
| std::size_t | nbranches ) |
The number of siblings the Join node joinNode (1-based) fires on, out of nbranches forked.
Port of matlab/src/api/fj/sn_join_quorum.m.
A standard join, an absent declaration, a non-positive quorum and a quorum that is not smaller than the sibling count all return nbranches, the ordinary AND-join.
NOTE the index space: joindecl is keyed by the BASE node index and carries ONE quorum per join rather than one per class, so a multiclass model with a different quorum per class cannot be expressed here. The reference and the JSON interchange have the same limitation.
Definition at line 44 of file sn_join_droprate.h.
References sn_join_quorum(), and line::lang::STD.
Referenced by line::mam::mam_fj_is_homogeneous(), sn_join_droprate(), and sn_join_quorum().
| std::map< std::pair< std::size_t, std::size_t >, Matrix< T > > line::sn::sn_make_ergodic | ( | const qn::NetworkStruct< T > & | sn, |
| const std::string & | targetName = std::string() ) |
A routing map that makes the network ergodic, by redirecting every absorbing station to TARGETNAME (empty for the default: the first Delay, else the first non-absorbing station).
Returns the modified blocks; the caller assigns them to sn.P and refreshes. Nothing is mutated here, which is the C++ reading of the reference's "does NOT relink": the modeller sees the repair before it is applied.
Definition at line 202 of file sn_routing_ergodic.h.
References line::sn::RoutingErgodicityInfo::absorbingStations, line::InputError::InputError(), line::sn::RoutingErgodicityInfo::isRoutingErgodic, sn_is_routing_ergodic(), and sn_make_ergodic().
Referenced by sn_make_ergodic().
| RoutingErgodicityInfo line::sn::sn_reducibility_info | ( | const qn::NetworkStruct< T > & | sn | ) |
The reducibility structure plus a suggested repair per absorbing station.
Definition at line 168 of file sn_routing_ergodic.h.
References line::sn::RoutingErgodicityInfo::absorbingStations, line::sn::RoutingErgodicityInfo::isRoutingErgodic, sn_is_routing_ergodic(), sn_reducibility_info(), and line::sn::RoutingErgodicityInfo::suggestedFixes.
Referenced by sn_reducibility_info().
| ScheduleNominal< T > line::sn::sn_schedule_nominal | ( | const qn::NetworkStruct< T > & | sn, |
| std::size_t | ist, | ||
| std::size_t | r ) |
Port of sn_schedule_nominal(sn, ist, r); ist and r are 0-based here.
Definition at line 63 of file sn_schedule_nominal.h.
References line::sn::ScheduleNominal< T >::breakpoints, line::sn::ScheduleNominal< T >::cyclic, line::lang::Distrib< T >::D0, line::sn::ScheduleNominal< T >::D0bar, line::lang::Distrib< T >::D1, line::sn::ScheduleNominal< T >::D1bar, line::InputError::InputError(), line::lang::Distrib< T >::sched_bp, line::lang::Distrib< T >::sched_cyclic, line::lang::Distrib< T >::sched_D0, line::lang::Distrib< T >::sched_D1, line::sn::ScheduleNominal< T >::segD0, line::sn::ScheduleNominal< T >::segD1, sn_has_schedule(), and sn_schedule_nominal().
Referenced by sn_schedule_nominal(), and line::fluid::solver_fluid_kp_core().
| QrfAlpha line::sn::sn_to_qrf_alpha | ( | const qn::NetworkStruct< T > & | L | ) |
ld stays TRUE through a refusal: the model IS load dependent, and the caller has to tell "no arm serves this" from "the arm you asked for does not".
Clearing it would report the latter for both.
Definition at line 78 of file sn_to_qrf_alpha.h.
References line::sn::QrfAlpha::alpha, line::mam::Map< T >::D0, line::lang::dist_to_map(), line::sn::QrfAlpha::ld, line::sn::QrfAlpha::msg, line::qn::NetworkStruct< T >::njobs(), line::qn::NetworkStruct< T >::nstations, line::sn::QrfAlpha::peak, line::qn::NetworkStruct< T >::service, sn_to_qrf_alpha(), and line::qn::NetworkStruct< T >::stations.
Referenced by line::ba::list_valid_methods(), sn_to_qrf_alpha(), and line::ba::solver_ba_qrf_analyzer().
| QrfBlocking line::sn::sn_to_qrf_blocking | ( | const qn::NetworkStruct< T > & | sn, |
| int | Ktot, | ||
| double | max_vars = kQrfDefaultMaxVars ) |
The QRF BAS blocking tables (f, MR, BB, MM, ZZ, MM1), derived from an sn.
| sn | network structure |
| Ktot | total service phases, which sizes the LP together with MR and N |
| max_vars | variable-count ceiling; pass kQrfDefaultMaxVars for the default |
Definition at line 298 of file sn_to_qrf_blocking.h.
References line::sn::QrfBlocking::BB, line::sn::QrfCapacity::binding, line::sn::QrfBlocking::blockers, line::sn::QrfBlocking::F, line::sn::QrfCapacity::F, line::sn::QrfBlocking::f, kQrfDefaultMaxVars, line::sn::QrfBlocking::MM, line::sn::QrfBlocking::MM1, line::sn::QrfBlocking::MR, line::sn::QrfBlocking::msg, line::sn::QrfCapacity::msg, sn_to_qrf_blocking(), sn_to_qrf_capacity(), line::sn::QrfBlocking::ZM, and line::sn::QrfBlocking::ZZ.
Referenced by line::ba::blocking_default(), and sn_to_qrf_blocking().
| QrfCapacity line::sn::sn_to_qrf_capacity | ( | const qn::NetworkStruct< T > & | sn | ) |
F is an OCCUPANCY BOUND, not a declared capacity: the station's buffer where that buffer BINDS, and the population N everywhere else, since no queue of a closed model can hold more than N jobs.
Binding is decided by sn_get_buffer_size, the single place in LINE that makes that call.
Both QRF blocking bounds need this. qrf.bas needs it beside the blocking tables; qrf.rsrd needs it ALONE, since its PBB constraint reads only which queues can be full and it carries no blocking tables at all.
Definition at line 112 of file sn_to_qrf_blocking.h.
References line::sn::QrfCapacity::binding, line::sn::QrfCapacity::F, line::sn::QrfCapacity::msg, sn_get_buffer_size(), and sn_to_qrf_capacity().
Referenced by sn_to_qrf_blocking(), and sn_to_qrf_capacity().
| const double line::sn::kQrfDefaultMaxVars = 5e5 |
Variable-count ceiling of the derived LP.
A guard, not a tuning knob: the enumeration cannot be truncated (invariant 2), so an oversized model is refused rather than approximated.
Definition at line 92 of file sn_to_qrf_blocking.h.
Referenced by sn_to_qrf_blocking().