eaLib API Docs
Last Modified : January 7 2002

mss.ea.core
Class GenericPopulation

java.lang.Object
  |
  +--mss.ea.core.GeneticOperator
        |
        +--mss.ea.core.AbstractPopulation
              |
              +--mss.ea.core.GenericPopulation
All Implemented Interfaces:
java.util.EventListener, IndividualGate, NotificationListener

public class GenericPopulation
extends AbstractPopulation

Generic implementation of a population. The individuals in this population are unsorted.

Since:
0.1
Version:
$Revision: 1.4 $ $Date: 2001/11/23 12:40:49 $
Author:
Andreas Rummler

Field Summary
protected  java.util.ArrayList pop
          ArrayList with individuals, which represents the population.
 
Fields inherited from class mss.ea.core.AbstractPopulation
filter, gc
 
Fields inherited from class mss.ea.core.GeneticOperator
description, ID, name
 
Constructor Summary
GenericPopulation()
          Default constructor.
GenericPopulation(IndividualFilter filt)
          Constructor with individual filter.
 
Method Summary
 void add(Individual i)
          Adds an individual.
 void add(Individual[] ia)
          Adds an array with individuals to the population.
 Individual get(int i)
          Gets the individual at a particular index.
 int getIndex(Individual i)
          Gets the index of a particular individual.
 void remove(int i)
          Removes an individual from the population.
 void remove(int lowerIndex, int upperIndex)
          Removes a range of individuals.
 void removeAll()
          Removes all individuals.
 void replace(Individual i, int index)
          Replaces an individual at a position.
 int size()
          Gets the current size of the population.
 java.util.List subList(int fromIndex, int toIndex)
          Gets a part of the population as a list.
 
Methods inherited from class mss.ea.core.AbstractPopulation
add, add, getCounter, getFilter, getStream, notificationSignal, setFilter, toArray, toCollection, toStream
 
Methods inherited from class mss.ea.core.GeneticOperator
getDescription, getID, getName, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

pop

protected java.util.ArrayList pop
ArrayList with individuals, which represents the population.
Constructor Detail

GenericPopulation

public GenericPopulation()
Default constructor. Initializes the internal vector.

GenericPopulation

public GenericPopulation(IndividualFilter filt)
Constructor with individual filter.
Parameters:
filt - individual filter used for insertion
Method Detail

size

public int size()
Gets the current size of the population.
Overrides:
size in class AbstractPopulation
Returns:
population size

add

public void add(Individual i)
Adds an individual.
Overrides:
add in class AbstractPopulation
Parameters:
i - individual to add

add

public void add(Individual[] ia)
Adds an array with individuals to the population.
Overrides:
add in class AbstractPopulation
Parameters:
ia - array with individuals

get

public Individual get(int i)
Gets the individual at a particular index. Attention : the first individual has the index 0, but the rank 1 !!!
Overrides:
get in class AbstractPopulation
Parameters:
i - position of the individual
Returns:
individual at given position

getIndex

public int getIndex(Individual i)
Gets the index of a particular individual.
Parameters:
i - individual
Returns:
position of the given individual

replace

public void replace(Individual i,
                    int index)
Replaces an individual at a position. The new individual will be inserted according to it's score.
Overrides:
replace in class AbstractPopulation
Parameters:
i - new individual
index - position of the individual to replace

remove

public void remove(int i)
Removes an individual from the population.
Overrides:
remove in class AbstractPopulation
Parameters:
i - position of the individual

remove

public void remove(int lowerIndex,
                   int upperIndex)
Removes a range of individuals. The range reaches from lowerIndex (inclusive) to upperIndex (exclusive).
Overrides:
remove in class AbstractPopulation
Parameters:
lowerIndex - lower bound
upperIndex - upper bound

removeAll

public void removeAll()
Removes all individuals.
Overrides:
removeAll in class AbstractPopulation

subList

public java.util.List subList(int fromIndex,
                              int toIndex)
Gets a part of the population as a list. The liste contains all individuals between two indexes.
Parameters:
fromIndex - lower index
toIndex - upper index
Returns:
list with individuals

eaLib API Docs
Last Modified : January 7 2002

Copyright © 2000-2001 Technical University of Ilmenau, Department ESS