public abstract class ModelPSO extends Optimizer
This project was carried out at:
and supported byGenOpt Copyright (c) 1998-2021, 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.
Modifier and Type | Field and Description |
---|---|
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
|
done, EXCLUDING, FS, INCLUDING, LS, MAINITERATION, ORIGINAL, SUBITERATION, TRANSFORMED
Constructor and Description |
---|
ModelPSO(GenOpt genOptData)
Constructor
|
Modifier and Type | Method and Description |
---|---|
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
|
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
private static final int GBEST
private static final int LBEST
private static final int VONNEUMANN
private int NeiHooTop
private int NeiHooSiz
private int[][] NeiHooInd
protected int dimCon
protected int dimDis
protected int[] LenBitStr
protected int dimF
protected int NumPar
protected int NumGen
protected int IGen
protected java.util.Random RanGen
protected double CogAcc
protected double SocAcc
private double MaxVelGaiCon
protected double MaxVelDis
protected double[] VelMaxCon
protected double[][] VelCon
protected double[][][] VelDis
protected Point[] CurPop
protected Point[] LocBes
protected Point[] GloBes
public ModelPSO(GenOpt genOptData) throws OptimizerException, java.io.IOException, java.lang.Exception, InputFormatException
genOptData
- a reference to the GenOpt object.OptimizerException
- if an OptimizerException occurs or
if the user required to stop GenOptSimulationInputException
- if an error in writing the
simulation input file occursjava.lang.NoSuchMethodException
- if a method that should be invoked could not be foundjava.lang.IllegalAccessException
- if an invoked method enforces Java language access
control and the underlying method is inaccessibleInvocationTargetException
- if an invoked method throws an exceptionjava.lang.Exception
- if an I/O error in the simulation input file occursjava.io.IOException
InputFormatException
public int run(Point x0) throws SimulationInputException, OptimizerException, java.lang.NoSuchMethodException, java.lang.IllegalAccessException, java.lang.Exception
run
in class Optimizer
x0
- Initial point-1
if the maximum number of iteration
is exceeded
+1
if the required accuracy is reachedOptimizerException
- if an OptimizerException occurs or
if the user required to stop GenOptSimulationInputException
- if an error in writing the
simulation input file occursjava.lang.NoSuchMethodException
- if a method that should be invoked could not be foundjava.lang.IllegalAccessException
- if an invoked method enforces Java language access
control and the underlying method is inaccessibleInvocationTargetException
- if an invoked method throws an exceptionjava.lang.Exception
- if an I/O error in the simulation input file occursprivate void updateParticleLocation()
protected abstract void updateVelocity()
protected static final double clampVelocity(double velocity, double max)
velocity
- particle velocitymax
- maximum absolute value of the velocity. If max ≤ 0
then the value of velocity
is returned.private void updateGlobalBest()
private final void updateLocalBest()
private void initializeCurrentPopulation(Point x0)
x0
- Initial pointprivate void initializeNeighborhoodIndices()
private final int _getVonNeumannIndex(int i, int j, int offSet)
i
- zero-based row indexj
- zero-based column indexoffSet
- off set of index