| Input: event log L1 = [σ1, σ2, σ3, …, σn], and alignment transition system TS2 = (S2, M2, T2) between L1 and N1 = (P1, T1; F1, α1, mi,1, mf,1). |
| Output: OA_one[n](OA_one[i] stores an optimal alignment γi between the ith trace and the model, where 1 ≤ i ≤ n). |
(1) | FOR(all σi ∈ L1) DO |
(2) | queue ⟵ ∅; |
(3) | firststate ⟵ (mi,1, s0); |
(4) | firstalign ⟵ <>; |
(5) | firstcost ⟵ 0; |
(6) | firstnode ⟵ (firststate, firstalign, firstcost); |
| //add the initial node to the queue; |
(7) | queue ⟵ queue ∪ {firstnode}; |
(8) | WHILE(queue ≠ ∅) DO |
(9) | FOR (all node ∈ queue) Do |
(10) | choose the node with the minimum cost as curnode; |
(11) | queue ⟵ queue − {curnode}; |
(12) | END FOR |
| //delete the current node from the queue; |
(13) | FOR(all tj ∈ T2) DO |
(14) | IF(π1(tj) = π1(curnode)) THEN |
(15) | γi = π2(curnode) ⊕ <(π2(tj)>; |
(16) | IF is the prefix of σi THEN |
(17) | IF AND (π3(tj) ∈ )THEN |
(18) | OA_one[i] ⟵ γi; |
(19) | JUMP TO Step 1; |
| //obtain the optimal alignment for the given trace and be ready to do the search for the next one; |
(20) | ELSE |
(21) | sucstate ⟵ π3(tj); |
(22) | sucalign ⟵ γi; |
(23) | succost ⟵ π3(curnode) + lc(π2(tj)); |
(24) | sucnode ⟵ (sucstate,sucalign, succost); |
(25) | queue ⟵ queue ∪ {sucnode}; |
| //add the successor to the queue; |
(26) | END IF |
(27) | END IF |
(28) | END IF |
(29) | END FOR |
(30) | END WHILE |
(31) | END FOR |
(32) | RETURN OA_one; |