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

The SolverSSA queries that are not the average table: getProb, getProbAggr, getProbSys, getProbSysAggr, and the four samplers sample, sampleAggr, sampleSys, sampleSysAggr. More...

#include <cstddef>
#include <string>
#include <vector>
#include "line/lang/qn/network_struct.h"
#include "line/lang/qn/state.h"
#include "line/lang/qn/state_events.h"
#include "line/solvers/ctmc/solver_ctmc_analyzer.h"
#include "line/solvers/ssa/solver_ssa_serial.h"
#include "line/util/error.h"
#include "line/util/matrix.h"
Include dependency graph for solver_ssa_getters.h:

Go to the source code of this file.

Classes

struct  line::ssa::SsaProbResult
 One probability query: the estimate, and whether the state occurred at all. More...
struct  line::ssa::SsaProbReport
 The four probabilities -a prob reports, over one requested state. More...
struct  line::ssa::SsaSamplePath< T >
 One trajectory, in the shape the reference's sampleSys returns it. More...

Namespaces

namespace  line
namespace  line::ssa

Functions

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.
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)
 getProbAggr(node, n): the same, over the per-class counts alone.
template<class T>
SsaProbResult line::ssa::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 line::ssa::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 > line::ssa::ssa_sample_sys (const qn::NetworkStruct< T > &sn, const SsaSerialRun< T > &r)
 sampleSys and sampleSysAggr: the trajectory itself.
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.
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.
void line::ssa::ssa_cdf_respt_refuse ()
 getCdfRespT: refused, and the refusal is the ANSWER rather than a gap.

Detailed Description

The SolverSSA queries that are not the average table: getProb, getProbAggr, getProbSys, getProbSysAggr, and the four samplers sample, sampleAggr, sampleSys, sampleSysAggr.

THEY ALL READ ONE SAMPLE PATH, which is why they live together. The reference splits them across nine files in @@SolverSSA/, but every one of them runs the analyzer and then reduces the SAME trajectory: a probability is the fraction of simulated time spent in a state, and a sample is that trajectory printed. Running the engine once and reducing it several ways is therefore not an optimization – it is what makes the four probabilities mutually consistent, which they would not be if each drew its own path.

THE SERIAL ENGINE, NEVER THE NRM, and that is the reference's own choice: @@SolverSSA/getProb.m rewrites default and nrm to serial before it asks for the trajectory. The NRM does not simulate the state ENCODING at all – it moves per-(node, class, phase) counts – so it has no row to compare a requested state against and no per-event trace to print. A caller who asked for nrm and then for a probability gets the serial engine's answer, as they do in MATLAB.

TIME-WEIGHTED, NOT EVENT-COUNTED. A probability here is the fraction of SIMULATED TIME the path spent in the state, not the fraction of firings that landed in it. The two differ by the holding-time distribution and only the first estimates the stationary law; the reference's TSS(:,1) = [TSS(1,1); diff(TSS(:,1))] is exactly that reweighting, and SsaSerialRun::pi has already applied it, so these functions sum pi and never counts.

A STATE THAT WAS NEVER VISITED HAS PROBABILITY 0, and the reference warns before returning it. That zero is a measurement of a finite path and not a statement about the chain: a rare state simply did not occur in the sample. SsaProbResult::seen carries the distinction so a caller can tell "the path says this state is impossible" from "the path never got there".

Definition in file solver_ssa_getters.h.