Shortest-Path Optimization of Ship Diesel Engine Disassembly and Assembly Based on AND/OR Network
Algorithm 2
Breadth-first shortest-path algorithm.
Input: a set of nodes in the network : a set of arcs in the network .: cost of arcs ,.: origin node of the shortest path.: destination of the shortest path.: set of nodes that are excluded from the path if contains node .
Sets: the path sets , in which contains the nodes of the path from node to .: a set of forbidden nodes for the path ,.: a set of the newly added node to the path ,.: binary variable, if path is completed; 0, otherwise.
Output: set of nodes in the shortest path;: the cost of the shortest path .
ProcessStep 1: initialize ,,,,Step 2: set Step 3: while Step 3.1: select the first path that satisfies ,Step 3.2: if Step 3.2.1: set Step 3.2.2: go to Step 3Step 3.3: if or Step 3.3.1: set Step 3.3.2: set Step 3.3.3: set Step 3.3.4: go to Step 2Step 3.4: for in :Step 3.4.1: select the precursor nodes of , denoted by Step 3.4.2: for in :Step 3.4.2.1: select (the conflict nodes of ), denoted by Step 3.4.2.2: set Step 3.4.2.3: if Step 3.4.2.3.1: add to ,Step 3.4.2.3.2: delete in ,Step 3.4.2.3.3: add to ,Step 3.4.2.3.4: set elseStep 3.4.2.3.5: generate a new path Step 3.4.2.3.6: set ,,Step 3.4.2.3.7: set Step 3.4.2.3.8: add to Step 3.4.2.3.9: set Step 4: output and