5#ifndef LINE_API_SPN_SPN_REC_ENABLED_H
6#define LINE_API_SPN_SPN_REC_ENABLED_H
65 const SpnMode<T>& mde, std::size_t nplacelevels) {
66 if (nplacelevels > mdds.
K)
67 throw InputError(
"spn_rec_enabled: more place levels than diagram levels");
74 bool has_input =
false;
75 for (std::size_t l = 0; l < nplacelevels; ++l) {
76 if (!(mde.
enab[l] > 0))
continue;
77 const double top =
static_cast<double>(mdds.
domain[l] - 1);
78 const std::size_t cap =
static_cast<std::size_t
>(std::floor(top / mde.
enab[l]));
79 emax = has_input ? (cap < emax ? cap : emax) : cap;
83 throw InputError(
"spn_rec_enabled: the mode consumes from no place, so its enabling "
84 "degree is unbounded");
88 out.
ge.assign(emax + 2, zero);
89 out.
eq.assign(emax + 2, zero);
90 for (std::size_t k = 0; k <= emax; ++k) {
92 for (std::size_t j = 0; j < mdds.
K; ++j)
93 mask[j].assign(
static_cast<std::size_t
>(mdds.
domain[j]),
true);
94 for (std::size_t l = 0; l < nplacelevels; ++l) {
95 const double need = mde.
enab[l] *
static_cast<double>(k);
96 for (
int v = 0; v < mdds.
domain[l]; ++v) {
97 const bool short_of_tokens =
static_cast<double>(v) < need;
98 const bool inhibited =
static_cast<double>(v) >= mde.
inhib[l];
101 if (short_of_tokens || (k > 0 && inhibited))
102 mask[l][
static_cast<std::size_t
>(v)] =
false;
107 for (std::size_t k = 0; k <= emax; ++k) out.
eq[k] = T(out.
ge[k] - out.
ge[k + 1]);
The exception types the port throws.
Quasi-reduced ordered Multi-valued Decision Diagram.
MDD-rec: the normalising constant of a product-form model whose reachable set is held in a decision d...
std::vector< std::vector< bool > > MddMask
Per-level admissible local values, the restriction of Sec.
T mdd_rec_masked(const MddStruct &mdds, const std::vector< std::vector< T > > &g, const MddMask &mask)
Unnormalised mass of the masked subset of the reachable set (Algorithm 1).
SpnEnabling< T > spn_rec_enabled(const mdd::MddStruct &mdds, const std::vector< std::vector< T > > &g, const SpnMode< T > &mde, std::size_t nplacelevels)
Enabling-degree masses of mode mde over the reachable set in mdds.
Number-type abstraction for the templated API port.
Decision-diagram reachable set and Kronecker rate descriptor of a stochastic Petri net,...
Plain-array export of an MDD, the input contract of mdd_mcd.
std::vector< int > domain
domain[k] is the number of local states at level k.
std::size_t K
Number of variable levels.
Unnormalised enabling-degree masses of one mode.
std::size_t max_degree
The largest enabling degree the place bounds permit, E_j in the paper.
std::vector< T > eq
eq[k] is the mass of {e == k}, i.e.
std::vector< T > ge
ge[k] is the mass of {e >= k}; ge[0] is the whole reachable set.
One (transition, mode) pair of the net, in level coordinates.
std::vector< double > enab
Enabling multiplicity per place level.
std::vector< double > inhib
Inhibition threshold per place level; infinite when absent.