![]() |
LINE Solver (C++)
Templated C++ port of the LINE queueing solver
|
Collapse the detected workflow patterns and convolve their service laws. More...
#include <algorithm>#include <cstddef>#include <map>#include <set>#include <vector>#include "line/api/wf/wf_branch_detector.h"#include "line/api/wf/wf_link_matrix.h"#include "line/api/wf/wf_loop_detector.h"#include "line/api/wf/wf_parallel_detector.h"#include "line/api/wf/wf_sequence_detector.h"#include "line/lang/lang_types.h"#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::wf::ServiceParameters< T > |
| A phase-type-shaped service law: entry vector and transient generator. More... | |
| struct | line::wf::UpdatedWorkflow< T > |
| The collapsed link matrix and the service law of every surviving node. More... | |
| struct | line::wf::UpdateStats< T > |
| Statistics of one update pass; the Java getUpdateStats map. More... | |
Namespaces | |
| namespace | line |
| namespace | line::wf |
Functions | |
| template<class T> | |
| ServiceParameters< T > | line::wf::convolve_sequence (const std::vector< ServiceParameters< T > > ¶ms) |
| Convolution of the durations, i.e. | |
| template<class T> | |
| ServiceParameters< T > | line::wf::convolve_parallel (const std::vector< ServiceParameters< T > > ¶ms) |
| Maximum of the durations, i.e. | |
| template<class T> | |
| ServiceParameters< T > | line::wf::convolve_loop (const ServiceParameters< T > ¶ms, const T &loopProb) |
| Geometric repetition: the exit flow re-enters through alpha with probability loopProb. | |
| template<class T> | |
| ServiceParameters< T > | line::wf::convolve_branches (const std::vector< ServiceParameters< T > > ¶ms, const std::vector< T > &probsIn) |
| Probabilistic choice among the alternatives, on a block-diagonal generator. | |
| template<class T> | |
| bool | line::wf::find_fork_join_for_parallel (const Matrix< T > &, const std::vector< int > &, int *, int *) |
| The fork and join bracketing a parallel pattern. | |
| template<class T> | |
| UpdatedWorkflow< T > | line::wf::update_patterns (const Matrix< T > &linkMatrix, const std::vector< int > &serviceNodes, const std::vector< int > &forkNodes, const std::vector< int > &joinNodes, const std::vector< int > &routerNodes, const std::map< int, ServiceParameters< T > > &serviceParams) |
| Collapse the four pattern families in the reference's order: sequences, parallels, loops, branches. | |
| template<class T> | |
| bool | line::wf::validate_updated_workflow (const UpdatedWorkflow< T > &w) |
| Every node the collapsed matrix still references carries a service law. | |
| template<class T> | |
| UpdateStats< T > | line::wf::get_update_stats (const Matrix< T > &originalMatrix, const UpdatedWorkflow< T > &w) |
| How much the collapse shrank the link matrix. | |
Collapse the detected workflow patterns and convolve their service laws.
Templated port of the native Python line_solver/api/wf/pattern_updater.py, cross-checked against jar/src/main/java/jline/api/wf/Wf_pattern_updater.java. There is no MATLAB counterpart: api/wf exists in the JAR and in Python only.
PYTHON IS THE REFERENCE HERE, NOT THE JAR. The JAR's four convolutions are STUBS – convolveSequence, convolveParallel and convolveBranches return params.get(0) unchanged and convolveLoop returns its argument – so the Java class rewrites the link matrix and then reports the FIRST branch's service law as the law of the collapsed pattern. Its removeMatrixRows is also defective: the loop over the sorted row list returns inside its first iteration, so at most one row is ever removed. Python implements the actual phase-type algebra and removes every row, and that is what is ported.
THE FOUR CONVOLUTIONS, on representations (alpha, T) that need not be honest phase types – alpha may sum below one, and the deficit 1 - alpha e is treated as instantaneous completion, which is what makes the formulas below carry the sub-stochastic entry vectors the detectors produce:
find_fork_join_for_parallel returns "none" in BOTH references, so the parallel arm of update_patterns never fires. That is reproduced rather than invented: supplying a fork/join search here would collapse patterns neither reference collapses, and the resulting workflow would not be the one any other codebase produces. The convolution itself is implemented and reachable through convolve_parallel, which is what a caller with its own fork/join pairing needs.
ARITHMETIC: field. Block assembly, Kronecker products, and one division in the probability renormalization, so it instantiates under Rational.
Definition in file wf_pattern_updater.h.