liveBook · Manning

Swap mutation

As explained in Optimization Algorithms: AI techniques for design, planning, and control problems

A swapping operator generates a neighboring permutation by exchanging the positions or values of two elements.

Swap mutation generates a neighboring permutation by selecting two genes at random and exchanging their positions. It introduces a small perturbation while preserving a valid permutation, mainly retaining adjacency information but disrupting some of the original order. section 8.3.2

Four-city tour

For the feasible tour {1,2,4,3}, swapping cities 3 and 4 produces {1,2,3,4}; swapping 2 and 3 produces {1,3,4,2}; swapping 2 and 4 produces {1,4,2,3}. These pairwise exchanges form neighboring solutions for tabu search. section 6.2

The operator appears in permutation-based genetic algorithms and as a building block for discrete particle swarm optimization, where a velocity is represented as a sequence of swaps that transforms one city permutation into another. section 8.3.2 section 9.4

Figure 8.10 Mutation methods in permutation-based GA

Compare swap mutation with insertion, inversion, and scramble mutation to select the perturbation that best balances retained structure and disruption. section 8.3.2

How Optimization Algorithms: AI techniques for design, planning, and control problems covers it

How deep it goes
Defines the exchange and its structural effect, then works through neighbors, but does not provide direct swap-mutation code.
Examples
Uses an eight-city permutation for mutation comparisons and a four-city tour to enumerate swap-generated neighbors.
What it assumes
Assumes permutation-encoded solutions and distinguishes feasibility, adjacency, and order information.
What you can do after
Apply pairwise exchanges to generate feasible neighboring permutations and swap sequences for discrete optimization.
How it connects
Connects permutation encoding with genetic algorithms, tabu search, particle swarm optimization, and the traveling salesman problem.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Optimization Algorithms: AI techniques for design, planning, and control problems. The section links point to the parts of the book it draws on.