| Algorithm 1 ACOE |
| Input: a CSP (X, D, C), maximum number of iterations Nmax, number of ants Nant |
| Output: bestA |
| 1: Initialization |
| 2: repeat |
| 3: for k = 1 to Nant do |
| 4: Construct a complete assignment Ak |
| 5: if cost(Ak) < cost(bestA) then |
| 6: bestA ← Ak |
| 7: end if |
| 8: if the condition is satisfied then |
| 9: bestA ← CLS(bestA) |
| 10: end if |
| 11: end for |
| 12: Update pheromone on each vertex |
| 13: until cost(bestA) = 0 ∨ Nmax is reached |
| 14: return bestA |