Understanding and Choosing Genotypes

What are genotypes?

One of the most important decisions we can make when using a genetic algorithm is the type of encoding you use to represent solutions. Encodingsare simply representations of a single solution. A good encoding needs to contain only the information necessary to represent a complete solution to a problem. If a solution is a path through a grid, an encoding of a solution would only need to contain the coordinates of each gridpoint it passes through.

The type of encoding scheme we use is known as a genotype. The genotype of a chromosome tells us what the chromosome should look like. It defines our search space. For example, if we’re trying to create an optimal shipping route through 15 cities, our genotype is a permutation of all 15 cities.

Relationship between genotype and phenotype

While the genotype is the internal representation of solutions, the phenotype is the expressed representation of solutions. The following figure illustrates the relationship between genotype and phenotype:

Get hands-on with 1200+ tech skills courses.