single cross over function for genetic algorithm
6 views (last 30 days)
Show older comments
hello,
i'm working on a code for genetic algorithm and i have 2 random parents data for example
p1=[1 2 3 4 5 6 7 8 9 10] % parent #1
p2=[2 6 8 9 1 3 4 5 10 9] % parent #2
now if i want to make a single crossover on point 3 for example .. is there any specific function i can use to produce the child ?
i saw crossoversinglepoint function but i really don't know how to use it.. ps all the parents are integer numbers
thank you in advance
Abdulla Aqeel
0 Comments
Accepted Answer
Geoff Hayes
on 19 May 2015
Abdulla - since you want a single crossover point in your list of variables, then using crossoversinglepoint seems like the correct choice. To use this function, you will need to set the GA options using gaoptimset. Something like the following would probably work for you
options = gaoptimset('CrossoverFcn',@crossoversinglepoint);
Note that you can set other properties of options as well, so you are not limited to the above single option.
0 Comments
More Answers (0)
See Also
Categories
Find more on Genetic Algorithm in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!