Ant System

Any System #

Name #

Ant System, AS, Ant-based System

Taxonomy #

The Ant System is a foundational algorithm in the field of Ant Colony Optimization (ACO), which belongs to the broader category of Swarm Intelligence, a sub-field of Computational Intelligence and Biologically Inspired Computation. It is closely related to other ACO algorithms such as Ant Colony System (ACS) and Max-Min Ant System (MMAS).

  • Computational Intelligence
    • Biologically Inspired Computation
      • Swarm Intelligence
        • Ant Colony Optimization (ACO)
          • Ant System (AS)

Strategy #

The Ant System is inspired by the foraging behavior of ants, which use pheromone trails to communicate and find optimal paths between their nest and food sources. In the algorithm, artificial ants construct solutions to a given optimization problem by iteratively selecting components based on pheromone trails and heuristic information.

Solution Construction #

Each ant starts with an empty solution and iteratively adds components until a complete solution is obtained. The probability of selecting a particular component depends on the pheromone level associated with it and a problem-specific heuristic value. This allows the algorithm to balance between exploiting good solutions found in previous iterations and exploring new possibilities.

Pheromone Update #

After all ants have constructed their solutions, the pheromone trails are updated to reflect the quality of the solutions found. First, the pheromone levels are evaporated by a certain factor to simulate the natural decay of pheromones over time. Then, each ant deposits pheromone on the components it used in its solution, with the amount of pheromone proportional to the solution’s quality. This reinforces the pheromone trails associated with good solutions, making them more likely to be followed by ants in future iterations.

Iteration and Termination #

The solution construction and pheromone update steps are repeated for a predefined number of iterations or until a termination criterion is met, such as reaching a time limit or finding a solution of sufficient quality. The best solution found across all iterations is returned as the final output of the algorithm.

Procedure #

Data Structures:

  • pheromone_trails: A matrix or data structure to store the pheromone levels associated with each component or solution element.
  • heuristic_info: A matrix or data structure to store the problem-specific heuristic information for each component or solution element.


  • num_ants: The number of ants in the colony.
  • num_iterations: The maximum number of iterations to run the algorithm.
  • alpha: The importance of pheromone trails in the selection process.
  • beta: The importance of heuristic information in the selection process.
  • rho: The pheromone evaporation rate.
  • Q: A constant that determines the amount of pheromone deposited by ants.


  1. Initialize pheromone_trails with a small positive value.
  2. For iteration = 1 to num_iterations:
    1. For ant = 1 to num_ants:
      1. Construct a solution:
        1. Start with an empty solution.
        2. While the solution is not complete:
          1. Select the next component based on pheromone trails and heuristic information using a probability rule.
          2. Add the selected component to the solution.
      2. Evaluate the quality of the constructed solution.
    2. Update pheromone_trails:
      1. Evaporate pheromone trails by multiplying them by (1 - rho).
      2. For each ant:
        1. For each component in the ant’s solution:
          1. Deposit pheromone proportional to the solution’s quality, multiplied by Q.
  3. Return the best solution found across all iterations.

Considerations #


  • Inherently parallel and distributed, making it suitable for solving large-scale optimization problems.
  • Robust to changes in the problem instance and can adapt to dynamic environments.
  • Can incorporate problem-specific heuristics to improve performance.


  • Convergence speed can be slow, especially for large problem instances.
  • Requires careful tuning of parameters to balance exploration and exploitation.
  • Pheromone trails can lead to stagnation if not properly managed.

Heuristics #

Parameter Settings #

  • Set num_ants to be proportional to the problem size or complexity.
  • Choose num_iterations based on the available computational resources and desired solution quality.
  • Set alpha and beta to balance the influence of pheromone trails and heuristic information. Commonly used values are alpha = 1 and beta = 2.
  • Choose rho in the range [0.01, 0.1] to control the rate of pheromone evaporation. Higher values lead to faster convergence but may cause stagnation.
  • Set Q to a value proportional to the magnitude of the solution quality to ensure appropriate pheromone deposit levels.

Initialization and Termination #

  • Initialize pheromone trails with a small positive value to encourage initial exploration.
  • Use a combination of iteration count and solution quality improvement as termination criteria to avoid premature convergence or unnecessary computations.

Solution Construction #

  • Incorporate problem-specific heuristics in the selection process to guide ants towards promising solutions.
  • Use a probabilistic selection rule, such as the roulette wheel or the stochastic universal sampling, to balance exploration and exploitation.

Pheromone Update #

  • Apply pheromone evaporation to all trails to avoid unlimited accumulation and promote exploration of new solutions.
  • Deposit pheromone proportional to solution quality to reinforce good solutions and guide future ants.
  • Consider using additional pheromone update strategies, such as elite ant update or global best update, to intensify the search around the best solutions found.