# What is a Genetic Algorithm?

A genetic algorithm - specifically [NSGA II](http://vision.ucsd.edu/~sagarwal/nsga2.pdf) - is a kind of optimization algorithm that is popular in generative design applications.

Genetic algorithms tend to be very useful when your objective function is highly complex, subject to randomness, or is discontinuous.

In technical terms, it is an example of an 'adaptive heuristic algorithm'. You might also hear it referred to as an 'evolutionary algorithm' - this is because genetic algorithms were inspired by the process of evolution by natural selection.

In a genetic algorithm, the 'fittest' individuals (or the potential solutions) from a 'population' of possible solutions are selected for reproduction and their 'genes' are passed on to future 'generations'.

![](/files/-LrPm3TE4jREjNhPQqcS)

In generative design processes, the \_'\_genes' are the parameters of our model. These are the values that drive our design and will either consist of a single value or a range of acceptable values.

![](/files/-LrPm3TGJMO3bLBEkZt9)

A typical genetic algorithm has five phases:

1. [Initialization](/02-deeper-dive/02-04_genetic-algorithms/02-04-02_initialization-phase.md)
2. [Evaluation](/02-deeper-dive/02-04_genetic-algorithms/02-04-03_evaluation-phase.md)
3. [Selection](/02-deeper-dive/02-04_genetic-algorithms/02-04-04_selection-phase.md)
4. [Crossover / Reproduction](/02-deeper-dive/02-04_genetic-algorithms/02-04-05_crossover-phase.md)
5. [Mutation](/02-deeper-dive/02-04_genetic-algorithms/02-04-06_mutation-phase.md)

![](/files/-LrPm3TI57kjTUXtuCts)

Each of these phases repeats itself over generations (or iterations), where each iteration uses the data from the previous generation to inform the next.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://www.generativedesign.org/02-deeper-dive/02-04_genetic-algorithms/02-04-01_what-is-a-genetic-algorithm.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
