# VII. Parameters of GA

### Crossover and Mutation Probability

There are two basic parameters of GA - crossover probability and mutation probability.

Crossover probability says how often will be crossover performed. If there is no crossover, offspring is exact copy of parents. If there is a crossover, offspring is made from parts of parents' chromosome. If crossover probability is 100%, then all offspring is made by crossover. If it is 0%, whole new generation is made from exact copies of chromosomes from old population (but this does not mean that the new generation is the same!).
Crossover is made in hope that new chromosomes will have good parts of old chromosomes and maybe the new chromosomes will be better. However it is good to leave some part of population survive to next generation.

Mutation probability says how often will be parts of chromosome mutated. If there is no mutation, offspring is taken after crossover (or copy) without any change. If mutation is performed, part of chromosome is changed. If mutation probability is 100%, whole chromosome is changed, if it is 0%, nothing is changed.
Mutation is made to prevent falling GA into local extreme, but it should not occur very often, because then GA will in fact change to random search.

### Other Parameters

There are also some other parameters of GA. One also important parameter is population size.

Population size says how many chromosomes are in population (in one generation). If there are too few chromosomes, GA have a few possibilities to perform crossover and only a small part of search space is explored. On the other hand, if there are too many chromosomes, GA slows down. Research shows that after some limit (which depends mainly on encoding and the problem) it is not useful to increase population size, because it does not make solving the problem faster.

Some recommendations for all parameters can be found in one of the following chapters.

Example
Here you can see example similar to previous one. But here you can try to change crossover and mutation probability. You can also control elitism.
On the graph below you can see performance of GA. Red is the best solution, blue is average value (fitness) of all population.
Try to change parameters and look how GA behaves.

Here is applet, but your browser does not support Java. If you want to see applets, please check browser requirements.

Question: If you try to increase mutation probability to 100%, GA will start to behave very strange, nearly like if the mutation probability is 0%. Do you know why? You can use a hint and if you still do not know, look at solution!