genetic algorithms: an introduction - curaj.ac.in algorithm introduction.pdf · what are genetic...
TRANSCRIPT
Genetic Algorithms: An Introduction
Rao Vemuri
UC Davis
Outline
Motivation
Running Example
Examples from Dissertations
– DNA Sequencing
– Groundwater Remediation
– Atomic Stabilization
Genetic Programming
What are Genetic Algorithms
Inspired by Biological Evolution
Search and Optimization Procedures
Good in Rugged Search Spaces
Good for Multimodal Environments
Characteristics of GA’s
Can solve “hard” problems
Easy to interface with existing models
Rely on very little domain knowledge
Adaptive Search Using GAs
Figure goes here
The Central Idea
Start with a population of individual solutions
Represent individual solutions by bit strings
Call each bit string a chromosome
Evaluate each individual for fitness
Select those with high fitness
Mate them using Crossover (Exploitation)
Mutate (Exploration)
Genetic Operators
Selection:
– Survival of the Fittest
Crossover:
– Unite individuals as parents to generate new
combinations of partial solutions
Mutation:
– Introduce new features not present in the parents
Selection Operator
Calculate the fitness of all members
Select a subset with better fitness scores
– Roulette wheel selection (or FPR: fitness
proportionate reproduction)
– Tournament selection
– Etc.
Crossover Operation
Parent 1: 100 111 00
Parent 2: 010 001 10
Child 1: 100 001 00
Child 2: 010 111 10
Mutation Operation
Mutation is an important genetic operator.
It takes a single candidate and randomly
changes some aspect of it.
Parent: 100 111 00
Child: 100 011 00
A Running Example
A Franchiser wants a profit-making strategy
in running a restaurant
Options are:
– Affordable Vs Fancy
– Hot Dogs Vs Crepes
– Soft Drinks Vs Wine
Data on costs and sales available to estimate
profits
Encoding the Problem
Define 3-bit chromosome
Encode as follows
Bit 1: 0 Soft drink 1 Wine
Bit 2: 0 Hot dogs 1 Crepes
Bit 3: 0 Cheap 1 Expensive
Bit 1 Bit 2 Bit 3
Fitness Evaluation
Each option is a 3-bit sequence
There are only 2^3 = 8 options
Assume that Profit =
Decimal value of the 3-bit sequence
A peek at the correct optimum by exhaustive
enumeration
– 000, 001, 010, 011, 100, 101, 110, 111
Exhaustive Enumeration is Impractical
Consider a Travelling Salesman Problem
For N cities, there are (N-1)!/2 solutions
Assume
– A 20-city problem takes 1 hour
Then
– 21-city problem takes 20*1 hours = 20 hours
– 22-city problem takes 21*20*1 hours = 17.5 days
– 25-city problem takes ~ 6 Centuries !!!
Let us Try a GA
Try, say, 4 randomly selected strategies at 4
different outlets
Compare their profits
Pick those that are doing well: Mating Pool
Using X-over and Mutation, generate
offspring strategies
Go back and repeat until a good strategy is
found
One Simulation Run
X(i) F(i) MP F(i) X(i) F(i)
001 3 011 3 111 7
001 1 110 6 010 2
110 6 110 6 110 6
010 2 010 2 010 2
Total F 12 17 17
Worst 1 2 2
Ave 3 4.25 4.25
Best 6 6 7
What Did the Franchiser Learn?
Lesson 1: $3 is an estimate of the average
profit (estimate based on 4 samples)
Lesson 2:
– 110 is 200% better than average strategy
– 010 is 2/3 as good as average strategy
– 001 is 1/3 as good as average strategy
What Do We Do Next?
Option 1: Brute Force Method
– Continue Searching for better solutions
Option 2: Greedy Method
– Because 110 is 200% better than the average,
grab it. Do not worry about searching for better
solutions.
Another Lesson Learned
Cost of exploring for a better solution
– Current profit – Average profit = $6 - $3 = $3
Cost of NOT exploring further
– Max. profit possible – Current profit + $7 - $6 = $1
This is Exploration Vs Exploitation
A general form of the genetic algorithm:
Useful References
• John Holland, Adaption in Natural and Artificial Systems, 1975.
• David E. Goldberg, Genetic Algorithms in Search, Optimization, and Machine Learning, Addison Wesley
• Zbigniew Michalewicz, Genetic Algorithms + Data Structures = Evolution Programs,Third Edition, Springer, 1996, ISBN: 3-540-60676-9,
• Evolutionary computing (EC) was introduced in the 1960s by I. Rechenberg in his work "Evolution strategies" (Evolutionsstrategie in original).
• In 1992 John Koza has used genetic algorithm to evolve programs to perform certain tasks. He called his method "genetic programming" (GP). LISP programs were used, because programs in this language can expressed in the form of a "parse tree", which is the object the GA works on.
An Example
• Consider f(x)=100x2(1–x)2–x,
which has local minima x1 near 0 and x2
near 1:
Plot
Code for Plotting
ezplot('100*x^2*(1-x)^2 - x',[-0.2,1.2])
ylabel('f(x)')
hold on
plot([0 0],[-1.7 0],'r--')
plot([1 1],[-1.7 -1],'r--')
annotation('textbox',[0.25 0.1 0.07 0.1],...
'String',{'x1'},'EdgeColor','none');
annotation('textbox',[0.8 0.1 0.07 0.1],...
'String',{'x2'},'EdgeColor','none');
hold off
Output of Matlab
The minima are located at:
x1 = fminsearch(@(x)(100*x^2*(x - 1)^2 - x),0)
x1 =
0.0051
x2 = fminsearch(@(x)(100*x^2*(x - 1)^2 - x),1)
x2 =
1.0049
Plot