net.sourceforge.cilib.stoppingcondition
Class MinimumDiversity

java.lang.Object
  extended by net.sourceforge.cilib.stoppingcondition.MinimumDiversity
All Implemented Interfaces:
Serializable, StoppingCondition, Cloneable

public class MinimumDiversity
extends Object
implements StoppingCondition

A stopping condition that is based on the Diversity of the population. The Algorithm will stop as soon as the population's diversity drops below a (user-specified) threshold for a (user-specified) number of consecutive iterations.

Author:
Theuns Cloete
See Also:
Serialized Form

Field Summary
 
Fields inherited from interface net.sourceforge.cilib.stoppingcondition.StoppingCondition
CICLOPS_EXCLUDE_ALGORITHM
 
Constructor Summary
MinimumDiversity()
           
MinimumDiversity(MinimumDiversity rhs)
           
 
Method Summary
 MinimumDiversity getClone()
          Create a cloned copy of the current object and return it.
 double getPercentageCompleted()
          Calculate a rough completion percentage estimate of the Algorithm based on the calculatedDiversity, maximumDiversity and minimumDiversity.
 boolean isCompleted()
          Calculate the diversity of the population and store it.
 void setAlgorithm(Algorithm a)
          Not used.
 void setConsecutiveIterations(ControlParameter ci)
          Any ControlParameter can be used to control the consecutiveIterations value.
 void setDiversity(Diversity d)
          The manner in which the diversity should be calculated can be constructed using the Diversity hierarchy and its strategies.
 void setMinimumDiversity(ControlParameter md)
          Any ControlParameter can be used to control the minimumDiversity value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MinimumDiversity

public MinimumDiversity()

MinimumDiversity

public MinimumDiversity(MinimumDiversity rhs)
Method Detail

getClone

public MinimumDiversity getClone()
Description copied from interface: Cloneable
Create a cloned copy of the current object and return it. In general the created copy will be a deep copy of the provided instance. As a result this operation an be quite expensive if used incorrectly.

Specified by:
getClone in interface StoppingCondition
Specified by:
getClone in interface Cloneable
Returns:
An exact clone of the current object instance.
See Also:
Object.clone()

getPercentageCompleted

public double getPercentageCompleted()
Calculate a rough completion percentage estimate of the Algorithm based on the calculatedDiversity, maximumDiversity and minimumDiversity. It is normal for the completion percentage to be irregular or unpredictable, because the calculatedDiversity and maximumDiversity will sporadically change over time.

Specified by:
getPercentageCompleted in interface StoppingCondition
Returns:
the completion percentage as a number between 0 and 1

isCompleted

public boolean isCompleted()
Calculate the diversity of the population and store it. We also keep track of the maximum diversity. The number of consecutive iterations are incremented when calculatedDiversity < minimumDiversity or reset to 0 otherwise.

Specified by:
isCompleted in interface StoppingCondition
Returns:
true when iterations > consecutiveIterations; false otherwise

setMinimumDiversity

public void setMinimumDiversity(ControlParameter md)
Any ControlParameter can be used to control the minimumDiversity value.

Parameters:
md - a ControlParameter to control the minimumDiversity value

setConsecutiveIterations

public void setConsecutiveIterations(ControlParameter ci)
Any ControlParameter can be used to control the consecutiveIterations value.

Parameters:
ci - a ControlParameter to control the consecutiveIterations value

setDiversity

public void setDiversity(Diversity d)
The manner in which the diversity should be calculated can be constructed using the Diversity hierarchy and its strategies.

Parameters:
d - a Diversity object that will be used to calculate the diversity of the population

setAlgorithm

public void setAlgorithm(Algorithm a)
Not used.

Specified by:
setAlgorithm in interface StoppingCondition
Parameters:
a - The applicable Algorithm.


Copyright © 2009 CIRG. All Rights Reserved.