Sunteți pe pagina 1din 31

GENETIC ALGORITHM

Rovick P. Tarife

INTRODUCTION
What is GENETIC ALGORITHM? A genetic algorithm (GA) is a search heuristic that mimics the process of natural selection.
It used to generate useful solutions to optimization and search problems.

INTRODUCTION
Genetic algorithms belong to the larger class of evolutionary algorithms (EA), which generate solutions to optimization problems using techniques inspired by natural evolution, such as inheritance, mutation, selection, and crossover. It follows the idea of survival of the fittest

INTRODUCTION
G.A. was pioneered by John Holland in 1970s and was further developed by mathematicians, engineers and scientists in 1980s. It has now a flourishing field of research and application that goes much wider than the original GA.

TERMINOLOGIES
GA Terms Chromosome Gene Alleles Phenotype Genotype Locus Corresponding Optimization Description Solution set Part of solution Value of gene Decoded solution Encoded solution Position of gene

REPRESENTATION

REPRESENTATION
Chromosomes could be: Bit strings Real numbers Permutations of element Lists of rules Program elements ... any data structure ...

(0101 ... 1100) (43.2 -33.1 ... 0.0 89.2) (E11 E3 E7 ... E1 E15) (R1 R2 R3 ... R22 R23) (genetic programming)

REPRESENTATION
Genotype: Particular set of genes in a genome Phenotype: Physical characteristic of the genotype (smart, beautiful, healthy, etc.)

REPRESENTATION
Phenotype space Encoding (representation) Genotype space = {0,1}L

10010001
10010010 010001001

011101001
Decoding (inverse representation)

G.A. OUTLINE
Randomly generate a set of possible solutions to a problem, representing each as a fixed length character string Test each possible solution against the problem using a fitness function to evaluate each solution Keep the best solutions, and use them to generate new possible solutions Repeat the previous two steps until either an acceptable solution is found, or until the algorithm has iterated through a given number of cycles (generations)

G.A. OUTLINE

OPERATORS: SELECTION

OPERATORS: SELECTION
Roulette Wheel Parent Selection
100 0
OPERATORS: SELECTION

75.2

36.7 49.5 43.1

X1: 16.5% X2: 20.2% X3: 6.4% X4: 6.4% X5: 25.3% X6: 24.8%

OPERATORS: CROSSOVER
Crossover is an important random operator in GA and the function of the crossover operator is to generate new or child chromosomes from two parent chromosomes by combining the information extracted from the parents. It randomly chooses a crossover point where two parent chromosomes break, and then exchanges the chromosome parts after that point. As a result, two new offspring are created. Typically, the probability for crossover ranges from 0.6 to 0.95.

OPERATORS: CROSSOVER

OPERATORS: MUTATION
Mutation represents a change in the gene. Mutation is a background operator. Its role is to provide a guarantee that the search algorithm is not trapped on a local optimum. The mutation operator flips a randomly selected gene in a chromosome. The mutation probability is quite small in nature, and is kept low for GAs, typically in the range between 0.001 and 0.01.

OPERATORS: MUTATION
X6'i 1 0 0 0 X2'i 0 1 0 1 0 X1'i 1 0 1 1 1 1 1 X1"i

X5'i 0 1 0 1 0 1 X2i X5i 0 1 0 0 1 0 X2"i

0 1 1 1

BASIC GENETIC ALGORITHM


Step 1: Represent the problem variable domain as a chromosome of a fixed length, choose the size of a chromosome population N, the crossover probability pc and the mutation probability pm. Step 2: Define a fitness function to measure the performance, or fitness, of an individual chromosome in the problem domain. The fitness function establishes the basis for selecting chromosomes that will be mated during reproduction. Step 3: Randomly generate an initial population of chromosomes of size N: x1, x2 , . . . , xN Step 4: Calculate the fitness of each individual chromosome: f (x1), f (x2), . . . , f (xN)

BASIC GENETIC ALGORITHM


Step 5: Select a pair of chromosomes for mating from the current population. Parent chromosomes are selected with a probability related to their fitness. Step 6: Create a pair of offspring chromosomes by applying the genetic operators - crossover and mutation. Step 7: Place the created offspring chromosomes in the new population. Step 8: Repeat Step 5 until the size of the new chromosome population becomes equal to the size of the initial population, N. Step 9: Replace the initial (parent) chromosome population with the new (offspring) population. Step 10: Go to Step 4, and repeat the process until the termination criterion is satisfied.

BASIC GENETIC ALGORITHM


C rossover Generation i X1i X2i X3i X4i X5i X6i 1 1 0 0 0 1 0 0 0 0 0 1 1 1 1 0 0 1 1 1 1 0 0 1 f = 36 f = 44 f = 14 f = 14 f = 56 f = 54 X2i 0 1 0 0 0 1 1 1 X5i X1i 0 1 1 1 0 0 0 0 0 11 11 1 1 X5i X6i 1 0 0 0 1 0 1 00 00 X2i

Generation ( i + 1) X1 i+1 1 0 0 X2 i+1 0 1 0 X3 i+1 1 0 1 X4 i+1 0 1 0 X5 i+1 0 1 1 X6 i+1 0 1 1 0 1 1 0 0 1 f = 56 f = 50 f = 44 f = 44 f = 54 f = 56 X1'i X5'i X2i X5i 0 1 1 1 1 1 1 X1"i 0 1 0 1 0 1 0 1 0 0 1 0 X2"i X6'i X2'i Mutation 1 0 0 0 0 1 0 1 0

0 1 1 1

EXAMPLE
An example after Goldberg 89 Simple problem: max x2 over {0,1,,31} GA approach:
Representation: binary code, e.g. 01101 13 Population size: 4 1-point crossover, bitwise mutation Roulette wheel selection Random initialization

EXAMPLE
x2 example: selection

EXAMPLE
X2 example: crossover

EXAMPLE
X2 example: mutation

EXAMPLE

EXAMPLE
MATLAB Program Example MATLAB Optimization Tool -GA (Add-In)
EXAMPLE

Issues for Genetic Algorithm Practitioners


Choosing basic implementation issues such as Representation Population size and mutation rate Selection, deletion policies Cross over and mutation operators Termination criterion Performance and scalability Solution is only as good as evaluation functions.

Benefits Of Using Genetic Algorithms

Easy to understand

Supports multi-objective optimization


Good for noisy environment We always get answer and answer gets better with time Inherently parallel and easily distributed Easy to exploit for precious or alternate solutions Flexible in forming building blocks for hybrid applications Has substantial history and range of use

APPLICATIONS

Parameter and System Identification Control Systems Robotics Pattern Recognition Engineering Designs Planning and Scheduling Classifier Systems and etc.

REFERENCES

Genetic Algorithms by Colin Reeves Chapter 13 (Genetic Algorithms) of Electric Power System Applications of Optimization by James Momoh Tutorial on Genetic Algorithm by Dr. Adel Abdennour Genetic Algorithm Toolbox by Chipperfield et. al. Genetic Algorithms: Concepts and Applications by Man et. al. http://en.wikipedia.org/wiki/Genetic_algorithm

Thank you for listening & To God be the glory!

S-ar putea să vă placă și