net.sourceforge.cilib.algorithm.population
Class SinglePopulationBasedAlgorithm

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.SinglePopulationBasedAlgorithm
All Implemented Interfaces:
Serializable, Runnable, Cloneable
Direct Known Subclasses:
ABC, EC, PSO

public abstract class SinglePopulationBasedAlgorithm
extends PopulationBasedAlgorithm

Base class for algorithms that focus on a single populations of entities. These types of algoruthms typically include PSO , EC, ACO etc.

Author:
Gary Pampara
See Also:
Serialized Form

Field Summary
protected  PopulationInitialisationStrategy initialisationStrategy
           
 
Fields inherited from class net.sourceforge.cilib.algorithm.Algorithm
optimisationProblem
 
Constructor Summary
protected SinglePopulationBasedAlgorithm()
          Create an empty PopulationBasedAlgorithm.
protected SinglePopulationBasedAlgorithm(SinglePopulationBasedAlgorithm 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.
protected abstract  void algorithmIteration()
          Perform the iteration within the algorithm.
abstract  SinglePopulationBasedAlgorithm getClone()
          Create a cloned copy of the current object and return it.
 PopulationInitialisationStrategy getInitialisationStrategy()
          Get the currently set PopulationInitialisationStrategy.
abstract  Topology<? extends Entity> getTopology()
          Get the current collection (population) of entities.
 void setInitialisationStrategy(PopulationInitialisationStrategy initialisationStrategy)
          Set the PopulationInitialisationStrategy to be used.
abstract  void setTopology(Topology<? extends Entity> topology)
          Set the Topology for the population-based algorithm.
 
Methods inherited from class net.sourceforge.cilib.algorithm.population.PopulationBasedAlgorithm
getBestSolution, 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, reset, run, setOptimisationProblem, terminate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

initialisationStrategy

protected PopulationInitialisationStrategy initialisationStrategy
Constructor Detail

SinglePopulationBasedAlgorithm

protected SinglePopulationBasedAlgorithm()
Create an empty PopulationBasedAlgorithm.


SinglePopulationBasedAlgorithm

protected SinglePopulationBasedAlgorithm(SinglePopulationBasedAlgorithm copy)
Create a copy of the provided instance.

Parameters:
copy - The PopulationBasedAlgorithm to copy.
Method Detail

getClone

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

algorithmIteration

protected abstract void algorithmIteration()
Perform the iteration within the algorithm.

Specified by:
algorithmIteration in class PopulationBasedAlgorithm

getTopology

public abstract Topology<? extends Entity> getTopology()
Get the current collection (population) of entities.

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

setTopology

public abstract void setTopology(Topology<? extends Entity> topology)
Set the Topology for the population-based algorithm.

Parameters:
topology - The Topology to be set.

getInitialisationStrategy

public PopulationInitialisationStrategy getInitialisationStrategy()
Get the currently set PopulationInitialisationStrategy.

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

setInitialisationStrategy

public void setInitialisationStrategy(PopulationInitialisationStrategy initialisationStrategy)
Set the PopulationInitialisationStrategy to be used.

Specified by:
setInitialisationStrategy in class PopulationBasedAlgorithm
Parameters:
initialisationStrategy - The PopulationInitialisationStrategy to use.

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.


Copyright © 2009 CIRG. All Rights Reserved.