genetic algorithm a biologically inspired model of intelligence and the principles of biological...
TRANSCRIPT
![Page 1: GENETIC ALGORITHM A biologically inspired model of intelligence and the principles of biological evolution are applied to find solutions to difficult problems](https://reader035.vdocument.in/reader035/viewer/2022062720/56649f055503460f94c1ac49/html5/thumbnails/1.jpg)
GENETIC ALGORITHMGENETIC ALGORITHM
A biologically inspired model of intelligence and the principles of biological evolution are applied to find solutions to difficult problems
The problems are not solved by reasoning logically about them; rather populations of competing candidate solutions are spawned and then evolved to become better solutions through a process patterned after biological evolution
Less worthy candidate solutions tend to die out, while those that show promise of solving a problem survive and reproduce by constructing new solutions out of their components
![Page 2: GENETIC ALGORITHM A biologically inspired model of intelligence and the principles of biological evolution are applied to find solutions to difficult problems](https://reader035.vdocument.in/reader035/viewer/2022062720/56649f055503460f94c1ac49/html5/thumbnails/2.jpg)
GENETIC ALGORITHMGENETIC ALGORITHM
GA begin with a population of candidate problem solutions
Candidate solutions are evaluated according to their ability to solve problem instances: only the fittest survive and combine with each other to produce the next generation of possible solutions
Thus increasingly powerful solutions emerge in a Darwinian universe
Learning is viewed as a competition among a population of evolving candidate problem solutions
This method is heuristic in nature and it was introduced by John Holland in 1975
![Page 3: GENETIC ALGORITHM A biologically inspired model of intelligence and the principles of biological evolution are applied to find solutions to difficult problems](https://reader035.vdocument.in/reader035/viewer/2022062720/56649f055503460f94c1ac49/html5/thumbnails/3.jpg)
GENETIC ALGORITHMGENETIC ALGORITHM
Basic Algorithm
begin set time t = 0; initialise population P(t) = {x1
t, x2t, …, xn
t} of solutions;
while the termination condition is not met do begin evaluate fitness of each member of P(t); select some members of P(t) for creating offspring; produce offspring by genetic operators; replace some members with the new offspring; set time t = t + 1; endend
![Page 4: GENETIC ALGORITHM A biologically inspired model of intelligence and the principles of biological evolution are applied to find solutions to difficult problems](https://reader035.vdocument.in/reader035/viewer/2022062720/56649f055503460f94c1ac49/html5/thumbnails/4.jpg)
GENETIC ALGORITHMGENETIC ALGORITHM
Representation of Solutions: The Chromosome
Gene: A basic unit, which represents one characteristic of the individual. The value of each gene is called an allele
Chromosome: A string of genes; it represents an individual i.e. a possible solution of a problem. Each chromosome represents a point in the search space
Population: A collection of chromosomes
An appropriate chromosome representation is important for the efficiency and complexity of the GA
![Page 5: GENETIC ALGORITHM A biologically inspired model of intelligence and the principles of biological evolution are applied to find solutions to difficult problems](https://reader035.vdocument.in/reader035/viewer/2022062720/56649f055503460f94c1ac49/html5/thumbnails/5.jpg)
GENETIC ALGORITHMGENETIC ALGORITHM
Representation of Solutions: The Chromosome
The classical representation scheme for chromosomes is binary vectors of fixed length
In the case of an I-dimensional search space, each chromosome consists of I variables with each variable encoded as a bit string
![Page 6: GENETIC ALGORITHM A biologically inspired model of intelligence and the principles of biological evolution are applied to find solutions to difficult problems](https://reader035.vdocument.in/reader035/viewer/2022062720/56649f055503460f94c1ac49/html5/thumbnails/6.jpg)
GENETIC ALGORITHMGENETIC ALGORITHM
Example: Cookies Problem
Two parameters sugar and flour (in kgs). The range for both is 0 to 9 kgs. Therefore a chromosome will comprise of two genes called sugar and flour
5 1 Chromosome # 01
2 4 Chromosome # 02
![Page 7: GENETIC ALGORITHM A biologically inspired model of intelligence and the principles of biological evolution are applied to find solutions to difficult problems](https://reader035.vdocument.in/reader035/viewer/2022062720/56649f055503460f94c1ac49/html5/thumbnails/7.jpg)
GENETIC ALGORITHMGENETIC ALGORITHM
Example: Expression satisfaction Problem
F = (a c) (a c e) (b c d e) (a b c) (e f)
Chromosome: Six binary genes a b c d e f e.g. 100111
![Page 8: GENETIC ALGORITHM A biologically inspired model of intelligence and the principles of biological evolution are applied to find solutions to difficult problems](https://reader035.vdocument.in/reader035/viewer/2022062720/56649f055503460f94c1ac49/html5/thumbnails/8.jpg)
GENETIC ALGORITHMGENETIC ALGORITHM
Representation of Solutions: The Chromosome
Chromosomes have either binary or real valued genes
In binary coded chromosomes, every gene has two alleles
In real coded chromosomes, a gene can be assigned any value from a domain of values
![Page 9: GENETIC ALGORITHM A biologically inspired model of intelligence and the principles of biological evolution are applied to find solutions to difficult problems](https://reader035.vdocument.in/reader035/viewer/2022062720/56649f055503460f94c1ac49/html5/thumbnails/9.jpg)
Model Learning
Use GA to learn the concept Yes Reaction from the Food Allergy problem’s data
GENETIC ALGORITHMGENETIC ALGORITHM
![Page 10: GENETIC ALGORITHM A biologically inspired model of intelligence and the principles of biological evolution are applied to find solutions to difficult problems](https://reader035.vdocument.in/reader035/viewer/2022062720/56649f055503460f94c1ac49/html5/thumbnails/10.jpg)
Chromosomes Encoding
A potential model of the data can be represented as a chromosome with the genetic representation:
Gene # 1 Gene # 2 Gene # 3 Gene # 4Restaurant Meal Day Cost
The alleles of genes are:
Restaurant gene: Sam, Lobdell, Sarah, XMeal gene: breakfast, lunch, XDay gene: Friday, Saturday, Sunday, XCost gene: cheap, expensive, X
GENETIC ALGORITHMGENETIC ALGORITHM
![Page 11: GENETIC ALGORITHM A biologically inspired model of intelligence and the principles of biological evolution are applied to find solutions to difficult problems](https://reader035.vdocument.in/reader035/viewer/2022062720/56649f055503460f94c1ac49/html5/thumbnails/11.jpg)
Chromosomes Encoding (Hypotheses Representation)
Hypotheses are often represented by bit strings (because they can be easily manipulated by genetic operators), but other numerical and symbolic representations are also possible
Set of if-then rules: Specific sub-strings are allocated for encoding each rule pre-condition and post-condition
Example: Suppose we have an attribute “Outlook” which can take on values: Sunny, Overcast or Rain
GENETIC ALGORITHMGENETIC ALGORITHM
![Page 12: GENETIC ALGORITHM A biologically inspired model of intelligence and the principles of biological evolution are applied to find solutions to difficult problems](https://reader035.vdocument.in/reader035/viewer/2022062720/56649f055503460f94c1ac49/html5/thumbnails/12.jpg)
Chromosomes Encoding (Hypotheses Representation)
We can represent it with 3 bits: 100 would mean the value Sunny, 010 would mean Overcast & 001 would mean Rain
110 would mean Sunny or Overcast111 would mean that we don’t care about its value
The pre-conditions and post-conditions of a rule are encoding by concatenating the individual representation of attributes
GENETIC ALGORITHMGENETIC ALGORITHM
![Page 13: GENETIC ALGORITHM A biologically inspired model of intelligence and the principles of biological evolution are applied to find solutions to difficult problems](https://reader035.vdocument.in/reader035/viewer/2022062720/56649f055503460f94c1ac49/html5/thumbnails/13.jpg)
Chromosomes Encoding (Hypotheses Representation)
Example:
If (Outlook = Overcast or Rain) and Wind = strong then PlayTennis = No
can be encoded as 0111001
Another rule If Wind = Strong
then PlayTennis = Yes
can be encoded as 1111010
GENETIC ALGORITHMGENETIC ALGORITHM
![Page 14: GENETIC ALGORITHM A biologically inspired model of intelligence and the principles of biological evolution are applied to find solutions to difficult problems](https://reader035.vdocument.in/reader035/viewer/2022062720/56649f055503460f94c1ac49/html5/thumbnails/14.jpg)
Chromosomes Encoding (Hypotheses Representation)
An hypothesis comprising of both of these rules can be encoded as a chromosome
01110011111010
Note that even if an attribute does not appear in a rule, we reserve its place in the chromosome, so that we can have fixed length chromosomes
GENETIC ALGORITHMGENETIC ALGORITHM
![Page 15: GENETIC ALGORITHM A biologically inspired model of intelligence and the principles of biological evolution are applied to find solutions to difficult problems](https://reader035.vdocument.in/reader035/viewer/2022062720/56649f055503460f94c1ac49/html5/thumbnails/15.jpg)
Variable size chromosomes
Sometimes we need a variable size chromosome; e.g. to represent a set of rules
Example: Suppose we are representing a set of rules by a chromosome
If a1 = T and a2 = F then c = TIf a2 = T then c = F
The chromosome would be 10 01 1 11 10 0where a1 = T is represented by 10,
a2 = F by 01, and so on
GENETIC ALGORITHMGENETIC ALGORITHM
![Page 16: GENETIC ALGORITHM A biologically inspired model of intelligence and the principles of biological evolution are applied to find solutions to difficult problems](https://reader035.vdocument.in/reader035/viewer/2022062720/56649f055503460f94c1ac49/html5/thumbnails/16.jpg)
GENETIC ALGORITHMGENETIC ALGORITHM
Evaluation/Fitness Function
It is used to determine the fitness of a chromosome
Creating a good fitness function is one of the challenging tasks of using GA
![Page 17: GENETIC ALGORITHM A biologically inspired model of intelligence and the principles of biological evolution are applied to find solutions to difficult problems](https://reader035.vdocument.in/reader035/viewer/2022062720/56649f055503460f94c1ac49/html5/thumbnails/17.jpg)
GENETIC ALGORITHMGENETIC ALGORITHM
Example: Cookies Problem
Two parameters sugar and flour (in kgs). The range for both is 0 to 9 kgs. Therefore a chromosome will comprise of two genes called sugar and flour
5 1
2 4
The fitness function for a chromosome is the taste of the resulting cookies; range of 1 to 9
![Page 18: GENETIC ALGORITHM A biologically inspired model of intelligence and the principles of biological evolution are applied to find solutions to difficult problems](https://reader035.vdocument.in/reader035/viewer/2022062720/56649f055503460f94c1ac49/html5/thumbnails/18.jpg)
GENETIC ALGORITHMGENETIC ALGORITHM
Example: Expression satisfaction Problem
F = (a c) (a c e) (b c d e) (a b c) (e f)
Chromosome: Six binary genes a b c d e f e.g. 100111
Fitness function: No of clauses having truth value of 1e.g. 010010 has fitness 2
![Page 19: GENETIC ALGORITHM A biologically inspired model of intelligence and the principles of biological evolution are applied to find solutions to difficult problems](https://reader035.vdocument.in/reader035/viewer/2022062720/56649f055503460f94c1ac49/html5/thumbnails/19.jpg)
Model Learning
Use GA to learn the concept Yes Reaction from the Food Allergy problem’s data
GENETIC ALGORITHMGENETIC ALGORITHM
The fitness function can be the number of training samples correctly classified by a chromosome (model)
![Page 20: GENETIC ALGORITHM A biologically inspired model of intelligence and the principles of biological evolution are applied to find solutions to difficult problems](https://reader035.vdocument.in/reader035/viewer/2022062720/56649f055503460f94c1ac49/html5/thumbnails/20.jpg)
GENETIC ALGORITHMGENETIC ALGORITHM
Population Size
Number of individuals present and competing in an iteration (generation)
If the population size is too large, the processing time is high and the GA tends to take longer to converge upon a solution (because less fit members have to be selected to make up the required population)
If the population size is too small, the GA is in danger of premature convergence upon a sub-optimal solution (all chromosomes will soon have identical traits). This is primarily because there may not be enough diversity in the population to allow the GA to escape local optima
![Page 21: GENETIC ALGORITHM A biologically inspired model of intelligence and the principles of biological evolution are applied to find solutions to difficult problems](https://reader035.vdocument.in/reader035/viewer/2022062720/56649f055503460f94c1ac49/html5/thumbnails/21.jpg)
GENETIC ALGORITHMGENETIC ALGORITHM
Selection Operators (Algorithms)
They are used to select parents from the current population
The selection is primarily based on the fitness. The better the fitness of a chromosome, the greater its chance of being selected to be a parent
The rate at which a selection algorithm selects individuals with above average fitness is selective pressure
If there is not enough selective pressure, the population will fail to converge upon a solution. If there is too much, the population may not have enough diversity and converge prematurely
![Page 22: GENETIC ALGORITHM A biologically inspired model of intelligence and the principles of biological evolution are applied to find solutions to difficult problems](https://reader035.vdocument.in/reader035/viewer/2022062720/56649f055503460f94c1ac49/html5/thumbnails/22.jpg)
GENETIC ALGORITHMGENETIC ALGORITHM
Selection Operators: Random Selection
Individuals are selected randomly with no reference to fitness at all
All the individuals, good or bad, have an equal chance of being selected
![Page 23: GENETIC ALGORITHM A biologically inspired model of intelligence and the principles of biological evolution are applied to find solutions to difficult problems](https://reader035.vdocument.in/reader035/viewer/2022062720/56649f055503460f94c1ac49/html5/thumbnails/23.jpg)
GENETIC ALGORITHMGENETIC ALGORITHM
Selection Operators: Proportional Selection
Chromosomes are selected based on their fitness relative to the fitness of all other chromosomes
For this all the fitness are added to form a sum S and each chromosome is assigned a relative fitness (which is its fitness divided by the total fitness S)
A process similar to spinning a roulette wheel is adopted to choose a parent; the better a chromosome’s relative fitness, the higher its chances of selection
![Page 24: GENETIC ALGORITHM A biologically inspired model of intelligence and the principles of biological evolution are applied to find solutions to difficult problems](https://reader035.vdocument.in/reader035/viewer/2022062720/56649f055503460f94c1ac49/html5/thumbnails/24.jpg)
GENETIC ALGORITHMGENETIC ALGORITHM
Selection Operators: Proportional Selection
The selection of only the most fittest chromosomes may result in the loss of a correct gene value which may be present in a less fit member (and then the only chance of getting it back is by mutation)
One way to overcome this risk is to assign probability of selection to each chromosome based on its fitness
In this way even the less fit members have some chance of surviving into the next generationChromosomes are selected based on their fitness relative to the fitness of all other chromosomes
![Page 25: GENETIC ALGORITHM A biologically inspired model of intelligence and the principles of biological evolution are applied to find solutions to difficult problems](https://reader035.vdocument.in/reader035/viewer/2022062720/56649f055503460f94c1ac49/html5/thumbnails/25.jpg)
GENETIC ALGORITHMGENETIC ALGORITHM
Selection Operators: Proportional Selection
For this all the fitness are added to form a sum S and each chromosome is assigned a relative fitness (which is its fitness divided by the total fitness S)
A process similar to spinning a roulette wheel is adopted to choose a parent; the better a chromosome’s relative fitness, the higher its chances of selection
![Page 26: GENETIC ALGORITHM A biologically inspired model of intelligence and the principles of biological evolution are applied to find solutions to difficult problems](https://reader035.vdocument.in/reader035/viewer/2022062720/56649f055503460f94c1ac49/html5/thumbnails/26.jpg)
GENETIC ALGORITHMGENETIC ALGORITHM
Selection Operators: Proportional Selection
The probability of selection of a chromosome “i” may be calculated as
pi = fitnessi / j fitnessj
Example
Chromosome Fitness Selection Probability1 7 7/142 4 4/143 2 2/144 1 1/14
![Page 27: GENETIC ALGORITHM A biologically inspired model of intelligence and the principles of biological evolution are applied to find solutions to difficult problems](https://reader035.vdocument.in/reader035/viewer/2022062720/56649f055503460f94c1ac49/html5/thumbnails/27.jpg)
GENETIC ALGORITHMGENETIC ALGORITHM
Selection Operators: Proportional Selection
![Page 28: GENETIC ALGORITHM A biologically inspired model of intelligence and the principles of biological evolution are applied to find solutions to difficult problems](https://reader035.vdocument.in/reader035/viewer/2022062720/56649f055503460f94c1ac49/html5/thumbnails/28.jpg)
GENETIC ALGORITHMGENETIC ALGORITHM
Selection Operators: Proportional Selection
Advantage
Selective pressure varies with the distribution of fitness within a population. If there is a lot of fitness difference between the more fit and less fit chromosomes, then the selective pressure will be higher
Disadvantage
As the population converges upon a solution, the selective pressure decreases, which may hinder the GA to find better solutions
![Page 29: GENETIC ALGORITHM A biologically inspired model of intelligence and the principles of biological evolution are applied to find solutions to difficult problems](https://reader035.vdocument.in/reader035/viewer/2022062720/56649f055503460f94c1ac49/html5/thumbnails/29.jpg)
References
Engelbrecht Chapter 8 & 9
GENETIC ALGORITHMGENETIC ALGORITHM