Frequently Asked Questions


What are genetic algorithms?

Genetic algorithms (GAs) are search and optimization methods inspired by biological evolution. They maintain a population of candidate solutions and improve them over generations using three operators: selection (choosing the best individuals), crossover (combining two solutions), and mutation (randomly modifying a solution). GAs are particularly effective when the search space is large, complex, or poorly understood.

What types of problems can genetic algorithms solve?

Genetic algorithms are well suited for optimization and search problems where finding the best solution from a large set of possibilities is required. Examples include route planning (Travelling Salesman Problem), scheduling, engineering design, function optimization, evolving neural network architectures, and game strategy. They are especially useful when the fitness function is not differentiable or has no known analytical solution.

Do I need programming experience to follow this tutorial?

No. The tutorial explains concepts step by step with diagrams and interactive browser-based demonstrations. No programming knowledge is required. If you want to implement your own GA afterwards, basic programming skills will help, but they are not needed to understand the material here.

How do genetic algorithms compare to gradient-based optimization?

Gradient-based methods (such as gradient descent) follow the slope of the fitness function and can get stuck in local optima. Genetic algorithms explore the search space with a whole population simultaneously and are less likely to get trapped — but they are generally slower and computationally more expensive. GAs do not require the fitness function to be differentiable or continuous, making them applicable to a wider range of problems.

How do I choose population size, crossover rate, and mutation rate?

There are no universal rules, but empirical guidelines suggest: population size 20–100, crossover rate 80–95%, mutation rate 0.5–1%. The right values depend on your specific problem and encoding. The Parameters chapter covers the options in detail, and the interactive demo lets you experiment directly.

Can a genetic algorithm guarantee finding the optimal solution?

No. Genetic algorithms are heuristics — they search for good solutions but cannot guarantee finding the global optimum. The quality of results depends heavily on the choice of encoding, fitness function, and parameters. For many real-world problems, a near-optimal solution found quickly is more practical than an exact solution that would take too long to compute.

What is the Travelling Salesman Problem used as an example?

The Travelling Salesman Problem (TSP) asks for the shortest route visiting a set of cities exactly once and returning to the start. It is a classic NP-hard combinatorial optimization problem. TSP is used in this tutorial to demonstrate permutation encoding and to show how GAs handle combinatorial search problems where gradient-based methods do not apply. See the TSP example chapter for details.

Can I use or reproduce the content of this tutorial?

The text and images in this tutorial are published under the Creative Commons Attribution–ShareAlike 4.0 licence (CC BY-SA 4.0). You are free to share and adapt them, provided you give appropriate credit and distribute any adaptations under the same licence.

The interactive JavaScript demonstrations may only be used as part of this website; any other use requires prior written permission. Contact: marek@obitko.com.

·