09 Ga
09 Ga
Genetic Algorithms
Mohammad Tehranipoor
ECE Department
16 September 2008
Search Space
If we are solving a problem, we are usually looking for some solution which will be the best among others. The space of all feasible solutions (the set of solutions among which the desired solution resides) is called search space (also state space). Each point in the search space represents one possible solution. Each possible solution can be "marked" by its value (or fitness) for the problem.
16 September 2008
Search Space
With GA we look for the best solution among a number of possible solutions - represented by one point in the search space. Looking for a solution is then equal to looking for some extreme value (minimum or maximum) in the search space. In the process of using GA, the process of finding solutions generates other points (possible solutions) as evolution proceeds.
16 September 2008
Search Space
The problem is that the search can be very complicated. One may not know:
where to look for a solution where to start
Many methods can be used for finding a suitable solution, but these methods do not necessarily provide the best solution.
Hill Climbing, Simulated Annealing, and Genetic Algorithm The solutions found by these methods are often considered as good solutions, because it is not often possible to prove what the optimum is.
16 September 2008
Biological Background
Genetic algorithms are a part of evolutionary computing, which is a rapidly growing area of artificial intelligence. Chromosome: All living organisms consist of cells. In each cell there is the same set of chromosomes. A chromosome consists of genes, blocks of DNA. Each gene has its own position in the chromosome.
16 September 2008
Biological Background
Reproduction:
During reproduction, recombination (or crossover) first occurs. Genes from parents combine to form a whole new chromosome. The newly created offspring can then be mutated. Mutation means that the elements of DNA are a bit changed. These changes are mainly caused by errors in copying genes from parents. The fitness of an organism is measured by success of the organism in its life (survival).
16 September 2008
Solution to a problem solved by genetic algorithms uses an evolutionary process (it is evolved).
16 September 2008
GA
Algorithm begins with a set of solutions (represented by chromosomes) called population. Solutions from one population are taken and used to form a new population. This is motivated by a hope, that the new population will be better than the old one. Solutions which are then selected to form new solutions (offspring) are selected according to their fitness - the more suitable they are the more chances they have to reproduce. This is repeated until some condition (for example number of populations or improvement of the best solution) is satisfied.
16 September 2008 8
Example
Population 1
Fitness
x
Solutions (search space)
16 September 2008
Cont.
Population 2
Fitness
x
Solutions
16 September 2008
10
[Replace] Use new generated population for a further run of the algorithm [Test] If the end condition is satisfied, stop, and return the best solution in current population [Loop] Go to step 2
16 September 2008
11
Operators of GA
Encoding of a Chromosome
A chromosome should contain information about solution that it represents. The most used way of
Encoding of a Chromosome
There are many other ways of encoding. The encoding depends mainly on the solved problem and potential solution. For example, one can encode directly integer or real numbers. Binary string is the most widely used one.
16 September 2008
13
Crossover
After we have decided what encoding we will use, we can proceed to crossover operation. Crossover operates on selected genes from parent chromosomes and creates new offspring. Choose randomly some crossover point and copy everything before this point from the first parent and then copy everything after the crossover point from the other parent.
16 September 2008
14
Crossover
Example: ( | is the crossover point): Chromosome 1: 11011 | 00100110110 Chromosome 2: 11011 | 11000011110 Offspring 1: Offspring 2: 11011 | 11000011110 11011 | 00100110110
Crossover can be quite complicated and depends mainly on the encoding of chromosomes. Specific crossover made for a specific problem can improve performance of the genetic algorithm.
16 September 2008 15
Mutation
After a crossover is performed, mutation takes place. Mutation is intended to prevent falling of all solutions in the population into a local optimum of the solved problem. Mutation operation randomly changes the offspring resulted from crossover. In case of binary encoding we can switch a few randomly chosen bits from 1 to 0 or from 0 to 1.
16 September 2008
16
Mutation
Mutation can be then illustrated as follows: Original offspring 1: 1101111000011110 Original offspring 2: 1101100100110110 Mutated offspring 1: 1100111000011110 Mutated offspring 2: 1101101100110110 The technique of mutation (as well as crossover) depends mainly on the encoding of chromosomes.
16 September 2008
17