com.rapidminer.tools.math.optimization.ec.pso
Class PSOOptimization

java.lang.Object
  extended by com.rapidminer.tools.math.optimization.ec.pso.PSOOptimization
All Implemented Interfaces:
Optimization
Direct Known Subclasses:
PSOSVMOptimization

public abstract class PSOOptimization
extends java.lang.Object
implements Optimization

This class performs the optimization of a value vector with a particle swarm approach.

Author:
Ingo Mierswa

Constructor Summary
PSOOptimization(int popSize, int individualSize, int maxGen, int maxWithoutImprovement, double inertiaWeight, double localWeight, double globalWeight, double minValue, double maxValue, boolean dynamicInertiaWeight, RandomGenerator random)
          Creates a new PSO optimization with the given parameters.
 
Method Summary
protected  Population createInitialPopulation(int popSize, int individualSize)
          Creates the initial population.
abstract  PerformanceVector evaluateIndividual(double[] individual)
          Subclasses must implement this method to calculate the fitness of the given individual.
 double getBestFitnessEver()
          Returns the best fitness ever.
 double getBestFitnessInGeneration()
          Returns the best fitness in the current generation.
 PerformanceVector getBestPerformanceEver()
          Returns the best performance vector ever.
 double[] getBestValuesEver()
          Returns the best values ever.
 int getGeneration()
          Returns the current generation.
 void nextIteration()
          This method is invoked after each evaluation.
 void optimize()
          Invoke this method for optimization.
 void reinit(int popSize, int individualSize, int maxGen, int maxWithoutImprovement, double inertiaWeight, double localWeight, double globalWeight, double minValue, double maxValue, boolean dynamicInertiaWeight, RandomGenerator random)
           
 void setMaxValue(double maxValue)
           
 void setMinValue(double minValue)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PSOOptimization

public PSOOptimization(int popSize,
                       int individualSize,
                       int maxGen,
                       int maxWithoutImprovement,
                       double inertiaWeight,
                       double localWeight,
                       double globalWeight,
                       double minValue,
                       double maxValue,
                       boolean dynamicInertiaWeight,
                       RandomGenerator random)
Creates a new PSO optimization with the given parameters.

Method Detail

evaluateIndividual

public abstract PerformanceVector evaluateIndividual(double[] individual)
                                              throws OperatorException
Subclasses must implement this method to calculate the fitness of the given individual. Please note that null might be returned for non-valid individuals.

Throws:
OperatorException

nextIteration

public void nextIteration()
                   throws OperatorException
This method is invoked after each evaluation. The default implementation does nothing but subclasses might implement this method to support online plotting or logging.

Throws:
OperatorException

setMinValue

public void setMinValue(double minValue)

setMaxValue

public void setMaxValue(double maxValue)

createInitialPopulation

protected Population createInitialPopulation(int popSize,
                                             int individualSize)
Creates the initial population.


reinit

public void reinit(int popSize,
                   int individualSize,
                   int maxGen,
                   int maxWithoutImprovement,
                   double inertiaWeight,
                   double localWeight,
                   double globalWeight,
                   double minValue,
                   double maxValue,
                   boolean dynamicInertiaWeight,
                   RandomGenerator random)

optimize

public void optimize()
              throws OperatorException
Invoke this method for optimization.

Specified by:
optimize in interface Optimization
Throws:
OperatorException

getGeneration

public int getGeneration()
Returns the current generation.

Specified by:
getGeneration in interface Optimization

getBestFitnessInGeneration

public double getBestFitnessInGeneration()
Returns the best fitness in the current generation.

Specified by:
getBestFitnessInGeneration in interface Optimization

getBestFitnessEver

public double getBestFitnessEver()
Returns the best fitness ever.

Specified by:
getBestFitnessEver in interface Optimization

getBestPerformanceEver

public PerformanceVector getBestPerformanceEver()
Returns the best performance vector ever.

Specified by:
getBestPerformanceEver in interface Optimization

getBestValuesEver

public double[] getBestValuesEver()
Returns the best values ever. Use this method after optimization to get the best result.

Specified by:
getBestValuesEver in interface Optimization


Copyright © 2001-2009 by Rapid-I