| Input: reachable graph TS of synchronous composition model N3; |
| Output: optimal alignment γ. |
(1) | //initialize a priority queue by (total cost value of mi to mf) + (total estimated value of the current node to the target node) in ascending order |
(2) | pqueue.create (); |
(3) | visitedNodesSet = Ø; |
(4) | pqueue.push (TS.initialmarking); |
(5) | while pqueue.size ()! = 0 do |
(6) | currenrNode = pqueue.poll (); |
(7) | if currenrNode == targetNode then |
(8) | //recursively search the predecessor node of currenrNode to get optimal alignment |
(9) | γ = getOptAlignment (currenrNode); |
(10) | return γ; |
(11) | else |
(12) | //visit all successorNodes of currentNode |
(13) | for all successorNode ∈ currentNode.getSuccessors() do |
(14) | //calculate the new total cost value of successorNode |
(15) | newcost = successorNode.calNewCost (currentNode); |
(16) | if successorNode ∈ visitedNodesSet then |
(17) | //for the visited node, if the new total cost value is smaller, update the total cost value of successorNode |
(18) | if successorNode.getTotalCost() > newcost then |
(19) | successorNode .setTotalCost (newcost); |
(20) | pqueue.push (successorNode); |
(21) | end |
(22) | Else |
(23) | visitedNodesSet = visitedNodesSet ∪ {successorNode}; |
(24) | successorNode.setTotalCost (newcost); |
(25) | pqueue.push (successorNode); |
(26) | end |
(27) | end |
(28) | end |
(29) | end |