SubPopulation (JEvolution)
Date: 2013-03-21

evSOLve.JEvolution

## Class SubPopulation

- java.lang.Object
- - evSOLve.JEvolution.SubPopulation

-     public class SubPopulation
      extends java.lang.Object

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addIndividual(Individual individual)` Adds an Individual to the SubPopulation.
    `Individual` | `getIndividual(int index)` Gives specific Individual.
    `int` | `getSize()` Gives the current sub-population size.
    `void` | `removeIndividual(int index)` Removes an indexed Individual from the SubPopulation.
    `void` | `removeIndividuals()` Clear all individuals of the population.
    `void` | `sort()` Sorts the SubPopulation according to fitness in descending order.
    `void` | `swap(int a, int b)` Exchanges two Individuals in the Population.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### getSize

          public int getSize()

      Gives the current sub-population size.
      Returns:
        the number of individuals in the population

    - #### getIndividual

          public Individual getIndividual(int index)

      Gives specific Individual.
      Parameters:
        `index` - index of Individual (0 - (size - 1))
      Returns:
        Individual

    - #### addIndividual

          public void addIndividual(Individual individual)

      Adds an Individual to the SubPopulation.
      Parameters:
        `individual` - an Individual

    - #### removeIndividual

          public void removeIndividual(int index)

      Removes an indexed Individual from the SubPopulation.
      Parameters:
        `index` - the index of the Individual

    - #### removeIndividuals

          public void removeIndividuals()

      Clear all individuals of the population.

    - #### sort

          public void sort()

      Sorts the SubPopulation according to fitness in descending order.

    - #### swap

          public void swap(int a,
                  int b)

      Exchanges two Individuals in the Population.
      Parameters:
        `a` - index of Individual a
        `b` - index of Individual b