Ant Colony Optimization (ACO)
Ant Colony Optimization
- Estimated duration
- 30 minutes
- Related questions
- 12
- Related algorithms
- 1
- Status
- Log in to track
Lesson objectives
- Understanding probabilistic solution construction and the pheromone.
- Applying ACO to TSP.
- Knowing ACO_R for continuous problems.
Explanation
ACO is a constructive algorithm: it does not modify a ready solution but builds the solution step by step, with the help of a collective memory, the pheromone.
In TSP: each ant starts from a city and chooses the next city with a probability proportional to τ^α·η^β, where η=1/distance. When the tours are complete, the pheromone evaporates at rate ρ, and the ants deposit pheromone inversely proportional to their tour length.
Well-known improvements: Ant Colony System (a pseudo-greedy selection rule and a local update), and MAX-MIN Ant System (lower and upper pheromone bounds, and only the best ant deposits).
For continuous problems: ACO_R (Socha & Dorigo 2008) replaces the pheromone matrix with an archive of k ranked solutions and samples new solutions from a Gaussian mixture around the archive solutions; this is what the lab's simulator implements.
In feature selection: the features are represented as nodes, and an ant builds a subset by adding features one after another according to the pheromone and a heuristic measure such as mutual information.
Mathematics
The probability
p_{ij} = \frac{\tau_{ij}^{\alpha}\eta_{ij}^{\beta}}{\sum_{l}\tau_{il}^{\alpha}\eta_{il}^{\beta}}Update
\tau \leftarrow (1-\rho)\tau + \sum_k \Delta\tau^kPython code
import numpy as np
rng = np.random.default_rng(0)
def next_city(i, unvisited, tau, eta, a=1, b=3):
w = (tau[i, unvisited] ** a) * (eta[i, unvisited] ** b)
return unvisited[rng.choice(len(unvisited), p=w / w.sum())]Simplified teaching code that works with NumPy only; for research experiments use a documented library and fix the random seed.
Practical exercise
In the ACO simulator (the ACO_R version), change q and ξ and notice their effect on the speed of convergence.
Common mistakes
- Applying the original ACO directly to continuous variables without ACO_R or discretization.
- A very small evaporation rate causes early stagnation.
Summary
ACO builds solutions probabilistically with a pheromone memory; ACO_R extends it to the continuous domain.
References
- Verified Ant system: optimization by a colony of cooperating agents M. Dorigo; V. Maniezzo; A. Colorni (1996) 10.1109/3477.484436
- Verified Ant colony optimization for continuous domains Krzysztof Socha; Marco Dorigo (2008) 10.1016/j.ejor.2006.06.046
Related papers in the repository
Short quiz
5 questions are chosen at random from 12 questions linked to this lesson, and the quiz is graded on the server.
Links within the lab
- Algorithms
- Models
- Optimization types
- Related lessons
- In the paths
