A genetic algorithm (GA) is a metaheuristic search algorithm inspired by natural evolution. It maintains a population of candidate solutions, evaluates each by a fitness function, selects the fittest for reproduction via crossover, and introduces variation via mutation. Over many generations, the population converges toward high-quality solutions.
GAs are part of the broader field of evolutionary computation and are covered in AI courses alongside classical search methods. The N queens problem is a standard GA benchmark because:
- The solution space is a set of permutations — a well-studied GA domain.
- The fitness function (counting non-attacking pairs) is easy to compute.
- There are 92 known optimal solutions for n=8, making verification straightforward.
For a comparison with other AI approaches (hill climbing, simulated annealing, CSP), see the 8 Queens in AI guide. For classical exact solutions, see the backtracking algorithm guide.