net.sourceforge.cilib.stoppingcondition
Interface StoppingCondition

All Superinterfaces:
Cloneable, Serializable
All Known Implementing Classes:
DesiredMaximizationFitness, MaximumFitnessEvaluations, MaximumIterations, MaximumRestarts, MinimumDiversity, MinimumFunctionMinimisationError, MinimumSwarmDiameter, OptimiserStalled, SingleIteration

public interface StoppingCondition
extends Serializable, Cloneable

A class that implements this interface can be used to measure the progress of an algorithm. Primarily, subclasses of this interface are used to determine the stopping criteria for an Algorithm. Stopping coditions are applied to algorithms using Algorithm.addStoppingCondition(StoppingCondition).

Stopping conditions are also useful for implementing graphical progress bars and varying inertia weights etc.

Author:
Edwin Peer

Field Summary
static byte CICLOPS_EXCLUDE_ALGORITHM
           
 
Method Summary
 StoppingCondition 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 getPercentageCompleted() == 1.0 but may be more efficient).
 void setAlgorithm(Algorithm algorithm)
          Sets the algorithm that this stopping condition should be applied to.
 

Field Detail

CICLOPS_EXCLUDE_ALGORITHM

static final byte CICLOPS_EXCLUDE_ALGORITHM
See Also:
Constant Field Values
Method Detail

getPercentageCompleted

double getPercentageCompleted()
Determines the percentage complete for the associated algorithm.


isCompleted

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

Returns:
true when condition is satisfied, false otherwise

setAlgorithm

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).

Parameters:
algorithm - The applicable Algorithm.

getClone

StoppingCondition 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 Cloneable
Returns:
See Also:
Object.clone()


Copyright © 2009 CIRG. All Rights Reserved.