net.sourceforge.cilib.stoppingcondition
Class OptimiserStalled

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

public class OptimiserStalled
extends Object
implements StoppingCondition

used to check if optimisation algorithm has stalled. still a very crude implementation. if the distance from the current best is less then the specified minimum for more then the specified maximum consecutive minimum change, then the algorithm is assumed to have stalled.

Author:
frans
See Also:
Serialized Form

Field Summary
protected  int maxConsecutiveMinChange
           
protected  double minChange
           
protected  int minChangeCounter
           
 
Fields inherited from interface net.sourceforge.cilib.stoppingcondition.StoppingCondition
CICLOPS_EXCLUDE_ALGORITHM
 
Constructor Summary
OptimiserStalled()
          Creates a new instance of OptimiserStalled.
OptimiserStalled(OptimiserStalled copy)
          Copy constructor.
 
Method Summary
 OptimiserStalled getClone()
          Create a cloned copy of the current object and return it.
 double getPercentageCompleted()
          Determines the percentage complete for the associated algorithm.
 boolean isCompleted()
          Determines whether the stopping condition has been satisfied (equivalent to StoppingCondition.getPercentageCompleted() == 1.0 but may be more efficient).
 void setAlgorithm(Algorithm algorithm)
          Sets the algorithm that this stopping condition should be applied to.
 void setMaxConsecutiveMinChange(int count)
          sets the maximum consecutive evalutions that an algorithm can improve less then the minimum.
 void setMinimumChange(double distance)
          sets the minimum percentage that the new best location must be from the previous.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

minChange

protected double minChange

maxConsecutiveMinChange

protected int maxConsecutiveMinChange

minChangeCounter

protected int minChangeCounter
Constructor Detail

OptimiserStalled

public OptimiserStalled()
Creates a new instance of OptimiserStalled.


OptimiserStalled

public OptimiserStalled(OptimiserStalled copy)
Copy constructor.

Parameters:
copy - The instance to create the copy from.
Method Detail

getClone

public OptimiserStalled getClone()
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()
Determines the percentage complete for the associated algorithm.

Specified by:
getPercentageCompleted in interface StoppingCondition

isCompleted

public boolean isCompleted()
Determines whether the stopping condition has been satisfied (equivalent to StoppingCondition.getPercentageCompleted() == 1.0 but may be more efficient).

Specified by:
isCompleted in interface StoppingCondition
Returns:
true when condition is satisfied, false otherwise

setAlgorithm

public void setAlgorithm(Algorithm algorithm)
Sets the algorithm that this stopping condition should be applied to. Called by Algorithm.addStoppingCondition(StoppingCondition). This ensures that any down casting necessary is done only once, when the stopping codition is added to an alogorithm (as apposed to after each iteration).

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

setMinimumChange

public void setMinimumChange(double distance)
sets the minimum percentage that the new best location must be from the previous.

Parameters:
distance - The value to set.

setMaxConsecutiveMinChange

public void setMaxConsecutiveMinChange(int count)
sets the maximum consecutive evalutions that an algorithm can improve less then the minimum. percentage. this value relates to evaluations and not iterations.

Parameters:
count - The value to set.


Copyright © 2009 CIRG. All Rights Reserved.