genopt.algorithm.util.pso
Class ModelPSO

java.lang.Object
  extended by genopt.algorithm.Optimizer
      extended by genopt.algorithm.util.pso.ModelPSO
Direct Known Subclasses:
PSOCC, PSOIW

public abstract class ModelPSO
extends Optimizer

Abstract class with model Particle Swarm Optimization algorithm.

This project was carried out at:

and supported by

GenOpt Copyright (c) 1998-2011, The Regents of the University of California, through Lawrence Berkeley National Laboratory (subject to receipt of any required approvals from the U.S. Dept. of Energy). All rights reserved.

Version:
GenOpt(R) 3.1.0 (December 8, 2011)

Author:
Michael Wetter

Field Summary
protected  double CogAcc
          Acceleration constant for cognitive component
protected  Point[] CurPop
          Current population
protected  int dimCon
          The number of independent continuous variables
protected  int dimDis
          The number of independent discrete variables
protected  int dimF
          The number of function values
private static int GBEST
          Constant to denote the gbest neighborhood topology
protected  Point[] GloBes
          Global best particles
protected  int IGen
          Number of the current generation
private static int LBEST
          Constant to denote the lbest neighborhood topology
protected  int[] LenBitStr
          Length of the bit string used to encode each component of the discrete parameters
protected  Point[] LocBes
          Local best particles
protected  double MaxVelDis
          Maximum velocity for discrete parameter
private  double MaxVelGaiCon
          Gain for maximal velocity of continuous parameters
private  int[][] NeiHooInd
          Index with neighborhood points for each particle
private  int NeiHooSiz
          Neighborhood size
private  int NeiHooTop
          Neighborhood topology
protected  int NumGen
          The number of generations
protected  int NumPar
          The number of particles
protected  java.util.Random RanGen
          Random number generator
protected  double SocAcc
          Acceleration constant for social component
protected  double[][] VelCon
          Velocity of the continuous particles
protected  double[][][] VelDis
          Velocity of the discrete particles
protected  double[] VelMaxCon
          Maximum velocity for each component of the continuous parameter
private static int VONNEUMANN
          Constant to denote the von Neumann neighborhood topology
 
Fields inherited from class genopt.algorithm.Optimizer
done, EXCLUDING, FS, INCLUDING, LS, MAINITERATION, ORIGINAL, SUBITERATION, TRANSFORMED
 
Constructor Summary
ModelPSO(GenOpt genOptData)
          Constructor
 
Method Summary
private  int _getVonNeumannIndex(int i, int j, int offSet)
          Computes the index of a point used in the von Neumann neighborhood
protected static double clampVelocity(double velocity, double max)
          Clamps the velocity
private  void initializeCurrentPopulation(Point x0)
          Initializes the current population
private  void initializeNeighborhoodIndices()
          Initializes the neighborhood indices for each particle
 int run(Point x0)
          Runs the optimization process until a termination criteria is satisfied
private  void updateGlobalBest()
          Updates the global best particles based on the local best particles
private  void updateLocalBest()
          Updates the local best particles based on the current population
private  void updateParticleLocation()
          Updates the particle location
protected abstract  void updateVelocity()
          Updates the particle velocity
 
Methods inherited from class genopt.algorithm.Optimizer
algorithmRequiresUsageOfStepNumber, appendToOutputListing, checkMaxIteration, checkObjectiveFunctionValue, ensureOnlyContinuousParameters, ensureOnlyDiscreteParameters, getAbsAccuracyFunction, getDimensionContinuous, getDimensionDiscrete, getDimensionF, getDimensionX, getDiscreteValueDouble0, getDx, getDx0, getF, getF, getIndex0, getIndex0, getInputValueBoolean, getInputValueDouble, getInputValueDouble, getInputValueInteger, getInputValueInteger, getInputValueString, getInputValueString, getKindOfConstraint, getL, getLengthDiscrete, getMainIterationNumber, getMaximumThreadPoolSize, getMaxIterationNumber, getMinimumPoint, getMode, getObjectiveFunctionName, getOutputPath, getPointerToEqualPoints, getRelAccuracyFunction, getSimulationNumber, getStepNumber, getU, getVariableNameContinuous, getVariableNameDiscrete, getX0, getX0, goToEndOfCommandFile, increaseStepNumber, increaseStepNumber, isFeasible, isNextToken, maxIterationReached, mustStopOptimization, print, println, replace, report, reportCurrentLowestPoint, reportMinimum, resetStepNumber, roundCoordinates, run, setInfo, setMode, setNumberOfMatchingResults, setToFeasibleCoordinate, setToFeasibleCoordinate, setWarning, simulate, throwInputError, useStepNumber, writeStepNumber
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

GBEST

private static final int GBEST
Constant to denote the gbest neighborhood topology

See Also:
Constant Field Values

LBEST

private static final int LBEST
Constant to denote the lbest neighborhood topology

See Also:
Constant Field Values

VONNEUMANN

private static final int VONNEUMANN
Constant to denote the von Neumann neighborhood topology

See Also:
Constant Field Values

NeiHooTop

private int NeiHooTop
Neighborhood topology


NeiHooSiz

private int NeiHooSiz
Neighborhood size


NeiHooInd

private int[][] NeiHooInd
Index with neighborhood points for each particle


dimCon

protected int dimCon
The number of independent continuous variables


dimDis

protected int dimDis
The number of independent discrete variables


LenBitStr

protected int[] LenBitStr
Length of the bit string used to encode each component of the discrete parameters


dimF

protected int dimF
The number of function values


NumPar

protected int NumPar
The number of particles


NumGen

protected int NumGen
The number of generations


IGen

protected int IGen
Number of the current generation


RanGen

protected java.util.Random RanGen
Random number generator


CogAcc

protected double CogAcc
Acceleration constant for cognitive component


SocAcc

protected double SocAcc
Acceleration constant for social component


MaxVelGaiCon

private double MaxVelGaiCon
Gain for maximal velocity of continuous parameters


MaxVelDis

protected double MaxVelDis
Maximum velocity for discrete parameter


VelMaxCon

protected double[] VelMaxCon
Maximum velocity for each component of the continuous parameter


VelCon

protected double[][] VelCon
Velocity of the continuous particles


VelDis

protected double[][][] VelDis
Velocity of the discrete particles


CurPop

protected Point[] CurPop
Current population


LocBes

protected Point[] LocBes
Local best particles


GloBes

protected Point[] GloBes
Global best particles

Constructor Detail

ModelPSO

public ModelPSO(GenOpt genOptData)
         throws OptimizerException,
                java.io.IOException,
                java.lang.Exception,
                InputFormatException
Constructor

Parameters:
genOptData - a reference to the GenOpt object.
Note: the object is used as a reference. Hence, the data of GenOpt are modified by this Class.
Throws:
OptimizerException - if an OptimizerException occurs or if the user required to stop GenOpt
SimulationInputException - if an error in writing the simulation input file occurs
java.lang.NoSuchMethodException - if a method that should be invoked could not be found
java.lang.IllegalAccessException - if an invoked method enforces Java language access control and the underlying method is inaccessible
InvocationTargetException - if an invoked method throws an exception
java.lang.Exception - if an I/O error in the simulation input file occurs
java.io.IOException
InputFormatException
Method Detail

run

public int run(Point x0)
        throws SimulationInputException,
               OptimizerException,
               java.lang.NoSuchMethodException,
               java.lang.IllegalAccessException,
               java.lang.Exception
Runs the optimization process until a termination criteria is satisfied

Specified by:
run in class Optimizer
Parameters:
x0 - Initial point
Returns:
-1 if the maximum number of iteration is exceeded
+1 if the required accuracy is reached
Throws:
OptimizerException - if an OptimizerException occurs or if the user required to stop GenOpt
SimulationInputException - if an error in writing the simulation input file occurs
java.lang.NoSuchMethodException - if a method that should be invoked could not be found
java.lang.IllegalAccessException - if an invoked method enforces Java language access control and the underlying method is inaccessible
InvocationTargetException - if an invoked method throws an exception
java.lang.Exception - if an I/O error in the simulation input file occurs

updateParticleLocation

private void updateParticleLocation()
Updates the particle location


updateVelocity

protected abstract void updateVelocity()
Updates the particle velocity


clampVelocity

protected static final double clampVelocity(double velocity,
                                            double max)
Clamps the velocity

Parameters:
velocity - particle velocity
max - maximum absolute value of the velocity. If max <= 0 then the value of velocity is returned.
Returns:
velocity clamp to admissible interval

updateGlobalBest

private void updateGlobalBest()
Updates the global best particles based on the local best particles


updateLocalBest

private final void updateLocalBest()
Updates the local best particles based on the current population


initializeCurrentPopulation

private void initializeCurrentPopulation(Point x0)
Initializes the current population

Parameters:
x0 - Initial point

initializeNeighborhoodIndices

private void initializeNeighborhoodIndices()
Initializes the neighborhood indices for each particle


_getVonNeumannIndex

private final int _getVonNeumannIndex(int i,
                                      int j,
                                      int offSet)
Computes the index of a point used in the von Neumann neighborhood

Parameters:
i - zero-based row index
j - zero-based column index
offSet - off set of index
Returns:
the zero-based particle index