single cross over function for genetic algorithm

10 ビュー (過去 30 日間)
abdulla ishaq
abdulla ishaq 2015 年 5 月 18 日
回答済み: Geoff Hayes 2015 年 5 月 19 日
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

採用された回答

Geoff Hayes
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);
You would then pass this object (as the last input parameter) into the ga function.
Note that you can set other properties of options as well, so you are not limited to the above single option.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGenetic Algorithm についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by