How to apply a random Crossover (Arithmetic/Scattered/Two-point) in Genetic Algorithm using auto-generated file from Optimization Toolbox ?
古いコメントを表示
I have prepared a code in MATLAB with optimization toolbox which seems to be giving fair results for different optimization functions but at present, accuracy is highly dependent on the type of crossover selected.
To take advantage of different crossover and to improve efficiency, i want to apply a random crossover after every iteration i.e. any of Arithmetic, Scattered or Two-point. How can I do that ?
7 件のコメント
Walter Roberson
2020 年 8 月 10 日
Do you have integer constraints? Do you have linear constraints?
If your system is eligible to provide CrossoverFcn, then that function is not required to do the same kind of cross-over each time.
Ankur Shah
2020 年 8 月 10 日
編集済み: Ankur Shah
2020 年 8 月 10 日
Walter Roberson
2020 年 8 月 10 日
Then you can provide a custom CrossoverFcn that does whatever you want, possibly even calling a random one of the standard crossover functions.
Ankur Shah
2020 年 8 月 11 日
編集済み: Ankur Shah
2020 年 8 月 11 日
Walter Roberson
2020 年 8 月 11 日
crossfcns = {@first, @second};
chosen = crossfcns{randi(length(crossfcns))} ;
[varargout{:}] = chosen<varargin{:}) ;
Ankur Shah
2020 年 8 月 11 日
編集済み: Ankur Shah
2020 年 8 月 11 日
Walter Roberson
2020 年 8 月 11 日
options = optimoptions(options,'CrossoverFcn', @MyCustomCrossover)
function varargout = MyCustomCrossover(varargin)
crossfcns = {@crossoverarithmetic, @crossoverheuristic, @crossoveritnermediate, @crossoverscattered, @crossoversinglepoint, @crossovertwopoint};
chosen = crossfcns{randi(length(crossfcns))} ;
[varargout{:}] = chosen(varargin{:}) ;
end
採用された回答
その他の回答 (1 件)
Sulaymon Eshkabilov
2020 年 8 月 11 日
0 投票
See the screen shot given in the attachement. You should select from the drop-down options whichever crossover function suits for your task.
3 件のコメント
Ankur Shah
2020 年 8 月 11 日
編集済み: Ankur Shah
2020 年 8 月 11 日
Walter Roberson
2021 年 1 月 24 日
I show using a literally random crossover in https://www.mathworks.com/matlabcentral/answers/577609-how-to-apply-a-random-crossover-arithmetic-scattered-two-point-in-genetic-algorithm-using-auto-gen#comment_968707
Ankur Shah
2021 年 1 月 25 日
編集済み: Ankur Shah
2021 年 1 月 25 日
カテゴリ
ヘルプ センター および File Exchange で Genetic Algorithm についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!