org.dishevelled.swarm
Class ParticleSwarmOptimizationAlgorithm

java.lang.Object
  extended by org.dishevelled.swarm.ParticleSwarmOptimizationAlgorithm

public final class ParticleSwarmOptimizationAlgorithm
extends Object

Particle swarm optimization (PSO) algorithm function.

Version:
$Revision$ $Date$
Author:
Michael Heuer

Field Summary
static double DEFAULT_COGNITIVE_WEIGHT
          Default cognitive weight.
static double DEFAULT_INERTIA_WEIGHT
          Default inertia weight.
static double DEFAULT_MAXIMUM_POSITION
          Default maximum position.
static double DEFAULT_MAXIMUM_VELOCITY
          Default maximum velocity.
static double DEFAULT_MINIMUM_POSITION
          Default minimum position.
static double DEFAULT_MINIMUM_VELOCITY
          Default minimum velocity.
static double DEFAULT_SOCIAL_WEIGHT
          Default social weight.
 
Constructor Summary
ParticleSwarmOptimizationAlgorithm()
          Create a new particle swarm optimization algorithm function with default parameters.
 
Method Summary
 void addParticleSwarmOptimizationAlgorithmListener(ParticleSwarmOptimizationAlgorithmListener l)
          Add the specified particle swarm optimization algorithm listener.
 void addPropertyChangeListener(PropertyChangeListener listener)
          Add a property change listener to this particle swarm optimization algorithm.
 void addPropertyChangeListener(String propertyName, PropertyChangeListener listener)
          Add a property change listener for the specified property to this particle swarm optimization algorithm.
 double getCognitiveWeight()
          Return the cognitive weight for this particle swarm optimization algorithm.
 double getInertiaWeight()
          Return the inertia weight for this particle swarm optimization algorithm.
 double getMaximumPosition()
          Return the maximum position for this particle swarm optimization algorithm.
 double getMaximumVelocity()
          Return the maximum velocity for this particle swarm optimization algorithm.
 double getMinimumPosition()
          Return the minimum position for this particle swarm optimization algorithm.
 double getMinimumVelocity()
          Return the minimum velocity for this particle swarm optimization algorithm.
 int getParticleSwarmOptimizationAlgorithmListenerCount()
          Return the number of particle swarm optimization algorithm listeners registered to this particle swarm optimization algorithm.
 ParticleSwarmOptimizationAlgorithmListener[] getParticleSwarmOptimizationAlgorithmListeners()
          Return an array of particle swarm optimization algorithm listeners registered to this particle swarm optimization algorithm.
 int getPropertyChangeListenerCount()
          Return the number of property change listeners registered to this particle swarm optimization algorithm.
 int getPropertyChangeListenerCount(String propertyName)
          Return the number of property change listeners registered to this particle swarm optimization algorithm for the specified property.
 PropertyChangeListener[] getPropertyChangeListeners()
          Return an array of property change listeners registered to this particle swarm optimization algorithm.
 PropertyChangeListener[] getPropertyChangeListeners(String propertyName)
          Return an array of property change listeners registered to this particle swarm optimization algorithm for the specified property.
 Random getRandom()
          Return the source of randomness for this particle swarm optimization algorithm.
 double getSocialWeight()
          Return the social weight for this particle swarm optimization algorithm.
 ParticleSwarm optimize(int particles, int dimensions, ExitStrategy exitStrategy, Fitness fitness)
          Optimize a particle swarm of the specified size over the specified number of dimensions given the specified exit strategy and fitness functions.
 void removeParticleSwarmOptimizationAlgorithmListener(ParticleSwarmOptimizationAlgorithmListener l)
          Remove the specified particle swarm optimization algorithm listener.
 void removePropertyChangeListener(PropertyChangeListener listener)
          Remove a property change listener from this particle swarm optimization algorithm.
 void removePropertyChangeListener(String propertyName, PropertyChangeListener listener)
          Remove a property change listener for the specified property from this particle swarm optimization algorithm.
 void setCognitiveWeight(double cognitiveWeight)
          Set the cognitive weight for this particle swarm optimization algorithm to cognitiveWeight.
 void setInertiaWeight(double inertiaWeight)
          Set the inertia weight for this particle swarm optimization algorithm to inertiaWeight.
 void setMaximumPosition(double maximumPosition)
          Set the maximum position for this particle swarm optimization algorithm to maximumPosition.
 void setMaximumVelocity(double maximumVelocity)
          Set the maximum velocity for this particle swarm optimization algorithm to maximumVelocity.
 void setMinimumPosition(double minimumPosition)
          Set the minimum position for this particle swarm optimization algorithm to minimumPosition.
 void setMinimumVelocity(double minimumVelocity)
          Set the minimum velocity for this particle swarm optimization algorithm to minimumVelocity.
 void setRandom(Random random)
          Set the source of randomness for this particle swarm optimization algorithm to random.
 void setSocialWeight(double socialWeight)
          Set the social weight for this particle swarm optimization algorithm to socialWeight.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_INERTIA_WEIGHT

public static final double DEFAULT_INERTIA_WEIGHT
Default inertia weight.

See Also:
Constant Field Values

DEFAULT_COGNITIVE_WEIGHT

public static final double DEFAULT_COGNITIVE_WEIGHT
Default cognitive weight.

See Also:
Constant Field Values

DEFAULT_SOCIAL_WEIGHT

public static final double DEFAULT_SOCIAL_WEIGHT
Default social weight.

See Also:
Constant Field Values

DEFAULT_MINIMUM_POSITION

public static final double DEFAULT_MINIMUM_POSITION
Default minimum position.

See Also:
Constant Field Values

DEFAULT_MAXIMUM_POSITION

public static final double DEFAULT_MAXIMUM_POSITION
Default maximum position.

See Also:
Constant Field Values

DEFAULT_MINIMUM_VELOCITY

public static final double DEFAULT_MINIMUM_VELOCITY
Default minimum velocity.

See Also:
Constant Field Values

DEFAULT_MAXIMUM_VELOCITY

public static final double DEFAULT_MAXIMUM_VELOCITY
Default maximum velocity.

See Also:
Constant Field Values
Constructor Detail

ParticleSwarmOptimizationAlgorithm

public ParticleSwarmOptimizationAlgorithm()
Create a new particle swarm optimization algorithm function with default parameters.

Method Detail

optimize

public ParticleSwarm optimize(int particles,
                              int dimensions,
                              ExitStrategy exitStrategy,
                              Fitness fitness)
Optimize a particle swarm of the specified size over the specified number of dimensions given the specified exit strategy and fitness functions.

Returns a 2D matrix of particle positions with the specified number of particles as rows and the specified number of dimensions as columns.

Parameters:
particles - number of particles, must be >= 1
dimensions - number of dimensions, must be >= 1
exitStrategy - exit strategy function, must not be null
fitness - fitness function, must not be null
Returns:
2D matrix of particle positions with particles rows and dimensions columns

getRandom

public Random getRandom()
Return the source of randomness for this particle swarm optimization algorithm. The source of randomness will not be null.

Returns:
the source of randomness for this particle swarm optimization algorithm

setRandom

public void setRandom(Random random)
Set the source of randomness for this particle swarm optimization algorithm to random.

This is a bound property.

Parameters:
random - source of randomness for this particle swarm optimization algorithm, must not be null

getInertiaWeight

public double getInertiaWeight()
Return the inertia weight for this particle swarm optimization algorithm. Defaults to 0.1d.

Returns:
the inertia weight for this particle swarm optimization algorithm
See Also:
DEFAULT_INERTIA_WEIGHT

setInertiaWeight

public void setInertiaWeight(double inertiaWeight)
Set the inertia weight for this particle swarm optimization algorithm to inertiaWeight.

This is a bound property.

Parameters:
inertiaWeight - inertia weight for this particle swarm optimization algorithm

getCognitiveWeight

public double getCognitiveWeight()
Return the cognitive weight for this particle swarm optimization algorithm. Defaults to 0.2d.

Returns:
the cognitive weight for this particle swarm optimization algorithm
See Also:
DEFAULT_COGNITIVE_WEIGHT

setCognitiveWeight

public void setCognitiveWeight(double cognitiveWeight)
Set the cognitive weight for this particle swarm optimization algorithm to cognitiveWeight.

This is a bound property.

Parameters:
cognitiveWeight - cognitive weight for this particle swarm optimization algorithm

getSocialWeight

public double getSocialWeight()
Return the social weight for this particle swarm optimization algorithm. Defaults to 0.2d.

Returns:
the social weight for this particle swarm optimization algorithm
See Also:
DEFAULT_SOCIAL_WEIGHT

setSocialWeight

public void setSocialWeight(double socialWeight)
Set the social weight for this particle swarm optimization algorithm to socialWeight.

This is a bound property.

Parameters:
socialWeight - social weight for this particle swarm optimization algorithm

getMinimumPosition

public double getMinimumPosition()
Return the minimum position for this particle swarm optimization algorithm. Defaults to 0.0d.

Returns:
the minimum position for this particle swarm optimization algorithm
See Also:
DEFAULT_MINIMUM_POSITION

setMinimumPosition

public void setMinimumPosition(double minimumPosition)
Set the minimum position for this particle swarm optimization algorithm to minimumPosition.

This is a bound property.

Parameters:
minimumPosition - minimum position for this particle swarm optimization algorithm

getMaximumPosition

public double getMaximumPosition()
Return the maximum position for this particle swarm optimization algorithm. Defaults to 1.0d.

Returns:
the maximum position for this particle swarm optimization algorithm
See Also:
DEFAULT_MAXIMUM_POSITION

setMaximumPosition

public void setMaximumPosition(double maximumPosition)
Set the maximum position for this particle swarm optimization algorithm to maximumPosition.

This is a bound property.

Parameters:
maximumPosition - maximum position for this particle swarm optimization algorithm

getMinimumVelocity

public double getMinimumVelocity()
Return the minimum velocity for this particle swarm optimization algorithm. Defaults to -0.5d.

Returns:
the minimum velocity for this particle swarm optimization algorithm
See Also:
DEFAULT_MINIMUM_VELOCITY

setMinimumVelocity

public void setMinimumVelocity(double minimumVelocity)
Set the minimum velocity for this particle swarm optimization algorithm to minimumVelocity.

This is a bound property.

Parameters:
minimumVelocity - maximum velocity for this particle swarm optimization algorithm

getMaximumVelocity

public double getMaximumVelocity()
Return the maximum velocity for this particle swarm optimization algorithm. Defaults to Double.MAX_VALUE.

Returns:
the maximum velocity for this particle swarm optimization algorithm
See Also:
DEFAULT_MAXIMUM_VELOCITY

setMaximumVelocity

public void setMaximumVelocity(double maximumVelocity)
Set the maximum velocity for this particle swarm optimization algorithm to maximumVelocity.

This is a bound property.

Parameters:
maximumVelocity - maximum velocity for this particle swarm optimization algorithm

addParticleSwarmOptimizationAlgorithmListener

public void addParticleSwarmOptimizationAlgorithmListener(ParticleSwarmOptimizationAlgorithmListener l)
Add the specified particle swarm optimization algorithm listener.

Parameters:
l - particle swarm optimization algorithm listener to add

removeParticleSwarmOptimizationAlgorithmListener

public void removeParticleSwarmOptimizationAlgorithmListener(ParticleSwarmOptimizationAlgorithmListener l)
Remove the specified particle swarm optimization algorithm listener.

Parameters:
l - particle swarm optimization algorithm listener to add

getParticleSwarmOptimizationAlgorithmListenerCount

public int getParticleSwarmOptimizationAlgorithmListenerCount()
Return the number of particle swarm optimization algorithm listeners registered to this particle swarm optimization algorithm.

Returns:
the number of particle swarm optimization algorithm listeners registered to this particle swarm optimization algorithm

getParticleSwarmOptimizationAlgorithmListeners

public ParticleSwarmOptimizationAlgorithmListener[] getParticleSwarmOptimizationAlgorithmListeners()
Return an array of particle swarm optimization algorithm listeners registered to this particle swarm optimization algorithm. The returned array may be empty but will not be null.

Returns:
an array of particle swarm optimization algorithm listeners registered to this particle swarm optimization algorithm

addPropertyChangeListener

public void addPropertyChangeListener(PropertyChangeListener listener)
Add a property change listener to this particle swarm optimization algorithm. The listener is registered for all properties.

Parameters:
listener - property change listener to add

addPropertyChangeListener

public void addPropertyChangeListener(String propertyName,
                                      PropertyChangeListener listener)
Add a property change listener for the specified property to this particle swarm optimization algorithm. The listener will be invoked only when a call on firePropertyChange names that specific property.

Parameters:
propertyName - specific property name
listener - property change listener to add

removePropertyChangeListener

public void removePropertyChangeListener(PropertyChangeListener listener)
Remove a property change listener from this particle swarm optimization algorithm. This removes a listener that was registered for all properties.

Parameters:
listener - property change listener to remove

removePropertyChangeListener

public void removePropertyChangeListener(String propertyName,
                                         PropertyChangeListener listener)
Remove a property change listener for the specified property from this particle swarm optimization algorithm.

Parameters:
propertyName - specific property name
listener - property change listener to remove

getPropertyChangeListenerCount

public int getPropertyChangeListenerCount()
Return the number of property change listeners registered to this particle swarm optimization algorithm.

Returns:
the number of property change listeners registered to this particle swarm optimization algorithm

getPropertyChangeListenerCount

public int getPropertyChangeListenerCount(String propertyName)
Return the number of property change listeners registered to this particle swarm optimization algorithm for the specified property.

Parameters:
propertyName - property name
Returns:
the number of property change listeners registered to this particle swarm optimization algorithm for the specified property

getPropertyChangeListeners

public PropertyChangeListener[] getPropertyChangeListeners()
Return an array of property change listeners registered to this particle swarm optimization algorithm. The returned array may be empty but will not be null.

Returns:
an array of property change listeners registered to this particle swarm optimization algorithm

getPropertyChangeListeners

public PropertyChangeListener[] getPropertyChangeListeners(String propertyName)
Return an array of property change listeners registered to this particle swarm optimization algorithm for the specified property. The returned array may be empty but will not be null.

Parameters:
propertyName - property name
Returns:
an array of property change listeners registered to this particle swarm optimization algorithm


Copyright © 2006-2012 dishevelled.org. All Rights Reserved.