net.sourceforge.cilib.algorithm.population
Class AbstractIterationStrategy<E extends PopulationBasedAlgorithm>

java.lang.Object
  extended by net.sourceforge.cilib.algorithm.population.AbstractIterationStrategy<E>
Type Parameters:
E - The PopulationBasedAlgorithm type.
All Implemented Interfaces:
Serializable, IterationStrategy<E>, Cloneable
Direct Known Subclasses:
ASynchronousIterationStrategy, CoevolutionSynchronousIterationStrategy, DifferentialEvolutionIterationStrategy, GeneticAlgorithmIterationStrategy, SynchronousIterationStrategy

public abstract class AbstractIterationStrategy<E extends PopulationBasedAlgorithm>
extends Object
implements IterationStrategy<E>

Generic IterationStrategy class for all population based algorithms. Each and every IterationStrategy will have a pipeline available to it in order to specify the needed operators that will be required to be executed during the iteration. For the implementing classes, a default pipeline is constructed and made available, this can (as with everything within CIlib) be overridden.

Author:
Gary Pampara
See Also:
Serialized Form

Field Summary
protected  BoundaryConstraint boundaryConstraint
           
protected  CompositeOperator operatorPipeline
           
 
Constructor Summary
AbstractIterationStrategy()
          Create an instance of the IterationStrategy.
 
Method Summary
 BoundaryConstraint getBoundaryConstraint()
          Get the currently associated BoundaryConstraint.
abstract  AbstractIterationStrategy<E> getClone()
          Create a cloned copy of the current object and return it.
 CompositeOperator getOperatorPipeline()
          Get the List<Operator> that represents the sequence of operators to be performed within the current IterationStrategy.
abstract  void performIteration(E algorithm)
          Perform the iteration of the PopulationBasedAlgorithm.
 void setBoundaryConstraint(BoundaryConstraint boundaryConstraint)
          Set the BoundaryConstraint to maintain within this IterationStrategy.
 void setOperatorPipeline(CompositeOperator operatorPipeline)
          Set the pipeline to be used within the current IterationStrategy.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

boundaryConstraint

protected BoundaryConstraint boundaryConstraint

operatorPipeline

protected CompositeOperator operatorPipeline
Constructor Detail

AbstractIterationStrategy

public AbstractIterationStrategy()
Create an instance of the IterationStrategy.

Method Detail

getClone

public abstract AbstractIterationStrategy<E> 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 IterationStrategy<E extends PopulationBasedAlgorithm>
Specified by:
getClone in interface Cloneable
Returns:
An exact clone of the current object instance.
See Also:
Object.clone()

performIteration

public abstract void performIteration(E algorithm)
Perform the iteration of the PopulationBasedAlgorithm.

Due to the nature of the PopulationBasedAlgorithms, the actual manner in which the algorithm's iteration is performed is deferred to the specific iteration strategy being used.

This implies that the general structure of the iteration for a specific flavour of algorithm is constant with modifications on that algorithm being made. For example, within a Genetic Algorithm you would expect:

  1. Parent individuals to be selected in some manner
  2. A crossover process to be done on the selected parent individuals to create the offspring
  3. A mutation process to alter the generated offspring
  4. Recombine the existing parent individuals and the generated offspring to create the next generation

Specified by:
performIteration in interface IterationStrategy<E extends PopulationBasedAlgorithm>
Parameters:
algorithm - The algorithm to perform the iteration process on.

getBoundaryConstraint

public BoundaryConstraint getBoundaryConstraint()
Get the currently associated BoundaryConstraint.

Returns:
The current BoundaryConstraint.

setBoundaryConstraint

public void setBoundaryConstraint(BoundaryConstraint boundaryConstraint)
Set the BoundaryConstraint to maintain within this IterationStrategy.

Parameters:
boundaryConstraint - The BoundaryConstraint to set.

getOperatorPipeline

public CompositeOperator getOperatorPipeline()
Get the List<Operator> that represents the sequence of operators to be performed within the current IterationStrategy.

Returns:
The operator pipeline List<Operator>

setOperatorPipeline

public void setOperatorPipeline(CompositeOperator operatorPipeline)
Set the pipeline to be used within the current IterationStrategy.

Parameters:
operatorPipeline - The pipeline to be used.


Copyright © 2009 CIRG. All Rights Reserved.