GA Ignores Initial Population and Initial Scores
Show older comments
I am trying to optimize a function which accepts over 1300 parameters, (all integers between 1 and 13). The output is a score which varies between 0 and 100 (floating number), lets call this function as follow:
Score=F([x1,x2,...,x1303]);
I want to maximize this function so I defined a function like this:
OptFun=@(x) (100-F(x));
Now I use GA to minimize this function:
[x,fval,exitflag,output,population,scores] = ga(OptFun,nParam,[],[],[],[],ones(nParam,1),13*ones(nParam,1),[],1:nParam,GAOptions);
nParam=1303 and GAOptions is set like this:
GAOptions = gaoptimset(@ga);
GAOptions.Generations=500;
GAOptions.PopulationSize=24;
GAOptions.UseParallel=true;
GAOptions.Display='iter';
Well, let's not talk about if the Population size is small or number of generations are too low.
The question is that I am expecting that each set of parameters to be evaluated once. But I noticed that each function is revaluated couple of times. For example if x1=x2=...=x1303=13 is re-evaluted couple of times. How do I know this? I added few lines of code to F() which at the end it prints to a text file, what score was evaluted and what was the input parameters. So each time that GA gives a call to OptFun() which subsequently gives a call to F() I would know exactly what is evaluated and what was the score.
I have to mention that each evaluatin of F() could vary between 10min to 1.5hr, (depending on the machine, there is system call to a another application that I only have the binary of it).
I appreciate it if anyone can shed some light on this
2 Comments
Geoff Hayes
on 14 Mar 2015
Mohammad - perhaps I've misunderstood your question, but why can't a member (of the population) with the same set of parameters be evaluated more than once? Why wouldn't the algorithm re-evaluate each member of the population on subsequent generations/iterations to determine their score which may have changed due to the effects of crossover or mutation from the previous generation?
Otherwise the algo would need to flag - at the end of each iteration - those members of the population that are either "new" because of crossover and/or mutation. Thus those that have been flagged in this manner would be evaluated (for their score) on the next iteration, whereas those that aren't flagged would be ignored.
The "flagging" would be nice especially in those cases (like yours) where the evaluation of the objective/fitness function varies from 10 to 90 minutes.
Mohammad Abouali
on 16 Mar 2015
Accepted Answer
More Answers (0)
Categories
Find more on Entering Commands 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!