How to change Crossover Function in GA midway through solving?
조회 수: 5 (최근 30일)
이전 댓글 표시
Hi all,
I have a GA setup to search for a minimum of a problem. I think my problem is well defined, except it has many local optima. I read in the documentation that changing the Crossover and Mutation Functions midway through iterations can be very useful in aiding of finding global optima. I understand it needs to be modified by the 'OutputFcn' settings, but all the documentation I see include cases where multiple things are being changed. Say if I just want to change the Crossover from 0.2 at the beginning to 0.8 after a certain number of iterations, what would the script for OutputFcn look like?
All the best.
댓글 수: 0
답변 (1개)
Alan Weiss
2018년 8월 6일
I think that this will work, but I have not tested it, so use at your own risk.
Suppose that you want to change the crossover probability at generation 27.
function [state,options,optchanged] = gaoutfun(options,state,flag)
optchanged = false;
if state.Generation == 27
options.CrossoverFraction = 0.8;
optchanged = true;
end
Pass @gaoutfun as the OutputFcn option (I assume that you use optimoptions to set your options).
Alan Weiss
MATLAB mathematical toolbox documentation
댓글 수: 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!