LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
wf_aph.m
1%% Workflow with APH Distributions
2% A workflow using APH (Acyclic Phase-Type) distributions
3% for flexible variability modeling.
4%
5% Copyright (c) 2012-2026, Imperial College London
6% All rights reserved.
7
8clear;
9lineStart;
10
11%% Define the workflow
12wf = Workflow('APHWorkflow');
13
14% Add activities with different SCVs using APH
15A = wf.addActivity('A', APH.fitMeanAndSCV(1.0, 0.5)); % Low variability
16B = wf.addActivity('B', APH.fitMeanAndSCV(2.0, 2.0)); % High variability
17C = wf.addActivity('C', APH.fitMeanAndSCV(1.5, 1.0)); % Standard variability
18
19% Define serial precedence
20wf.addPrecedence(Workflow.Serial(A, B, C));
21
22%% Convert to phase-type distribution
23ph = wf.toPH();
24
25%% Display results
26fprintf('APH Workflow: A -> B -> C\n');
27fprintf('Activity A: APH(mean=1.0, SCV=0.5)\n');
28fprintf('Activity B: APH(mean=2.0, SCV=2.0)\n');
29fprintf('Activity C: APH(mean=1.5, SCV=1.0)\n');
30fprintf('Expected total mean: %.2f\n', 1.0 + 2.0 + 1.5);
31fprintf('Computed PH mean: %.4f\n', ph.getMean());
32fprintf('Computed PH SCV: %.4f\n', ph.getSCV());
33fprintf('Number of phases: %d\n', size(ph.getSubgenerator(), 1));