Class ListPopulation

    • Constructor Detail

      • ListPopulation

        public ListPopulation​(List<Chromosome> chromosomes,
                              int populationLimit)
        Creates a new ListPopulation instance.
        Parameters:
        chromosomes - list of chromosomes in the population
        populationLimit - maximal size of the population
      • ListPopulation

        public ListPopulation​(int populationLimit)
        Creates a new ListPopulation instance and initializes its inner chromosome list.
        Parameters:
        populationLimit - maximal size of the population
    • Method Detail

      • setChromosomes

        public void setChromosomes​(List<Chromosome> chromosomes)
        Sets the list of chromosomes.
        Parameters:
        chromosomes - the list of chromosomes
      • getChromosomes

        public List<Chromosome> getChromosomes()
        Access the list of chromosomes.
        Returns:
        the list of chromosomes
      • addChromosome

        public void addChromosome​(Chromosome chromosome)
        Add the given chromosome to the population.
        Specified by:
        addChromosome in interface Population
        Parameters:
        chromosome - the chromosome to add.
      • getFittestChromosome

        public Chromosome getFittestChromosome()
        Access the fittest chromosome in this population.
        Specified by:
        getFittestChromosome in interface Population
        Returns:
        the fittest chromosome.
      • getPopulationLimit

        public int getPopulationLimit()
        Access the maximum population size.
        Specified by:
        getPopulationLimit in interface Population
        Returns:
        the maximum population size.
      • setPopulationLimit

        public void setPopulationLimit​(int populationLimit)
        Sets the maximal population size.
        Parameters:
        populationLimit - maximal population size.
      • getPopulationSize

        public int getPopulationSize()
        Access the current population size.
        Specified by:
        getPopulationSize in interface Population
        Returns:
        the current population size.