Skip to main content
. 2018 Feb 11;18(2):548. doi: 10.3390/s18020548
Algorithm 3 Sampling-based Sparse A* Search Algorithm.
Input: The starting position, the destination position, the search leg length, and the termination condition
Output: Coordinates of the waypoints
Begin:
  • 1:

    Empty the open set and the close set;

  • 2:

    Set the starting waypoint as the first node Q1, add Q1 to the open set (J(Q1)=0), and initialize the number of the explored node Nj=1;

  • 3:

    repeat

  • 4:

       Select the best node Qm from the open set, move Qm from the open set to the close set;

  • 5:

       if the termination condition is satisfied at Qm then

  • 6:

          Terminate the iteration, then trace back the path up the search tree from Qm until the starting waypoint is reached (return the traced path);

  • 7:

       end if

  • 8:

       Expand the search tree from Qm, and obtain the children node set {Qmc};

  • 9:

       for each child node in {Qmc} do

  • 10:

          Calculate its distances from the other reached nodes {Qj}j=1,2,,Nj, and select the nearest node Qn from {Qj} with minimum distance rmin;

  • 11:

          if rmin<rc then

  • 12:

                This is a node that has been reached before;

  • 13:

                if J(Qmc)<J(Qn) then

  • 14:

                   Replace Qn by Qmc ;

  • 15:

                end if

  • 16:

          else

  • 17:

                A new node is obtained, Nj=Nj+1, and add Qmc to the open set as QNj;

  • 18:

          end if

  • 19:

       end for

  • 20:

    until the open set is empty (return failure)