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

Namespaces

namespace  sp

Classes

struct  Accum
 The running per-(station, class) integrals and tallies. More...
struct  BpTarget
 One measured target: a station set, optionally filtered to one class. More...
class  BusyPeriods
 The busy-period tracker of one run. More...
struct  CacheState
 Live state of one Cache node. More...
class  Convergence
 Convergence-based stopping: batch the four metrics and stop once EVERY active (station, class) pair has reached the requested relative precision. More...
struct  Event
 One scheduled event. More...
struct  EventLater
 Later-is-greater, so the priority queue pops the earliest event. More...
struct  Job
 A job held by a station. More...
struct  LnCacheAccess
 One ItemEntry read: its driver activity, its item law and its two branches. More...
struct  LnCacheState
 Live content of one replica of a cache task, LNCacheState of the Java engine. More...
struct  LnCustomer
 A reference-task customer: it thinks, then starts an invocation. More...
struct  LnEntryCdf
 One entry's empirical response-time CDF: F[j] = P(R <= t[j]). More...
struct  LnEvent
 One scheduled event of the layered engine. More...
struct  LnEventLater
struct  LnInv
 One invocation of an entry: what a call or a reference cycle starts. More...
struct  LnJoin
 Progress of one AND join within one invocation, JoinProgress of the Java engine. More...
struct  LnLine
 One LINE of execution: a point in the activity graph of one invocation. More...
struct  LnResult
 The layered result: per element, the mean measures. More...
struct  Observations
 The event-spaced observation series MSER-5 and the CI both read. More...
struct  PhaseTrace
 The phases one walked interval visited and how long it held each, filled by a sampler only while the sample-path export hands it one (Sampler::set_trace). More...
struct  PsJob
 A job being served by a sharing discipline, with the work it still owes. More...
struct  Region
 One finite capacity region, resolved to what the event loop needs. More...
struct  Rng
 The engine's randomness, in the SHAPE the Java engine uses it. More...
struct  RouteDest
 One destination NODE of a (node, class) pair, with the class it switches to. More...
struct  RouteEntry
 One routing alternative out of a (node, class) pair. More...
class  Sampler
 One variate generator, holding whatever state its family needs. More...
struct  SpnMode
 One mode of a transition, resolved to what the event loop needs. More...
struct  SpnTransition
 One Transition node. More...
struct  StationState
 One station's mutable state. More...
struct  StatTriple
 Grand mean, standard error and degrees of freedom of a batch-means estimate. More...
struct  Truncation
 Where the warmup ended, and whether a truncation was applied at all. More...
struct  WaitCmp
 The waiting-room order of a buffered discipline. More...

Enumerations

enum class  Role { Source , Queue , Delay , Synchronization }
 Station roles this engine simulates. More...
enum  EventKind {
  EV_DEPARTURE = 0 , EV_FIRING = 6 , EV_SWITCHOVER = 1 , EV_SETUP = 2 ,
  EV_RETRIAL = 3 , EV_RENEGE = 4 , EV_ARRIVAL = 5 , EV_BREAKDOWN = 7 ,
  EV_PLACE_SVC = 8 , EV_ORBIT_ABANDON = 9 , EV_QUANTUM = 10 , EV_POLL_TIMER = 11
}
 Event tags, ordered so that a service completion precedes an arrival scheduled for the same instant. More...
enum  PowerState { PW_ACTIVE = 0 , PW_OFF = 1 , PW_SETUP = 2 , PW_DELAYOFF = 3 }
 The power state of one server of a setup/delay-off station, the reference's Solver_ssj.ServerState. More...
enum class  ThreadState { ACTIVE , DELAYOFF , OFF , SETUP }
 Power state of one task thread, mirroring Solver_ssj_ln's THREAD_* constants. More...
enum class  LnColumn {
  QLen , Util , RespT , ResidT ,
  Tput
}
 A column of the shared layered average table, as line-cli prints it. More...

Functions

bool cache_refreshes (lang::ReplacementStrategy p)
 True for the policies that refresh recency on a hit.
void cache_hit (CacheState &cs, std::size_t item, std::size_t at, double u_random)
 Serve a HIT in list at.
void cache_miss (CacheState &cs, std::size_t item, double u_admit, double u_random)
 Serve a MISS: insert into the entry list, evicting if it is full.
std::string java_double_str (double v)
 A double as Java's Double.toString spells it, which is how the reference's Logger writes its time columns: the shortest digit string that reads back to the same value, plain between 1e-3 and 1e7 and d.dddE<n> outside, always with one digit after the point (1.0, 2.5E-4).
template<class T>
void ldes_engine_reject (const qn::NetworkStruct< T > &sn, const LdesOptions &o)
 Refuse, by name, every model outside this engine's scope.
template<class T>
std::vector< double > ldes_declared_placement (const qn::NetworkStruct< T > &sn)
 The job placement the model's DECLARED initial state stands for, station-major like init_sol, or empty when there is none to take.
std::vector< LnEntryCdf > ldes_ln_cdf_respt (const LnResult &r, std::size_t nentries)
 The empirical response time CDF of every ENTRY, the getCdfRespTLN of the other codebases: one [F(t), t] table per entry in the LOCAL index space, empty where the run observed nothing.
template<class T>
bool ln_defined (const lqn::LqnStruct< T > &lsn, const LnResult &r, std::size_t i, LnColumn c)
 Does the element at i HAVE the quantity in column c?
Rng ln_rng (long long seed, long long offset)
 The generator of one LN stream, seeded from a HASH of (run seed, offset).
double uniform01 (Rng &g)
 Uniform on (0,1) off the MRG stream; next_double never returns 0.
bool spn_enabled (const SpnMode &m, const std::vector< double > &tok)
 True when m is enabled by the marking tok, which is indexed the same way as the mode's own vectors – (place slot, class), flattened.
double spn_rate (const SpnMode &m, const std::vector< double > &tok)
 The rate of a timed mode under the current marking.
double spn_active_servers (const SpnMode &m, const std::vector< double > &tok)
 The clocks an enabled timed mode runs at once: min(servers, enabling degree), the degree being the floor over its input arcs of tokens over weight on the FULL marking, as the CTMC's State.afterGlobalEvent counts them.
void spn_fire (const SpnMode &m, std::vector< double > &tok)
 Move the tokens of one firing: consume the enabling counts, deposit the firing ones.
int spn_pick_immediate (const std::vector< SpnMode > &modes, const std::vector< double > &tok, double u)
 Pick among the enabled IMMEDIATE modes: the highest priority first (lowest value), then weighted at random among the ties.
bool is_preemptive (lang::SchedStrategy s)
 True for the disciplines that interrupt a job already in service.
bool is_preemptive_resume (lang::SchedStrategy s)
 PREEMPTIVE RESUME, as against preemptive restart.
bool is_size_based (lang::SchedStrategy s)
 True for the orders whose key is the job's size, residual or attained work.
bool is_ps_family (lang::SchedStrategy s)
 True for the disciplines that share the server instead of ordering a queue.
template<typename T, typename Cmp>
std::size_t jpq_sift_down (std::vector< T > &es, std::size_t k, T x, std::size_t n, const Cmp &cmp)
 THE WAITING ROOM IS A java.util.PriorityQueue, ALGORITHM FOR ALGORITHM.
template<typename T, typename Cmp>
void jpq_sift_up (std::vector< T > &es, std::size_t k, T x, const Cmp &cmp)
template<typename T, typename Cmp>
void jpq_offer (std::vector< T > &es, const T &x, const Cmp &cmp)
 PriorityQueue.offer: append, then sift the new element up.
template<typename T, typename Cmp>
T jpq_poll (std::vector< T > &es, const Cmp &cmp)
 PriorityQueue.poll: take the root, sift the LAST element down from it.
template<typename T, typename Cmp>
void jpq_remove_at (std::vector< T > &es, std::size_t i, const Cmp &cmp)
 PriorityQueue.removeAt: the last element fills the hole, down then up.
template<typename T, typename Cmp>
void jpq_heapify (std::vector< T > &es, const Cmp &cmp)
 PriorityQueue.heapify, for a buffer whose keys were rewritten in place.
std::vector< double > ps_shares (lang::SchedStrategy sched, const std::vector< PsJob > &jobs, double c, const std::vector< double > &weight, std::size_t nclasses)
 The per-job shares of a sharing discipline, in units of one server.
double fsp_virtual_finish (const std::vector< double > &residuals, double target_work, double c, double now)
 FSP's virtual finish time: when target would finish if the station ran processor sharing from now on.
std::size_t preemption_victim (lang::SchedStrategy sched, const std::vector< Job > &in_service, const std::vector< double > &started, const Job &arriving, double c, double now)
 Which job in service arriving displaces, or in_service.size() for none.
int mser5_truncation (const std::vector< double > &obs, int batch_size)
 MSER-5 truncation point over a series of observations, in BATCHES.
double overlap_adjustment (double overlap)
 The variance inflation of OVERLAPPING batch means.
StatTriple bm_statistics (const std::vector< double > &obs, int batch_size)
 Non-overlapping batch means.
StatTriple obm_statistics (const std::vector< double > &obs, int batch_size, double overlap)
 Overlapping batch means.
double t_critical (double level, int df)
 The two-sided t critical value at confidence level with df degrees of freedom: the EXACT Student-t quantile t_{(1+level)/2, df}, as the Java engine's Solver_ssj.getTCriticalValue computes it.
StatTriple spectral_statistics (const std::vector< double > &obs, int batch_size, double low_freq_frac)
 Heidelberger-Welch spectral estimate of the variance of the sample mean.
StatTriple ci_statistics (const std::vector< double > &obs, int batch_size, const LdesOptions &o)
 Dispatch on cimethod.
void batch_means_ci (const Observations &obs, const Truncation &tr, const Accum &acc, const LdesOptions &o, LdesResult &res, const Matrix< double > &u_law, const std::vector< std::vector< bool > > *lost_unserved=nullptr)
 Fill the half-width matrices of res from the post-warmup observation series.

Variables

static const std::size_t LN_NONE = static_cast<std::size_t>(-1)
 Index meaning "none" for a line, an invocation or a customer.
static const std::uint64_t LN_ANYFORK = static_cast<std::uint64_t>(-1)
 Fork instance meaning "any": the late inputs of a join fed by more than one fork instance.
static const std::size_t NOTHR = static_cast<std::size_t>(-1)
 Thread index meaning "no thread held", also used for an infinite-thread task.
static const std::size_t NOTDRAWN = static_cast<std::size_t>(-1)
 LnJob::calls_left before the repetition count of a call has been drawn.

Enumeration Type Documentation

◆ EventKind

Event tags, ordered so that a service completion precedes an arrival scheduled for the same instant.

The order matters on any model whose rates produce exact ties (a Det service, a closed class placed at t=0), and it is the completions-then- arrivals phase order of the Java engine's slotPhase. Ties inside one tag break on the insertion sequence, so the event list is a total order and the path is reproducible from the seed.

Enumerator
EV_DEPARTURE 
EV_FIRING 
EV_SWITCHOVER 
EV_SETUP 
EV_RETRIAL 
EV_RENEGE 
EV_ARRIVAL 
EV_BREAKDOWN 
EV_PLACE_SVC 

A service completion in the EMBEDDED QUEUE of a queueing place: the token leaves the place's servers for its depository, where the output arcs can finally see it.

station is the place SLOT and cls the token colour.

It sorts AFTER a firing at the same instant, which matters only for the degenerate Immediate service law: a token whose service ends exactly when a transition fires reaches the depository after that firing read it, which is the reference's own order (placeDepartureActions re-checks enabling once it has deposited, so the firing simply happens next).

EV_ORBIT_ABANDON 

A job abandons the retrial orbit (sn.orbitImpatience); tag is its id.

EV_QUANTUM 

Round robin: the quantum of the job in slot expires; tag is the slot's rr_qtag when it was armed.

It sorts after a departure at the same instant, so a service that ends exactly when its quantum does completes, as Solver_ssj arms the expiry only for a quantum strictly shorter.

EV_POLL_TIMER 

A polling visit timer expires; station is the station and tag the timer id.

Definition at line 157 of file ldes_engine.h.

◆ LnColumn

enum class line::ldes::engine::LnColumn
strong

A column of the shared layered average table, as line-cli prints it.

Enumerator
QLen 
Util 
RespT 
ResidT 
Tput 

Definition at line 422 of file ldes_ln_engine.h.

◆ PowerState

The power state of one server of a setup/delay-off station, the reference's Solver_ssj.ServerState.

An EV_SETUP event ends whichever timer the slot is running (SETUP -> ACTIVE, DELAYOFF -> OFF) and is discarded when its tag no longer matches the slot's power_tag, which is how a cancelled delay-off is neutralised.

Enumerator
PW_ACTIVE 
PW_OFF 
PW_SETUP 
PW_DELAYOFF 

Definition at line 198 of file ldes_engine.h.

◆ Role

enum class line::ldes::engine::Role
strong

Station roles this engine simulates.

A Fork and a Join appear in sn.stations because the refresh registers them, but they SERVE NOTHING: they are handled by the routing layer, which replicates at one and synchronizes at the other. Giving them a role of their own keeps them out of the service-station setup, which would otherwise demand a service law they do not have.

Enumerator
Source 
Queue 
Delay 
Synchronization 

Definition at line 145 of file ldes_engine.h.

◆ ThreadState

Power state of one task thread, mirroring Solver_ssj_ln's THREAD_* constants.

Enumerator
ACTIVE 
DELAYOFF 
OFF 
SETUP 

Definition at line 308 of file ldes_ln_engine.h.

Function Documentation

◆ batch_means_ci()

void line::ldes::engine::batch_means_ci ( const Observations & obs,
const Truncation & tr,
const Accum & acc,
const LdesOptions & o,
LdesResult & res,
const Matrix< double > & u_law,
const std::vector< std::vector< bool > > * lost_unserved = nullptr )
inline

Fill the half-width matrices of res from the post-warmup observation series.

Transcribes computeOBMConfidenceIntervals.

The three series are not treated alike, and that is the reference's design:

  • QUEUE LENGTH has one observation per interval already, so it batches directly;
  • THROUGHPUT is stored CUMULATIVE, so it is differenced into per-interval rates first – batching the cumulative counts would estimate the variance of a random walk;
  • UTILIZATION is not measured separately at all. Its interval is the throughput's, carried through the utilization law U = T*S/c (u_law, the S/c of each row, with c the peak capacity and 1 at a delay), as MATLAB's law and the JAR's TNCI/(mu*c) read it, not through the measured UN/TN;
  • RESPONSE TIME is not batched: as the reference's responseTimeTally, it is the iid interval t(n-1) * sd / sqrt(n) over the tallied response times, reported only above 30 of them, over the same tally RN is the mean of.

A series shorter than ciminobs yields NO interval rather than a wide one: a half-width computed from a handful of batches is not conservative, it is arbitrary.

Definition at line 736 of file ldes_stats.h.

References batch_means_ci(), ci_statistics(), line::ldes::LdesOptions::cimethod, line::ldes::LdesOptions::ciminbatch, line::ldes::LdesOptions::ciminobs, line::ldes::engine::Observations::cmp, line::ldes::LdesOptions::confint, line::ldes::engine::StatTriple::df, line::ldes::LdesOptions::events, line::ldes::LdesResult::has_run_length_plan, line::ldes::engine::Observations::nclasses, line::ldes::engine::Observations::nstations, line::ldes::engine::StatTriple::ok, line::ldes::engine::Observations::qlen, line::ldes::LdesResult::QN, line::ldes::LdesResult::QNCI, line::ldes::engine::Accum::resp_cnt, line::ldes::engine::Accum::resp_m2, line::ldes::LdesResult::RNCI, line::Matrix< T >::rows(), line::ldes::LdesResult::run_length_plan, line::ldes::LdesOptions::run_length_plan_precision, line::ldes::LdesOptions::samples, line::sim::sim_runlength_plan(), line::ldes::engine::StatTriple::stderr_, t_critical(), line::ldes::engine::Observations::time, line::ldes::LdesResult::TN, line::ldes::LdesResult::TNCI, line::ldes::LdesResult::total_simulated_events, and line::ldes::LdesResult::UNCI.

Referenced by batch_means_ci().

◆ bm_statistics()

StatTriple line::ldes::engine::bm_statistics ( const std::vector< double > & obs,
int batch_size )
inline

Non-overlapping batch means.

Transcribes computeBMStatisticsInternal.

Definition at line 373 of file ldes_stats.h.

References bm_statistics(), line::ldes::engine::StatTriple::df, line::ldes::engine::StatTriple::mean, line::ldes::engine::StatTriple::ok, and line::ldes::engine::StatTriple::stderr_.

Referenced by bm_statistics(), ci_statistics(), and spectral_statistics().

◆ cache_hit()

void line::ldes::engine::cache_hit ( CacheState & cs,
std::size_t item,
std::size_t at,
double u_random )
inline

Serve a HIT in list at.

A hit PROMOTES the item one list, under EVERY policy, which is the default access-cost matrix (super-diagonal) the JAR engine and MATLAB afterEventCache sample from, and the RR(m)/FIFO(m)/LRU(m) chains the NC recursions solve. Only CLIMB used to promote here, so an RR cache with lists [2, 1] never filled its second list and reported HitProb 0.361 against the exact 0.539. In the top list the item stays and the recency policies refresh it. A promotion into a full list swaps: the item goes to the higher list and the displaced occupant returns to the lower one, to its head under the recency policies and SFIFO, and into the slot the item freed under RR and FIFO.

Definition at line 160 of file ldes_cache.h.

References cache_hit(), cache_refreshes(), line::ldes::engine::CacheState::cap_of(), line::ldes::engine::CacheState::capacity, line::ldes::engine::CacheState::capped(), line::ldes::engine::CacheState::list_cost(), line::ldes::engine::CacheState::lists, line::ldes::engine::CacheState::policy, line::lang::RR, line::lang::SFIFO, and line::ldes::engine::CacheState::size_of().

Referenced by cache_hit().

◆ cache_miss()

◆ cache_refreshes()

bool line::ldes::engine::cache_refreshes ( lang::ReplacementStrategy p)
inline

True for the policies that refresh recency on a hit.

Definition at line 142 of file ldes_cache.h.

References cache_refreshes(), line::lang::HLRU, line::lang::LRU, and line::lang::QLRU.

Referenced by cache_hit(), and cache_refreshes().

◆ ci_statistics()

StatTriple line::ldes::engine::ci_statistics ( const std::vector< double > & obs,
int batch_size,
const LdesOptions & o )
inline

◆ fsp_virtual_finish()

double line::ldes::engine::fsp_virtual_finish ( const std::vector< double > & residuals,
double target_work,
double c,
double now )
inline

FSP's virtual finish time: when target would finish if the station ran processor sharing from now on.

Sort every residual work at the station, then walk it: while n jobs remain each advances at min(1, c/n), so the wall time to clear the k-th smallest residual is the sum of (w_k - w_{k-1}) / rate over the ranks below it. FSP then serves in that order, which is what makes it dominate PS job by job. Transcribes computeFSPVirtualFinishTime.

Definition at line 546 of file ldes_station.h.

References fsp_virtual_finish().

Referenced by fsp_virtual_finish(), and preemption_victim().

◆ is_preemptive()

◆ is_preemptive_resume()

bool line::ldes::engine::is_preemptive_resume ( lang::SchedStrategy s)
inline

PREEMPTIVE RESUME, as against preemptive restart.

A resumed job continues from its residual work; a restarted one draws a FRESH requirement and discards what it had done. That distinction is the whole of the PR/PI split and it is not cosmetic: under exponential service the two agree in distribution (memorylessness) and under any other law they do not, so a model that uses PI to represent lost work is silently served as PR on a Coxian. Every size-based policy is RESUME – restarting a job would make its own scheduling key meaningless.

Definition at line 193 of file ldes_station.h.

References line::lang::FCFSPI, line::lang::FCFSPIPRIO, is_preemptive(), is_preemptive_resume(), line::lang::LCFSPI, and line::lang::LCFSPIPRIO.

Referenced by is_preemptive_resume().

◆ is_ps_family()

bool line::ldes::engine::is_ps_family ( lang::SchedStrategy s)
inline

True for the disciplines that share the server instead of ordering a queue.

Definition at line 222 of file ldes_station.h.

References line::lang::DPS, line::lang::DPSPRIO, line::lang::GPS, line::lang::GPSPRIO, is_ps_family(), line::lang::LPS, line::lang::PS, and line::lang::PSPRIO.

Referenced by is_ps_family(), and ldes_engine_reject().

◆ is_size_based()

bool line::ldes::engine::is_size_based ( lang::SchedStrategy s)
inline

True for the orders whose key is the job's size, residual or attained work.

Definition at line 206 of file ldes_station.h.

References line::lang::FB, line::lang::FSP, is_size_based(), line::lang::LRPT, line::lang::PSJF, line::lang::SETF, line::lang::SRPT, and line::lang::SRPTPRIO.

Referenced by is_size_based().

◆ java_double_str()

std::string line::ldes::engine::java_double_str ( double v)
inline

A double as Java's Double.toString spells it, which is how the reference's Logger writes its time columns: the shortest digit string that reads back to the same value, plain between 1e-3 and 1e7 and d.dddE<n> outside, always with one digit after the point (1.0, 2.5E-4).

Definition at line 265 of file ldes_engine.h.

References java_double_str().

Referenced by java_double_str().

◆ jpq_heapify()

template<typename T, typename Cmp>
void line::ldes::engine::jpq_heapify ( std::vector< T > & es,
const Cmp & cmp )
inline

PriorityQueue.heapify, for a buffer whose keys were rewritten in place.

Definition at line 409 of file ldes_station.h.

References jpq_heapify(), and jpq_sift_down().

Referenced by jpq_heapify().

◆ jpq_offer()

template<typename T, typename Cmp>
void line::ldes::engine::jpq_offer ( std::vector< T > & es,
const T & x,
const Cmp & cmp )
inline

PriorityQueue.offer: append, then sift the new element up.

Definition at line 379 of file ldes_station.h.

References jpq_offer(), and jpq_sift_up().

Referenced by jpq_offer().

◆ jpq_poll()

template<typename T, typename Cmp>
T line::ldes::engine::jpq_poll ( std::vector< T > & es,
const Cmp & cmp )
inline

PriorityQueue.poll: take the root, sift the LAST element down from it.

Definition at line 386 of file ldes_station.h.

References jpq_poll(), and jpq_sift_down().

Referenced by jpq_poll().

◆ jpq_remove_at()

template<typename T, typename Cmp>
void line::ldes::engine::jpq_remove_at ( std::vector< T > & es,
std::size_t i,
const Cmp & cmp )
inline

PriorityQueue.removeAt: the last element fills the hole, down then up.

Definition at line 396 of file ldes_station.h.

References jpq_remove_at(), jpq_sift_down(), and jpq_sift_up().

Referenced by jpq_remove_at().

◆ jpq_sift_down()

template<typename T, typename Cmp>
std::size_t line::ldes::engine::jpq_sift_down ( std::vector< T > & es,
std::size_t k,
T x,
std::size_t n,
const Cmp & cmp )
inline

THE WAITING ROOM IS A java.util.PriorityQueue, ALGORITHM FOR ALGORITHM.

The reference's comparators carry NO tie-break (FCFS compares orderTime alone), so jobs with equal keys – a closed population all admitted at t = 0, simultaneous arrivals under deterministic times – leave in whatever order the binary heap's sift rules produce. libstdc++'s pop_heap moves the hole to a leaf and sifts back up, which settles ties differently, so the native engine served the same jobs in a different order and the job ids of a sample path parted company at the first tied start (closed 2026-11-14). These four functions are offer, poll, removeAt and heapify of OpenJDK's PriorityQueue (identical in 8 and 17), with cmp the inverted comparator of WaitCmp: compare(x, y) > 0 there is cmp(x, y) here, and compare(x, y) >= 0 is !cmp(y, x).

Definition at line 352 of file ldes_station.h.

References jpq_sift_down().

Referenced by jpq_heapify(), jpq_poll(), jpq_remove_at(), and jpq_sift_down().

◆ jpq_sift_up()

template<typename T, typename Cmp>
void line::ldes::engine::jpq_sift_up ( std::vector< T > & es,
std::size_t k,
T x,
const Cmp & cmp )
inline

Definition at line 367 of file ldes_station.h.

References jpq_sift_up().

Referenced by jpq_offer(), jpq_remove_at(), and jpq_sift_up().

◆ ldes_declared_placement()

template<class T>
std::vector< double > line::ldes::engine::ldes_declared_placement ( const qn::NetworkStruct< T > & sn)

The job placement the model's DECLARED initial state stands for, station-major like init_sol, or empty when there is none to take.

Port of the JAR's Solver_ldes_analyzer.deriveInitSolFromState, so both engines start from the same placement and inject it in the same order. A station's declared state is its (statespace, stateprior) pair, which Network::set_state_prior and the reader of initialState write and which CTMC, SSA, FLD and JMT start from; the weighed row gives the per-class COUNT at each Queue and Delay. The engine draws every service afresh, so buffer order and phase are not carried, exactly as for init_sol. Empty, and so the reference-station default, when a Queue or Delay declares nothing or the counts do not conserve every closed population; a prior over rows with different counts is refused, since one run starts from one placement.

Definition at line 1096 of file ldes_engine.h.

References line::Matrix< T >::cols(), ldes_declared_placement(), line::qn::Marginal< T >::nir, line::lang::OPEN, line::Matrix< T >::rows(), line::qn::to_marginal(), and line::UnsupportedError::UnsupportedError().

Referenced by ldes_declared_placement().

◆ ldes_engine_reject()

template<class T>
void line::ldes::engine::ldes_engine_reject ( const qn::NetworkStruct< T > & sn,
const LdesOptions & o )

Refuse, by name, every model outside this engine's scope.

The refusal is the point. A PS station served FCFS, a preemptive-resume station served non-preemptively, or a blocking model run without blocking all finish and report plausible numbers; nothing downstream can tell them from correct ones, so the check has to happen here, before the run.

Definition at line 312 of file ldes_engine.h.

References line::qn::CacheParam< T >::accost, line::lang::BAS, line::lang::BBS, line::lang::DROP, line::InputError::InputError(), is_preemptive(), is_ps_family(), ldes_engine_reject(), line::lang::MAPT, line::ErrorKind::name, line::lang::NHPP, line::lang::NNPP, line::lang::node_type_to_text(), line::lang::NORMAL, line::lang::PHT, line::lang::process_is_batch(), line::lang::process_to_text(), line::lang::RETRIAL, line::lang::RETRIAL_WITH_LIMIT, line::lang::sched_to_text(), line::ldes::LdesOptions::slotted, line::UnsupportedError::UnsupportedError(), and line::lang::WAITQ.

Referenced by ldes_engine_reject().

◆ ldes_ln_cdf_respt()

std::vector< LnEntryCdf > line::ldes::engine::ldes_ln_cdf_respt ( const LnResult & r,
std::size_t nentries )
inline

The empirical response time CDF of every ENTRY, the getCdfRespTLN of the other codebases: one [F(t), t] table per entry in the LOCAL index space, empty where the run observed nothing.

The ecdf of each entry's observations: sort, step by 1/n, and collapse ties keeping the LARGEST value at each distinct time, so an interpolating reader cannot land on a multivalued point.

Definition at line 404 of file ldes_ln_engine.h.

References line::ldes::engine::LnResult::entry_resp_samples, and ldes_ln_cdf_respt().

Referenced by line::SolverLDES::cdf_respt_ln(), and ldes_ln_cdf_respt().

◆ ln_defined()

template<class T>
bool line::ldes::engine::ln_defined ( const lqn::LqnStruct< T > & lsn,
const LnResult & r,
std::size_t i,
LnColumn c )
inline

Does the element at i HAVE the quantity in column c?

THE MASK BELONGS TO THE TABLE, not to whichever engine filled it. A NaN there is not a failed computation: it says the quantity is not defined for that element kind, and SolverLN and LQNS report the same one –

Processor QLen no, Util yes, RespT no, ResidT no, Tput no Task QLen yes, Util yes, RespT no, ResidT yes, Tput yes Entry QLen yes, Util yes, RespT yes, ResidT no, Tput yes Activity all five

– so a reader can diff the arms row by row. This engine MEASURES more than that: a processor's completion rate is sitting in TLN and an entry's occupancy in QLN, both perfectly well defined as sample-path quantities. Reporting them where every other solver says NaN would make one column mean different things depending on who filled it, which is the divergence the JAR removed from getLNAvgTable on 2026-08-21. Nothing is discarded: the caller still has the whole LnResult; only the SHARED TABLE is masked.

ResidT needs no rule of its own here because the engine already applies it: WLN starts at NaN and only activities and their tasks are written, so a task with no activity at all keeps its NaN rather than claiming a residence of zero (which would say something is held there for no time, not that nothing is held).

Twin of the mask jline.solvers.ldes.SolverLDES.getLNAvgTable applies and of the defined_* flags of ln::LnSolution; the three are pinned against each other by cpp/tests/test_lqn_nan_mask_parity.cpp.

Definition at line 455 of file ldes_ln_engine.h.

References line::lang::ACTIVITY, line::lang::ENTRY, line::lang::HOST, ln_defined(), line::ldes::engine::LnResult::nidx, QLen, ResidT, RespT, Tput, Util, and line::ldes::engine::LnResult::WLN.

Referenced by ln_defined().

◆ ln_rng()

Rng line::ldes::engine::ln_rng ( long long seed,
long long offset )
inline

The generator of one LN stream, seeded from a HASH of (run seed, offset).

The MRG32k3a stream is rng::SeedHash's, exactly as the flat engine seeds its streams (equally spaced seed vectors are linearly dependent and had biased every AND join by 1-2%, see rng_ssj.h); the same hash then goes on to seed the java.util.Random and the McRng. Solver_ssj_ln draws everything from ONE java.util.Random, so the layered reference has no stream layout to reproduce bit for bit, only a law: the offsets keep naming the streams.

Definition at line 481 of file ldes_ln_engine.h.

References line::ldes::engine::Rng::aux, ln_rng(), line::ldes::engine::Rng::mc, line::rng::SeedHash::mrg_seeds(), line::rng::SeedHash::next(), line::rng::Mrg32k3a::set_seed(), and line::ldes::engine::Rng::stream.

Referenced by line::ldes::ldes_ln_engine_solve(), and ln_rng().

◆ mser5_truncation()

int line::ldes::engine::mser5_truncation ( const std::vector< double > & obs,
int batch_size )
inline

MSER-5 truncation point over a series of observations, in BATCHES.

Returns the batch index d minimising var(Z_{d..N-1}) / (N-d)^2 over the batch means Z, and 0 when there are fewer than four batches – below that the criterion is estimated from too few terms to be a truncation rule. Transcribes computeMSER5TruncationPoint.

Definition at line 169 of file ldes_stats.h.

References mser5_truncation().

Referenced by mser5_truncation(), and line::ldes::engine::Observations::truncate().

◆ obm_statistics()

StatTriple line::ldes::engine::obm_statistics ( const std::vector< double > & obs,
int batch_size,
double overlap )
inline

◆ overlap_adjustment()

double line::ldes::engine::overlap_adjustment ( double overlap)
inline

The variance inflation of OVERLAPPING batch means.

Overlapping batches are positively correlated, so the naive sample variance of their means underestimates the true one; 4/3 is the standard asymptotic correction at 50% overlap, interpolated linearly below it and reducing to 1 at zero overlap, where the batches are disjoint and no correction is due. Transcribes computeOverlapAdjustmentFactor.

Definition at line 366 of file ldes_stats.h.

References overlap_adjustment().

Referenced by obm_statistics(), and overlap_adjustment().

◆ preemption_victim()

std::size_t line::ldes::engine::preemption_victim ( lang::SchedStrategy sched,
const std::vector< Job > & in_service,
const std::vector< double > & started,
const Job & arriving,
double c,
double now )
inline

Which job in service arriving displaces, or in_service.size() for none.

ONE RULE PER FAMILY, transcribed from shouldPreemptForLCFS, shouldPreemptForFCFS and shouldPreemptForSizeBasedPolicy together with their findJobToPreempt* counterparts. The two halves are fused here because they ask the same question twice in the reference – once to decide and once to choose – and answering it once cannot disagree with itself.

THE PRIORITY VARIANTS PREEMPT ONLY STRICTLY LOWER PRIORITY, AND ONLY THEY DO. There are FOUR distinct tests here, not one:

  • LCFSPR/LCFSPI preempt UNCONDITIONALLY. Last-come-first-served keeps the NEWEST job in service, so the newcomer takes the head with no class ordering.
  • LCFSPRPRIO/LCFSPIPRIO preempt a job whose priority value is AT LEAST the arrival's, a strictly lower one first. started[j] is when in_service[j] last took its server, the tie-break among equals.
  • FCFSPRPRIO/FCFSPIPRIO preempt only one STRICTLY GREATER.
  • FCFSPR/FCFSPI preempt NOTHING AT ALL. Preemption under the FCFS families is a PRIORITY act, so it belongs to the PRIO names alone and only ACROSS priority groups: the base rule serves in ARRIVAL ORDER, and a plain variant is absent from the model's priority-aware set (the user is warned that "Priorities will be ignored"), so every class sits in ONE group and the arrival can only WAIT. Reading priority here anyway – which this function did until 2026-09-12, sharing an arm with the PRIO pair – infers a policy the model never declared; it is invisible for flat priorities and silently turns a declared-FCFS station into a preemptive-priority one otherwise. Collapsing those four tests into fewer turns a priority station into a thrashing one, or into a non-preemptive one, depending which way it falls.

Definition at line 591 of file ldes_station.h.

References line::ldes::engine::Job::deadline, line::lang::EDF, line::ldes::engine::Job::elapsed, line::lang::FB, line::lang::FCFSPI, line::lang::FCFSPIPRIO, line::lang::FCFSPR, line::lang::FCFSPRPRIO, line::lang::FSP, fsp_virtual_finish(), line::lang::LCFSPI, line::lang::LCFSPIPRIO, line::lang::LCFSPR, line::lang::LCFSPRPRIO, line::lang::LRPT, preemption_victim(), line::ldes::engine::Job::priority, line::lang::PSJF, line::ldes::engine::Job::remaining, line::ldes::engine::Job::service, line::lang::SETF, line::lang::SRPT, and line::lang::SRPTPRIO.

Referenced by preemption_victim().

◆ ps_shares()

std::vector< double > line::ldes::engine::ps_shares ( lang::SchedStrategy sched,
const std::vector< PsJob > & jobs,
double c,
const std::vector< double > & weight,
std::size_t nclasses )
inline

The per-job shares of a sharing discipline, in units of one server.

c is the station's effective server count: with n <= c every job runs at rate 1 and the station is an infinite server; above that the capacity is split. Each rule is capped at 1 because ONE job cannot consume more than ONE server however the weights fall – dropping that cap is what makes a two-class DPS station report a utilization above one.

Transcribed from calculatePSRates and the five rules under it.

Definition at line 450 of file ldes_station.h.

References line::ldes::engine::Job::cls, line::lang::DPS, line::lang::DPSPRIO, line::lang::GPS, line::lang::GPSPRIO, line::ldes::engine::Job::priority, ps_shares(), and line::lang::PSPRIO.

Referenced by ps_shares().

◆ spectral_statistics()

StatTriple line::ldes::engine::spectral_statistics ( const std::vector< double > & obs,
int batch_size,
double low_freq_frac )
inline

Heidelberger-Welch spectral estimate of the variance of the sample mean.

The variance of a mean over a correlated series is 2*pi*S(0)/m, with S(0) the spectral density at frequency zero. S(0) cannot be read off the periodogram directly – the ordinate at f=0 is exactly the quantity being estimated and carries all the bias – so the LOG-periodogram over the lowest frequencies is fitted with a quadratic and the intercept extrapolated back to zero. That is what makes this estimator different from batch means rather than a re-spelling of it: it models the correlation instead of trying to batch it away.

FALLS BACK TO PLAIN BATCH MEANS, not to an error, whenever the fit cannot be trusted: too few batches, too few regression points, a zero periodogram ordinate (log undefined) or a non-positive intercept. A spectral estimate from a singular fit is not conservative, it is arbitrary. Transcribes computeSpectralStatisticsInternal.

Definition at line 468 of file ldes_stats.h.

References bm_statistics(), line::ldes::engine::StatTriple::df, line::ldes::engine::StatTriple::mean, line::ldes::engine::StatTriple::ok, spectral_statistics(), and line::ldes::engine::StatTriple::stderr_.

Referenced by ci_statistics(), and spectral_statistics().

◆ spn_active_servers()

double line::ldes::engine::spn_active_servers ( const SpnMode & m,
const std::vector< double > & tok )
inline

The clocks an enabled timed mode runs at once: min(servers, enabling degree), the degree being the floor over its input arcs of tokens over weight on the FULL marking, as the CTMC's State.afterGlobalEvent counts them.

A mode with no input arc runs one clock.

Definition at line 109 of file ldes_spn.h.

References line::ldes::engine::SpnMode::enabling, line::ldes::engine::SpnMode::servers, and spn_active_servers().

Referenced by spn_active_servers().

◆ spn_enabled()

bool line::ldes::engine::spn_enabled ( const SpnMode & m,
const std::vector< double > & tok )
inline

True when m is enabled by the marking tok, which is indexed the same way as the mode's own vectors – (place slot, class), flattened.

An INHIBITING arc is a bound, not a requirement: the mode is blocked once the place reaches the count IN THAT CLASS, and an infinite count never blocks.

Definition at line 85 of file ldes_spn.h.

References line::ldes::engine::SpnMode::enabling, line::ldes::engine::SpnMode::inhibiting, and spn_enabled().

Referenced by spn_enabled(), and spn_pick_immediate().

◆ spn_fire()

void line::ldes::engine::spn_fire ( const SpnMode & m,
std::vector< double > & tok )
inline

Move the tokens of one firing: consume the enabling counts, deposit the firing ones.

Definition at line 118 of file ldes_spn.h.

References line::ldes::engine::SpnMode::enabling, line::ldes::engine::SpnMode::firing, and spn_fire().

Referenced by spn_fire().

◆ spn_pick_immediate()

int line::ldes::engine::spn_pick_immediate ( const std::vector< SpnMode > & modes,
const std::vector< double > & tok,
double u )
inline

Pick among the enabled IMMEDIATE modes: the highest priority first (lowest value), then weighted at random among the ties.

Returns -1 when none is enabled.

Definition at line 129 of file ldes_spn.h.

References spn_enabled(), and spn_pick_immediate().

Referenced by spn_pick_immediate().

◆ spn_rate()

double line::ldes::engine::spn_rate ( const SpnMode & m,
const std::vector< double > & tok )
inline

The rate of a timed mode under the current marking.

Definition at line 95 of file ldes_spn.h.

References line::ldes::engine::SpnMode::dep, line::ldes::engine::SpnMode::rate, and spn_rate().

Referenced by spn_rate().

◆ t_critical()

double line::ldes::engine::t_critical ( double level,
int df )
inline

The two-sided t critical value at confidence level with df degrees of freedom: the EXACT Student-t quantile t_{(1+level)/2, df}, as the Java engine's Solver_ssj.getTCriticalValue computes it.

Both engines used a three-decimal table, bucketed to the 90/95/99% levels and saturating at df = 30, until 2026-10-28; that moved every half-width by parts in a thousand and kept df > 30 from tending to the normal quantile. Below one degree of freedom there is no t law, and the normal quantile at the same level stands in.

Definition at line 443 of file ldes_stats.h.

References line::sim::sim_norminv(), line::sim::sim_tinv(), and t_critical().

Referenced by batch_means_ci(), and t_critical().

◆ uniform01()

double line::ldes::engine::uniform01 ( Rng & g)
inline

Uniform on (0,1) off the MRG stream; next_double never returns 0.

Definition at line 112 of file ldes_sampler.h.

References line::rng::Mrg32k3a::next_double(), line::ldes::engine::Rng::stream, and uniform01().

Referenced by uniform01().

Variable Documentation

◆ LN_ANYFORK

const std::uint64_t line::ldes::engine::LN_ANYFORK = static_cast<std::uint64_t>(-1)
static

Fork instance meaning "any": the late inputs of a join fed by more than one fork instance.

Definition at line 224 of file ldes_ln_engine.h.

◆ LN_NONE

const std::size_t line::ldes::engine::LN_NONE = static_cast<std::size_t>(-1)
static

Index meaning "none" for a line, an invocation or a customer.

Definition at line 170 of file ldes_ln_engine.h.

◆ NOTDRAWN

const std::size_t line::ldes::engine::NOTDRAWN = static_cast<std::size_t>(-1)
static

LnJob::calls_left before the repetition count of a call has been drawn.

Definition at line 305 of file ldes_ln_engine.h.

◆ NOTHR

const std::size_t line::ldes::engine::NOTHR = static_cast<std::size_t>(-1)
static

Thread index meaning "no thread held", also used for an infinite-thread task.

Definition at line 302 of file ldes_ln_engine.h.