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

Classes

struct  EnabledEvent
 One transition the enabled scan found: where it goes, and at what rate. More...
class  NrmEngine
 The NRM engine: the reaction network built from sn, and the sample path. More...
class  NrmSpaceEngine
 The aggregate NRM engine of solver_ssa_nrm_space.m. More...
struct  NrmSpaceState
 One state of the aggregate chain: the (node, class) populations, and the ordered buffer contents of every buffered node. More...
struct  SsaCacheRatio
 What the cache write-back of solver_ssa_analyzer_serial.m produces. More...
class  SsaEventCache
 EventCache: the per-state enabled-event memo of the serial SSA engine. More...
struct  SsaEventKey
 The memoization key: the argument list of after_event, in fields. More...
struct  SsaNrmSpaceOptions
 The knobs the space variant reads. More...
struct  SsaNrmSpaceRun
 What solver_ssa_nrm_space.m returns, plus what makes it a measurement. More...
struct  SsaNrmSpaceSolution
 The metric table, the table it came from, and the stream that produced it. More...
struct  SsaOptions
 Controls, defaulting to SolverOptions('SSA') in the reference. More...
struct  SsaParallelOptions
 The replicated engine's knobs: the serial engine's, plus the two the reference reads from options.config on this path. More...
struct  SsaParallelSolution
 What the replicated analyzer returns. More...
struct  SsaProbReport
 The four probabilities -a prob reports, over one requested state. More...
struct  SsaProbResult
 One probability query: the estimate, and whether the state occurred at all. More...
struct  SsaReachability
 Port of solver_ssa_reachability.m's return: [SSq, SSh, sn.space]. More...
class  SsaRng
 The uniform source, MATLAB's rand. More...
struct  SsaSamplePath
 One trajectory, in the shape the reference's sampleSys returns it. More...
class  SsaSerialEngine
 The serial engine: the sample path of solver_ssa.m's main loop. More...
struct  SsaSerialOptions
 The serial engine's knobs: SsaOptions plus the three the serial path reads and the NRM has no use for. More...
struct  SsaSerialRun
 One sample path, in the shape solver_ssa.m returns it. More...
struct  SsaSerialSolution
 The serial analyzer's return: the metric table, the path, and the stream. More...
struct  SsaSolution
 What the analyzer returns, in the same shape as the MVA and fluid results. More...

Functions

template<class T>
SsaProbResult ssa_prob (const qn::NetworkStruct< T > &sn, const SsaSerialRun< T > &r, std::size_t ind, const std::vector< T > &row)
 getProb(node, state): the time fraction the path spent with node ind in row.
template<class T>
SsaProbResult ssa_prob_aggr (const qn::NetworkStruct< T > &sn, const SsaSerialRun< T > &r, std::size_t ind, const std::vector< double > &counts)
 getProbAggr(node, n): the same, over the per-class counts alone.
template<class T>
SsaProbResult ssa_prob_sys (const qn::NetworkStruct< T > &sn, const SsaSerialRun< T > &r, const qn::NetState< T > &st)
 getProbSys(): the joint state of every stateful node at once.
template<class T>
SsaProbResult ssa_prob_sys_aggr (const qn::NetworkStruct< T > &sn, const SsaSerialRun< T > &r, const qn::NetState< T > &st)
 getProbSysAggr(): the joint per-class counts of every stateful node.
template<class T>
SsaSamplePath< T > ssa_sample_sys (const qn::NetworkStruct< T > &sn, const SsaSerialRun< T > &r)
 sampleSys and sampleSysAggr: the trajectory itself.
template<class T>
SsaSamplePath< T > ssa_sample_node (const qn::NetworkStruct< T > &sn, const SsaSerialRun< T > &r, std::size_t ind)
 sample(node) and sampleAggr(node): the same trajectory, one node's block.
template<class T>
SsaProbReport solver_ssa_prob (const qn::NetworkStruct< T > &sn, const SsaSerialOptions &opt)
 The whole -a prob report over the model's DEFAULT INITIAL STATE, which is the state SolverCTMC's own -a prob reports on.
void ssa_cdf_respt_refuse ()
 getCdfRespT: refused, and the refusal is the ANSWER rather than a gap.
template<class T>
std::vector< EnabledEvent< T > > ssa_find_enabled (const qn::NetworkStruct< T > &sn, const std::vector< qn::Sync< T > > &sync, const std::vector< qn::GlobalSync< T > > &gsync, const qn::NetState< T > &state, std::vector< std::vector< double > > *arv=nullptr, std::vector< std::vector< double > > *dep=nullptr)
 Port of solver_ssa_findenabled.m: every synchronization that can fire in state, with the arrival and departure rates each carries.
template<class T>
SsaNrmSpaceRun< T > solver_ssa_nrm_space (const qn::NetworkStruct< T > &sn, const SsaNrmSpaceOptions &opt)
 solver_ssa_nrm_space.m: run the tabulating engine.
template<class T>
SsaNrmSpaceSolution< T > solver_ssa_nrm_space_analyzer (const qn::NetworkStruct< T > &sn, const SsaNrmSpaceOptions &opt)
 Port of the else branch of solver_ssa_analyzer_nrm.m, the one state_space_gen selects: the means as pi * A over the tabulated states.
template<class T>
SsaParallelSolution< T > solver_ssa_parallel_analyzer (const qn::NetworkStruct< T > &sn, const SsaParallelOptions &opt)
 solver_ssa_analyzer_parallel.m: run R replicas of the serial engine and combine their estimates.
template<class T>
SsaParallelSolution< T > solver_ssa_parallel (const qn::NetworkStruct< T > &sn, const SsaParallelOptions &opt)
 The para / parallel entry of solver_ssa_analyzer.m.
template<class T>
SsaReachability< T > solver_ssa_reachability (const qn::NetworkStruct< T > &sn, const SsaSerialOptions &opt=SsaSerialOptions())
 Port of solver_ssa_reachability.m: the states the DYNAMICS can occupy, decomposed per stateful node.
template<class T>
SsaSerialSolution< T > solver_ssa_serial_on_struct (const qn::NetworkStruct< T > &sn, const SsaSerialOptions &opt, const std::vector< qn::FjSync< T > > &fjsync)
 Port of solver_ssa_analyzer_serial.m: run the serial engine and reduce its path to the metric table.
template<class T>
SsaSerialSolution< T > solver_ssa_serial_analyzer (const qn::NetworkStruct< T > &sn, const SsaSerialOptions &opt)
 Port of solver_ssa_analyzer_serial.m plus the fork-join wrapper @@SolverSSA/runAnalyzer.m puts in front of it.
template<class T>
SsaSerialSolution< T > solver_ssa_serial (const qn::NetworkStruct< T > &sn, const SsaSerialOptions &opt)
 The serial entry of solver_ssa_analyzer.m.
std::vector< std::string > list_valid_methods ()
 Port of SolverSSA.listValidMethods.
template<class T>
SsaSolution solver_ssa_nrm_analyzer (const qn::NetworkStruct< T > &sn, const SsaOptions &opt)
 solver_ssa_analyzer_nrm.m: run the NRM and return the metric table.
template<class T>
SsaSolution solver_ssa (const qn::NetworkStruct< T > &sn, const SsaOptions &opt, std::vector< SsaCacheRatio > *cache=nullptr)
 solver_ssa_analyzer.m: choose the method.
template<class T>
solvers::CacheMetrics< T > cache_metrics_of_ssa (const qn::NetworkStruct< T > &sn, const std::vector< SsaCacheRatio > &cache)
 CacheMetrics from the serial engine's cache write-back.
template<class T>
qn::NetworkStruct< T > sn_with_ssa_cache_split (const qn::NetworkStruct< T > &base, const std::vector< SsaCacheRatio > &cache)
 The struct with the cache split the SIMULATION MEASURED, visits rebuilt.

Function Documentation

◆ cache_metrics_of_ssa()

template<class T>
solvers::CacheMetrics< T > line::ssa::cache_metrics_of_ssa ( const qn::NetworkStruct< T > & sn,
const std::vector< SsaCacheRatio > & cache )

CacheMetrics from the serial engine's cache write-back.

The shares are matched to their Cache node BY INDEX, not by position: the base struct walks every Cache the model declares while the engine reports only the nodes it simulated, so pairing the two off in order would write one cache's measurement onto another on any model holding more than one.

residt becomes latency unchanged, NaN included. The reference warns that retrieval latency is not implemented and reports NaN in every codebase, so carrying the NaN IS parity; dropping the field would report "not computed" about a quantity the engine did state.

Definition at line 621 of file ssa_dispatch.h.

References line::solvers::cache_metrics_of(), cache_metrics_of_ssa(), line::solvers::CacheMetrics< T >::caches, line::solvers::CacheNodeMetrics< T >::delayedprob, line::solvers::CacheNodeMetrics< T >::hitprob, line::solvers::CacheNodeMetrics< T >::latency, and line::solvers::CacheNodeMetrics< T >::missprob.

Referenced by cache_metrics_of_ssa().

◆ list_valid_methods()

std::vector< std::string > line::ssa::list_valid_methods ( )
inline

Port of SolverSSA.listValidMethods.

Six names for three engines, because the reference spells the same engine more than one way: 'ssa' and 'serial' are the serial trajectory, 'para' and 'parallel' the replicated one, 'nrm' the next-reaction method, and 'default' is the ladder solver_ssa walks – the NRM when it can run the model and the serial engine when it cannot. Every name here is dispatched by solver_ssa below, which refuses anything else by name.

Definition at line 469 of file ssa_dispatch.h.

References list_valid_methods().

Referenced by line::autosolver::auto_family_methods(), line::NetworkSolver::list_valid_methods(), and list_valid_methods().

◆ sn_with_ssa_cache_split()

template<class T>
qn::NetworkStruct< T > line::ssa::sn_with_ssa_cache_split ( const qn::NetworkStruct< T > & base,
const std::vector< SsaCacheRatio > & cache )

The struct with the cache split the SIMULATION MEASURED, visits rebuilt.

A cache splits the read stream into a hit stream and a miss stream, and that split IS routing: the visit ratios of everything downstream depend on it. The base struct carries only what link() offered, an even share over the hit and miss classes, because the split is a RESULT and cannot be known before the solve. Anything derived from visits after the solve therefore has to be taken on the rewritten struct, not on the base one – sn_get_residt_from_respt reported ResidT = RespT/2 for both classes of tut06_cache_lru_zipf (0.1 and 0.5 against the reference's 0.16475 and 0.17625), which is the even split showing through, not a residence time.

The rewrite is the one da_cacheqn performs between passes, with the measured shares in place of the analytical ones: the cache row of rtnodes is cleared and the hit and miss mass sent to every connected successor, after which da_recompute_visits_from_rtnodes rebuilds visits and nodevisits. A share the engine left undefined (NaN, a class that does not read this cache) leaves that row alone rather than zeroing a routing the model does have.

Definition at line 669 of file ssa_dispatch.h.

References sn_with_ssa_cache_split().

Referenced by sn_with_ssa_cache_split().

◆ solver_ssa()

template<class T>
SsaSolution line::ssa::solver_ssa ( const qn::NetworkStruct< T > & sn,
const SsaOptions & opt,
std::vector< SsaCacheRatio > * cache = nullptr )

solver_ssa_analyzer.m: choose the method.

The ladder is the reference's, in its order:

default the NRM when it is eligible, ELSE the serial engine, and only a model neither engine runs is refused – by the NRM's message, which names the missing sub-engine. nrm the NRM alone, reached by naming the estimator: a model it cannot run is refused rather than silently answered by the other engine, because a caller who spelled out an estimator asked for that estimator's variance as well as its mean. ssa the reference's alias for serial (line 128), not for the NRM. serial one run of the event-driven engine. para the NRM when eligible (the reference prefers one fast run over parallel R replicated ones, lines 143-157), else the replica mean of nreplicas independent serial runs.

default's FALLBACK IS THE REFERENCE'S (lines 66-78) and was restored on 2026-07-31, when the serial engine gained fork-join and the finite capacity regions. It had been held back while the serial engine covered less than the NRM gate rejects, on the ground that a second failure further downstream is less informative than the NRM's own message. That ground is gone for every construct the serial engine now runs, and where it still holds – a model NEITHER engine covers – the NRM's message is what the caller reads, because serial_can_run is asked BEFORE the fallback is taken rather than after it has failed.

cache, when given, receives the serial engine's cache write-back – the realized hit and miss shares of every Cache node, which are a SOLVER RESULT and the only thing that tells a node table apart from the 1/2-1/2 link() offers. It is an out-parameter rather than a field of SsaSolution because that struct is the metric table the three engines share, and only one of them has a cache to report: the NRM refuses a Cache node by name and the parallel engine averages replicas that carry none.

Definition at line 547 of file ssa_dispatch.h.

References solver_ssa(), solver_ssa_nrm_analyzer(), solver_ssa_parallel_analyzer(), and line::UnsupportedError::UnsupportedError().

Referenced by line::NetworkSolver::avg_table(), solver_ssa(), and line::uq::uq_stage_solver().

◆ solver_ssa_nrm_analyzer()

template<class T>
SsaSolution line::ssa::solver_ssa_nrm_analyzer ( const qn::NetworkStruct< T > & sn,
const SsaOptions & opt )

solver_ssa_analyzer_nrm.m: run the NRM and return the metric table.

The reference's post-processing (QN(isnan(QN)) = 0 and the rest) is inside the engine already: it never produces a NaN, because every division is guarded at the point it is taken.

Definition at line 481 of file ssa_dispatch.h.

References line::ssa::NrmEngine< T >::run(), solver_ssa_nrm_analyzer(), solver_ssa_nrm_space_analyzer(), and line::UnsupportedError::UnsupportedError().

Referenced by solver_ssa(), and solver_ssa_nrm_analyzer().

◆ solver_ssa_nrm_space()

template<class T>
SsaNrmSpaceRun< T > line::ssa::solver_ssa_nrm_space ( const qn::NetworkStruct< T > & sn,
const SsaNrmSpaceOptions & opt )

solver_ssa_nrm_space.m: run the tabulating engine.

Definition at line 902 of file solver_ssa_nrm_space.h.

References line::ssa::NrmSpaceEngine< T >::run(), and solver_ssa_nrm_space().

Referenced by solver_ssa_nrm_space().

◆ solver_ssa_nrm_space_analyzer()

template<class T>
SsaNrmSpaceSolution< T > line::ssa::solver_ssa_nrm_space_analyzer ( const qn::NetworkStruct< T > & sn,
const SsaNrmSpaceOptions & opt )

Port of the else branch of solver_ssa_analyzer_nrm.m, the one state_space_gen selects: the means as pi * A over the tabulated states.

THE STANDALONE solver_ssa_nrm_space_analyzer.m IS A STUB. Its whole body is the INF/EXT/PS scheduling gate and a debug line; it assigns none of its nine declared outputs, so calling it in MATLAB raises "Output argument not assigned". The working analyzer is the branch ported here, whose utilization switch admits FCFS and LCFS as well – which is also the set the engine has rate laws for, so narrowing to the stub's three would refuse models this variant can simulate. The stub's narrower gate is therefore NOT reproduced, and the divergence is named rather than hidden.

A SOURCE REPORTS ZERO QLen AND ZERO Util, not the negative number the reference's UN(ist,:) = QN(ist,:) produces for an EXT station: the Source slot is a fictitious token that arrivals consume, so its time average is 1 - E[jobs in system]. solver_ssa_nrm.h states the rule at length and this port applies it everywhere. It is moot for the models this variant accepts, since an open one is refused outright, and it is kept so the rule holds uniformly.

Definition at line 930 of file solver_ssa_nrm_space.h.

References line::ssa::SsaNrmSpaceSolution< T >::avg, line::ssa::SsaSolution::CN, line::ssa::SsaNrmSpaceRun< T >::dep_rates, line::InputError::InputError(), line::ssa::SsaSolution::method, line::ssa::SsaNrmSpaceRun< T >::pi, line::ssa::SsaSolution::QN, line::ssa::SsaSolution::RN, line::ssa::NrmSpaceEngine< T >::run(), line::ssa::SsaNrmSpaceSolution< T >::run, line::ssa::SsaNrmSpaceRun< T >::samples, line::ssa::SsaSolution::samples, line::ssa::SsaNrmSpaceSolution< T >::seed, line::ssa::SsaNrmSpaceRun< T >::simulated_time, line::ssa::SsaSolution::simulated_time, solver_ssa_nrm_space_analyzer(), line::lang::Source, line::ssa::SsaNrmSpaceRun< T >::space, line::ssa::SsaSolution::TN, line::ssa::SsaSolution::UN, line::UnsupportedError::UnsupportedError(), and line::ssa::SsaSolution::XN.

Referenced by solver_ssa_nrm_analyzer(), and solver_ssa_nrm_space_analyzer().

◆ solver_ssa_parallel()

template<class T>
SsaParallelSolution< T > line::ssa::solver_ssa_parallel ( const qn::NetworkStruct< T > & sn,
const SsaParallelOptions & opt )

The para / parallel entry of solver_ssa_analyzer.m.

The reference reaches this only after its NRM eligibility gate has declined the model (solver_ssa_analyzer.m lines 143-157 run the NRM instead when it is eligible, because one fast exact-enough run beats replicated simulation). That preference belongs to the dispatcher and is not duplicated here, so this entry always replicates the serial engine; asking it for serial says so by name rather than quietly answering with one replica, whose error bar is a factor sqrt(R) wider than the one requested.

Definition at line 362 of file solver_ssa_parallel.h.

References solver_ssa_parallel(), solver_ssa_parallel_analyzer(), and line::UnsupportedError::UnsupportedError().

Referenced by solver_ssa_parallel().

◆ solver_ssa_parallel_analyzer()

template<class T>
SsaParallelSolution< T > line::ssa::solver_ssa_parallel_analyzer ( const qn::NetworkStruct< T > & sn,
const SsaParallelOptions & opt )

solver_ssa_analyzer_parallel.m: run R replicas of the serial engine and combine their estimates.

The reference's run_replica subfunction is solver_ssa_serial_analyzer here: the two compute the same per-station table from one sample path, and factoring the replication away from the estimator is what makes it obvious that the combination below touches only the R finished numbers.

Definition at line 209 of file solver_ssa_parallel.h.

References line::ssa::SsaParallelSolution< T >::avg, line::ssa::SsaSerialSolution< T >::avg, line::ssa::SsaParallelSolution< T >::base_seed, line::lang::Cache, line::ssa::SsaParallelSolution< T >::cache, line::ssa::SsaSerialSolution< T >::cache, line::ssa::SsaSolution::CN, line::ssa::SsaParallelSolution< T >::CN_sem, line::ssa::SsaCacheRatio::delayedprob, line::ssa::SsaCacheRatio::hitprob, line::ssa::SsaOptions::method, line::ssa::SsaSolution::method, line::ssa::SsaCacheRatio::missprob, line::ssa::SsaCacheRatio::node, line::ssa::SsaParallelSolution< T >::nreplicas, line::ssa::SsaSolution::QN, line::ssa::SsaParallelSolution< T >::QN_sem, line::ssa::SsaParallelSolution< T >::replica, line::ssa::SsaCacheRatio::residt, line::ssa::SsaSolution::RN, line::ssa::SsaParallelSolution< T >::RN_sem, line::ssa::SsaOptions::samples, line::ssa::SsaSolution::samples, line::ssa::SsaParallelSolution< T >::samples_per_replica, line::ssa::SsaParallelSolution< T >::samples_requested, line::ssa::SsaOptions::seed, line::ssa::SsaParallelSolution< T >::seed, line::ssa::SsaSolution::simulated_time, solver_ssa_parallel_analyzer(), solver_ssa_serial_analyzer(), line::ssa::SsaSolution::TN, line::ssa::SsaParallelSolution< T >::TN_sem, line::ssa::SsaSolution::UN, line::ssa::SsaParallelSolution< T >::UN_sem, line::UnsupportedError::UnsupportedError(), line::ssa::SsaOptions::verbose, line::ssa::SsaSolution::XN, and line::ssa::SsaParallelSolution< T >::XN_sem.

Referenced by solver_ssa(), solver_ssa_parallel(), and solver_ssa_parallel_analyzer().

◆ solver_ssa_prob()

template<class T>
SsaProbReport line::ssa::solver_ssa_prob ( const qn::NetworkStruct< T > & sn,
const SsaSerialOptions & opt )

The whole -a prob report over the model's DEFAULT INITIAL STATE, which is the state SolverCTMC's own -a prob reports on.

SAME STATE, SAME QUESTION, DIFFERENT ESTIMATOR: the CTMC answer is the stationary law of the chain and this one is a time average of a finite path, so the pair is a direct measurement of the simulation error on a model small enough for both. That is what makes the report worth having at the same state rather than at a state of the simulator's choosing.

Definition at line 295 of file solver_ssa_getters.h.

References line::ssa::SsaProbReport::aggr, line::ctmc::CtmcOptions::cutoff, line::qn::NetState< T >::local, line::ssa::SsaProbReport::marg, line::ssa::SsaProbReport::samples, line::ssa::SsaProbReport::seed, line::ssa::SsaProbReport::simulated_time, solver_ssa_prob(), solver_ssa_serial_analyzer(), ssa_prob(), ssa_prob_aggr(), ssa_prob_sys(), ssa_prob_sys_aggr(), line::ctmc::CtmcOptions::state_max, line::ssa::SsaProbReport::sys, line::ssa::SsaProbReport::sys_aggr, and line::UnsupportedError::UnsupportedError().

Referenced by solver_ssa_prob().

◆ solver_ssa_reachability()

template<class T>
SsaReachability< T > line::ssa::solver_ssa_reachability ( const qn::NetworkStruct< T > & sn,
const SsaSerialOptions & opt = SsaSerialOptions() )

Port of solver_ssa_reachability.m: the states the DYNAMICS can occupy, decomposed per stateful node.

The walk itself is reachable_space_generator, which applies the same handlers to the same synchronization list and additionally walks gsync. The reference's reachability walks only sync, so an SPN's firing states reach it through solver_ssa's own global scan instead of through this function; here they are in the space from the start, which is strictly more of the reachable set and never less.

WHAT THIS ADDS OVER THE WALK is the decomposition the reference returns and the CTMC does not need: the per-node list of distinct local rows, and the per-state index into it. That is the reference's space{i} / SSh pair, and it exists so a caller can address a state by node without carrying the rows.

Definition at line 479 of file solver_ssa_serial.h.

References line::ctmc::ctmc_filter_regions(), line::ctmc::ctmc_has_waitq_region(), line::ctmc::CtmcOptions::cutoff, line::ssa::SsaReachability< T >::hash, line::Matrix< T >::Matrix(), line::ssa::SsaReachability< T >::node_space, line::ctmc::reachable_space_generator(), line::qn::refresh_global_sync(), line::qn::refresh_sync(), solver_ssa_reachability(), line::ssa::SsaReachability< T >::space, line::ssa::SsaReachability< T >::ssq, line::ctmc::CtmcOptions::state_max, and line::UnsupportedError::UnsupportedError().

Referenced by solver_ssa_reachability().

◆ solver_ssa_serial()

template<class T>
SsaSerialSolution< T > line::ssa::solver_ssa_serial ( const qn::NetworkStruct< T > & sn,
const SsaSerialOptions & opt )

The serial entry of solver_ssa_analyzer.m.

The reference reaches it from default (when the NRM eligibility gate fails), from ssa, from serial and from para/parallel without the Parallel Computing Toolbox. para/parallel is NOT that: it replicates the SAME engine across workers and averages, so answering it with one replica would report a number at a different variance from the one asked for, and it refuses by name here.

Definition at line 1375 of file solver_ssa_serial.h.

References solver_ssa_serial(), solver_ssa_serial_analyzer(), and line::UnsupportedError::UnsupportedError().

Referenced by solver_ssa_serial().

◆ solver_ssa_serial_analyzer()

template<class T>
SsaSerialSolution< T > line::ssa::solver_ssa_serial_analyzer ( const qn::NetworkStruct< T > & sn,
const SsaSerialOptions & opt )

Port of solver_ssa_analyzer_serial.m plus the fork-join wrapper @@SolverSSA/runAnalyzer.m puts in front of it.

A FORK-JOIN MODEL IS SIMULATED ON THE TAG-AUGMENTED COPY, exactly as SolverCTMC solves it there: the fork emits one sibling per branch in a class of its own, the tag is what lets the Join recognize which siblings belong to the same parent, and fj_tag is the only thing that builds the fjsync firing list the engine fires. The sample path in the returned run is therefore indexed by the AUGMENTED classes; only the metric table is folded back, which is why fjclassmap travels with it.

Definition at line 1344 of file solver_ssa_serial.h.

References line::ssa::SsaSerialSolution< T >::avg, line::tr::fj_foldback(), line::qn::fj_tag(), line::qn::FjTagged< T >::fjclassmap, line::ssa::SsaSerialSolution< T >::fjclassmap, line::qn::FjTagged< T >::fjsync, line::tr::has_fork_join(), line::qn::FjTagged< T >::korig, line::ssa::SsaSerialSolution< T >::parked, solver_ssa_serial_analyzer(), solver_ssa_serial_on_struct(), and line::qn::FjTagged< T >::V.

Referenced by solver_ssa_parallel_analyzer(), solver_ssa_prob(), solver_ssa_serial(), and solver_ssa_serial_analyzer().

◆ solver_ssa_serial_on_struct()

template<class T>
SsaSerialSolution< T > line::ssa::solver_ssa_serial_on_struct ( const qn::NetworkStruct< T > & sn,
const SsaSerialOptions & opt,
const std::vector< qn::FjSync< T > > & fjsync )

Port of solver_ssa_analyzer_serial.m: run the serial engine and reduce its path to the metric table.

THE UTILIZATION ESTIMATOR IS THE REFERENCE'S, discipline by discipline. An INF station is utilized by every job it holds; a PS-family station takes the ARRIVAL rate over rate*servers, because the offered load is what a processor sharing server carries; every other discipline takes the arrival rate times the mean service time over the servers. A class that can be DROPPED – an open class at a station with a finite capacity – is measured on the CARRIED rate instead, because the offered rate counts arrivals that never entered service.

ONE DIVERGENCE FROM THE REFERENCE, stated rather than hidden:

THE CACHE LOOP IS INDEXED BY NODE, NOT BY STATEFUL INDEX. The reference writes sn.nodetype(isf) == NodeType.Cache with isf running over the STATEFUL nodes, so on any model whose stateful indices differ from its node indices – one with a Source, a Router or a ClassSwitch, which is most of them – it tests the type of the wrong node. Reproducing that would report hit ratios for a node that is not the cache.

A PAS STATION takes the reference's otherwise branch, T*E[S]/c, and NOT the in-service occupancy solver_ctmc_avg_from_pi computes for the same station. The two disagree because a pass-and-swap job does not engage a single server; the reference serial analyzer is what is ported here, and the disagreement is named so it is not mistaken for a defect in either.

Definition at line 1090 of file solver_ssa_serial.h.

References line::ssa::SsaSerialRun< T >::arv_rates, line::ssa::SsaSerialSolution< T >::avg, line::ssa::SsaSerialRun< T >::buf, line::lang::Cache, line::ssa::SsaSerialSolution< T >::cache, line::ssa::SsaSolution::CN, line::ssa::SsaCacheRatio::delayedprob, line::ssa::SsaSerialRun< T >::dep_rates, line::ssa::SsaSerialRun< T >::dly_rates, line::ssa::SsaCacheRatio::hitprob, line::InputError::InputError(), line::ssa::SsaSolution::method, line::ssa::SsaCacheRatio::missprob, line::ssa::SsaCacheRatio::node, line::ssa::SsaSerialSolution< T >::parked, line::ssa::SsaSerialRun< T >::pi, line::ssa::SsaSerialRun< T >::preempt_rates, line::ssa::SsaSolution::PreemptN, line::ssa::SsaSolution::QN, line::ssa::SsaCacheRatio::residt, line::ssa::SsaSolution::RN, line::ssa::SsaSerialEngine< T >::run(), line::ssa::SsaSerialSolution< T >::run, line::ssa::SsaSerialRun< T >::samples, line::ssa::SsaSolution::samples, line::ssa::SsaSerialSolution< T >::seed, line::ssa::SsaSerialRun< T >::simulated_time, line::ssa::SsaSolution::simulated_time, solver_ssa_serial_on_struct(), line::lang::Source, line::ssa::SsaSerialRun< T >::space, line::ssa::SsaSerialRun< T >::ssq, line::ssa::SsaSerialRun< T >::start_rates, line::ssa::SsaSolution::StartN, line::ssa::SsaSolution::TN, line::ssa::SsaSolution::UN, line::UnsupportedError::UnsupportedError(), and line::ssa::SsaSolution::XN.

Referenced by solver_ssa_serial_analyzer(), and solver_ssa_serial_on_struct().

◆ ssa_cdf_respt_refuse()

void line::ssa::ssa_cdf_respt_refuse ( )
inline

getCdfRespT: refused, and the refusal is the ANSWER rather than a gap.

@@SolverSSA/getCdfRespT.m raises the same error in MATLAB, for the reason it states: SSA samples state trajectories, not per-job sojourn times, so there is nothing to build an empirical CDF from. The inherited implementation would fabricate an exponential law with the right mean, which carries no information about the tail and would be indistinguishable, to the caller, from a measured distribution. Reproducing THAT would be the defect.

Definition at line 341 of file solver_ssa_getters.h.

References ssa_cdf_respt_refuse(), and line::UnsupportedError::UnsupportedError().

Referenced by ssa_cdf_respt_refuse().

◆ ssa_find_enabled()

template<class T>
std::vector< EnabledEvent< T > > line::ssa::ssa_find_enabled ( const qn::NetworkStruct< T > & sn,
const std::vector< qn::Sync< T > > & sync,
const std::vector< qn::GlobalSync< T > > & gsync,
const qn::NetState< T > & state,
std::vector< std::vector< double > > * arv = nullptr,
std::vector< std::vector< double > > * dep = nullptr )

Port of solver_ssa_findenabled.m: every synchronization that can fire in state, with the arrival and departure rates each carries.

THE ENUMERATION IS WIDER THAN THE REFERENCE'S, and deliberately so. MATLAB calls State.afterEvent with isSimulation = true, which SAMPLES one successor row and returns the probability it was drawn with; the C++ after_event is the enumeration-mode handler and returns every successor with its probability. So one reference entry becomes one entry per (active row, passive row) pair here, and the caller draws from the flattened list in one step instead of two. The induced jump chain is identical; the number of uniforms consumed is not, which is a statement about which random stream this is and not about which model it simulates.

A ZERO RATE IS DROPPED rather than rewritten to 1e-38 "so that it is never selected". Keeping it leaves it in the arrival and departure statistics, where it is not a rounding difference but a rate the CTMC generator does not have, and these rates are what the analyzers integrate.

arv and dep are indexed [stateful-1][class-1] and are OVERWRITTEN, not accumulated, so a caller may reuse one pair of buffers across states.

Definition at line 133 of file solver_ssa_nrm_space.h.

References line::qn::Sync< T >::active, line::qn::after_event(), line::qn::after_global_event(), line::qn::ModeEvent< T >::cls, line::lang::DEP, line::qn::ModeEvent< T >::event, line::lang::FIRE, line::qn::NetState< T >::local, line::ssa::EnabledEvent< T >::next, line::qn::ModeEvent< T >::node, line::qn::Sync< T >::passive, line::lang::POST, line::lang::PRE, line::qn::EventOutcome< T >::prob, line::qn::GlobalOutcome< T >::prob, line::qn::EventOutcome< T >::rate, line::qn::GlobalOutcome< T >::rate, line::ssa::EnabledEvent< T >::rate, line::qn::EventOutcome< T >::space, line::qn::GlobalOutcome< T >::space, ssa_find_enabled(), and line::ssa::EnabledEvent< T >::sync.

Referenced by ssa_find_enabled().

◆ ssa_prob()

template<class T>
SsaProbResult line::ssa::ssa_prob ( const qn::NetworkStruct< T > & sn,
const SsaSerialRun< T > & r,
std::size_t ind,
const std::vector< T > & row )

getProb(node, state): the time fraction the path spent with node ind in row.

The row is compared at the ENCODING width the path lives at, which is why the caller is expected to pass a row taken from the same widening the engine applies (serial_detail::wide_init_state, or a row of run.space). The reference left-pads a short row with zeros; a row that is short here would compare unequal to every state, so it is refused by name instead of silently matching nothing.

Definition at line 143 of file solver_ssa_getters.h.

References line::InputError::InputError(), line::ssa::SsaSerialRun< T >::pi, line::ssa::SsaProbResult::prob, line::ssa::SsaProbResult::seen, line::ssa::SsaSerialRun< T >::space, and ssa_prob().

Referenced by solver_ssa_prob(), and ssa_prob().

◆ ssa_prob_aggr()

template<class T>
SsaProbResult line::ssa::ssa_prob_aggr ( const qn::NetworkStruct< T > & sn,
const SsaSerialRun< T > & r,
std::size_t ind,
const std::vector< double > & counts )

◆ ssa_prob_sys()

template<class T>
SsaProbResult line::ssa::ssa_prob_sys ( const qn::NetworkStruct< T > & sn,
const SsaSerialRun< T > & r,
const qn::NetState< T > & st )

◆ ssa_prob_sys_aggr()

template<class T>
SsaProbResult line::ssa::ssa_prob_sys_aggr ( const qn::NetworkStruct< T > & sn,
const SsaSerialRun< T > & r,
const qn::NetState< T > & st )

◆ ssa_sample_node()

template<class T>
SsaSamplePath< T > line::ssa::ssa_sample_node ( const qn::NetworkStruct< T > & sn,
const SsaSerialRun< T > & r,
std::size_t ind )

sample(node) and sampleAggr(node): the same trajectory, one node's block.

The aggregate here is the node's own per-class counts and NOT a column slice of ssq: ssq is indexed by STATION and a Cache, a Join or a Transition is stateful without being one, so slicing would silently address the wrong node on every model that has one.

Definition at line 259 of file solver_ssa_getters.h.

References line::ssa::SsaSamplePath< T >::aggr, line::ssa::SsaSamplePath< T >::event, line::InputError::InputError(), line::Matrix< T >::Matrix(), line::ssa::SsaSamplePath< T >::samples, line::ssa::SsaSerialRun< T >::samples, line::ssa::SsaSamplePath< T >::seed, line::ssa::SsaSerialRun< T >::seed, line::ssa::SsaSerialRun< T >::space, ssa_sample_node(), line::ssa::SsaSamplePath< T >::state, line::ssa::SsaSamplePath< T >::t, line::ssa::SsaSerialRun< T >::tran_state, line::ssa::SsaSerialRun< T >::tran_sync, and line::ssa::SsaSerialRun< T >::tran_time.

Referenced by ssa_sample_node().

◆ ssa_sample_sys()

template<class T>
SsaSamplePath< T > line::ssa::ssa_sample_sys ( const qn::NetworkStruct< T > & sn,
const SsaSerialRun< T > & r )

sampleSys and sampleSysAggr: the trajectory itself.

THE STATE ON ROW i IS THE ONE OCCUPIED UNTIL t[i], not the one entered at it, which is the convention run.tran_state already records and the only one under which the time weighting of pi and the rows printed here agree. The event on the same row is the synchronization that ENDED that sojourn.

Definition at line 225 of file solver_ssa_getters.h.

References line::ssa::SsaSamplePath< T >::aggr, line::ssa::SsaSamplePath< T >::event, line::Matrix< T >::Matrix(), line::ssa::SsaSamplePath< T >::samples, line::ssa::SsaSerialRun< T >::samples, line::ssa::SsaSamplePath< T >::seed, line::ssa::SsaSerialRun< T >::seed, line::ssa::SsaSerialRun< T >::space, ssa_sample_sys(), line::ssa::SsaSerialRun< T >::ssq, line::ssa::SsaSamplePath< T >::state, line::ssa::SsaSamplePath< T >::t, line::ssa::SsaSerialRun< T >::tran_state, line::ssa::SsaSerialRun< T >::tran_sync, and line::ssa::SsaSerialRun< T >::tran_time.

Referenced by ssa_sample_sys().