How to show initial population in Genetic Algorithm
1 次查看(过去 30 天)
显示 更早的评论
Dear all
I like to show initial population for each generation from given codes below. Normally, GA generate a uniform random number for initital population. My expectation is show full initial population for each generation. Let's given that my populationsize is 100 and i have 10 time of generations. I only could see a final matrix initial population for only 1 generation (i think this is the best genetic found from GA) when GA completed its run. I am not sure if i am missing a loop for initial population? Does anyone could help me? Thank you.
fitnessFunction = @myfunc;
nvars = 24 ;
Aineq = [];
Bineq = [];
Aeq = [];
Beq = [];
bound=load('...limitdata.txt');
LB(1:12)=bound(2,1:12);
LB(13:24)=bound(2,13:24);
UB(1:12)=bound(1,1:12);
UB(13:24)=bound(1,13:24);
nonlconFunction = [];
options = gaoptimset;
options = gaoptimset(options,'SelectionFcn' ,@selectionroulette);
options = gaoptimset(options,'PopulationSize' ,100);
options = gaoptimset(options,'Generations' ,10);
options = gaoptimset(options,'PlotFcns' ,{ @gaplotbestf @gaplotbestindiv @gaplotdistance @gaplotexpectation });
[X,FVAL,REASON,OUTPUT,POPULATION,SCORES] = ga(fitnessFunction,nvars,Aineq,Bineq,Aeq,Beq,LB,UB,nonlconFunction,options);
0 个评论
回答(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!