single cross over function for genetic algorithm
9 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
Geoff Hayes
2015-5-19
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 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Genetic Algorithm 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!