MCS shares much of its basic function with ACS. All
ACO algorithms are based on stigmergy, a process by
which ant agents leave pheromone on a graph in order
to communicate and influence other ants’ construction
of solutions. In the case of the TSP, ants communicate
and gradually improve their solutions by modifying the
amounts of pheromone on a graph of edges between
the cities of a TSP instance. At the beginning of the run,
each edge has a low initial amount of pheromone. At
the start of every iteration, the ants of each colony are
placed at random starting cities (Figure 1).
The ants construct their tours in the same way as
ants do in ACS. At each step of an ant’s tour, a random
number q between 0 and 1 is compared with a parameter
q0, where 0 < q0 < 1:
[2]
where s is the next city the ant will visit, r is the current
city the ant is on, Jk is the set of cities not yet visited
by the ant on its tour, τ is the amount of pheromone on
an edge, η is visibility, or (the length of the edge)-1, and
β is a parameter determining the relative importance of
pheromone and visibility. This rule determines whether
the ant will build its tour according to exploitation
or exploration. If q ≤ q0, the “best” edge (i.e. the one
with the highest probability of being selected) is taken.
Otherwise, S is found via the probabilistic transition rule
of AS:
[3]
where pk(r, s) is the edge between cities r and s. Informally,
shorter edges with more pheromone are more likely to
be traveled than longer edges with less pheromone.
A higher q0 thus leads to increased selection of the
“best” edges, while a lower q0 makes the selection of
other edges more likely. In MCS, the colonies can have
differing q0 values, so a high-q0 colony has a higher
probability of exploitation of the “best” edges, while low-q0 colonies’ ants are more likely to construct tours
that differ from the best-so-far tour.
After all the ants in a colony have completed their
tours for the iteration, the local pheromone update rule
is applied to an edge once for each time it was visited by
an ant that iteration:
τ(r,s)←(1-ρ)*τ(r,s)+ρ*τ0 [4]
where ρ is the pheromone decay parameter and τ0 is
the initial amount of pheromone, set to be the same for
all edges at the beginning of the run. τ0 is set as the
number of cities, multiplied by 1 / (Cnn), where Cnn is
the length of a tour constructed by a nearest-neighbor
heuristic (Figure 2).
After the application of the local pheromone update
rule, the lowest-cost, or shortest, tour of the iteration is
compared to the shortest tour the colony has recorded
since the beginning of the run. If the former is shorter
than the latter, the iteration-best tour is run through a
2-opt local search algorithm, and the resulting optimized
tour replaces the previous colony-best tour. The colonybest
tour is then allocated pheromone according to the
following global pheromone update rule:
τ(r,s)←(1-α)*τ(r,s)+α* 1/Lgb [5]
where α is a tuning parameter and Lgb is the length of
the colony-best tour. After each colony has completed
this process, it reports its colony-best tour. If a colony’s
best tour is shorter than the global-best tour across all
colonies previously recorded, it replaces the global-best
tour (Figure 3).
In each iteration, the edges of global-best tour are
allocated pheromone in all colonies according to the
same global pheromone update rule. This step allows
the colonies to share their best tours and thus work
to construct solutions in parallel. In the colony that
produced the global-best tour, the edges of the globalbest
tour are reinforced twice, while they are reinforced
once in the other colony. The above process is repeated
every iteration until the program either reaches a
predetermined number of iterations or a time limit
(Figure 4).
The algorithms tested in this experiment were all
implemented entirely by the student researcher in Java.
The trials were run on an Intel Core i5-3450 CPU at 3.10
GHz with 8 GB DDR3 RAM, within the Java Eclipse IDE.
The TSP instances tested (eil101, d198, pcb442, and
pr1002) were obtained from TSPLIB, an online library of
sample TSP instances (8).