Class Engine

  • public class Engine
    extends java.lang.Object
    Engine class provides complete algorithm to evolve populations of chromosomes, regardless of these kind. This implementation of the genetic algorithm contemplates the elitism variant for the selection. The mutation and cross are more chromosome-dependent that the algorithm-dependent, therefore, chromosomes are instantiated for its class and evaluated through the Fitness instance.
    • Constructor Summary

      Constructor Description
      Engine​(java.lang.Class chromotype, int individuals, int _chromosomeSize, double _pc, double _pm, Fitness _evaluator)
    • Constructor Detail

      • Engine

        public Engine​(java.lang.Class chromotype,
                      int individuals,
                      int _chromosomeSize,
                      double _pc,
                      double _pm,
                      Fitness _evaluator)
        Constructor. Initialize a population of individuals of type chromotype. Each chromosome has a length of _chromosomeSize, with a crossing probability of _pc and a mutation probability of _pm. To evaluate the fitness of each chromosome will use _evaluator.
        chromotype - The class for the chromosomes
        individuals - The number of individuals for this population
        _chromosomeSize - The size of each chromosome
        _pc - The crossing probability.
        _pm - The mutation probability.
        _evaluator - The fitness evaluator.
    • Method Detail

      • getDefaultRandomGenerator

        public static java.util.Random getDefaultRandomGenerator()
      • initialize

        protected void initialize​(int chromosomeSize)
        Initialize population with size chromosomeSize
        chromosomeSize - The size of the chromosome.
      • evolve

        public Chromosome evolve​(int ages)
        Evolve the population for ages
        ages - ages
        The best chromosome for all these epochs.
      • setProgressBar

        public void setProgressBar​(javax.swing.JProgressBar _progress)