net.sourceforge.cilib.algorithm.population
Class MultiPopulationBasedAlgorithm

java.lang.Object
  extended by net.sourceforge.cilib.algorithm.Algorithm
      extended by net.sourceforge.cilib.algorithm.population.PopulationBasedAlgorithm
          extended by net.sourceforge.cilib.algorithm.population.MultiPopulationBasedAlgorithm
All Implemented Interfaces:
Serializable, Iterable<PopulationBasedAlgorithm>, Runnable, Cloneable
Direct Known Subclasses:
CoevolutionAlgorithm, HybridCooperativeAlgorithm, MultiPopulationCriterionBasedAlgorithm, Niche, SplitCooperativeAlgorithm

public abstract class MultiPopulationBasedAlgorithm
extends PopulationBasedAlgorithm
implements Iterable<PopulationBasedAlgorithm>

Algorithm class to describe the notion of aggregated PopulationBasedAlgorithm instances.

The objective of this class is to ensure that the manner in which various multi-population based algorithms are interfaced in the same manner.

Examples of such algorithms can include:

Author:
Gary Pampara
See Also:
Serialized Form

Field Summary
protected  AlgorithmIterator<PopulationBasedAlgorithm> algorithmIterator
           
protected  List<PopulationBasedAlgorithm> subPopulationsAlgorithms
           
 
Fields inherited from class net.sourceforge.cilib.algorithm.Algorithm
optimisationProblem
 
Constructor Summary
MultiPopulationBasedAlgorithm()
          Create an instance of MultiPopulationBasedAlgorithm.
MultiPopulationBasedAlgorithm(MultiPopulationBasedAlgorithm copy)
          Create a copy of the provided instance.
 
Method Summary
 Object accept(TopologyVisitor visitor)
          General method to accept a visitor to perform a calculation on the current algorithm.
 void addPopulationBasedAlgorithm(PopulationBasedAlgorithm algorithm)
          Add a PopulationBasedAlgorithm to the list of maintained sub-populations.
protected abstract  void algorithmIteration()
          The actual operations that the current Algorithm performs within a single iteration.
 AlgorithmIterator<PopulationBasedAlgorithm> getAlgorithmIterator()
          Get an AlgorithmIterator to iterate over the current collection of PopulationBasedAlgorithms.
 PopulationInitialisationStrategy getInitialisationStrategy()
          Get the current PopulationInitialisationStrategy.
 List<PopulationBasedAlgorithm> getPopulations()
          Get the List of current sub-populations.
 Topology<? extends Entity> getTopology()
          Get the current collection (population) of entities.
 Iterator<PopulationBasedAlgorithm> iterator()
          
 void removePopulationBasedalgorithm(PopulationBasedAlgorithm algorithm)
          Remove the provided PopulationBasedAlgorithm from the collection of maintained instances.
 void reset()
          Reset the Algorithm internals if needed.
 void setAlgorithmIterator(AlgorithmIterator<PopulationBasedAlgorithm> algorithmIterator)
          Set the type of iterator to be used.
 void setInitialisationStrategy(PopulationInitialisationStrategy initialisationStrategy)
          Set the initialisation strategy to use for the initialisation of the population.
 void setPopulations(List<PopulationBasedAlgorithm> populationBasedAlgorithms)
          Set the list of PopulationBasedAlgorithm instances that the MultiPopulationBasedAlgorithm should maintain.
 
Methods inherited from class net.sourceforge.cilib.algorithm.population.PopulationBasedAlgorithm
getBestSolution, getClone, getSolutions
 
Methods inherited from class net.sourceforge.cilib.algorithm.Algorithm
addAlgorithmListener, addStoppingCondition, get, getAlgorithmList, getIterations, getOptimisationProblem, getPercentageComplete, getStoppingConditions, initialise, isFinished, performInitialisation, performIteration, performUninitialisation, removeAlgorithmListener, removeStoppingCondition, run, setOptimisationProblem, terminate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

subPopulationsAlgorithms

protected List<PopulationBasedAlgorithm> subPopulationsAlgorithms

algorithmIterator

protected AlgorithmIterator<PopulationBasedAlgorithm> algorithmIterator
Constructor Detail

MultiPopulationBasedAlgorithm

public MultiPopulationBasedAlgorithm()
Create an instance of MultiPopulationBasedAlgorithm.


MultiPopulationBasedAlgorithm

public MultiPopulationBasedAlgorithm(MultiPopulationBasedAlgorithm copy)
Create a copy of the provided instance.

Parameters:
copy - The instance to copy.
Method Detail

reset

public void reset()
Reset the Algorithm internals if needed.

Overrides:
reset in class Algorithm

iterator

public Iterator<PopulationBasedAlgorithm> iterator()

Specified by:
iterator in interface Iterable<PopulationBasedAlgorithm>

algorithmIteration

protected abstract void algorithmIteration()
The actual operations that the current Algorithm performs within a single iteration.

Specified by:
algorithmIteration in class PopulationBasedAlgorithm

getPopulations

public List<PopulationBasedAlgorithm> getPopulations()
Get the List of current sub-populations.

Returns:
The List of PopulationBasedAlgorithm.

setPopulations

public void setPopulations(List<PopulationBasedAlgorithm> populationBasedAlgorithms)
Set the list of PopulationBasedAlgorithm instances that the MultiPopulationBasedAlgorithm should maintain.

Parameters:
populationBasedAlgorithms - The List of PopulationBasedAlgorithms to set.

addPopulationBasedAlgorithm

public void addPopulationBasedAlgorithm(PopulationBasedAlgorithm algorithm)
Add a PopulationBasedAlgorithm to the list of maintained sub-populations.

Parameters:
algorithm - The PopulationBasedAlgorithm to add to the current collection.

removePopulationBasedalgorithm

public void removePopulationBasedalgorithm(PopulationBasedAlgorithm algorithm)
Remove the provided PopulationBasedAlgorithm from the collection of maintained instances.

Parameters:
algorithm - The instance to remove from the collection.

getAlgorithmIterator

public AlgorithmIterator<PopulationBasedAlgorithm> getAlgorithmIterator()
Get an AlgorithmIterator to iterate over the current collection of PopulationBasedAlgorithms.

Returns:
An AlgorithmIterator over the current collection.

setAlgorithmIterator

public void setAlgorithmIterator(AlgorithmIterator<PopulationBasedAlgorithm> algorithmIterator)
Set the type of iterator to be used.

Parameters:
algorithmIterator - The iterator instance to set.

accept

public Object accept(TopologyVisitor visitor)
General method to accept a visitor to perform a calculation on the current algorithm. The operation is generally deferred down to the underlying topology associated with the algorithm, as the algorithm does not contain information, but rather only behaviour to alter the candidate solutions that are managed by the Topology.

Specified by:
accept in class PopulationBasedAlgorithm
Parameters:
visitor - The Visitor to be applied to the algorithm
Returns:
The result of the visitor operation.

getTopology

public Topology<? extends Entity> getTopology()
Description copied from class: PopulationBasedAlgorithm
Get the current collection (population) of entities.

Specified by:
getTopology in class PopulationBasedAlgorithm
Returns:
The current population.

getInitialisationStrategy

public PopulationInitialisationStrategy getInitialisationStrategy()
Description copied from class: PopulationBasedAlgorithm
Get the current PopulationInitialisationStrategy.

Specified by:
getInitialisationStrategy in class PopulationBasedAlgorithm
Returns:
The current PopulationInitialisationStrategy.

setInitialisationStrategy

public void setInitialisationStrategy(PopulationInitialisationStrategy initialisationStrategy)
Description copied from class: PopulationBasedAlgorithm
Set the initialisation strategy to use for the initialisation of the population.

Specified by:
setInitialisationStrategy in class PopulationBasedAlgorithm
Parameters:
initialisationStrategy - The population initialisation strategy to set.


Copyright © 2009 CIRG. All Rights Reserved.