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

Fork-join node visit ratios, via the auxiliary closed SPN. More...

#include <cstddef>
#include <string>
#include <vector>
#include "line/lang/qn/network_struct.h"
#include "line/num/number.h"
#include "line/util/error.h"
#include "line/util/matrix.h"
Include dependency graph for sn_fj_visits_spn.h:

Go to the source code of this file.

Classes

struct  line::api::FjSpnStructure
 What the auxiliary construction found, for one class. More...

Namespaces

namespace  line
namespace  line::api

Functions

template<class T>
FjSpnStructure line::api::fj_spn_structure (const qn::NetworkStruct< T > &sn, const Matrix< T > &P_r, const std::vector< bool > &visited, std::size_t cls=0)
 Classify one class's visited subgraph and size the auxiliary net.
template<class T>
std::vector< Matrix< T > > line::api::sn_fj_visits_spn (const qn::NetworkStruct< T > &sn)
 Per-chain fork-join node visit ratios.

Detailed Description

Fork-join node visit ratios, via the auxiliary closed SPN.

Port of matlab/src/api/sn/sn_fj_visits_spn.m (twins: SnFjVisitsSpn.java, python/line_solver/api/sn/sn_fj_visits_spn.py).

WHAT IT COMPUTES. For each class that passes through a fork-join pair, the reference builds an auxiliary closed stochastic Petri net that carries the fork/join synchronization exactly – one Place per station, a "done" Place per branch feeding a Join, an immediate Join transition consuming one token from each branch, and B tokens circulating, B being the largest leaf count over the outermost forks – and reads the per-Place throughputs as the visit ratios, normalized so the chain's reference station is one.

THE SPN SOLVE IS NOT WHAT PRODUCES THE ANSWER, but the rule it produces is NOT the uniform one sn_fj_visits_spn.m:113 claims. That comment says the net is population preserving, so every station Place fires at the same rate; the reference's own CTMC solve says otherwise, and it is the solve that defines the function. The pre-fork transition consumes all B tokens at once and the Join returns them, so a station INSIDE a fork-join region fires once per B firings of the cycle: normalized on the reference station, a station outside the region is 1, a station inside it is 1/B, and a Fork or a Join, which holds no Place, is 0. Measured against MATLAB and the JAR on a two-branch, a three-branch, a nested, a chained-branch, a pre/post-fork-station and a two-class model: 1, 0.5 and 1/3 exactly where predicted.

This port evaluates that rule instead of enumerating a state space whose size is exponential in B. WHAT IS LOST, stated plainly: MATLAB's solve would DETECT a construction that violates the assumptions (an unbalanced Join, a fork whose leaves are not conserved), where this port assumes them. That is why the structural preconditions are CHECKED here – an unresolvable fork, or a Join with no branch feeding it, is refused by name.

ARITHMETIC: field. No transcendental function is involved; before normalization the answer is exactly 0, 1 or the unit fraction 1/B.

Definition in file sn_fj_visits_spn.h.