# Ant Colony Optimization
## Metadata
**Status**:: #x
**Zettel**:: #zettel/fleeting
**Created**:: [[2026-05-12]]
## Synopsis
From Chapter 6, *Swarm intelligence: Ants* in the book [[Grokking AI Algorithms, Second Edition]].
## Deciding Next Visit
Probability to choose path $x$ for the next visit:
$
\frac{P_x^a H_x^{-b}}{\sum_{n} P_n^a H_n^{-b}}
$
where
- $P_n$: pheromones on path n
- $H_n$: heuristic for path n
- $a, b$: parameters to tune the weights of influences of $P$ and $H$.
## Updating Pheromones
- Evaporation: degrading over time
- Add $\frac{1}{\sum{H}}$ to visited path for each Ant that has finished a tour with total heuristic $\sum{H}$.