Initial population of GA has many duplicates

3 views (last 30 days)
Frederik A.
Frederik A. on 17 Oct 2015
Edited: Frederik A. on 23 Oct 2015
Hello everyone,
Currently I'm using the genetic algorithm to perform a global optimization. In the function that needs to be optimized, some code writes the parameters and the calculated fitness value to a file for each evaluation of the function. Now I noticed that the initial population contains a lot of duplicates and very similar individuals, which seems very inefficient to me.
The optimization problem has the following characteristics:
- 5 parameters (an initial population of 50 individuals)
- Lower bound = 0.001, Upper bound = 0.999
- The sum of all the coefficients has to be smaller than one (inequality constraint): A = ones(1,5), b = 1
The problem can be tested with the following piece of code:
function showInitialPop5Param
options = gaoptimset('Generations',1);
ga(@(x) objfunction(x),5,ones(1,5),1,[],[],...
ones(1,5)*0.001,ones(1,5)*0.999,[],options);
end
function err = objfunction(x)
disp(['C1: ' num2str(x(1)) ',C2: ' num2str(x(2)) ',C3: '...
num2str(x(3)) ',C4: ' num2str(x(4)) ',C5: ' num2str(x(5))]);
err = 1;
end
I ran this once, put it in Excel and counted the amount of duplicates using countif in the first 50 strings and found only 10 unique individuals. On top of that, all the individuals are very similar.
A lot of duplicates can be found in the initial population. I was wondering if someone noticed this before, is it an error in my initial conditions, is this on purpose for some reason,...?
(I'm using Matlab R2014b.)
Thank you in advance,
Kind regards,
Frederik

Answers (0)

Community Treasure Hunt

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

Start Hunting!