mic_none

# Chromosome (genetic algorithm) Source: en.wikipedia.org/wiki/Chromosome_(genetic_algorithm)

In genetic algorithms, a chromosome (also sometimes called a genotype) is a set of parameters which define a proposed solution to the problem that the genetic algorithm is trying to solve. The set of all solutions is known as the population. The chromosome is often represented as a binary string, although a wide variety of other data structures are also used.

## Chromosome design

The design of the chromosome and its parameters is by necessity specific to the problem to be solved. Traditionally, chromosomes are represented in binary as strings of 0s and 1s, however other encodings are also possible; almost any representation which allows the solution to be represented as a finite-length string can be used. Finding a suitable representation of the problem domain for a chromosome is an important consideration, as a good representation will make the search easier by limiting the search space; similarly, a poorer representation will allow a larger search space. The mutation operator and crossover operator employed by the genetic algorithm must also take into account the chromosome's design.

### Example 1: binary representation

Suppose the problem is to find the integer value of $x$ between 0 and 255 that provides the maximal result for $f(x)=x^{2}$ . The possible solutions for this problem are the integers from 0 to 255, which can all be represented as 8-digit binary strings. Thus, we might use an 8-digit binary string as our chromosome. If a given chromosome in the population represents the value 155, its chromosome would be `10011011`.

Note that this is not the type of problem that is normally solved by a genetic algorithm, since it can be trivially solved using numeric methods; it is only used to serve as a simple example.

### Example 2: string representation

A more realistic problem we might wish to solve is the travelling salesman problem. In this problem, we seek an ordered list of cities that results in the shortest trip for the salesman to travel. Suppose there are six cities, which we'll call A, B, C, D, E, and F. A good design for our chromosome might be the ordered list we want to try. An example chromosome we might encounter in the population might be `DFABEC`.

## Selection, crossover, elitism and mutation

Fitness Function

Each generation in the genetic algorithm is the set of all current solutions. In each generation of the genetic algorithm, two parent chromosomes (encodings) are selected based on their fitness values which is determined by the fitness function; these chromosomes are used by the mutation and crossover operators to produce two offspring chromosomes for the new population. Each encoding is an argument to the fitness function and outputs a score. In the real world you can imagine a fitness function being an organisms ability to survive and the score being the ease at which it does so. This determines how "good" a genetic encoding is with respect to the fitness function. Not all solutions pass the threshold and are therefore not considered for the next step.

Crossover

Two parent chromosomes are selected and using the single point Crossover (genetic algorithm) they create two new solutions. One factor to consider is that because the selection and crossover functions are governed by randomness there is no way to ensure an improvement in solutions across evolutions.

Elitism

Elitism remedies this however by selecting the nth top solutions in regard to the fitness function and copy them into the next generation. This ensures our best solutions are not lost while still utilizing the algorithm.

Mutation

The next step is the introduction of mutation. Mutation will change a random bit of the genome for example, To discover solutions that may otherwise be impossible by regular crossover of existing solutions. These new solutions are introduced to the algorithm and it runs on a loop until a satisfactory solution has been found. How genetic algorithms differ is by changing the functions(fitness function, crossover function, selection function, mutation function and function to generate new solutions) used in the algorithm. You may also change the genetic representation of a solution.