net.sourceforge.cilib.pso
Class PSO

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
              extended by net.sourceforge.cilib.pso.PSO
All Implemented Interfaces:
Serializable, Runnable, ParticipatingAlgorithm, Cloneable
Direct Known Subclasses:
LFPSO, RNAPSO

public class PSO
extends SinglePopulationBasedAlgorithm
implements ParticipatingAlgorithm

An implementation of the standard PSO algorithm.

References:

Author:
Edwin Peer, Gary Pampara
See Also:
Serialized Form

Field Summary
 
Fields inherited from class net.sourceforge.cilib.algorithm.population.SinglePopulationBasedAlgorithm
initialisationStrategy
 
Fields inherited from class net.sourceforge.cilib.algorithm.Algorithm
optimisationProblem
 
Constructor Summary
PSO()
          Creates a new instance of PSO.
PSO(PSO copy)
          Create a copy of the provided instance.
 
Method Summary
protected  void algorithmIteration()
          Perform the iteration of the PSO algorithm, use the appropriate IterationStrategy to perform the iteration.
 OptimisationSolution getBestSolution()
          Get the best current solution.
 PSO getClone()
          Create a cloned copy of the current object and return it.
 Particle getContribution()
          Returns contribution to the solution for the co-operative optimisation algorithm.
 Fitness getContributionFitness()
          Returns the fitness of contribution to the solution.
 IterationStrategy<PSO> getIterationStrategy()
          Get the IterationStrategy of the PSO algorithm.
 List<OptimisationSolution> getSolutions()
          Get the collection of best solutions.
 Topology<Particle> getTopology()
          Accessor for the topology being used.
 void performInitialisation()
          Perform the required initialisation for the algorithm.
 void reset()
          Reset the Algorithm internals if needed.
 void setIterationStrategy(IterationStrategy<PSO> iterationStrategy)
          Set the IterationStrategy to be used.
 void setTopology(Topology topology)
          Sets the particle topology used.
 void updateContributionFitness(Fitness fitness)
          Updates the new fitness for the solution contribution.
 
Methods inherited from class net.sourceforge.cilib.algorithm.population.SinglePopulationBasedAlgorithm
accept, getInitialisationStrategy, setInitialisationStrategy
 
Methods inherited from class net.sourceforge.cilib.algorithm.Algorithm
addAlgorithmListener, addStoppingCondition, get, getAlgorithmList, getIterations, getOptimisationProblem, getPercentageComplete, getStoppingConditions, initialise, isFinished, 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
 

Constructor Detail

PSO

public PSO()
Creates a new instance of PSO. All fields are initialised to reasonable defaults. Note that the OptimisationProblem is initially null and must be set before Algorithm.initialise() is called.


PSO

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

Parameters:
copy - The instance to copy.
Method Detail

getClone

public PSO 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 SinglePopulationBasedAlgorithm
Returns:
An exact clone of the current object instance.
See Also:
Object.clone()

reset

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

Overrides:
reset in class Algorithm

performInitialisation

public void performInitialisation()
Perform the required initialisation for the algorithm. Create the particles and add then to the specified topology.

Overrides:
performInitialisation in class Algorithm

algorithmIteration

protected void algorithmIteration()
Perform the iteration of the PSO algorithm, use the appropriate IterationStrategy to perform the iteration.

Specified by:
algorithmIteration in class SinglePopulationBasedAlgorithm

getBestSolution

public OptimisationSolution getBestSolution()
Get the best current solution. This best solution is determined from the personal bests of the particles.

Specified by:
getBestSolution in class PopulationBasedAlgorithm
Returns:
The OptimisationSolution representing the best solution.

getSolutions

public List<OptimisationSolution> getSolutions()
Get the collection of best solutions. This result does not actually make sense in the normal PSO algorithm, but rather in a MultiObjective optimisation.

Specified by:
getSolutions in class PopulationBasedAlgorithm
Returns:
The Collection<OptimisationSolution> containing the solutions.

setTopology

public void setTopology(Topology topology)
Sets the particle topology used. The default is GBestTopology.

Specified by:
setTopology in class SinglePopulationBasedAlgorithm
Parameters:
topology - A class that implements the Topology interface.

getTopology

public Topology<Particle> getTopology()
Accessor for the topology being used.

Specified by:
getTopology in class SinglePopulationBasedAlgorithm
Returns:
The Topology being used.

getContribution

public Particle getContribution()
Description copied from interface: ParticipatingAlgorithm
Returns contribution to the solution for the co-operative optimisation algorithm.

Specified by:
getContribution in interface ParticipatingAlgorithm
Returns:
The algorithm's solution contribution.

getContributionFitness

public Fitness getContributionFitness()
Returns the fitness of contribution to the solution.

Specified by:
getContributionFitness in interface ParticipatingAlgorithm
Returns:
The fitness of the solution contribution.

updateContributionFitness

public void updateContributionFitness(Fitness fitness)
Updates the new fitness for the solution contribution.

Specified by:
updateContributionFitness in interface ParticipatingAlgorithm
Parameters:
fitness - The new fitness of the contribution.

getIterationStrategy

public IterationStrategy<PSO> getIterationStrategy()
Get the IterationStrategy of the PSO algorithm.

Returns:
Returns the iterationStrategy..

setIterationStrategy

public void setIterationStrategy(IterationStrategy<PSO> iterationStrategy)
Set the IterationStrategy to be used.

Parameters:
iterationStrategy - The iterationStrategy to set.


Copyright © 2009 CIRG. All Rights Reserved.