| () Initialize: |
| Set |
| Set NC 0 NC is the cycles counter |
| For every edge () set an initial value for |
| trail intensity and |
| () Place the ants on the source node |
| () Set s is the tabu list index |
| For to do |
| Place the starting town of each ant in |
| () Repeat until each ant reaches the target or in local minima |
| Set |
| For to do |
| // at time the th ant is in town |
| Calculate the evaluation function of each neighbor |
| |
| Choose the town j to move to, with probability |
| |
| Move the th ant to the selected town |
| Insert town in |
| () For to do |
| Compute the length |
| Update the shortest tour found |
| For every edge |
| For to m do |
| |
| () For every edge |
| Compute |
| () Set |
| Set NC NC + 1 |
| For every edge |
| Set |
| () If (NC < NCMAX) and (not stagnation behavior) then |
| Empty all tabu lists |
| Go to step () |
| Else |
| Print shortest tour |
| Stop |