AI Glossary / Graphs and symbolic AI / Intermediate

Genetic algorithms

Definition

Genetic algorithms are population-based search methods inspired by biological evolution. They repeatedly evaluate candidate solutions, select parents and create new candidates through operations such as crossover and mutation, seeking better solutions according to a defined objective.

What it means

The candidates are possible answers to a problem, not necessarily biological data. A candidate might encode a schedule, a set of selected features or a collection of design settings. The representation is often called a chromosome, and its components are called genes.

Fitness expresses how useful a candidate is under the chosen evaluation. Selection favors candidates according to that evaluation, while variation explores alternatives. The details differ across implementations: a genetic algorithm is a family of methods, not one fixed recipe.

Finding a high-scoring candidate means success against the implemented objective and constraints. It does not automatically prove global optimality or show that the objective fully captures the real task.

How it works

Choose a representation, an evaluation procedure and a way to enforce constraints. Create an initial population, evaluate it and select parents. Crossover combines parts of parents, while mutation introduces changes to individual candidates.

Evaluate the resulting offspring and decide which candidates form the next population. Some methods retain selected strong candidates unchanged, a practice called elitism. Continue until a budget, stopping criterion or satisfactory result is reached.

Operators must suit the representation. Swapping arbitrary segments of a route can create duplicate visits unless the operator or repair procedure handles them. In software libraries, modified candidates also need fresh evaluations; their parents' fitness values may no longer describe them. Maintaining diversity can help avoid searching only a narrow region too early.

Three practical examples

  • A planning team searches alternative task assignments when the objective includes complicated combinations of delays and preferences.
  • A model-development experiment searches subsets of input features, evaluating candidates with a properly separated validation procedure.
  • An engineering study explores design settings using a simulator as its fitness evaluator.

Think of it this way

Think of testing a collection of draft recipes, keeping useful ideas and trying recombinations or small changes in the next round. Each round is judged against a chosen taste test.

The analogy describes variation and selection. Software candidates are evaluated by explicit procedures, and a favorable score may reflect a flawed test. Genetic algorithms do not reproduce the full biology of evolution.

Worked example

Following crossover, mutation and a constraint

Suppose four optional project tasks have values 6, 5, 4 and 3, and require 4, 3, 2 and 2 hours. The total time budget is 7 hours. Encode selection as four bits, where 1 means include that task.

Parent 1100 selects the first two tasks: value 11, time 7. Parent 0011 selects the last two: value 7, time 4. Both are feasible.

One-point crossover after the second bit can produce children 1111 and 0000. The first has value 18 but requires 11 hours, so it violates the budget. The second has value 0 and time 0. Neither is automatically an improvement over its parents.

A mutation of 1111 that flips its first bit produces 0111. This candidate has value 5 + 4 + 3 = 12 and time 3 + 2 + 2 = 7, so it is feasible and improves on the stated parents.

This is one possible variation sequence, not a promise that the algorithm will produce it. Constraint handling determines how infeasible 1111 is treated, and a complete run needs a defined population update and stopping rule.

Illustrative case study

The fictional Birch Planning team prototypes a genetic algorithm for selecting optional maintenance tasks. An early fitness function rewards task value but subtracts only a small penalty for exceeding available hours.

The strongest-looking candidates repeatedly exceed the schedule limit. Reviewers make feasibility explicit and compare the search with a simple baseline and, for small examples, exhaustive enumeration. They also repeat runs with different random seeds to examine variation in the returned solutions.

Birch records the best feasible candidate found within its evaluation budget. It does not label that result globally optimal merely because progress has stalled. The case illustrates objective design and evidence reporting rather than a documented reduction in maintenance costs.

Common misconceptions and mistakes

  • Genetic algorithms require DNA data. The genetic terminology describes the search mechanism and representation.
  • Crossover always improves a solution. Recombination can produce inferior or infeasible candidates.
  • A high fitness score proves the business objective is met. Fitness reflects only the objective and constraints actually implemented.
  • No improvement for several generations proves optimality. The search may have stagnated without exploring better regions.

Business use

These methods can be useful when candidate evaluation is available but conventional optimization is difficult to apply. Their practicality depends heavily on evaluation cost: a population across many generations may require substantial computation or simulation time.

Use an agreed budget and compare with alternatives appropriate to the problem, including simpler search, local optimization or exact methods for smaller instances. Report feasibility, objective value, run-to-run variation and the evaluation budget together. For noisy evaluations, a candidate's apparent advantage may need repeated measurement. Reproducible seeds help investigations, but a single reproducible run does not establish robust performance.

People also ask

Do genetic algorithms need derivatives?

Standard variants do not require gradient information, although hybrid methods can combine evolutionary and gradient-based techniques.

Are they the same as genetic programming?

They share evolutionary ideas. Genetic programming evolves executable expressions or programs, while genetic algorithms often use other candidate encodings.

Is the fittest candidate always retained?

Only if the chosen replacement or elitism policy preserves it; this is an algorithm design choice.

Check your understanding

Why is child 1111 not the best valid answer in the worked example, despite its value of 18?

Answer: It requires 11 hours and violates the 7-hour budget. Value alone is insufficient; the candidate must satisfy the task's constraint.

Related terms

  • Evolutionary computation
  • Fitness function
  • Mutation
  • Selection
  • Elitism
  • Genetic programming
  • chromosome
  • crossover

Learn next

Enumerate the 16 bit strings in the four-task example and identify the best feasible value. Compare that known answer with the candidates in the worked sequence, then explain what an evaluation budget would mean for a much larger problem.

More in Graphs and symbolic AI

  • Generalization hierarchy - A generalization hierarchy organizes concepts or descriptions from more specific to more general.
  • Generalization loss - Generalization loss is a model's expected loss on examples drawn from the target data distribution.
  • Generalized modus ponens - Generalized modus ponens is a first-order logic inference rule that derives a conclusion when known facts match all premises of an implication under a...
  • Gestalt pattern matching - Gestalt pattern matching, also called Ratcliff/Obershelp pattern recognition, is a string-similarity approach that finds matching contiguous blocks and...
  • Gittins index - The Gittins index is a priority value for an individual option, or arm, in a classical discounted multi-armed bandit problem.
  • GLIE - GLIE stands for greedy in the limit with infinite exploration.

Sources

MathWorks documents genetic algorithm search, variation operators and the absence of a general convergence guarantee: https://www.mathworks.com/help/gads/what-is-the-genetic-algorithm.html

The DEAP developers explain selection, crossover, mutation and reevaluation of changed individuals: https://deap.readthedocs.io/en/master/tutorials/basic/part2.html

The task-selection arithmetic and Birch Planning case are original illustrations, not performance claims for either implementation.

Previous: Generics Next: Genetic fuzzy systems

  • Home
  • Daily AI Updates
  • Blog
  • AIFBL Academy
  • AI Glossary
  • Products and Tools
  • Store
  • Free CFO AI Prompt Pack
  • About Shihan Sheriff
  • Privacy Policy
  • Terms of Use
  • Refund Policy
  • Cookie Policy
  • Earnings Disclaimer