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

LQN2PN: LayeredNetwork to Petri net (GSPN) translator. More...

#include <algorithm>
#include <cctype>
#include <cmath>
#include <cstddef>
#include <cstdio>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <set>
#include <string>
#include <utility>
#include <vector>
#include "line/io/lqn2qn.h"
#include "line/lang/lqn/lqn_reader.h"
#include "line/lang/lqn/lqn_struct.h"
#include "line/lang/qn/network_builder.h"
#include "line/num/number.h"
#include "line/util/error.h"
Include dependency graph for lqn2pn.h:

Go to the source code of this file.

Classes

struct  line::io::Lqn2PnCell
 A (place, class) pair of the Petri net, by node and class NAME. More...
struct  line::io::Lqn2PnProcessor
 Where to read a processor replica. More...
struct  line::io::Lqn2PnTask
 Where to read a task replica. More...
struct  line::io::Lqn2PnElement
 The (place, class) copies of an entry or activity whose Tput sums to its throughput. More...
struct  line::io::Lqn2PnMap
 The result map of LQN2PN, the twin of the Python return_map dictionary, insertion-ordered. More...

Namespaces

namespace  line
 Conservation laws of a layered queueing network, enumerated from its structure.
namespace  line::io

Functions

template<class T>
qn::Network< T > line::io::lqn2pn (const lqn::LqnModel< T > &lqn, const std::string &replication="auto", const std::string &name="model", std::vector< std::string > *warnings=nullptr, Lqn2PnMap *map=nullptr)
 Port of Python LQN2PN(lqn, replication, return_map) and MATLAB LQN2PN: convert a layered network into a Petri net (Place and Transition nodes, a GSPN) that keeps every layer at once.
template<class T>
qn::Network< T > line::io::lqn2pn (const lqn::LqnStruct< T > &lsn, const std::string &replication="auto", const std::string &name="model", std::vector< std::string > *warnings=nullptr, Lqn2PnMap *map=nullptr)
 LQN2PN over an already flattened LqnStruct.

Detailed Description

LQN2PN: LayeredNetwork to Petri net (GSPN) translator.

Port of python/line_solver/io/lqn2pn.py and matlab/src/io/LQN2PN.m; the three must stay in step and produce the same net: the same node list, class list, populations and transition modes, in the same order. See _kb/06-solver-catalog.md (LQN2PN) for the construction and its caveats.

Construction, in brief:

  • Every request travels as a token. A reference task replica is a closed class whose population is the task multiplicity, waiting in <T>_think and leaving it through a timed, infinite-server transition with the think-time law. An entry with an open arrival is an open class fed by a Source and absorbed by a Sink at the reply.
  • A finite thread pool is a closed class of thread tokens held in <T>_free; an immediate mode <E>_acq takes one with the request and parks it in <T>_busy, and the reply returns it.
  • An FCFS or SIRO processor is a closed class of processor tokens in <P>_free, taken by an immediate <A>_get and returned by the timed, infinite-server <A>_run. A PS processor has no tokens: its run modes have the marking-dependent rate g = min(1, c/n), n the jobs at the processor, read through never-binding inhibitor arcs. An infinite-server processor is the timed run mode alone.
  • Sequence and OR precedences are place merges and weighted immediate modes, an AND-fork is one immediate mode putting a token on every branch, an AND-join one immediate mode taking one token from every branch.
  • A synchronous call moves the caller's token into a per-call-site copy of the callee, unrolled into floor(m) stages plus one Bernoulli stage. An asynchronous call mints a token of a class of its own (population 0). A forwarding hands the request, with its continuation, to the target entry.
  • Phase 2: at the reply the request returns to the caller and the thread token (or a minted <T>_ph2 token) walks the phase-2 activities.
  • Replication is materialised (one copy per replica, with the fan-out block rule of LQN2QN) or pooled (r times the tokens).

Refused by name, as LINE:unsupported:<kind>: cache tasks (CacheTask), setup tasks (SetupTask), admission constraints (AdmissionConstraint), load, class and joint dependence (LoadDependence), server pools (ServerPools), scheduling other than FCFS, SIRO, PS and INF, plus REF on tasks (SchedStrategy), an AND-join quorum below its branch count (AndJoinQuorum), a host demand on a PS processor that is not a renewal phase-type law (PSNonPhaseType: MAP, ME, RAP, Det, Uniform, Gamma, ...) and the unrepresentable fork/join shapes (Structure). A phase-type demand (alpha, S) on a PS processor is expanded into one place <A>_ph<k> per phase, entered by alpha through <A>_start and left through exponential modes <A>_run<k> (rates S(k,j) and the exit rates) scaled by min(1, c/n): exact PS with phase-type service.

Definition in file lqn2pn.h.