liveBook · Manning

Tour

As explained in Grokking AI Algorithms, Second Edition

A tour is a complete route constructed by an ant through the locations or attractions of a routing problem.

A tour is a complete route in which an ant visits every location or attraction once. It records the sequence of visits and the total distance traveled. section 6.7 section 6.9

Ant colony optimization constructs tours incrementally. At each step, an ant chooses an unvisited destination using pheromone strength, a distance-based heuristic, and probabilistic selection; completing one tour contributes one iteration. section 6.7 section 6.4

A tour fits into the ACO lifecycle as follows:

  • Start each ant at an attraction and repeatedly choose among destinations it has not visited. section 6.4
  • Stop extending the route when every attraction has been visited once. section 6.7
  • Compare completed tours by total distance and retain the shortest as the best solution. section 6.9
  • Repeat tours across iterations while pheromone trails are updated and the stopping condition remains unmet. section 6.4

Carnival attractions

For six attractions, one optimal tour visits the swings, Ferris wheel, circus, carousel, balloons, and bumper cars. With more attractions, comparing every possible tour becomes increasingly expensive, making ACO useful for searching for a short route. section 6.2

Figure 6.11 The ACO algorithm life cycle
06_11

The lifecycle diagram shows where tour construction, completion checks, pheromone updates, best-tour selection, and termination fit together. section 6.4

How Grokking AI Algorithms, Second Edition covers it

How deep it goes
Explains construction, unvisited-destination constraints, distance comparison, and iteration, while deferring broader route theory.
Examples
Demonstrates tours with carnival attractions, an optimal six-stop sequence, distance tables, and Python selection and evaluation routines.
What you can do after
Apply it via Python to construct candidate routes, measure their distances, and retain the shortest completed tour.
How it connects
Connects tours to ant colony optimization, pheromone trails, heuristics, probabilistic selection, and brute-force search.

Also explained in

Compare how 2 books explain tour →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Grokking AI Algorithms, Second Edition. The section links point to the parts of the book it draws on.