Part 6 · Chapter 25

Particle Swarm and Ant Colony Optimization

A genetic algorithm borrows from evolution: solutions breed, and the good ones have more children. The two methods in this chapter borrow from something faster and stranger — the coordinated behaviour of a swarm, in which individuals of no particular intelligence produce collectively intelligent results by sharing information. In particle swarm optimization, candidate solutions fly through a continuous space, pulled by their own best memory and by their neighbours' best discovery. In ant colony optimization, artificial ants build solutions step by step and leave chemical traces that bias the ants who follow. Both are population methods; neither uses recombination; each dominates a different half of the optimization world.

Optimization Techniques Prof. Mithun Mondal Reading time ≈ 55 min
i What you'll learn
  • What swarm intelligence is, and the two ways a swarm shares information — social learning and stigmergy.
  • The PSO velocity and position updates, and the meaning of the inertia, cognitive and social terms.
  • Inertia schedules, velocity clamping, the constriction factor, and why swarms stagnate.
  • Topologies — how \(gbest\) and \(lbest\) trade convergence speed against diversity.
  • The Ant System: the pheromone–visibility transition rule, deposit and evaporation.
  • The ACS and MAX–MIN variants, and when to reach for PSO, ACO, or a GA.
Section 25-1

Swarm Intelligence

A single ant is nearly mindless. It has poor eyesight, no map, no plan, and no conception of the colony's goal. Yet a colony reliably discovers the shortest route to a food source, and does so without any ant ever comparing two routes. A flock of starlings turns as one without a leader. This is swarm intelligence: complex, apparently purposeful global behaviour emerging from simple local rules, applied by many individuals, with no central control.

For an optimizer the appeal is obvious. If a colony can solve a shortest-path problem it cannot even perceive, using rules simple enough to write in three lines, then those rules are worth stealing. Two mechanisms do the work, and the distinction between them is exactly the distinction between the two algorithms in this chapter.

MechanismHow information travelsBiological originalAlgorithm
Social learningIndividuals observe each other and are attracted toward what others have foundBirds flocking, fish schoolingParticle swarm optimization
StigmergyIndividuals modify the environment; later individuals read the modificationAnts laying pheromone trailsAnt colony optimization

Stigmergy — coined by Grassé in 1959 for termite mound-building — deserves the emphasis, because it is the more radical idea. The ants never communicate with one another at all. They communicate with the ground, and the ground remembers. Information persists after its author has gone, accumulates when many agree, and fades when unreinforced. That is a shared memory external to every individual, and it is a genuinely different way to build an algorithm.

Both methods are population-based, so both inherit the strengths Chapter 23 attributed to that class: many regions sampled at once, trivial parallelism, robustness to ruggedness. But note what they do not inherit from Chapter 24. Neither method has crossover; neither kills anyone. A GA's population is a gene pool that turns over every generation. A swarm's population is a fixed cast of individuals that persist for the whole run and merely change what they know.

Where each one lives. PSO moves points through a continuous space by adding a velocity — an operation that requires \(\mathbf{x} + \mathbf{v}\) to mean something, which restricts it naturally to \(\mathbb{R}^n\). ACO builds a solution one discrete decision at a time, guided by a table of numbers on the decision graph — which restricts it naturally to combinatorial problems. The division of labour is not an accident of history: it follows from the representation each method assumes. Reach for PSO to tune continuous parameters; reach for ACO to order, route, or assign.
Section 25-2

The Particle Swarm Algorithm

Kennedy and Eberhart introduced PSO in 1995 after trying to simulate a flock of birds and noticing that the simulation, pointed at an objective function, optimised it. A swarm of \(N\) particles flies through \(\mathbb{R}^n\). Particle \(i\) carries three things: where it is, how fast it is going, and the best place it has personally ever been.

SymbolNameMeaning
\(\mathbf{x}_i^k\)PositionA candidate solution — the design vector itself
\(\mathbf{v}_i^k\)VelocityThe step to be added this iteration; the particle's momentum and direction
\(\mathbf{p}_i\)Personal best (\(pbest\))The best position particle \(i\) has visited so far — its private memory
\(\mathbf{g}\)Global best (\(gbest\))The best position any particle has visited — the shared memory

Each iteration, every particle updates its velocity from three influences and then moves. These two lines are the entire algorithm:

🔑
The PSO update equations
\[ \mathbf{v}_i^{k+1} = \underbrace{w\,\mathbf{v}_i^{k}}_{\text{inertia}} + \underbrace{c_1 r_1 \left(\mathbf{p}_i - \mathbf{x}_i^{k}\right)}_{\text{cognitive}} + \underbrace{c_2 r_2 \left(\mathbf{g} - \mathbf{x}_i^{k}\right)}_{\text{social}} \]

\[ \mathbf{x}_i^{k+1} = \mathbf{x}_i^{k} + \mathbf{v}_i^{k+1} \]

with \(r_1, r_2 \sim U(0,1)\) drawn afresh for every particle, every dimension, every iteration. That per-component randomness is essential — it is the swarm's only source of diversity.

The full procedure is then short enough to state completely:

  1. Initialise \(N\) particles with random positions across the search domain and small random velocities.
  2. Evaluate \(f(\mathbf{x}_i)\) for every particle.
  3. Update \(\mathbf{p}_i\) if the particle's current position beats its own record; update \(\mathbf{g}\) if it beats the swarm's.
  4. Update every velocity by the equation above, clamping to \(\pm\mathbf{v}_{\max}\) if used.
  5. Move every particle: \(\mathbf{x}_i \leftarrow \mathbf{x}_i + \mathbf{v}_i\). Repair any particle that has left the feasible box.
  6. Repeat from step 2 until the evaluation budget is spent or the swarm stops improving. Report \(\mathbf{g}\).

Compare this to a genetic algorithm and the economy is striking. There is no encoding — a particle is the design vector, in the units the engineer already uses. There is no selection, no crossover, no mutation, and nothing dies. The whole method is a difference equation, which is also why PSO has been analysed far more successfully than most metaheuristics: it is a linear dynamical system with stochastic coefficients, and its stability can be studied directly.

Section 25-3

Inertia, Cognitive & Social Terms

The velocity update earns its behaviour from the tension between its three terms. Read each as a separate opinion about where the particle should go, with the sum a compromise.

TermSaysContributesIf dominant
Inertia \(w\mathbf{v}_i\)"Keep going the way you were going"Momentum — carries the particle across barriers and past the pull of the bestsThe swarm flies off and never settles
Cognitive \(c_1r_1(\mathbf{p}_i - \mathbf{x}_i)\)"Return to the best you have found"Individual memory; nostalgia — a spring anchored at \(\mathbf{p}_i\)Particles search independently; no cooperation at all
Social \(c_2r_2(\mathbf{g} - \mathbf{x}_i)\)"Go where the swarm's best is"Cooperation — the channel through which discovery spreadsAll particles collapse onto \(\mathbf{g}\); premature convergence

The cognitive and social terms are literally spring forces: each pulls the particle toward an attractor with a strength proportional to the distance, so a particle far from \(\mathbf{g}\) is yanked hard while one already there feels nothing. Without inertia the particle would be over-damped and simply slide to a point between \(\mathbf{p}_i\) and \(\mathbf{g}\). Inertia makes it overshoot — and overshoot is what lets the swarm explore past its own best guesses instead of collapsing onto them. A particle that always stopped exactly where the springs balanced would learn nothing new.

xᵢ pᵢ g w·v c₁r₁(pᵢ−xᵢ) c₂r₂(g−xᵢ) v new
The velocity update as a vector sum
nest food long path — trail fades short path — trail reinforced shorter trip ⇒ more round trips ⇒ more pheromone
Stigmergy: the double-bridge experiment
Section 25-4

Parameters, Topology & Stagnation

PSO has few parameters, and each is a direct handle on the exploration–exploitation dial of Section 23-4.

ParameterRoleTypical valueEffect of increasing
\(w\)Inertia weight\(0.9 \to 0.4\), linearly decreasingMore exploration; above \(\approx 1\) the swarm diverges
\(c_1\)Cognitive coefficient\(2.0\) (or \(1.49\))More independent search; less cooperation
\(c_2\)Social coefficient\(2.0\) (or \(1.49\))Faster convergence; more risk of collapse
\(N\)Swarm size\(20\)–\(50\)Better coverage; proportionally more evaluations
\(v_{\max}\)Velocity clamp\(0.1\)–\(0.2\) of the domain rangeLonger jumps allowed; too large and particles fly out of the domain

The inertia schedule is the workhorse. Shi and Eberhart's linear rule, \(w_k = w_{\max} - (w_{\max}-w_{\min})\,k/K\), starts the swarm loose and wide and finishes it tight and local — the exploration-to-exploitation slide made into arithmetic, exactly as the cooling schedule does for simulated annealing in Chapter 26.

The alternative is Clerc and Kennedy's constriction factor, which arrives at damping by analysis rather than by schedule. Treat the particle as a linear system and ask what keeps it stable; the answer is to multiply the whole velocity by a factor \(\chi\):

Constriction factor
\[ \mathbf{v}_i^{k+1} = \chi\Big[\mathbf{v}_i^{k} + c_1r_1(\mathbf{p}_i - \mathbf{x}_i^{k}) + c_2r_2(\mathbf{g} - \mathbf{x}_i^{k})\Big], \qquad \chi = \frac{2}{\left|\,2 - \varphi - \sqrt{\varphi^2 - 4\varphi}\,\right|}, \quad \varphi = c_1 + c_2 > 4 \]

The canonical choice \(\varphi = 4.1\) gives \(\chi = 0.7298\), and the method then needs no velocity clamp at all — convergence is guaranteed by the algebra rather than enforced by a cap. It is also, as Example 2 shows, algebraically identical to the inertia form with \(w = 0.7298\) and \(c_1 = c_2 = 1.4962\). The two "competing" formulations are the same equation.

The other design choice is topology: who counts as "the swarm" in the social term. Using the true global best (\(gbest\)) makes every particle a neighbour of every other; using a ring in which each particle sees only two neighbours (\(lbest\)) lets good news travel slowly, so different parts of the swarm can explore different basins for a while.

gbest — fully connected news reaches everyone at once fast convergence · low diversity lbest — ring news spreads one hop per iteration slow convergence · high diversity the topology decides how fast a discovery becomes everyone's assumption
Swarm topologies: how fast good news travels

That framing explains PSO's characteristic failure. Suppose the swarm converges: every particle sits on \(\mathbf{g}\), so \(\mathbf{p}_i = \mathbf{g} = \mathbf{x}_i\) and both spring terms vanish identically. The update degenerates to \(\mathbf{v}_i^{k+1} = w\mathbf{v}_i^{k}\) — a geometric decay to zero for any \(w < 1\). The swarm freezes, permanently, wherever it happens to be, whether or not that place is any good.

🔑
Stagnation
\[ \mathbf{p}_i = \mathbf{g} = \mathbf{x}_i \ \ \forall i \quad\Longrightarrow\quad \mathbf{v}_i^{k+1} = w\,\mathbf{v}_i^{k} \ \longrightarrow\ \mathbf{0} \]

Collapse is self-reinforcing and irreversible: with no diversity there is no force, and with no force there is no diversity. This is why an \(lbest\) ring, a larger \(w\), or a re-diversification trigger matters — a converged swarm cannot restart itself.

Section 25-5

Stigmergy & the Double Bridge

The experiment that founded ACO is worth describing exactly, because the algorithm is a direct transcription of it. Goss and colleagues connected an Argentine ant nest to a food source by two bridges, one twice as long as the other, and watched. Ants leaving the nest initially chose at random — they cannot see the food and have no way to measure a bridge. Within minutes, almost the entire colony was using the short bridge.

No ant compared the two. The mechanism is entirely mechanical: ants lay pheromone as they walk, and ants prefer paths with more pheromone. An ant taking the short bridge reaches the food and returns sooner, so its trail is laid down twice while a long-bridge ant is still travelling. The short bridge therefore accumulates pheromone faster; the higher concentration attracts more ants; more ants lay more pheromone. It is autocatalysis — a positive feedback loop in which the difference in trip time is amplified into a difference in choice.

🔑
Stigmergy
Indirect coordination through a persistent, decaying trace left in a shared environment

The pheromone table is a memory that no individual owns: it survives the ants who wrote it, sums the opinions of many, and forgets what is not reinforced. Positive feedback discovers a good path; evaporation is what stops the first accidental consensus from becoming permanent.

Both halves of that last sentence matter. Feedback without forgetting locks in whatever the first few ants did — and in the real experiment, if the short bridge is added only after the colony has committed to the long one, the ants never switch, because their pheromone does not evaporate fast enough. Artificial ants, unbound by chemistry, are given an evaporation rate we control. Evaporation is not a modelling detail; it is the exploration mechanism, and Example 6 measures exactly how long the colony's memory lasts.

Section 25-6

The Ant System

Dorigo's Ant System (1992) turns the bridge into an algorithm. Take the TSP as the standard vehicle. Each edge \((i,j)\) of the city graph carries a pheromone level \(\tau_{ij}\), which the colony writes, and a visibility \(\eta_{ij} = 1/d_{ij}\), which the problem provides and never changes. Each ant builds a complete tour by walking the graph, choosing its next city probabilistically from those it has not yet visited.

🔑
The transition rule
\[ p_{ij}^{k} = \frac{\left[\tau_{ij}\right]^{\alpha}\left[\eta_{ij}\right]^{\beta}}{\displaystyle\sum_{l \,\in\, N_i^{k}} \left[\tau_{il}\right]^{\alpha}\left[\eta_{il}\right]^{\beta}}, \qquad j \in N_i^{k} \]

Ant \(k\) at city \(i\) moves to \(j\) with this probability, where \(N_i^k\) is its set of unvisited cities. The exponents are the whole design: \(\alpha\) weights learned experience (pheromone), \(\beta\) weights problem knowledge (short edges). The denominator merely normalises over the legal moves.

The two exponents deserve to be read as a dial of their own. Set \(\alpha = 0\) and pheromone is ignored — the ants become a randomised nearest-neighbour heuristic that learns nothing. Set \(\beta = 0\) and distance is ignored — the colony learns from experience alone, converging slowly and often badly. Typical settings \(\alpha = 1\), \(\beta \in [2,5]\) say something quietly important: trust the problem's own structure more than your accumulated opinion, at least at first.

Once every ant has completed a tour, the colony writes to the environment. This happens in two steps, and their order matters: everything evaporates, then the ants deposit in proportion to how good their tours were.

Evaporation and deposit
\[ \tau_{ij} \leftarrow (1-\rho)\,\tau_{ij} + \sum_{k=1}^{m} \Delta\tau_{ij}^{k}, \qquad \Delta\tau_{ij}^{k} = \begin{cases} \dfrac{Q}{L_k}, & \text{if ant } k \text{ used edge } (i,j) \\[8pt] 0, & \text{otherwise} \end{cases} \]

Here \(L_k\) is the length of ant \(k\)'s tour, \(Q\) a constant, and \(\rho \in (0,1]\) the evaporation rate. The deposit \(Q/L_k\) is the mechanism that replaces the real ants' round-trip timing: a shorter tour is a larger deposit, so good solutions shout louder — and an edge on many good tours gets reinforced many times over. Meanwhile \((1-\rho)\) applies to every edge, including those no ant chose, so unused edges fade geometrically toward irrelevance and old mistakes are forgotten.

The full loop is therefore: initialise all \(\tau_{ij}\) to a small constant \(\tau_0\); let \(m\) ants each construct a tour by the transition rule; evaporate; deposit; record the best tour seen; repeat. Note that ACO fills the generic framework of Section 23-7 in an unusual way — its "generate" step constructs solutions from nothing each iteration rather than perturbing existing ones, and its memory lives entirely in \(\boldsymbol{\tau}\).

Where the search actually happens. A GA's population carries the search state, and a swarm's particles carry it. In ACO the ants carry nothing at all — they are discarded at the end of every iteration. All accumulated knowledge sits in the pheromone matrix, which is why ACO is the purest example of stigmergy in this book: the algorithm's memory is a property of the graph, not of any agent walking it.
Section 25-7

ACO Variants & Method Comparison

Plain Ant System is rarely competitive today; it is the ancestor everything else refines. Each descendant attacks the same weakness — too little intensification, or too much.

VariantChange from Ant SystemPurpose
Elitist ASThe best-so-far tour deposits extra pheromone every iterationStronger intensification around the incumbent
Rank-based ASOnly the top few ants deposit, weighted by rankSuppresses the noise of poor tours
Ant Colony System (ACS)Pseudorandom-proportional rule: with probability \(q_0\) take the greedy best edge, else sample; only the best ant updates; a local rule lowers \(\tau\) on edges as they are usedSharper exploitation, with the local rule pushing later ants onto different edges
MAX–MIN AS (MMAS)Only the best ant deposits; \(\tau\) is clamped to \([\tau_{\min}, \tau_{\max}]\); trails initialised at \(\tau_{\max}\)The clamp makes it impossible for any edge's probability to reach zero — stagnation is structurally prevented

MMAS is the most instructive. Its bounds are a direct admission of ACO's characteristic failure mode, the exact mirror of PSO's: runaway positive feedback drives \(\tau\) on one tour's edges so high that every other edge's transition probability rounds to zero, and the colony can never construct anything different again. Clamping \(\tau\) below by \(\tau_{\min}\) guarantees a floor on the probability of every edge forever — exploration by fiat.

With three population methods now on the table, the comparison that matters is which to reach for.

Genetic algorithm (Ch. 24)Particle swarmAnt colony
Natural domainEither, via encodingContinuous \(\mathbb{R}^n\)Combinatorial / graph problems
A solution isA chromosome (encoded)A position (the design vector itself)A path constructed edge by edge
Memory lives inThe population's gene poolEach particle's \(\mathbf{p}_i\), plus \(\mathbf{g}\)The pheromone matrix \(\boldsymbol{\tau}\)
New solutions fromCrossover + mutationVelocity update (no recombination)Probabilistic construction from scratch
Key parameters\(N\), \(p_c\), \(p_m\)\(w\), \(c_1\), \(c_2\)\(\alpha\), \(\beta\), \(\rho\), \(m\)
Fails byLoss of diversity in the gene poolStagnation: velocities decay to zeroPheromone lock-in on one tour
Typical useMixed or awkwardly structured spacesTuning controllers, weights, geometryRouting, scheduling, assignment

Notice how the last two rows rhyme. All three methods die of the same disease — the population agrees with itself and stops generating anything new — and all three treatments (mutation, inertia, evaporation) are devices for manufacturing disagreement. That is the through-line of Part 6: a population method's real parameter is how vigorously it resists its own consensus.

Section 25-8

Worked Examples

1 One PSO iteration by hand

Problem. Minimise \(f(x,y) = x^2 + y^2\). A particle is at \(\mathbf{x} = (2, 5)\) with velocity \(\mathbf{v} = (1, -1)\), personal best \(\mathbf{p} = (3, 4)\), and the swarm's best is \(\mathbf{g} = (1, 1)\). Take \(w = 0.7\), \(c_1 = c_2 = 1.5\), and suppose the draws are \(r_1 = 0.4\), \(r_2 = 0.3\). Find the new position.

Solution. Build the three terms separately. Inertia: \(0.7(1,-1) = (0.7,\,-0.7)\). Cognitive: \(c_1r_1(\mathbf{p}-\mathbf{x}) = 0.6\,\big((3,4)-(2,5)\big) = 0.6(1,-1) = (0.6,\,-0.6)\). Social: \(c_2r_2(\mathbf{g}-\mathbf{x}) = 0.45\,\big((1,1)-(2,5)\big) = 0.45(-1,-4) = (-0.45,\,-1.8)\). Summing, \(\mathbf{v}^{\text{new}} = (0.7+0.6-0.45,\ -0.7-0.6-1.8) = (0.85,\,-3.1)\), and \(\mathbf{x}^{\text{new}} = (2,5) + (0.85,-3.1) = (2.85,\ 1.9)\). Then \(f\) falls from \(29\) to \(2.85^2 + 1.9^2 = 11.73\), which also beats the personal best \(f(\mathbf{p}) = 25\), so \(\mathbf{p} \leftarrow (2.85, 1.9)\). Observe the \(y\)-component: all three terms pulled downward and agreed, producing a large step, while in \(x\) the social term partly cancelled the other two. The particle is now closer to \(\mathbf{g}\) but has not landed on it — the inertia carried it past where the springs alone would have stopped.

2 Constriction is inertia in disguise

Problem. Compute \(\chi\) for the canonical \(\varphi = 4.1\), and show the constriction form is the inertia form with particular constants.

Solution. \(\varphi^2 - 4\varphi = 16.81 - 16.4 = 0.41\), so \(\sqrt{0.41} = 0.6403\). Then \(2 - \varphi - \sqrt{\varphi^2-4\varphi} = 2 - 4.1 - 0.6403 = -2.7403\), and \(\chi = 2/|-2.7403| = 0.7298\). Now expand the constriction update: \(\mathbf{v} \leftarrow \chi\mathbf{v} + \chi c_1r_1(\mathbf{p}-\mathbf{x}) + \chi c_2r_2(\mathbf{g}-\mathbf{x})\). This is exactly the inertia form with \(w = \chi = 0.7298\) and effective coefficients \(\chi c_1 = 0.7298 \times 2.05 = 1.4962\). So the famous "standard PSO" settings \(w = 0.729\), \(c_1 = c_2 = 1.494\) are not tuned constants at all — they are the constriction analysis, rewritten. Two formulations that appear to compete in the literature are one equation.

3 How fast does a stagnant swarm freeze?

Problem. A swarm has fully converged: every \(\mathbf{p}_i = \mathbf{g} = \mathbf{x}_i\). With \(w = 0.7\), what fraction of its velocity remains after 20 iterations? Compare \(w = 0.4\) and \(w = 0.9\).

Solution. Both spring terms are identically zero, so \(\mathbf{v}^{k} = w^{k}\mathbf{v}^{0}\). After 20 iterations: \(0.7^{20} = 7.98\times10^{-4}\) — the swarm is motionless, retaining under a tenth of a percent of its speed. At \(w = 0.4\): \(0.4^{20} = 1.1\times10^{-8}\), frozen almost instantly. At \(w = 0.9\): \(0.9^{20} = 0.122\), still drifting at 12% — which is why a decreasing schedule ends near \(0.4\) only at the end of the run. The lesson is structural: the decay is geometric and the state is absorbing. Once diversity is gone the algorithm has no mechanism to recover it, so the cure must be prevention — a ring topology, or a restart trigger on \(\lVert\mathbf{v}\rVert\).

4 An ant chooses its next city

Problem. An ant sits at city 1 with unvisited cities \(\{2,3,4\}\). Pheromones are \(\tau_{12} = 1.0\), \(\tau_{13} = 2.0\), \(\tau_{14} = 0.5\); distances are \(d_{12} = 10\), \(d_{13} = 20\), \(d_{14} = 5\). Find the transition probabilities for \(\alpha = 1, \beta = 2\), and again for \(\alpha = 1, \beta = 0\).

Solution. Visibilities: \(\eta_{12} = 0.1\), \(\eta_{13} = 0.05\), \(\eta_{14} = 0.2\). With \(\alpha=1,\beta=2\) the numerators \(\tau\eta^2\) are: city 2, \(1.0(0.01) = 0.01\); city 3, \(2.0(0.0025) = 0.005\); city 4, \(0.5(0.04) = 0.02\). Sum \(= 0.035\), so \(p_{12} = 0.286\), \(p_{13} = 0.143\), \(p_{14} = 0.571\). City 4 is the favourite despite having the least pheromone, because it is very close and \(\beta = 2\) squares that advantage. Now set \(\beta = 0\): the numerators are just \(\tau\), giving \(1.0, 2.0, 0.5\) over a sum of \(3.5\) — so \(p_{12} = 0.286\), \(p_{13} = 0.571\), \(p_{14} = 0.143\). The favourite flips to city 3, purely on accumulated opinion. Same state, opposite decision: \(\beta\) sets how much the colony trusts the problem over its own history.

5 A pheromone update

Problem. Three ants complete tours of lengths \(L_1 = 100\), \(L_2 = 80\), \(L_3 = 120\). Ants 1 and 3 used edge \((1,2)\); none used edge \((3,4)\). With \(\tau_{12} = \tau_{34} = 2.0\), \(Q = 100\), \(\rho = 0.5\), update both edges.

Solution. Deposit on \((1,2)\): \(\Delta\tau_{12} = Q/L_1 + Q/L_3 = 100/100 + 100/120 = 1 + 0.833 = 1.833\). Then \(\tau_{12} \leftarrow (1-0.5)(2.0) + 1.833 = 1.0 + 1.833 = 2.833\) — reinforced by 42%. Edge \((3,4)\) receives nothing: \(\tau_{34} \leftarrow 0.5(2.0) = 1.0\), halved. Note what ant 2 did: it had the best tour (\(L_2 = 80\), worth \(1.25\) per edge) but avoided edge \((1,2)\), so its opinion counted against that edge by omission. Note also the asymmetry in the arithmetic — a single iteration widened the ratio \(\tau_{12}/\tau_{34}\) from \(1\) to \(2.83\). That is autocatalysis at work, and it is why \(\rho\) must be chosen with care: this gap compounds every iteration.

6 How long is the colony's memory?

Problem. An edge stops being used. Define the pheromone half-life as the number of iterations for \(\tau\) to fall to half its value. Compute it for \(\rho = 0.1\), \(\rho = 0.5\), and \(\rho = 0.02\).

Solution. With no deposit, \(\tau^{k} = (1-\rho)^{k}\tau^{0}\), so the half-life solves \((1-\rho)^{k} = 0.5\), i.e. \(k_{1/2} = \ln(0.5)/\ln(1-\rho)\). For \(\rho = 0.1\): \(k_{1/2} = -0.693/-0.105 = 6.6\) iterations. For \(\rho = 0.5\): \(k_{1/2} = 1\) exactly — the colony forgets almost everything each round, which is nearly random restarting. For \(\rho = 0.02\): \(k_{1/2} = -0.693/-0.0202 = 34.3\) iterations — a long memory, better for a rugged problem where an early consensus is likely to be wrong, at the cost of much slower convergence. So \(\rho\) is not an incidental constant: it is the colony's forgetting rate, and hence its position on the exploration–exploitation dial, precisely as \(w\) is for PSO and \(T\) for annealing.

Review

Chapter Summary

Swarm intelligence

Global competence from simple local rules — via social learning (PSO) or stigmergy, a decaying trace in a shared environment (ACO).

PSO in two lines

\(\mathbf{v} \leftarrow w\mathbf{v} + c_1r_1(\mathbf{p}_i - \mathbf{x}) + c_2r_2(\mathbf{g} - \mathbf{x})\), then \(\mathbf{x} \leftarrow \mathbf{x} + \mathbf{v}\). No encoding, no crossover, nothing dies.

Three terms

Inertia explores and overshoots; the cognitive spring pulls to \(\mathbf{p}_i\); the social spring pulls to \(\mathbf{g}\) and spreads discovery.

Tuning & stagnation

\(w: 0.9 \to 0.4\), or \(\chi = 0.7298\) at \(\varphi = 4.1\) — the same equation. Once \(\mathbf{p}_i = \mathbf{g} = \mathbf{x}_i\), velocity decays as \(w^k\) and the swarm is dead.

The Ant System

Construct by \(p_{ij} \propto \tau_{ij}^{\alpha}\eta_{ij}^{\beta}\), then evaporate and deposit \(Q/L_k\) — shorter tours shout louder; \(\alpha\) weights memory, \(\beta\) weights distance.

Choosing

PSO for continuous tuning, ACO for routing and scheduling, GA for awkward encodings. All three die of consensus; \(w\), \(\rho\) and \(p_m\) are the antidotes.

Practice

Problems

For the PSO problems, always build the three terms separately before summing. For the ACO problems, compute \(\tau^{\alpha}\eta^{\beta}\) for every candidate before normalising. Difficulty rises down the list.

  1. Define swarm intelligence, and distinguish social learning from stigmergy with one example of each.
  2. Write the PSO velocity and position updates, and name the role of each of the three terms in the velocity equation.
  3. A particle is at \((4, -2)\) with \(\mathbf{v} = (-1, 2)\), \(\mathbf{p} = (3, 0)\), \(\mathbf{g} = (0, 0)\). With \(w = 0.8\), \(c_1 = c_2 = 2\), \(r_1 = 0.5\), \(r_2 = 0.25\), find \(\mathbf{v}^{\text{new}}\) and \(\mathbf{x}^{\text{new}}\), and state whether the particle improved on \(f = x^2 + y^2\).
  4. Explain why \(r_1\) and \(r_2\) must be redrawn for every particle and every dimension, rather than once per iteration. What would break otherwise?
  5. Using \(w_k = w_{\max} - (w_{\max}-w_{\min})k/K\) with \(w_{\max} = 0.9\), \(w_{\min} = 0.4\), \(K = 1000\), find \(w\) at \(k = 0, 250, 500, 1000\), and relate the trend to the exploration–exploitation dial.
  6. Compute the constriction factor \(\chi\) for \(\varphi = 4.05\) and \(\varphi = 4.5\), and comment on what happens as \(\varphi \to 4^{+}\).
  7. Show that if \(\mathbf{p}_i = \mathbf{g} = \mathbf{x}_i\) for all \(i\), the swarm can never recover, and give two design measures that prevent this.
  8. Contrast the \(gbest\) and \(lbest\) topologies in terms of convergence speed and diversity. On a highly multimodal problem, which would you choose, and why?
  9. Describe the double-bridge experiment and explain, without reference to any ant comparing paths, why the short bridge wins.
  10. An ant at city 1 may go to cities 2, 3 or 4 with \(\tau = (3.0,\ 1.0,\ 2.0)\) and \(d = (4,\ 2,\ 8)\). Compute the transition probabilities for \((\alpha,\beta) = (1,2)\), \((2,2)\), and \((1,5)\), and explain the trend.
  11. Four ants have tour lengths \(90, 110, 70, 130\). Ants 2, 3 and 4 used edge \((5,6)\), whose pheromone is \(1.5\). With \(Q = 100\) and \(\rho = 0.3\), compute the updated \(\tau_{56}\), and separately the value of an edge used by nobody.
  12. Derive the pheromone half-life \(k_{1/2} = \ln(0.5)/\ln(1-\rho)\), and find the \(\rho\) that gives a half-life of exactly 10 iterations.
  13. MAX–MIN AS clamps \(\tau \in [\tau_{\min}, \tau_{\max}]\). Explain precisely which failure mode the lower bound prevents, and identify the corresponding failure mode and remedy in PSO.
  14. You must (a) tune the six gains of a cascade controller against a SPICE simulation, and (b) route a delivery fleet over 60 stops. Choose a method from Chapters 24–26 for each, and justify your choice by the representation each method assumes.
Tip: both algorithms in this chapter are best understood through their failure modes, because that is where the parameters reveal what they are for. Ask of PSO: what happens when every particle reaches \(\mathbf{g}\)? Both springs vanish, velocity decays as \(w^k\), and the swarm freezes at a point nobody chose. Ask of ACO: what happens when one tour's edges get all the pheromone? Every other transition probability rounds to zero and the colony can never build anything else. The two questions have the same answer — consensus is fatal — and every parameter you will ever tune is a device for delaying it. The inertia weight, the evaporation rate, the ring topology, the MAX–MIN clamp, and the mutation rate of Chapter 24 are five names for one idea: keep the population disagreeing until the budget runs out.