Initial population in genetic algorithm

조회 수: 44 (최근 30일)
djedoui Nassim
djedoui Nassim 2021년 4월 5일
댓글: djedoui Nassim 2021년 4월 6일
Hello
I am trying to use GA and other algorithms to minimize my problem. For a faire comparison, the initial population will be chosen the same for all the algorithms. A randomly generated population is then generated and called for each algorithm.
So far, the idea works well except for GA where different result (starting objective) is obtained.
Following the options used for the GA, anyone can help me with this?
options = optimoptions(@ga,'Generations',Max_iteration,'OutputFcns',@outputfunction,'PopulationSize',50,'InitialPopulationMatrix',initialX,'TolFun',1e-10);

채택된 답변

Alan Weiss
Alan Weiss 2021년 4월 5일
To get reproducible results, set the random number generator before you call ga. For example,
rng default
% or rng(1) or whatever you like
% Then call ga
Alan Weiss
MATLAB mathematical toolbox documentation
  댓글 수: 4
djedoui Nassim
djedoui Nassim 2021년 4월 6일
Thank you again,
My trouble is that is I am getting different result namely for the first itteration of the GA compared to the other algorithm where the same initial population is used.
djedoui Nassim
djedoui Nassim 2021년 4월 6일
I tried your suggested solution and it works
with
rng(0.5)
Many thanks

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

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

제품


릴리스

R2015b

Community Treasure Hunt

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

Start Hunting!

Translated by