필터 지우기
필터 지우기

How to change Crossover Function in GA midway through solving?

조회 수: 6 (최근 30일)
Harvey Rael
Harvey Rael 2018년 8월 2일
답변: Alan Weiss 2018년 8월 6일
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.

답변 (1개)

Alan Weiss
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

카테고리

Help CenterFile Exchange에서 Genetic Algorithm에 대해 자세히 알아보기

제품


릴리스

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by