Reputation: 7581
The genetic algorithm is a meta-heuristic algorithm. The statement is that the population evolves each generation into a better (fitter) solution. Why is that?
I am pretty new at AI but want to improve step by step ;-) So please help me understand this algorithm.
At each iteration, a new generation of the population is created. Why will it contain an equal fit or fitter Individual?
Create a population of Individuals
WHILE population does not have the optimal fittest OR not maximum number of generations
call: evoluate the population
print fittest of population
method: evoluate the population
Craete a new population
FOR the number of individuals in the population
Select a fittest individual out of 5 random Individuals
Select a fittest individual out of 5 random Individuals
Store the crossover of these (parent) Individuals in the new population
FOR the number of individuals in the population
mutate the individual
Is it possible that the next population contains a less fitt solution?
Upvotes: 0
Views: 99
Reputation: 26
Note: Apology for any grammatical mistakes.
Ques: Why will it contain an equal fit or fitter Individual?
Ans: Let's say the algorithm starts with a certain number (say 30) of the population (individual/solutions set) and will run for a certain number (say 30) of generation.
For details, you can check this book: https://www.amazon.com/Hands-Genetic-Algorithms-Python-intelligence-ebook/dp/B0842372RQ/ref=zg_bs_3880_18?_encoding=UTF8&psc=1&refRID=CEXPB1J6G099H25M0S21
Ques: Is it possible that the next population contains a less fitt solution?
Ans: Yes. Due to crossover and mutation, some of the offspring (new individuals) may change a lot from their best parent individual (previous individual selected for crossover/mutation) that they may not give the best result. However, in each generation, the individuals ultimately get better.
Upvotes: 1
Reputation: 27312
It could also contain a less fit solution too, to escape a local optima. That's why the global best solution must be remembered too, unless the first individual is guaranteed to contain it and survive.
Upvotes: 1