Skip to content
Diego Giacomelli edited this page Nov 20, 2015 · 16 revisions

#Performance tips

  • If you need to run a long term GA, use PerformanceGenerationStrategy.
population.GenerationStrategy = new PerformanceGenerationStrategy();
  • If your chromosomes has any external resource, like a bitmap or a file, remember to dispose those resources.

#Generation strategy Population class has a property called GenerationStrategy, this property receive an implementation of IGenerationStrategy interface. The generation strategy is responsible for some key points of generation behavior inside a population and can affect the performance.

There two ways to keep track of generation on a population:

  • TrackingGenerationStrategy: an IGenerationStrategy's implementation that keeps all generations to further evaluation. This strategy can be slow and can suffer of OutOfMemoryException when you have great population and a long term termination.
  • PerformanceGenerationStrategy: an IGenerationStrategy's implementation which takes into account the performance and just keep the last one generations in the population. This strategy is not good for tracking all the generations, but is the best one when you have a very long term termination.

If you need to further evaluation all generations of the GA, use TrackingGenerationStrategy, otherwise use PerformanceGenerationStrategy. By default PerformanceGenerationStrategy will keep only one generation in the Population.Generations list and release all old generation to garbage collector.

Clone this wiki locally