![]() |
LINE Solver (C++)
Templated C++ port of the LINE queueing solver
|
#include <line/lang/workflow/workflow.h>
Public Member Functions | |
| Workflow (const std::string &name) | |
| const std::string & | name () const |
| std::size_t | add_activity (const std::string &name, const Distrib< T > &host_demand) |
| Add an activity; the name must be unique. | |
| std::size_t | add_activity (const std::string &name, const T &mean) |
| Add an activity with an exponential host demand of the given mean. | |
| void | add_precedence (const Precedence< T > &prec) |
| std::size_t | num_activities () const |
| const std::vector< WorkflowActivity< T > > & | activities () const |
| const std::vector< Precedence< T > > & | precedences () const |
| std::size_t | activity_index (const std::string &name) const |
| WorkflowActivity< T > & | activity (const std::string &name) |
| const WorkflowActivity< T > & | activity_at (std::size_t i) const |
| Activity by index, the form a series-parallel LEAF node names it in. | |
| void | validate () const |
| Validate the workflow, throwing on the first defect. | |
| Distrib< T > | to_ph () |
| The composed law of the workflow. | |
| Distrib< T > | refresh_ph () |
| Recompose the law after a demand change. | |
| void | set_activity_demand (const std::string &name, const Distrib< T > &host_demand) |
| Change the host demand of one activity. | |
| void | set_activity_demand_mean (const std::string &name, const T &mean_value) |
| Change only the mean of one activity, preserving its shape. | |
| void | invalidate_topology () |
| Discard the cached law and the decomposition. | |
| void | invalidate_activity (std::size_t act_idx) |
| Mark one activity law dirty, keeping every other cached block. | |
| void | rescale_activity_leaf (std::size_t act_idx, const T &factor) |
| Time-scale a cached leaf in place: S -> S*FACTOR with alpha fixed. | |
| const SPTree< T > * | sp_tree () |
| The cached series-parallel decomposition, or null when the precedence graph is not series-parallel. | |
Static Public Member Functions | |
| static PhLaw< T > | compose_serial (const PhLaw< T > &a, const PhLaw< T > &b) |
| Serial composition: the second law starts when the first absorbs. | |
| static PhLaw< T > | compose_parallel (const PhLaw< T > &a, const PhLaw< T > &b) |
| Parallel (AND-fork/join) composition: the time until BOTH complete. | |
| static PhLaw< T > | compose_mixture (const std::vector< PhLaw< T > > &laws, const std::vector< T > &probs) |
| Probabilistic mixture: a block-diagonal generator whose initial vector picks branch i with probability PROBS[i]. | |
| static PhLaw< T > | compose_loop_geometric (const PhLaw< T > &body, const T &count) |
| Geometric repetition of a phase-type law, the POST_LOOP semantics. | |
| static PhLaw< T > | compose_repeat (const PhLaw< T > &body, long count) |
| COUNT-fold convolution of a phase-type law. | |
| static bool | is_acyclic_generator (const Matrix< T > &S) |
| True when the phase graph of S has no cycle. | |
| static Precedence< T > | Serial (const std::string &pre, const std::string &post) |
| static std::vector< Precedence< T > > | SerialSequence (const std::vector< std::string > &acts) |
| static Precedence< T > | AndFork (const std::string &pre, const std::vector< std::string > &posts) |
| static Precedence< T > | AndJoin (const std::vector< std::string > &pres, const std::string &post, const std::vector< T > &quorum=std::vector< T >()) |
| An empty QUORUM means a full join; a partial one is refused by validate. | |
| static Precedence< T > | OrFork (const std::string &pre, const std::vector< std::string > &posts, const std::vector< T > &probs) |
| static Precedence< T > | OrJoin (const std::vector< std::string > &pres, const std::string &post) |
| static Precedence< T > | Loop (const std::string &pre, const std::vector< std::string > &posts, const T &count) |
| A loop: PRE runs once, then POSTS[0..n-2] repeat a geometric number of times of mean COUNT and POSTS[n-1] continues after the loop. | |
Static Public Attributes | |
| static constexpr std::size_t | npos = static_cast<std::size_t>(-1) |
Definition at line 223 of file workflow.h.
|
inlineexplicit |
Definition at line 227 of file workflow.h.
Referenced by line::api::lqn::entry_workflow().
|
inline |
Definition at line 253 of file workflow.h.
|
inline |
Definition at line 261 of file workflow.h.
|
inline |
Activity by index, the form a series-parallel LEAF node names it in.
Definition at line 268 of file workflow.h.
|
inline |
Definition at line 256 of file workflow.h.
|
inline |
Add an activity; the name must be unique.
Definition at line 232 of file workflow.h.
|
inline |
Add an activity with an exponential host demand of the given mean.
Definition at line 243 of file workflow.h.
|
inline |
Definition at line 247 of file workflow.h.
|
inlinestatic |
Definition at line 705 of file workflow.h.
|
inlinestatic |
An empty QUORUM means a full join; a partial one is refused by validate.
Definition at line 716 of file workflow.h.
|
inlinestatic |
Geometric repetition of a phase-type law, the POST_LOOP semantics.
For COUNT >= 1 the body runs at least once and repeats on absorption with probability P = 1-1/COUNT, so
S_out = S + P/D (-S e) alpha, alpha_out = alpha / D
with D = 1 - P(1 - alpha e) the correction for an atom at zero in alpha. The ORDER is that of the body, unlike the COUNT-fold convolution, and the mean is COUNT times the body mean in both cases.
For COUNT < 1 the body runs at most once, with probability COUNT; the skipped branch is an immediate phase.
Definition at line 585 of file workflow.h.
Referenced by line::api::lqn::detail_compose_serialized().
|
inlinestatic |
Probabilistic mixture: a block-diagonal generator whose initial vector picks branch i with probability PROBS[i].
aph_simplify pattern 3, generalised to any number of branches.
Definition at line 548 of file workflow.h.
Referenced by line::api::lqn::detail_compose_serialized().
|
inlinestatic |
Parallel (AND-fork/join) composition: the time until BOTH complete.
States (i,j) with both active carry the Kronecker sum S1 (+) S2; when one branch absorbs the chain moves into that branch's own survivor block, so the law is the maximum of the two.
Definition at line 496 of file workflow.h.
|
inlinestatic |
COUNT-fold convolution of a phase-type law.
The DETERMINISTIC repetition, kept for a caller that genuinely wants an exact number of executions. POST_LOOP is geometric and uses compose_loop_geometric instead.
Definition at line 638 of file workflow.h.
|
inlinestatic |
Serial composition: the second law starts when the first absorbs.
S = [S1, (-S1 e) alpha2; 0, S2]
A defective alpha1 carries an atom at zero, which starts the second law immediately; this is aph_simplify pattern 1.
Definition at line 463 of file workflow.h.
Referenced by line::api::lqn::detail_compose_serialized().
|
inline |
Mark one activity law dirty, keeping every other cached block.
Definition at line 407 of file workflow.h.
|
inline |
Discard the cached law and the decomposition.
Definition at line 396 of file workflow.h.
|
inlinestatic |
True when the phase graph of S has no cycle.
A geometric loop over a body of two or more phases closes a cycle, so the composed law is a PH and not an APH.
Definition at line 657 of file workflow.h.
|
inlinestatic |
A loop: PRE runs once, then POSTS[0..n-2] repeat a geometric number of times of mean COUNT and POSTS[n-1] continues after the loop.
Definition at line 753 of file workflow.h.
|
inline |
Definition at line 229 of file workflow.h.
|
inline |
Definition at line 252 of file workflow.h.
|
inlinestatic |
Definition at line 728 of file workflow.h.
|
inlinestatic |
Definition at line 739 of file workflow.h.
|
inline |
Definition at line 254 of file workflow.h.
|
inline |
Recompose the law after a demand change.
Only the series-parallel nodes on the path from a dirty leaf to the root recompose; nodes whose subtree is unchanged keep their cached law. The topology is not rebuilt.
Definition at line 353 of file workflow.h.
|
inline |
Time-scale a cached leaf in place: S -> S*FACTOR with alpha fixed.
Ancestors still recompose, because they mix phases of several leaves, but the tree keeps its shape and no acyclic phase-type is refitted.
Definition at line 424 of file workflow.h.
|
inlinestatic |
Definition at line 689 of file workflow.h.
|
inlinestatic |
Definition at line 698 of file workflow.h.
|
inline |
Change the host demand of one activity.
Marks only that leaf dirty, which is the entry point an iterative solver uses when it updates call-response laws at each iteration.
Definition at line 361 of file workflow.h.
|
inline |
Change only the mean of one activity, preserving its shape.
The law is scaled in time rather than refitted, so its SCV, its skewness and its order are preserved and the cached tree keeps its shape.
Definition at line 374 of file workflow.h.
|
inline |
The cached series-parallel decomposition, or null when the precedence graph is not series-parallel.
Definition at line 446 of file workflow.h.
|
inline |
The composed law of the workflow.
The generator is acyclic unless a geometric loop closes a cycle over a multi-phase body, which is_acyclic_generator reports; the returned Distrib is typed APH or PH accordingly.
Definition at line 331 of file workflow.h.
|
inline |
Validate the workflow, throwing on the first defect.
A quorum AND-join is refused here rather than composed as a full join.
Definition at line 278 of file workflow.h.
|
staticconstexpr |
Definition at line 225 of file workflow.h.