How to show initial population in Genetic Algorithm
5 views (last 30 days)
Show older comments
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 Comments
Answers (0)
See Also
Categories
Find more on Genetic Algorithm in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!