Genetic Algorithm
Genetic Algorithm
Parent 1 1 0 1 0 1 1 1
Parent 2 1 1 0 0 0 1 1
Child 1 1 0 1 0 0 1 1
Child 2 1 1 0 0 1 1 0 Mutation
Crossover Operators
Singlepoint crossover:
Parent A: 1 0 0 1 0| 1 1 1 0 1
Parent B: 0 1 0 1 1 |1 0 1 1 0
Child AB: 1 0 0 1 0 1 0 1 1 0
Child BA: 0 1 0 1 1 1 1 1 0 1
Twopoint crossover:
Parent A: 1 0 0 1 |0 1 1| 1 0 1
Parent B: 0 1 0 1 |1 1 0 |1 1 0
Child AB: 1 0 0 1 1 1 0 1 0 1
Child BA: 0 1 0 1 0 1 1 1 1 0
Uniform Crossover and Mutation
Uniform crossover:
Parent A: 1 0 0 1 0 1 1 1 0 1
Parent B: 0 1 0 1 1 1 0 1 1 0
Child AB: 1 1 0 1 1 1 1 1 0 1
Child BA: 0 0 0 1 0 1 0 1 1 0
(1 2 3 4 5 6 7 8 9) + (4 5 3 6 8 9 7 2 1) = (1 2 3 4 5 6 8 9 7)
Mutation
Order changing - two numbers are selected and exchanged
(1 2 3 4 5 6 8 9 7) => (1 8 3 4 5 6 2 9 7)
Crossover – Value Encoding
Crossover
All crossovers from binary encoding can be used
Mutation
Adding a small number (for real value encoding) - to
selected values is added (or subtracted) a small number
(1.29 5.68 2.86 4.11 5.55) => (1.29 5.68 2.73 4.22 5.55)
Selection Criteria
Fitness proportionate selection, rank selection
methods.
Fitness proportionate – each individual, I, has the
probability fitness(I)/sum_over_all_individual_j
Fitness(j), where Fitness(I) is the fitness function value
for individual I.
Rank selection – sorts individual by fitness and the
probability that an individual will be selected is
proportional to its rank in this sorted list.
Fitness Function
Represents a rank of the “representation”
It is usually a real number.
The function usually has a value between 0 and 1.
One can have a subjective judgment (e.g. 1-5 for
recipe 2-1-4.)
Similarly the length of the route in the traveling
salesperson problem is a good measure, because
the shorter the route, the better the solution.
Outline of the Basic Genetic Algorithm
Generate
Initial
Solutions
No
Solution 0 1 0 1 0 1 0
Benefit 5 8 3 2 7 9 4
Weight 7 8 4 10 4 6 4
Benefit 8 + 2 + 9 = 19
Weight 8 + 10 + 6 = 24
Knapsack Example
Solution 2
Item 1 2 3 4 5 6 7
Solution 1 1 0 0 1 0 0
Benefit 5 8 3 2 7 9 4
Weight 7 8 4 10 4 6 4
Benefit 5 + 8 + 7 = 20
Weight 7 + 8 + 4 = 19
Knapsack Example
Solution 3
Item 1 2 3 4 5 6 7
Solution 0 1 0 0 1 1 1
Benefit 5 8 3 2 7 9 4
Weight 7 8 4 10 4 6 4
Benefit 8 + 7 + 9 + 4 = 28
Weight 8 + 4 + 6 + 4 = 22
Knapsack Example
Solution 3 is clearly the best solution and has met
our conditions, therefore, item number 2, 5, 6,
and 7 will be taken on the hiking trip. We will be
able to get the most benefit out of these items
while still having weight equal to 22 pounds.
This is a simple example illustrating a genetic
algorithm approach.
The Knapsack Problem
The knapsack
problem, though
simple, has many
important
applications
including
determining what
items to take on a
space ship
mission.
Genetic Algorithms
Genetic Algorithms are a type of machine
learning for representing and solving complex
problems.
They provide a set of efficient, domain-
independent search heuristics for a broad
spectrum of applications.
A genetic algorithm interprets information that
enables it to reject inferior solutions and
accumulate good ones, and thus it learns about its
universe.
Genetic Algorithm Application Areas
Dynamic process control
Induction of rule optimization
Discovering new connectivity topologies
Simulating biological models of behavior and evolution
Complex design of engineering structures
Pattern recognition
Scheduling
Transportation
Layout and circuit design
Telecommunication
Graph-based problems
Business Applications
Schedule Assembly lines at Volvo Truck North America
Channel 4 Television (England) to schedule
commercials
Driver scheduling in a public transportation system
Jobshop scheduling
Assignment of destinations to sources
Trading stocks
Productivity in whisky-making is increased
Often genetic algorithm hybrids with other AI methods
A good site example
http://cs.felk.cvut.cz/~xobitko/ga/tspexample.html