es.udc.gii.common.eaf.stoptest
Class BitwiseConvergence

java.lang.Object
  extended by es.udc.gii.common.eaf.stoptest.SimpleStopTest
      extended by es.udc.gii.common.eaf.stoptest.BitwiseConvergence
All Implemented Interfaces:
Configurable, StopTest

public class BitwiseConvergence
extends SimpleStopTest

This class implements a simple stoptest. The objective is reached when the current population of the passed evolutionary algorithm has converged to a specified rate. The convergence is messured as the average number of bits that each two individuals from the population share.

The convergence rate is specified as a configuration parameter. A convergence rate of 1.0 means that all individuals in the population have the same genotype. A convergence rate of 0.x means that, in average, each two individuals from the population share their genotypes at x %.

Convergence rates between 0.6 and 0.9 have yield good results for populations of 5 individuals. This class is only suitable for individuals with the same number of genes and for internal values of type 'double'.

This class uses an algorithm with a computational cost of O(n**2), beeing n the number of individuals of the population of the passed evolutionary algorithm. So, consider using other approaches for calculating the population's convergence (such as a fixed number of generations) if you plan to use an algorithm with a big population. To use and configure this stop test, you must add the following xml code in the appropriate section of the configuration file:

 <StopTest>
      <Class>es.udc.gii.common.eaf.stoptest.BitwiseConvergence</Class>
      <ConvergenceRate>value</ConvergenceRate>
 </StopTest>
 
 

Author:
Grupo Integrado de IngenierĂ­a (www.gii.udc.es)

Field Summary
private  double convergenceRate
           
 
Constructor Summary
BitwiseConvergence()
          Creates a new instance of BitwiseConvergence
 
Method Summary
 void configure(org.apache.commons.configuration.Configuration conf)
          Configure this stop test.
private  double convergence(Individual i1, Individual i2)
          Calculates the convergence rate between two individuals.
 boolean isReach(EvolutionaryAlgorithm algorithm)
          Returns true if the problem reach the objective.
 java.lang.String toString()
          Returns a string representation of the object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

convergenceRate

private double convergenceRate
Constructor Detail

BitwiseConvergence

public BitwiseConvergence()
Creates a new instance of BitwiseConvergence

Method Detail

convergence

private double convergence(Individual i1,
                           Individual i2)
Calculates the convergence rate between two individuals.


isReach

public boolean isReach(EvolutionaryAlgorithm algorithm)
Description copied from interface: StopTest
Returns true if the problem reach the objective.

Parameters:
algorithm - The algorithm wich has to reach the objective
Returns:
true if the problem has reached the objective, false in other case.

configure

public void configure(org.apache.commons.configuration.Configuration conf)
Configure this stop test.

Parameters:
conf - Configuration object which contains the configuration values.

toString

public java.lang.String toString()
Returns a string representation of the object.

Overrides:
toString in class java.lang.Object
Returns:
a string representation of the object.