Research Article

A Novel Sparrow Particle Swarm Algorithm (SPSA) for Unmanned Aerial Vehicle Path Planning

Algorithm 3

Sparrow particle swarm algorithm (SPSA) pseudocode.
Initialize
 Set the basic parameters
 Set the start point and target point
 Initialize the position of each individual in the population using equations (10)–(12)
 Oscillation optimization of all individuals trajectories
For each iteration
  Initialize optimal fitness and worst fitness
  For each producer
   For each dimension
    Update the position of by the equation (11)
    Set T = 0
    While the position can not reach and T < Tmax
     Update the position of by the equation (11)
     T = T + 1
    End While
   End For
  End For
  For each scrounger
   For each dimension
    Update the position of by the equation (4)
    Set T = 0
    While the position can not reach and T < Tmax
     Update the position of by the equation (4)
     T = T + 1
    End While
    If T ≥ Tmax
     Search for the next position by adaptive escape using equation (12)
    End If
   End For
  End For
For each individual that finds danger
   For each dimension
    Update the position of by the equation (5)
    Set T = 0
    While the position can not reach and T < Tmax
     Update the position of by the equation (5)
     T = T + 1
    End While
   End For
  End For
  Optimize adaptive oscillation using equation (13)
  Update position of all individuals
  Calculate and sort fitness values
  End For
 Perform node optimization on the optimal path and smooth optimization
Return results
Terminate