Professional Documents
Culture Documents
GENETIC ALGORITHMS
BY AHMED MEDHAT OTHMAN @amedhat3
AGENDA
1. Introduction 2. Natural Inspired Computing 3. Classical Computation vs. bio-inspired computing 4. Evolution in the real world 5. Collaborative discussion 6. Problem solving 7. Genetic Algorithms (GA) 8. Anatomy of a GA 9. Advantages of GA 10. Limitations of GA 11. Related techniques 12. Summary
INTRODUCTION
INTRODUCTION
INTRODUCTION
INTRODUCTION
INTRODUCTION
INTRODUCTION
INTRODUCTION
The only intelligent systems on this planet are biological. Biological intelligences are designed by natural evolutionary processes. They often work together in groups, swarms, or flocks. They don't appear to use logic, mathematics, complex planning, complicated modeling of their environment. They can achieve complex information processing and computational tasks that current artificial intelligences find very challenging indeed.
10
11
12
13
14
15
16
COLLABORATIVE DISCUSSION
What we can learn from nature? Applications of nature in the engineering field.
17
PROBLEM SOLVING
Suppose you have a problem. You dont know how to solve it. What can you do? Can you use a computer to somehow find a solution? This would be nice! Can it be done?
18
PROBLEM SOLVING
Brute-Force Solution A blind generate and test algorithm: Repeat Generate a random possible solution Test the solution and see how good it is Until solution is good enough
19
PROBLEM SOLVING
Can we use this Brute-Force idea? Sometimes - YES: if there are only a few possible solutions and you have enough time then such a method could be used For most problems - NO: many possible solutions with no time to try them all so this method cannot be used
20
PROBLEM SOLVING
Search Techniques Calculus Base Techniques Fibonacci Sort Hill Climbing Simulated Annealing Genetic Programming Enumerative Techniques Dynamic BFS Programming
Tabu Search
21
GENETIC ALGORITHMS
Initialize Population
Evaluate Fitness
Yes
22
Output Results
GENETIC ALGORITHMS
How do you encode a solution? Obviously this depends on the problem! GAs often encode solutions as fixed length bitstrings (e.g. 101110, 111111, 000101) Each bit represents some aspect of the proposed solution to the problem For GAs to work, we need to be able to test any string and get a score indicating how good that solution is.
23
GENETIC ALGORITHMS
The set of all possible solutions [0..1000] is called the search space or state space. In this case its just one number but it could be many numbers. Often GAs code numbers in binary producing a bitstring representing a solution. We choose 1,0 bits which is enough to represent 0..1000
24
GENETIC ALGORITHMS
Binary Representation
Example: encoding 4 parameters Param1 value = 1000 = 8 Param2 value = 1011 = 11 Etc.,
25
GENETIC ALGORITHMS
Search Space For a simple function f(x) the search space is one dimensional. But by encoding several values into the chromosome many dimensions can be searched e.g. two dimensions f(x,y). Search space can be visualised as a surface or fitness landscape in which fitness dictates height. Each possible genotype is a point in the space. A GA tries to move the points to better places (higher fitness) in the the space.
26
GENETIC ALGORITHMS
Fitness landscapes
27
GENETIC ALGORITHMS
Implicit fitness functions Most GAs use explicit and static fitness function Some GAs (such as in Artificial Life or Evolutionary Robotics) use dynamic and implicit fitness functions - like how many obstacles did I avoid Individuals fitness Average fitness of population
28
GENETIC ALGORITHMS
Example - Drilling for Oil Imagine you have to drill for oil somewhere along a single 1 km desert road. Problem: choose the best place on the road that produces the most oil per day. We could represent each solution as a position on the road. Say, a whole number between [0..1000]
29
GENETIC ALGORITHMS
Where to drill for oil?
Solution1 = 300
Solution2 = 900
Road
0
500
1000
30
GENETIC ALGORITHMS
Convert to binary string
32 0 1 1
16 0 0 1
8 0 1 1
4 1 1 1
2 0 0 1
1 0 0 1
1 0 1
1 1 1
1 0 1
0 0 1
31
In GAs these encoded strings are sometimes called genotypes or chromosomes and the individual bits are sometimes called genes
GENETIC ALGORITHMS
Solution1 = 300 (0100101100)
Solution2 = 900 (1110000100)
Road
0
1000
OIL
30
5
Location
32
ANATOMY OF GA
Selecting Parents Many schemes are possible so long as better scoring chromosomes more likely selected Score is often termed the fitness Roulette Wheel selection can be used: Add up the fitness's of all chromosomes Generate a random number R in that range Select the first chromosome in the population that - when all previous fitnesss are added - gives you at least the value R
33
ANATOMY OF GA
Example population
34
No.
1
2
3
4
5
6
7
8
Chromosome
1010011010
1111100001
1011001100
1010000000
0000010000
1001011111
0101010101
1011100111
Fitness
1
2
3
1
3
5
1
2
ANATOMY OF GA
Roulette Wheel Selection
1 1
2 2
3 3
4 1
5 3
6 5
7 1
8 2
18
35
ANATOMY OF GA
Crossover - Recombination
0100101100 1110000100
Crossover single point random
Parent1 Parent2
Offspring1 Offspring2
0100000100 1110101100
With some high probability (crossover rate) apply crossover to the parents. (typical values are 0.8 to 0.95)
36
ANATOMY OF GA
Why does crossover work? A lot of theory about this and some controversy The idea is that crossover preserves good bits from different parents, combining them to produce better solutions A good encoding scheme would therefore try to preserve good bits during crossover and mutation
37
ANATOMY OF GA
Mutation
mutate
Offspring1 Offspring2
1011011111 1010000000
Offspring1 Offspring2
1011001111 1000000000
Original offspring
Mutated offspring
With some small probability (the mutation rate) flip each bit in the offspring (typical values between 0.1 and 0.001)
38
ANATOMY OF GA
Many Variants of GA Different kinds of selection (not roulette) Tournament Elitism, etc. Different recombination Multi-point crossover 3 way crossover etc. Different kinds of encoding other than bitstring Integer values Ordered set of symbols Different kinds of mutation
39
ADVANTAGES OF GA
Concepts are easy to understand Genetic Algorithms are intrinsically parallel. Always an answer; answer gets better with time Inherently parallel; easily distributed Less time required for some special applications Chances of getting optimal solution are more
40
LIMITATIONS OF GA
The population considered for the evolution should be moderate or suitable one for the problem (normally 20-30 or 50-100) Crossover rate should be 80%-95% Mutation rate should be low i.e. 0.5%-1% assumed as best The method of selection should be appropriate Writing of fitness function must be accurate
41
RELATED TECHNIQUES
Genetic programming Evolutionary programming Swarm intelligence Ant colony optimization Particle swarm optimization Intelligent Water Drops Bees algorithm Neural Networks
42
SUMMARY
Representation Recombination Mutation Parent selection Survivor selection Speciality Binary strings N-point or uniform Bitwise bit-flipping with fixed probability Fitness-Proportionate All children replace parents Emphasis on crossover
43
44
THANKS
Contact information Email: amedhat3@gmail.com Website: http://amedhat.info Twitter: @amedhat3 Linkedin: linkedin.com/in/amedhat
45