Research Article

A Fast Fully Parallel Ant Colony Optimization Algorithm Based on CUDA for Solving TSP

Algorithm 2

Compensation mechanism.
Begin:
  a ← 0
  released pheromone matrix deta_tao [n][n] ← 0
  //using nodes matrix R in Algorithm 1
  for i:1 to n
   deta_tao [R [i-1]-1] [R [i]-1] ← deta_tao [R [i-1]-1] [R[i]-1] + Q
   //Q is the pheromone release coefficient
  end for
  deta_tao [R [n-1]-1] [R [0]-1] ← deta_tao [R [n-1]-1] [R [0]-1] + Q
  for i:1 to n
   for j:1 to n
    tao [i-1] [j-1] ← tao [i-1] [j-1]  (1-ρ) + deta tao [i-1] [j-1]
    //pheromone compensation
    if tao [i-1] [j-1] ≤ (10−15/α (D [i-1] [j-1]) β/α))
     //D is the distance matrix
    then
     tao [i-1] [j-1] ← ((D [i-1] [j-1]) β/10k)1/α
    end if
    //constrain maximum of pheromone
    if tao [i-1] [j-1] ≥ (1/(1-ρ)  L)  exp (-a)
     //L is the length of current shortest path
    then
     tao [i-1] [j-1] ← (1/(1-ρ)  L)  exp (-a)
    end if
   end for
  end for
   //update shortest path
  if L ≤ Best_Path_value
   Best_Path_value ← L
   a ← 0
   else if L = = Best_Path_value
     a ← a + 1
    end if
  end if
End.