MOEA Framework 2.12
API Specification

org.moeaframework.algorithm.pso
Class AbstractPSOAlgorithm

java.lang.Object
  extended by org.moeaframework.algorithm.AbstractAlgorithm
      extended by org.moeaframework.algorithm.pso.AbstractPSOAlgorithm
All Implemented Interfaces:
Algorithm
Direct Known Subclasses:
OMOPSO, SMPSO

public abstract class AbstractPSOAlgorithm
extends AbstractAlgorithm

Abstract multi-objective particle swarm optimizer (MOPSO).


Field Summary
protected  NondominatedPopulation archive
          The archive of non-dominated solutions; or null of no external archive is sued.
protected  DominanceComparator dominanceComparator
          Comparator for updating the local best particles.
protected  DominanceComparator leaderComparator
          Comparator for selecting leaders.
protected  FitnessBasedArchive leaders
          The leaders.
protected  int leaderSize
          The number of leaders.
protected  Solution[] localBestParticles
          The local best particles.
protected  Variation mutation
          Mutation operator, or null if no mutation is defined.
protected  Solution[] particles
          The particles.
protected  int swarmSize
          The number of particles.
protected  double[][] velocities
          The speed / velocity of each particle.
 
Fields inherited from class org.moeaframework.algorithm.AbstractAlgorithm
initialized, numberOfEvaluations, problem, terminated
 
Constructor Summary
AbstractPSOAlgorithm(Problem problem, int swarmSize, int leaderSize, DominanceComparator leaderComparator, DominanceComparator dominanceComparator, FitnessBasedArchive leaders, NondominatedPopulation archive, Variation mutation)
          Constructs a new abstract PSO algorithm.
 
Method Summary
 NondominatedPopulation getResult()
          Returns the current best-known result.
 Serializable getState()
          Returns a Serializable object representing the internal state of this algorithm.
protected  void initialize()
          Performs any initialization that is required by this algorithm.
protected  void iterate()
          Performs one iteration of the algorithm.
protected  void mutate()
          Applies the mutation operator to all particles.
protected  void mutate(int i)
          Applies the mutation operator to an individual particle.
protected  Solution selectLeader()
          Randomly select a leader.
 void setState(Object objState)
          Sets the internal state of of this algorithm.
protected  void updateLocalBest()
          Updates the local best particles.
protected  void updatePosition(int i)
          Update the position of an individual particle.
protected  void updatePositions()
          Update the positions of all particles.
protected  void updateVelocities()
          Update the speeds of all particles.
protected  void updateVelocity(int i)
          Update the speed of an individual particle.
 
Methods inherited from class org.moeaframework.algorithm.AbstractAlgorithm
evaluate, evaluateAll, evaluateAll, finalize, getNumberOfEvaluations, getProblem, isInitialized, isTerminated, step, terminate
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

swarmSize

protected int swarmSize
The number of particles.


leaderSize

protected int leaderSize
The number of leaders.


particles

protected Solution[] particles
The particles.


localBestParticles

protected Solution[] localBestParticles
The local best particles.


leaders

protected FitnessBasedArchive leaders
The leaders.


archive

protected NondominatedPopulation archive
The archive of non-dominated solutions; or null of no external archive is sued.


velocities

protected double[][] velocities
The speed / velocity of each particle.


leaderComparator

protected DominanceComparator leaderComparator
Comparator for selecting leaders.


dominanceComparator

protected DominanceComparator dominanceComparator
Comparator for updating the local best particles.


mutation

protected Variation mutation
Mutation operator, or null if no mutation is defined.

Constructor Detail

AbstractPSOAlgorithm

public AbstractPSOAlgorithm(Problem problem,
                            int swarmSize,
                            int leaderSize,
                            DominanceComparator leaderComparator,
                            DominanceComparator dominanceComparator,
                            FitnessBasedArchive leaders,
                            NondominatedPopulation archive,
                            Variation mutation)
Constructs a new abstract PSO algorithm.

Parameters:
problem - the problem
swarmSize - the number of particles
leaderSize - the number of leaders
leaderComparator - comparator for selecting leaders
dominanceComparator - comparator for updating the local best particles
leaders - non-dominated population for storing the leaders
archive - non-dominated population for storing the external archive; or null if no external archive is defined
mutation - mutation operator, or null if no mutation is defined
Method Detail

updateVelocities

protected void updateVelocities()
Update the speeds of all particles.


updateVelocity

protected void updateVelocity(int i)
Update the speed of an individual particle.

Parameters:
i - the index of the particle

updatePositions

protected void updatePositions()
Update the positions of all particles.


updatePosition

protected void updatePosition(int i)
Update the position of an individual particle.

Parameters:
i - the index of the particle

selectLeader

protected Solution selectLeader()
Randomly select a leader.

Returns:
the selected leader

updateLocalBest

protected void updateLocalBest()
Updates the local best particles.


mutate

protected void mutate()
Applies the mutation operator to all particles.


mutate

protected void mutate(int i)
Applies the mutation operator to an individual particle.

Parameters:
i - the index of the particle

getResult

public NondominatedPopulation getResult()
Description copied from interface: Algorithm
Returns the current best-known result.

Returns:
the current best-known result

initialize

protected void initialize()
Description copied from class: AbstractAlgorithm
Performs any initialization that is required by this algorithm. This method is called automatically by the first invocation of AbstractAlgorithm.step(), but may also be called manually prior to any invocations of step. Implementations should always invoke super.initialize() to ensure the hierarchy is initialized correctly.

Overrides:
initialize in class AbstractAlgorithm

iterate

protected void iterate()
Description copied from class: AbstractAlgorithm
Performs one iteration of the algorithm. This method should be overridden by implementations to perform each logical iteration of the algorithm.

Specified by:
iterate in class AbstractAlgorithm

getState

public Serializable getState()
                      throws NotSerializableException
Description copied from interface: Algorithm
Returns a Serializable object representing the internal state of this algorithm.

Specified by:
getState in interface Algorithm
Overrides:
getState in class AbstractAlgorithm
Returns:
a Serializable object representing the internal state of this algorithm
Throws:
NotSerializableException - if this algorithm does not support serialization

setState

public void setState(Object objState)
              throws NotSerializableException
Description copied from interface: Algorithm
Sets the internal state of of this algorithm.

Specified by:
setState in interface Algorithm
Overrides:
setState in class AbstractAlgorithm
Parameters:
objState - the internal state of this algorithm
Throws:
NotSerializableException - if this algorithm does not support serialization

MOEA Framework 2.12
API Specification

Copyright 2009-2016 MOEA Framework. All rights reserved.
Licensed under the GNU Lesser General Public License.
Return to the MOEA Framework homepage. Visit us on Github!