Interface IPSFunction
-
public interface IPSFunctionInterface for a particle swarm fitting function that is supposed to return a value to minimize.- Author:
- Andrea Antonello (www.hydrologis.com)
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description doubleevaluate(int iterationStep, int particleNum, double[] parameters, double[]... ranges)Evaluates the value of the fitting function and returns representing scalar.doublegetInitialGlobalBest()Gives the initial global best to use (ex.StringgetPostInfoString()Getter for information the module might want to collect and make available.booleanhasConverged(double globalBest, double[] globalBestLocations, double[] previousBestLocations)Evaluates if the solution has converged.booleanisBetter(double evaluatedValue, double consideredBest)Evaluates if the supplied value is better than the supplied best.doubleoptimization(double... parameters)apply the optimization function.StringoptimizationDescription()
-
-
-
Method Detail
-
evaluate
double evaluate(int iterationStep, int particleNum, double[] parameters, double[]... ranges) throws ExceptionEvaluates the value of the fitting function and returns representing scalar.- Parameters:
iterationStep- the iterationstep to monitor the process.particleNum- the particle number to monitor the process.parameters- the parameters to be used in the function.ranges- the valid ranges for the given parameters.- Returns:
- the calculated value.
- Throws:
Exception
-
optimization
double optimization(double... parameters)
apply the optimization function.- Parameters:
parameters- the parameters needed.- Returns:
- the optimized value;
-
optimizationDescription
String optimizationDescription()
- Returns:
- a description for the applied optimization function.
-
isBetter
boolean isBetter(double evaluatedValue, double consideredBest)Evaluates if the supplied value is better than the supplied best.Implementations will take care of defining whether a minimum, a maximum or some other condition has to be considered.
- Parameters:
evaluatedValue- the value to check.consideredBest- the best to check against.- Returns:
trueif the evaluatedValue is considered to be better than the supplied best.
-
hasConverged
boolean hasConverged(double globalBest, double[] globalBestLocations, double[] previousBestLocations)Evaluates if the solution has converged.- Parameters:
globalBest- the current global best.globalBestLocations- the locations resulting from the current global best.previousBestLocations- the locations of the previous iteration.- Returns:
trueif the solution can be considered as converged.
-
getInitialGlobalBest
double getInitialGlobalBest()
Gives the initial global best to use (ex. for initial swarm creation).- Returns:
- the initial global best to use.
-
getPostInfoString
String getPostInfoString()
Getter for information the module might want to collect and make available.- Returns:
- the info string or
null.
-
-