Presentation is loading. Please wait.

Presentation is loading. Please wait.

Ming-Feng Yeh1-102 4. Genetic Algorithm Genetic algorithms are a part of evolutionary computing, which is a rapidly growing area of artificial intelligence.

Similar presentations


Presentation on theme: "Ming-Feng Yeh1-102 4. Genetic Algorithm Genetic algorithms are a part of evolutionary computing, which is a rapidly growing area of artificial intelligence."— Presentation transcript:

1 Ming-Feng Yeh1-102 4. Genetic Algorithm Genetic algorithms are a part of evolutionary computing, which is a rapidly growing area of artificial intelligence. Based on Darwinian principles of biological evolution. “ 物競天擇,適者生存 ” First proposed by Prof. John Holland and his colleague at Univ. of Michigan.

2 Ming-Feng Yeh1-103 Biological Background: 1 Chromosomes are strings of DNA and serves as a model for the whole organism. A chromosome consists of genes. Each gene encodes a trait. Complete set of genetic material (all chromosomes) is called genome. Particular set of genes in genome is called genotype.

3 Ming-Feng Yeh1-104 Biological Background: 2 During reproduction, first occurs recombination (or crossover). Genes from parents form in some way the whole new chromosome. The new created offspring can then be mutated. Mutation means, that the elements of DNA are a bit changed. This changes are mainly caused by errors in copying genes from parents. The fitness of an organism is measured by success of the organism in its life.

4 Ming-Feng Yeh1-105 Search Space The space of all feasible solutions (it means objects among those the desired solution is) is called search space (also state space). Each point in the search space represent one feasible solution. The looking for a solution is then equal to a looking for some extreme (minimum or maximum) in the search space. Search methods: hill climbing, tabular search, simulated annealing and genetic algorithm.

5 Ming-Feng Yeh1-106 Basic Description of GA Algorithm is started with a set of solutions (represented by chromosomes) called population. Solutions from one population are taken and used to form a new population. The new population (offspring) will be better than the old one (parent). Solutions which are selected to form new solutions are selected according to their fitness - the more suitable they are the more chances they have to reproduce.

6 Ming-Feng Yeh1-107 Basic Genetic Algorithm

7 Ming-Feng Yeh1-108 Basic GA: part 1 Step 1: [Start] Generate random population of n chromosomes (suitable solutions for the problem.) Step 2: [Fitness] Evaluate the fitness f(x) of each chromosome x in the population. Step 3: [New population] Create a new population by repeating following steps until the new population is complete.

8 Ming-Feng Yeh1-109 Basic GA: part 2 Step 3: Create a new population: 1. [Selection] Select two parent chromosomes from a population according to their fitness. 2. [Crossover] With a crossover probability cross over the parents to form a new offspring (children). If no crossover was performed, offspring is an exact copy of parents. 3. [Mutation] With a mutation probability mutate new offspring at each locus. 4. [Accepting] Place new offspring in a new population

9 Ming-Feng Yeh1-110 Basic GA: part 3 Step 4: [Replace] Use new generated population for a further run of algorithm Step 5: [Test] If the end condition is satisfied, stop, and return the best solution in current population Step 6: [Loop] Go to step 2.

10 Ming-Feng Yeh1-111 Operators of GA: Encoding The chromosome should in some way contain information about solution which it represents. The most used way of encoding is a binary string. Chromosome 1  1101100100110110 Chromosome 2  1101111000011110 Each bit in this string can represent some characteristic of the solution. One can encode directly integer or real numbers.

11 Ming-Feng Yeh1-112 Operators of GA: Selection Chromosomes are selected from the population to be parents to crossover. According to Darwin's evolution theory the best ones should survive and create new offspring. For example: roulette wheel selection, Boltzman selection, tournament selection, rank selection, steady state selection and some others.

12 Ming-Feng Yeh1-113 Roulette Wheel Selection Parents are selected according to their fitness. The better the chromosomes are, the more chances to be selected they have.

13 Ming-Feng Yeh1-114 Example fitness values f(x)=x 2 xstringfitness f(x)% of total 130110116914.4 241100057649.2 801000645.5 191001136130.9 total1170100.0

14 Ming-Feng Yeh1-115 Rank Selection: 1 Rank selection first ranks the population and then every chromosome receives fitness from this ranking.

15 Ming-Feng Yeh1-116 Rank Selection: 2 After this all the chromosomes have a chance to be selected. But this method can lead to slower convergence, because the best chromosomes do not differ so much from other ones.

16 Ming-Feng Yeh1-117 Operators of GA: Crossover Crossover selects genes from parent chromosomes and creates a new offspring. Chromosome 1  11011 | 00100110110 Chromosome 2  11011 | 11000011110 Offspring 1  11011 | 11000011110 Offspring 2  11011 | 00100110110 “ | “ is the crossover point

17 Ming-Feng Yeh1-118 Crossover Single point crossover: 11001011+11011111 = 11001111 Two point crossover: 11001011 + 11011111 = 11011111 Uniform crossover : 11001011 + 11011101 = 11011111 Arithmetic crossover: 11001011 + 11011111 = 11001001 (AND)

18 Ming-Feng Yeh1-119 Operators of GA: Mutation Prevent falling all solutions in population into a local optimum of solved problem Mutation changes randomly the new offspring. Original offspring 1  1101111000011110 Mutated offspring 1  1100111000011110 Original offspring 2  1101100100110110 Mutated offspring 2  1101101100110110

19 Ming-Feng Yeh1-120 Control Parameters GA has two control parameters: crossover rate (p c ) and mutation rate (p m ). p c (0.5~1.0): The higher the value of p c, the quicker are the new solutions introduced into the population. p m (0.005~0.05): Large values of p m transform the GA into a purely random search algorithm, while some mutations are required to prevent the premature convergence of the GA to suboptimal solutions.

20 Ming-Feng Yeh1-121 Numerical Example No.string xfitness% of total 101101 1316914.4 211000 24576 (max)49.2 301000 8645.5 410011 1936130.9 total 1170100.0

21 Ming-Feng Yeh1-122 Numerical Example No.actual count 10.140.581 20.49 (max)1.97 (max)2 (max) 30.060.220 40.311.231 average0.251.0

22 Ming-Feng Yeh1-123 Numerical Example No.string mate crossover site new string 10110|1 2401100 21100|0 1411001 311|000 4211011 410|011 3210000

23 Ming-Feng Yeh1-124 Numerical Example No. new population xf(x)=x 2 10110012144 21100125625 31101127729 (max) 41000016256 10110113169 21100024576 (max) 301000864 41001119361

24 Ming-Feng Yeh1-125 Real-Valued GA Basic (binary) GA 當系統參數增多時,編碼 (encoding) 及解碼 (decoding) 過程相當耗時,尤 其當字串長度不足時,亦可能造成浮點數運算 之精確度不足,而導致無法搜尋到「真正」的 最佳值。 實數型基因演算法是直接以實數參數運算,無 須透過離散式的編碼形式。故可以免除編碼及 解碼過程,亦可以提高系統之精確度。

25 Ming-Feng Yeh1-126 交配過程及突變過程 假設 P 1 與 P 2 為父代, C 1 與 C 2 為子代 交配過程: C 1 =   P 1 + (1  )  P 2 C 2 =   P 1 + (1   )  P 2 其中  和  為隨機值,且 ,   [0, 1] 突變過程: C ’ = C + random_noise 其中 random_noise 為所加入之隨機雜訊

26 Ming-Feng Yeh1-127 整數型基因演算法 直接以整數型態作為運算之基本單位,無須再 進行二進位轉換。 設變數之區間為 [0,  ] ,若以 4 位元編碼,則 可將此區間均分為 15 等分: 二進位 00000001---1000---1111 整數 01---8 15 實數 0  / 15 --- 8  / 15 --- 

27 Ming-Feng Yeh1-128 交配過程及突變過程 交配過程: 與 Binary GA 相似 突變過程:交換法 例:原始字串  突變後字串 123456  125436


Download ppt "Ming-Feng Yeh1-102 4. Genetic Algorithm Genetic algorithms are a part of evolutionary computing, which is a rapidly growing area of artificial intelligence."

Similar presentations


Ads by Google