de.kumpe.hadooptimizer
Class Optimizer<I>

java.lang.Object
  extended by de.kumpe.hadooptimizer.Optimizer<I>
Type Parameters:
I - the individuals' type
Direct Known Subclasses:
EaJenevaOptimizer, HadoOptimizerBase, SimpleEaOptimizer, SimpleEsOptimizer, ThreadedEaOptimizer, ThreadedEsOptimizer

public abstract class Optimizer<I>
extends Object

An Optimizer tries to optimize a given population of individuals to improve their fitness. The concrete optimization technique depends on the subclasses implementation.

Subclasses need to implement this optimization technique inside optimize() and should override getConfiguration() to cast the result to the appropriate OptimizerConfiguration's subtype.

The implementations are generally considered to be not thread-safe and not reusable. Every instance should only be used for one optimization. And if the subclass' instance can be reused, external synchronization should be used to ensure that only one optimization runs on a given instance.

Author:
Christian Kumpe

Constructor Summary
Optimizer(OptimizerConfiguration<I> configuration)
          Creates a new Optimizer object with the given OptimizerConfiguration.
 
Method Summary
protected  OptimizerConfiguration<I> getConfiguration()
          Returns the optimizer's configuration.
protected  org.apache.commons.math.random.RandomGenerator getRandomGenerator()
           
abstract  void optimize()
          Starts the optimization.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Optimizer

public Optimizer(OptimizerConfiguration<I> configuration)
Creates a new Optimizer object with the given OptimizerConfiguration.

The configuration will be cloned and validated.

Parameters:
configuration - the new optimizer's configuration
Throws:
NullPointerException - if configuration is null
IllegalStateException - if the given configuration is not valid
Method Detail

getConfiguration

protected OptimizerConfiguration<I> getConfiguration()
Returns the optimizer's configuration. This configuration should not be modified once the optimizer has been created.

This method can be overridden to cast the OptimizerConfiguration to the appropriate subtype for the concrete optimizer implementation.

Returns:
the optimizer's configuration

getRandomGenerator

protected org.apache.commons.math.random.RandomGenerator getRandomGenerator()

optimize

public abstract void optimize()
Starts the optimization.

Subclasses need to implement this method with a concrete optimization technique.

Throws:
OptimizerException - if a checked exception occurs inside the optimization


Copyright © 2011 Christian Kumpe. All Rights Reserved.