Skip to content

Ant Colony Optimization

Leo Hanisch edited this page Nov 9, 2020 · 2 revisions

This repository includes an ant colony optimization algorithm for the traveling salesman problem (TSP) like Marco Dorigo, Mauro Birattari, and Thomas Stuetzle introduced in the IEEE Computational Intelligence Magazine in November 2006 (DOI: 10.1109/MCI.2006.329691).
The implementation was part of the course Natural computing for learning and optimisation at Charles University Prague in winter 2018/2019.

Features

Enables to apply the ant colony optimization algorithm to a TSP using a TSPLIB95 file and plots the result.

The algorithm solves the TSP and plots the result all n iterations.
The nodes are plot according to their coordinates read from the TSPLIB95 file. The widths of the edges indicate the amount of pheromone that is associated with this edge. If an edge is blue, it is part of the best found path.

CLI

To print all available options execute:

swarm ants -h

API

In addition to the cli you can also use the API:

from swarmlib import ACOProblem

problem = ACOProblem(ant_number=10)
path, distance = problem.solve()
problem.replay()

Example

ACO Sample