replace some individuals in the current population using genetic algorithm, matlab

1 view (last 30 days)
Hello,
I'd like to use genetic algorithm to solve optimization problems based on the available commands ga or gamultiobj in matlab. But I want to make some change:
|Evaluate the objective values of the current offspring (population), and sort out m individuals with the worst fitness values and some individuals with the best fitness values;
Create m new individuals based on the best individuals, replace the m worst individuals with the newly creased ones;
Start the next round of evolution...|
Is it possible to re-conduct the ga or gamultiopt command to achieve it? In the documentation I found that I could use user-defined function for the scaling, selection, mutation and crossover. But these do not offer a space for replacing the current population. Anybody know how to solve the problem? Or do I need to prepare my own genetic algorithm code instead of using ga or gamultiopt command?
I'm looking forward to any suggestions.
Thanks in advance!

Answers (2)

Alan Weiss
Alan Weiss on 5 Dec 2013
Selection gets you the parents. Mutation and crossover get you the children. So custom selection, mutation, and crossover functions can provide what you need.
For a discussion of the GA algorithm, see How the Genetric Algorithm Works.
Alan Weiss
MATLAB mathematical toolbox documentation

Ahmed Rageh
Ahmed Rageh on 5 Mar 2018
How could I know the current population number. For example, if I have 20 population, how can I know which one is currently in progress?

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!