Reusing scores during genetic algorithm optimization
Show older comments
I'm using GA to optimize a very expensive objective function. Since this is deterministic there are a lot of repeat runs using exactly the same input producing exactly the same output, especially in the mid-late generations where the population is quite homogeneous.
Is there an option to tell GA to maintain a (partial) database of fitness scores for already tested inputs? e.g. store the best 100 individuals and when a new individual is being evaluated, first compare it to the database to see if the score is already known.
Accepted Answer
More Answers (1)
Walter Roberson
on 20 May 2013
0 votes
I have not noticed such a thing documented.
You can do it on your end, in the objective function, by using persistent variables (amongst other possibilities.)
If the persistent variables are the empty array, [], then the variables need to be initialized.
Upon entry to the function, check if you have a record of those particular inputs. If you do, return the recorded output.
Otherwise do the calculation and then store the inputs and outputs together in the persistent variables.
Depending how long your input vector is, you might want to use a "map" object to do the storage. With short vectors, ismember() might be okay; with medium vectors, you could use a branching table of cell arrays. Unless, that is, you are lucky enough that your inputs can be mapped into non-negative integers, in which case you could do that conversion and index an array. (If you have bounded ranges, then dividing the range up into substates of equal length can make it easy to do an approximate conversion that would at least allow you to reduce the space you searched over.)
Categories
Find more on Genetic Algorithm in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!