GA Demo: Unimodal Function Optimization
by Amit
Here is a demo of using a Genetic Algorithm for a function optimization. Vital information:
- Real coded Genetic Algorithm
- Population size: 100, Generations: 100
- Crossover: SBX Crossover
- Mutation: Polynomial Mutation
What do you see?
A. We start with a initial population which is randomly distributed throughout the function landscape. If you have keen eyes, like a friend, Shivam, you will notice that the initial population is not so random. If you increase the population size, the initial population will cover all most all areas of the fitness landscape, like shown in this figure:
B. As the GA evolves, you see more individuals settling in on the two global minima and finally all the individuals settle in only one of the global minima. (A vanilla GA will in most cases converge to the best solution in the fitness landscape, to capture mulitple solutions, we will have to use one of the GA methods specially developed for that purpose, which are loosely called GAs for multimodal optimization)
C. An interesting thing to see here is that, which one of the minima the individuals go to is completely unpredictable, since our fitness or cost function here is the function value. In this case, since both the minima are global, hence the probability of the GA converging to each is equal and will vary w.r.t the GA parameter settings.
Code
I used an existing RGA implementation and I just hooked it up with gnuplot and xvidcap to capture the population evolution. I f you want to take a look at the code, please let me know and I shall be happy to discuss it with you.
Wishful wish
Such visualizations often help you with understanding the evolution of the population, which otherwise is not so easy. Sadly, we are in a three dimensional space. (which however, I hope is not true).Once that happens, working with GAs will be sure fun- Imagine population of individuals in 10s of dimensions evolving and you seeing them where exactly they are going) :D
[…] https://amitksaha.wordpress.com/2010/03/25/ga-demo-unimodal-function-optimization/ […]
[…] a second one where an explicit multiple-solution preserving mechanism is in place(For details refer here and […]
hi sir,
I am doing final year project on the topic ” A hybrid coevolutionary approach for designing fuzzy classifiers”.I have a small doubt on the chromosome structure.can you please explain me about this structure in detail sir.can i have your E-Mail id sir.
hi sir,
can i send my final year project paper to you sir for clarifying about chromosome structure.
hi sir,
I have posted my paper and my queries sir.