![]() |
LINE Solver (C++)
Templated C++ port of the LINE queueing solver
|
Sequence pattern detection in a workflow network. More...
#include <algorithm>#include <cstddef>#include <map>#include <set>#include <vector>#include "line/api/wf/wf_link_matrix.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::SequenceStats< T > |
| Mirrors the Java getSequenceStats map. More... | |
Namespaces | |
| namespace | line |
| namespace | line::wf |
Functions | |
| template<class T> | |
| std::vector< std::vector< int > > | line::wf::detect_sequences (const Matrix< T > &linkMatrix, const std::vector< int > &serviceNodes) |
| template<class T> | |
| bool | line::wf::validate_sequence (const std::vector< int > &sequence, const Matrix< T > &linkMatrix) |
| Every consecutive pair of the chain must be an edge of the workflow. | |
| template<class T> | |
| SequenceStats< T > | line::wf::get_sequence_stats (const std::vector< std::vector< int > > &sequences) |
| Count, total, mean, maximum and minimum chain length. | |
Sequence pattern detection in a workflow network.
Templated port of jar/src/main/java/jline/api/wf/Wf_sequence_detector.java (no MATLAB counterpart exists, so the JAR is the reference). A sequence is a maximal chain of service nodes connected service-to-service; the chain is grown from an unused edge in both directions until no edge extends it, and the number of chains looked for is half the number of service nodes that appear exactly once among the service-to-service edges, i.e. half the number of chain endpoints.
detect_sequences, validate_sequence and get_sequence_stats are the three public methods of the Java class, kept 1:1.
REFERENCE DEFECT (JAR), NOT reproduced: validateSequence builds a HashSet<Pair<Integer,Integer>> of the edges and asks whether each consecutive pair of the chain is in it, but jline.util.Pair implements neither equals nor hashCode, so contains() falls back to reference identity and NEVER matches. The Java method therefore returns false for every sequence of length >= 2, including the chains its own detectSequences just produced (verified against common/jline.jar: validateSequence([2,3,4]) on 1->2->3->4->9 returns false). Fixing Pair is outside this port, so validate_sequence here implements the intended semantics - std::pair has value equality - and returns true for a genuinely connected chain. This is the one place where the port deliberately disagrees with the reference.
Everything here is graph traversal and counting; the only arithmetic is the mean chain length, one division. Finite field computation, instantiates at exact arithmetic, no transcendental gate: for T = Rational the mean length is an exact rational and the structural counts are exact integers.
Definition in file wf_sequence_detector.h.