Documentation of 'org.apache.commons.math3.genetics.ListPopulation' Java class
ListPopulation
org.apache.commons.math3.genetics

Class ListPopulation

  • All Implemented Interfaces:
    java.lang.Iterable<Chromosome>, Population
    Direct Known Subclasses:
    ElitisticListPopulation


    public abstract class ListPopulation
    extends java.lang.Object
    implements Population
    Population of chromosomes represented by a List.
    Since:
    2.0
    • Constructor Detail

      • ListPopulation

        public ListPopulation(int populationLimit)
                       throws NotPositiveException
        Creates a new ListPopulation instance and initializes its inner chromosome list.
        Parameters:
        populationLimit - maximal size of the population
        Throws:
        NotPositiveException - if the population limit is not a positive number (< 1)
    • Method Detail

      • addChromosomes

        public void addChromosomes(java.util.Collection<Chromosome> chromosomeColl)
                            throws NumberIsTooLargeException
        Add a Collection of chromosomes to this Population.
        Parameters:
        chromosomeColl - a Collection of chromosomes
        Throws:
        NumberIsTooLargeException - if the population would exceed the population limit when adding this chromosome
        Since:
        3.1
      • getChromosomes

        public java.util.List<Chromosome> getChromosomes()
        Returns an unmodifiable list of the chromosomes in this population.
        Returns:
        the unmodifiable list of chromosomes
      • 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.
      • getPopulationSize

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

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • iterator

        public java.util.Iterator<Chromosome> iterator()
        Returns an iterator over the unmodifiable list of chromosomes.

        Any call to Iterator.remove() will result in a UnsupportedOperationException.

        Specified by:
        iterator in interface java.lang.Iterable<Chromosome>
        Returns:
        chromosome iterator

DMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.