![]() |
LINE Solver (C++)
Templated C++ port of the LINE queueing solver
|
Maximum sustainable multiplicity (concurrency level) of every element of a layered software network. More...
#include <cstddef>#include <deque>#include <vector>#include "line/num/number.h"#include "line/util/error.h"#include "line/util/matrix.h"Go to the source code of this file.
Classes | |
| struct | line::lsn::Multiplicity< T > |
| A multiplicity, possibly infinite; MATLAB's mult(i) = Inf. More... | |
| struct | line::lsn::LsnInput< T > |
| The plain-data fields of a layered software network read by the algorithm. More... | |
Namespaces | |
| namespace | line |
| namespace | line::lsn |
Enumerations | |
| enum class | line::lsn::LsnElementType { line::lsn::HOST = 0 , line::lsn::TASK = 1 , line::lsn::ENTRY = 2 , line::lsn::ACTIVITY = 3 , line::lsn::CALL = 4 } |
| Element kinds, with the values of MATLAB's LayeredNetworkElement. More... | |
Functions | |
| template<class T> | |
| Multiplicity< T > | line::lsn::mult_add (const Multiplicity< T > &a, const Multiplicity< T > &b) |
| a + b, with infinity absorbing. | |
| template<class T> | |
| Multiplicity< T > | line::lsn::mult_min (const Multiplicity< T > &a, const Multiplicity< T > &b) |
| min(a,b), with infinity as the top element. | |
| template<class T> | |
| std::vector< Multiplicity< T > > | line::lsn::lsn_max_multiplicity (const LsnInput< T > &lsn) |
| Maximum sustainable multiplicity (concurrency level) of every element of a layered software network. | |
Maximum sustainable multiplicity (concurrency level) of every element of a layered software network.
Templated port of matlab/src/api/lsn/lsn_max_multiplicity.m, cross-checked against jar/src/main/java/jline/api/lsn/LsnMaxMultiplicity.java. It lives under api/lqn/ because the port adds no api/lsn/ directory of its own; the namespace is line::lsn, matching the MATLAB domain.
Concurrency is propagated along the call graph in topological order (Kahn): a reference task seeds its own multiplicity, an entry with open arrivals seeds one thread, and every element passes on min(what reaches it, what it can hold). A setup task is exempt from the caller bound: its instances are provisioned by the platform rather than spawned by its callers, so it passes on its declared multiplicity. A non-reference task with infinite multiplicity ends up unbounded.
SCOPE: the port takes the six plain-data fields the algorithm actually reads – the call graph, the multiplicities, the element types, the reference and setup-task flags, and the per-entry open-arrival flag – rather than a LayeredNetworkStruct, so no model layer is needed.
DIVERGENCE, MATLAB vs JAR: MATLAB also seeds inflow(i) = 1 for an ENTRY that has an open arrival (lsn.arrival{i} non-empty); the JAR omits that branch entirely, so an open-arrival entry reachable from no reference task gets outflow 0 there and 1 in MATLAB. This port follows MATLAB, the reference implementation, and exposes the flag as entry_has_arrival.
ARITHMETIC: comparisons and additions only, so a finite field computation, exact in the exact instantiation. Infinite multiplicity is carried by an explicit flag instead of a floating infinity, both because Rational has no infinity and because Inf + Inf and min(Inf, Inf) are then decided by the algorithm rather than by the number type.
Definition in file lsn_max_multiplicity.h.