Skip to content Skip to footer

Ant Colony Optimization — Intuition, Code & Visualization | by James Koh, PhD | Jan, 2024

Where it stands out from other swarm algorithms

This article is a continuation of my nature-inspired series.

Previously, I talked about Evolutionary Algorithm (EA), Particle Swarm Optimization (PSO), as well as Artificial Bee Colony (ABC). Nature is everywhere, and there’s certainly more areas where humans can benefit by learning from nature.

Today, we focus on ants.

As children, we learnt that ants are hardworking and cooperative. What our parents hadn’t taught us was that ants collectively form a highly sophisticated swarm that communicates with one another effectively.

Knowledge of ants or pheromones (or any diffusion of any chemicals) is not required here at all. These are just names used for the purpose of packaging. I’ve shown previously that you do not need the slightest knowledge of a bee’s waggle dance in order to appreciate or utilize ABC, nor do you need to learn about genes or mutations or reproduction to apply EA.

All you need is an understanding of English to have the intuition, along with very basic math and python programming skills. While I will be showing some mathematics for completeness, which includes Greek symbols, it is really just for the purpose of completeness. It would be a great pity if these technical-sounding words or symbols stop you from learning these great algorithms, so do yourself a favor and read on.

Before going into any math or code, or even how the algorithm works at a high level, it makes sense to see the relevance. After all, if it doesn’t help to solve a problem, why bother in the first place?

The classic example which lecturers or proponents of Ant Colony Optimization (ACO) use is the double bridge experiment [1], which shows that this algorithm can be used to find the shortest path between two points.

(Image of ant from DALL·E 3, put together by author using PowerPoint.) Upper pathway is shorter, and hence has a higher density of ants, than bottom pathway.

Moreover, it is robust to changes in the environment. If existing paths get obstructed, and/or if new paths arise, the solution can be updated with ease, instead of re-computing everything from scratch.

Source link