| Algorithm 1: Beam Search | ||||||
| 1: | CT: List of current trajectories, where T is one trajectory in the list (CT is initially empty) | |||||
| 2: | FT: Set of final trajectories (FT is initially empty) | |||||
| 3: | OT: Own trajectory. | |||||
| 4: | asT: A current processed segment of T trajectory. | |||||
| 5: | maxN: Maximal number of processed solutions. | |||||
| 6: | Add OT to CT | |||||
| 7: | while CT is not empty do | |||||
| 8: | Remove T (the first trajectory of CT) from the start of list CT | |||||
| 9: | for each Target(i) ship’s trajectory do | |||||
| 10: | if the DCPA of the present ship is violated in section asT by Target(i)’s trajectory then | |||||
| 11: | Generate two anti-collision maneuvers (port and starboard) and segments back to the waypoint | |||||
| 12: | Based on the two maneuvers and T, create two new trajectories (T1 and T2) | |||||
| 13: | else | |||||
| 14: | Generate an artificial collision course TA of the present ship with Target(i)’s trajectory. | |||||
| 15: | For the artificial course TA, generate two anti-collision maneuvers (port and starboard) and segments back to the waypoint | |||||
| 16: | Based on the two maneuvers and TA, create two new trajectories (T1 and T2) | |||||
| 17: | end if | |||||
| 18: | for each trajectory from {T1, T2} set do | |||||
| 19: | if the first of two newly created segments of Ti trajectory is DCPA safe with respect to all remaining ships then | |||||
| 20: | if the segments are last segments in Ti and both are DCPA safe then | |||||
| 21: | Add Ti to FT | |||||
| 22: | else | |||||
| 23: | Add Ti to the end of list CT | |||||
| 24: | end if | |||||
| 25: | end if | |||||
| 26: | end for | |||||
| 27: | end for | |||||
| 28: | if size(CT) > maxN then | |||||
| 29: | Remove size(CT) from maxN worst trajectories (in terms of expected length) from CT | |||||
| 30: | end if | |||||
| 31: | end while | |||||
| 32: | Choose the best trajectory (or trajectories) from FT. | |||||