Evolvica Core API Version 0.6.2
Last Modified: June 29 2004

org.evolvica.core.population
Class AbstractPopulation

java.lang.Object
  extended byorg.evolvica.engine.AbstractOperator
      extended byorg.evolvica.core.common.AbstractGeneticOperator
          extended byorg.evolvica.core.population.AbstractPopulation
All Implemented Interfaces:
IGeneticOperator, IIndividualSet, IOperator, IPopulation, IProcessor, java.io.Serializable
Direct Known Subclasses:
DefaultPopulation, SortedPopulation

public abstract class AbstractPopulation
extends AbstractGeneticOperator
implements IPopulation

Abstract base class for a population. This class provides some common methods for a population.

Since:
0.4.0
Version:
$Revision: 1.14 $ $Date: 2004/05/26 11:58:11 $
Author:
Andreas Rummler
See Also:
Serialized Form

Field Summary
protected  IInsertionFilter filter
          Individual filter for insertion of individuals into this population.
protected  int generation
          Generation counter.
protected  java.util.Collection population
          Data structure holding the individuals of this population.
 
Fields inherited from class org.evolvica.engine.AbstractOperator
descriptor, element, id, name
 
Constructor Summary
AbstractPopulation()
          Constructor.
 
Method Summary
 void add(IIndividual ind)
          Adds an individual to this set.
 void add(IIndividual[] array)
          Adds the individuals from the array to this set.
 void clear()
          Removes all individuals from this set.
 boolean contains(IIndividual ind)
          Checks if the given individual is already contained in this set.
 IInsertionFilter getFilter()
           
 int getGeneration()
          Gets the generation counter.
 IIndividualSet insert(IIndividualSet iset)
          Inserts a set of indidividuals into this population.
 boolean isEmpty()
          Checks if this set is empty.
 ISetIterator iterator()
          Returns an iterator over this set.
 java.lang.Object process(java.lang.Object input)
          Processes a data object.
 void remove(IIndividual ind)
          Removes the given individual from this set, if it contained in the set.
 void remove(IIndividual[] array)
          Removes all individuals in the given array from this set.
 void replace(IIndividual[] indArray, IIndividual[] substArray)
          Replaces an array of individuals with several substitute indviduals.
 void replace(IIndividual ind, IIndividual subst)
          Replaces an individual with a substitute individual.
 void setFilter(IInsertionFilter filter)
          Sets a new reinsertion operator (filter).
 int size()
          Returns the number of individuals contained in this set.
 IIndividual[] toArray()
          Returns the contents of this set as an array.
 
Methods inherited from class org.evolvica.engine.AbstractOperator
attachDescriptor, attachElement, descriptor, element, getId, getName, setId, setName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.evolvica.engine.IOperator
attachDescriptor, attachElement, descriptor, element, getId, getName, setId, setName
 

Field Detail

population

protected java.util.Collection population
Data structure holding the individuals of this population. This collection may be used in subclasses, but need not. In case another model is used a user must ensure that all necessary methods are overloaded correctly. Beyond this a new individual iterator must be written.


generation

protected int generation
Generation counter. This counter contains the current generation number. The counter is incremented everytime the insert(IIndividualSet) method is called.


filter

protected IInsertionFilter filter
Individual filter for insertion of individuals into this population.

Constructor Detail

AbstractPopulation

public AbstractPopulation()
Constructor.

Method Detail

add

public void add(IIndividual ind)
Description copied from interface: IIndividualSet
Adds an individual to this set.

Specified by:
add in interface IIndividualSet
Parameters:
ind - individual to be added
See Also:
IIndividualSet.add(org.evolvica.core.IIndividual)

add

public void add(IIndividual[] array)
Description copied from interface: IIndividualSet
Adds the individuals from the array to this set.

Specified by:
add in interface IIndividualSet
Parameters:
array - array with individuals to be added
See Also:
IIndividualSet.add(org.evolvica.core.IIndividual[])

clear

public void clear()
Description copied from interface: IIndividualSet
Removes all individuals from this set.

Specified by:
clear in interface IIndividualSet
See Also:
IIndividualSet.clear()

contains

public boolean contains(IIndividual ind)
Description copied from interface: IIndividualSet
Checks if the given individual is already contained in this set.

Specified by:
contains in interface IIndividualSet
Parameters:
ind - individual that should be checked
Returns:
true if the given individual is contained in this set, false otherwise
See Also:
IIndividualSet.contains(org.evolvica.core.IIndividual)

isEmpty

public boolean isEmpty()
Description copied from interface: IIndividualSet
Checks if this set is empty.

Specified by:
isEmpty in interface IIndividualSet
Returns:
true if this set does not contain any individuals, false otherwise
See Also:
IIndividualSet.isEmpty()

iterator

public ISetIterator iterator()
Description copied from interface: IIndividualSet
Returns an iterator over this set.

Specified by:
iterator in interface IIndividualSet
Returns:
iterator for this set
See Also:
IIndividualSet.iterator()

remove

public void remove(IIndividual ind)
Description copied from interface: IIndividualSet
Removes the given individual from this set, if it contained in the set.

Specified by:
remove in interface IIndividualSet
Parameters:
ind - individual to be removed from this set
See Also:
IIndividualSet.remove(org.evolvica.core.IIndividual)

remove

public void remove(IIndividual[] array)
Description copied from interface: IIndividualSet
Removes all individuals in the given array from this set.

Specified by:
remove in interface IIndividualSet
Parameters:
array - array with individuals to be removed
See Also:
IIndividualSet.remove(org.evolvica.core.IIndividual[])

size

public int size()
Description copied from interface: IIndividualSet
Returns the number of individuals contained in this set.

Specified by:
size in interface IIndividualSet
Returns:
size of the set
See Also:
IIndividualSet.size()

toArray

public IIndividual[] toArray()
Description copied from interface: IIndividualSet
Returns the contents of this set as an array.

Specified by:
toArray in interface IIndividualSet
Returns:
array containing the individuals of this set
See Also:
IIndividualSet.toArray()

getGeneration

public int getGeneration()
Gets the generation counter.

Returns:
generation counter of this population

getFilter

public IInsertionFilter getFilter()
Returns:
returns the insertion filter of this population

setFilter

public void setFilter(IInsertionFilter filter)
Sets a new reinsertion operator (filter).

Specified by:
setFilter in interface IPopulation
Parameters:
filter - new reinsertion operator

process

public java.lang.Object process(java.lang.Object input)
Description copied from interface: IProcessor
Processes a data object.

Specified by:
process in interface IProcessor
Parameters:
input - input data for processing
Returns:
processed data object
See Also:
IProcessor.process(java.lang.Object)

insert

public IIndividualSet insert(IIndividualSet iset)
Description copied from interface: IPopulation
Inserts a set of indidividuals into this population. The individuals from the given set are inserted with applying the populations's insertion filter. The filter performs the actual insertion procedure and may remove older individuals from the population. The contents of the population are returned.

Specified by:
insert in interface IPopulation
Parameters:
iset - individual set to be inserted
Returns:
contents of the population after applying the insertion filter
See Also:
IPopulation.insert(org.evolvica.core.IIndividualSet)

replace

public void replace(IIndividual ind,
                    IIndividual subst)
Description copied from interface: IPopulation
Replaces an individual with a substitute individual.

Specified by:
replace in interface IPopulation
Parameters:
ind - individual to be replaced
subst - substitute for the replaced individual
See Also:
IPopulation.replace(org.evolvica.core.IIndividual, org.evolvica.core.IIndividual)

replace

public void replace(IIndividual[] indArray,
                    IIndividual[] substArray)
Description copied from interface: IPopulation
Replaces an array of individuals with several substitute indviduals.

Specified by:
replace in interface IPopulation
Parameters:
indArray - array with individuals to be replaced
substArray - array with individual used as substitution
See Also:
IPopulation.replace(org.evolvica.core.IIndividual[], org.evolvica.core.IIndividual[])

Evolvica Core API Version 0.6.2
Last Modified: June 29 2004

Copyright © 2000-2004 Technical University of Ilmenau, Department Electronic Circuits and Systems