Presentation is loading. Please wait.

Presentation is loading. Please wait.

Genetic Algorithms.

Similar presentations


Presentation on theme: "Genetic Algorithms."— Presentation transcript:

1 Genetic Algorithms

2 Introduction to GAs: Some non-traditional search and optimization techniques include: Genetic Algorithms Simulated Annealing Ant Colony optimization etc. Developed by John Holland, University of Michigan GAs are a particular class of evolutionary algorithms.

3 Biological Background:
All Living organisms consists of cells. Each cell has a set of Chromosomes. Chromosomes are strings of DNA and consists of genes. Genes are blocks of DNA. Each gene encodes a trait, for example color of eyes. Reproduction Organisms produce an offspring (children) similar to themselves but can have variations (changes in traits) due to: Mutations(random changes) Crossover(offspring have combinations of features inherited from each parent)

4 Evolution & natural selection:
Charles Darwin ( ): “survival of the fittest” the fittest survive in a competitive environment resulting in better organisms. The fitness of an organism is how much it can reproduce before it dies Evolution: the biological systems use the natural selection to optimize the individuals. The optimized individuals generate children behaves better than their parents. Evolution in computer: “problems are solved by an evolutionary process resulting in a best (fittest) solution (survivor) , -In Other words, the solution is evolved”

5 Genetic Algorithms: Inspired by natural selection :”survival of the fittest” GA mimics biological evolution to generate better solutions from existing ones through natural selection. Suited for class of optimization problems. GAs provide solutions for highly complex search spaces Evolutionary Cycle

6 GA Terminologies: Population: set of the chromosomes (solutions) available to test. Chromosome: a string of genes that represents a solution. Gene: one component of the solution pattern. Fitness value: Each individual is characterized by a fitness value. Higher fitness is better solution

7 How to simulate the process of natural selection in computer:
5 steps required which are: Encoding. Evaluation. Selection criteria. Reproduction using (cross over and mutation) Insertion and termination. Initially many individual solutions are randomly generated to form an initial population, covering the entire range of possible solutions (the search space). Each point in the search space represents one possible solution marked by its value( fitness).

8 How GA works: Initialize Population (initialization).
Apply the fitness function to calculate the fitness value for each individual. (fitness calculations). Select individuals for mating (selection). Mate individuals and produce an offspring (children) (crossover) Mutate children (mutation). Insert children into population (insertion). Test stopping criteria.

9 Initialize population
GA flowchart: Begin Initialize population Evaluate Solutions Optimum Solution? N Selection Y GAs implement optimization techniques by simulating this natural law of evolution in the biological world. We start with a population of randomly generated solutions. Each of these solutions is evaluated to determine how good or bad it is.In other words to determine how “fit” that solution is. We then check a terminating condition, to see if our solutions are good enough? If yes, we stop. If not, we have to optimize the solutions. So, we select the best solutions from the initial population (selection). This is similar to “natural selection”. Then we allow these good solutions to exchange their information, in order to get even better solutions. This step is similar to reproduction among animals or crossover among chrmosomes and is called “cross-over”. We may then randomly mutate some small % of the solutions thus obtained after crossover. Mutation is very imp. It could be a bad thing, it could be a good thing. In the boliogical sense it mean, making a small change in a gene. In GAs, it means, making a small change to the solution. Then again, we evaluate each of the sokutions, and check the termination condition. As you see , this is an optmization method. T=T+1 Stop Crossover Mutation

10 Encoding: The process of representing the solution in the form of a string. There are 3 encoding methods: Binary Encoding: Every chromosome is a string of bits, 0 or 1 Ex: fire station problem Each bit specifies if there is a fire station or not Chromosome B Chromosome A

11 Contd. Permutation Encoding: Every chromosome is a string of numbers. Ex: Travelling Salesman problem Chromosome represents the order of cities, in which the salesman will visit them. Value Encoding: Every chromosome is a string of real complicated values. Ex: left-back-right-forward. Chromosome B Chromosome A

12 Evaluation & selection:
Evaluation: Method for measuring the quality of any chromosome (solution), using some fitness function. Selection: How to select the best chromosomes from the population to be parents to crossover and produce offspring. Parents are selected according to their fitness There are many methods to select the best chromosomes Roulette Wheel Selection Rank Selection Tournament Selection Steady State Selection

13 Roulette Wheel Technique:
Given the following table: No. Chromosome Fitness- value Fitness (%) Ch1 01101 169 14 Ch2 01110 576 49 Ch3 01000 64 6 Ch4 10011 361 31 sum 1170 100%

14 Contd. Assign each individual part
of the wheel based on its fitness value. Find the total of fitness (sum). Spin wheel to generate random # in [0,sum] and find the corresponding chromosome Repeat step2 until the desired chromosomes selected. The chromosomes with bigger fitness will be selected more times. In our example: Let the rand # is 600, ch2 is selected as a parent. Let the rand # is 988, ch4 is selected as a parent.

15 Reproduction: The process of selecting parents from the population to
produce new offspring is called reproduction. Two genetic operators are used for reproduction: 1.Crossover. 2. Mutation. The new poopulation is further evaluated and tested for termination. If the termination criteria are not met, the population is iteratively operated One cycle of operations and the subsequent evaluation: Generation in GA

16 Crossover operator: Two parent chromosomes are randomly selected for mating to produce new offspring. To perform the crossover: Choose a random point. Split parents at this crossover point Create children by exchanging tails Probability of crossover is typically in range (0.6, 0.9) 1-point crossover

17 Contd. 2-point crossover Uniform crossover

18 Mutation operator: Alter the genes within a chromosome.
Probability of mutation is Pm=0.01 Mutation operator applied on the children resulted by crossover.

19 Significance of the genetic operators:
Reproduction will force the GA to search that area which has highest fitness values Crossover ensures that the search progresses in the right direction by making new chromosomes that possess characteristics similar to both parents. Mutation is used to maintain diversity in the population. Mutation prevents falling all solutions of the population into a local optima. Mutation causes movement in the search space and restores the lost information in the population.

20 Termination: A solution is found that satisfies minimum criteria.
Fixed number of generations found. Allocated budget (computation, time/money) reached. The highest ranking solution’s fitness is reaching or has reached

21 TSP Example: 30 Cities

22 Solution i (Distance = 941)

23 Solution j (Distance = 800)

24 Solution k (Distance = 652)

25 Best Solution (Distance = 420)


Download ppt "Genetic Algorithms."

Similar presentations


Ads by Google