Sei sulla pagina 1di 23

GENETIC

ALGORITHMS
Prepared by:
Engr. Ian Kent S. Bescoro
WHAT IS GENETIC ALGORITHMS?

» Based on the “Survival of the fittest” concept of


Darwinian Theory.
» Simulates the process of evolution.
EVOLUTION
Who developed it?

» Developed by Prof. John Holland, his colleagues and


students at the University of Michigan around 1975.
» Prof. David Goldberg – illustrious student of Holland and
author of “Genetic Algorithms- in search, optimization and
machine learning”.
BASIC PRINCIPLES OF GENETIC
ALGORITHMS
» Coding or Representation
• Process begins with a set of individuals which is called a population.
• It is characterized by a set of variables known as Genes.
» Fitness function
• Determines how fit an individual is. The probability that an individual will be selected for reproduction is
based on its fitness score or so called parent selection.

» Reproduction
•Crossover
•Mutation
» Convergence
•When to stop
Structure of Genetic Algorithms
Basic Genetic Algorithm

» Each solution usually represented by a string of binary


variables, corresponding to the chromosomes in genetics.
» The string length can be made large enough to achieve
any desired fitness of approximation and thus any desired
accuracy can be achieved.
» After trial solutions are selected, a new generation (a new
set of strings) is produced by selecting, using stochastic
principles, the “fittest” parents to produce “children” from
among the trial solutions.
» In each “child” crossover or exchange of portion of string
of each of the two parents generates new solutions.
» Some random alteration of binary digits in a string
reproduces the advantageous and disadvantageous effects of
mutations.
» Crossover – means cutting some chromosome and then in
the two parents and then mixing and matching to get new
children.
» Mutation - is a repeatedly mixing, matching, cutting and
pasting which will result in a drop of quality.
Crossover
Main idea: combine genetic material ( bits ) of 2 “parent”
chromosomes ( solutions ) and produce a new “child” possessing
characteristics of both “parents”.

How it works ?
Several methods ….
Crossover methods
Recombination

Main idea: "Select The Best, Discard The Rest”.

The process that chooses solutions to be preserved and allowed


to reproduce and selects which ones must to die out.

• The main goal of the recombination operator is to emphasize


the good solutions and eliminate the bad solutions in a
population
• ( while keeping the population size constant )
Roulette wheel selection
Main idea: The fitter is the solution with the most chances
to be chosen.

HOW IT WORKS ?
How do we represent a set of variables as a
string?
Example: Max of X^2 over {0,1…31}
X = X1, X2, X3 and X4
Let X1= 15, X2= 4, X3 = 21 and X4= 7
As a binary string, X can be written as
X1= 01111, X2= 00100, X3 = 10101 and X4= 00111
Example of Roulette wheel selection
NO STRING FITNESS %OF TOTAL

1 01111 225 30.78

2 00100 16 2.19

3 10101 441 60.33

4 00111 49 6.7

TOTAL 731 100.0

Chromosome1
Chromosome 2
Chromosome 3
Chromosome 4
EXAMPLE #1

1. The cost of engines plus fuel for a cargo ship varies with speed and is
given by 0.2 x^2 where x is the speed of the ship in m/s. The fixed costs
of hull and crew (again in the same unit) are given by 450/x. Using
Genetic Algorithm method, determine the operating speed of the ship
for minimum total cost. Start with an original interval of uncertainty of
0.5 ≤ x ≤ 25.5 m/s.
Y = 0.2 x^2 + 450/x
0.5 ≤ x ≤ 25.5 m/s Initial Iteration
Initial Iteration showing the
Crossover line
Second Iteration
Second Iteration showing the
Crossover line
Third Iteration
Third Iteration showing the
Crossover line
THANK YOU!

Potrebbero piacerti anche