eaLib API Docs
Last Modified : January 7 2002

mss.ea.ins
Class Reinsertion

java.lang.Object
  |
  +--mss.ea.core.GeneticOperator
        |
        +--mss.ea.ins.Reinsertion
All Implemented Interfaces:
IndividualFilter
Direct Known Subclasses:
DiscreteReinsertion, EliteReinsertion, EliteReinsertion2, PureReinsertion, UniformReinsertion

public abstract class Reinsertion
extends GeneticOperator
implements IndividualFilter

Abstract base class for the reinsertion operator. Make sure to read the descriptions of generation gap and reinsertion rate. These two values define, whether a population grows or shrinks.

Since:
0.1
Version:
$Revision: 1.10 $ $Date: 2001/11/12 17:08:28 $
Author:
Andreas Rummler

Field Summary
protected  IndividualGate gate
          Gate to insert individuals into.
protected  float generationGap
          Generation Gap.
protected  Individual[] pool
          Pool with individuals that could be inserted into the population.
protected  float reinsertionRate
          Reinsertion Rate.
 
Fields inherited from class mss.ea.core.GeneticOperator
description, ID, name
 
Constructor Summary
Reinsertion(float genGap, float insRate)
          Constructor with reinsertion parameters.
Reinsertion(IndividualGate gate)
          Constructor with population.
Reinsertion(IndividualGate gate, float genGap, float insRate)
          Constructor with population and reinsertion parameters.
 
Method Summary
abstract  boolean filter(Individual i)
          Executes the internal filter on the given individual.
 IndividualStream filter(IndividualStream is)
          Filters the whole individual stream.
 float getGap()
          Gets the value of the generation gap.
 int getGapSize()
          Gets the number of individuals to be replaced.
 float getRate()
          Gets the value of the reinsertion rate.
 int getRateSize(Individual[] ia)
          Gets the number of indivdiuals to be inserted.
 int getRateSize(IndividualStream is)
          Gets the number of individuals to be inserted.
 int getRateSize(java.util.Vector iv)
          Gets the number of indivdiuals to be inserted.
abstract  IndividualStream reinsert(IndividualStream is)
          Performs the reinsertion with the given individual stream.
 void setGap(float gap)
          Sets the generation gap.
 void setGate(IndividualGate gate)
          Sets a new gate for the filter.
 void setRate(float rate)
          Sets the reinsertion rate.
 
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

gate

protected IndividualGate gate
Gate to insert individuals into.

pool

protected Individual[] pool
Pool with individuals that could be inserted into the population.

generationGap

protected float generationGap
Generation Gap. The generation gap is defined as the quotient of the number of "to be replaced" individuals of a population and the size of the population. The default value is 1.0, this would replace all individuals.

reinsertionRate

protected float reinsertionRate
Reinsertion Rate. The reinsertion rate is defined as the quotient of the number of to be inserted individuals and the number of existing new individuals that could be inserted. The default value is 1.0.
Constructor Detail

Reinsertion

public Reinsertion(IndividualGate gate)
Constructor with population. The reinsertion parameters are both set to 1.0.
Parameters:
gate - gate the individuals are inserted into

Reinsertion

public Reinsertion(float genGap,
                   float insRate)
Constructor with reinsertion parameters.
Parameters:
genGap - generation gap
insRate - reinsertion rate

Reinsertion

public Reinsertion(IndividualGate gate,
                   float genGap,
                   float insRate)
Constructor with population and reinsertion parameters.
Parameters:
gate - gate the individuals are inserted into
genGap - generation gap
insRate - reinsertion rate
Method Detail

getGap

public float getGap()
Gets the value of the generation gap.
Returns:
generation gap

getRate

public float getRate()
Gets the value of the reinsertion rate.
Returns:
reinsertion rate

setGap

public void setGap(float gap)
Sets the generation gap. If the given value is smaller than 0.0 or bigger than 1.0, is silently set 1.0.
Parameters:
gap - new value of generation gap

setRate

public void setRate(float rate)
Sets the reinsertion rate. If the given value is smaller than 0.0 or bigger than 1.0, is silently set 1.0.
Parameters:
rate - new value of reinsertion rate

getGapSize

public int getGapSize()
Gets the number of individuals to be replaced. This value depends on generation gap and population size and indicates how many individuals will be replaced.
Returns:
number of individuals to be replaced

getRateSize

public int getRateSize(Individual[] ia)
Gets the number of indivdiuals to be inserted. This value depends on reinsertion rate and insertion pool size and indicates how many individuals will be inserted into the population. If the pool is null this method returns 0.
Returns:
number of individuals to be inserted

getRateSize

public int getRateSize(java.util.Vector iv)
Gets the number of indivdiuals to be inserted. This value depends on reinsertion rate and insertion pool size and indicates how many individuals will be inserted into the population. If the pool is null this method returns 0.
Returns:
number of individuals to be inserted

getRateSize

public int getRateSize(IndividualStream is)
Gets the number of individuals to be inserted. This value depends on reinsertion rate and insertion pool size and indicates how many individuals will be inserted into the population. If the pool is null this method returns 0.
Returns:
number of individuals to be inserted

setGate

public void setGate(IndividualGate gate)
Sets a new gate for the filter.
Specified by:
setGate in interface IndividualFilter
Parameters:
gate - new gate for this filter

reinsert

public abstract IndividualStream reinsert(IndividualStream is)
                                   throws ReinsertionException
Performs the reinsertion with the given individual stream.
Parameters:
is - stream of individuals to be inserted
Throws:
ReinsertionException - thrown if the reinsertion fails

filter

public abstract boolean filter(Individual i)
Executes the internal filter on the given individual.
Specified by:
filter in interface IndividualFilter
Parameters:
i - individual to check for insertion
Returns:
true if this individual should be inserted

filter

public IndividualStream filter(IndividualStream is)
Filters the whole individual stream.
Specified by:
filter in interface IndividualFilter
Parameters:
is - individual stream to filter
Returns:
filtered stream

eaLib API Docs
Last Modified : January 7 2002

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