de.kumpe.hadooptimizer
Class EaOptimizerConfigurationBase<I>

java.lang.Object
  extended by de.kumpe.hadooptimizer.OptimizerConfiguration<I>
      extended by de.kumpe.hadooptimizer.EaOptimizerConfigurationBase<I>
Type Parameters:
I - the individuals' type
All Implemented Interfaces:
Serializable, Cloneable
Direct Known Subclasses:
EaOptimizerConfiguration, EsOptimizerConfiguration

public abstract class EaOptimizerConfigurationBase<I>
extends OptimizerConfiguration<I>

The base class of configurations for evolutionary algorithms based optimizers.

It contains some of the main components for the evolution cycle of an evolutionary algorithm:

Author:
Christian Kumpe
See Also:
Serialized Form

Constructor Summary
EaOptimizerConfigurationBase()
           
 
Method Summary
 boolean equals(Object obj)
           
 Evaluator<I> getEvaluator()
           
 Halter<I> getHalter()
           
 Mutator<I> getMutator()
           
 int getParents()
           
 int hashCode()
           
 void injectRandomGenerator(org.apache.commons.math.random.RandomGenerator randomGenerator)
          Will inject the given RandomGenerator instance into all contained components which are implementing NeedsRandomGenerator.
 boolean isPreserveParents()
           
 void setEvaluator(Evaluator<I> evaluator)
           
 void setHalter(Halter<I> halter)
           
 void setMutator(Mutator<I> mutator)
           
 void setParents(int parents)
          Sets the number of parents in the evolution cycle.
 void setPreserveParents(boolean preserveParents)
           
 void validate()
          Validates the configuration for completeness and correctness.
 
Methods inherited from class de.kumpe.hadooptimizer.OptimizerConfiguration
clone, deepClone, getPopulationReader, getPopulationWriter, getRandomGeneratorFactory, injectRandomGenerator, setPopulationReader, setPopulationWriter, setRandomGeneratorFactory
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EaOptimizerConfigurationBase

public EaOptimizerConfigurationBase()
Method Detail

injectRandomGenerator

public void injectRandomGenerator(org.apache.commons.math.random.RandomGenerator randomGenerator)
Will inject the given RandomGenerator instance into all contained components which are implementing NeedsRandomGenerator.

Subclasses must override this method, if they contain additional components. Then first call this method from the superclass and then call OptimizerConfiguration.injectRandomGenerator(Object, RandomGenerator) for their additional components.

Calls OptimizerConfiguration.injectRandomGenerator(Object, RandomGenerator) on the given populationReader and populationWriter.

Additionally calls OptimizerConfiguration.injectRandomGenerator(Object, RandomGenerator) on the given halter, mutator and evaluator.

Overrides:
injectRandomGenerator in class OptimizerConfiguration<I>
Parameters:
randomGenerator - the RandomGenerator instance to inject

validate

public void validate()
Validates the configuration for completeness and correctness.

Subclasses have to override this method, then first call this method from the superclass and then do their own additional validation.

Verifies that a populationReader and populationWriter has been set.

Additionally verifies that a halter, mutator and evaluator has been set.

Overrides:
validate in class OptimizerConfiguration<I>
Throws:
IllegalStateException - if this configuration is not valid

getHalter

public final Halter<I> getHalter()
Returns:
the configured Halter; null if none has been set

setHalter

public final void setHalter(Halter<I> halter)
Parameters:
halter - the Halter for this configuration
Throws:
NullPointerException - if halter is null

getMutator

public final Mutator<I> getMutator()
Returns:
the configured Mutator; null if none has been set

setMutator

public final void setMutator(Mutator<I> mutator)
Parameters:
mutator - the Mutator for this configuration
Throws:
NullPointerException - if mutator is null

getEvaluator

public final Evaluator<I> getEvaluator()
Returns:
the configured Evaluator; null if none has been set

setEvaluator

public final void setEvaluator(Evaluator<I> evaluator)
Parameters:
evaluator - the Evaluator for this configuration
Throws:
NullPointerException - if evaluator is null

getParents

public final int getParents()
Returns:
the configured number of parents
See Also:
setParents(int)

setParents

public final void setParents(int parents)
Sets the number of parents in the evolution cycle.

For an E(μ+/,λ)-evolution strategy, this would sets μ.

The default-value is 1.

Parameters:
parents - the number of parents
Throws:
IllegalArgumentException - if parents is zero or negative

isPreserveParents

public final boolean isPreserveParents()
Returns:
true if parents will be preserved in the next evolution cycle; false if parents will be discarded

setPreserveParents

public final void setPreserveParents(boolean preserveParents)
Parameters:
preserveParents - true if parents should be preserved in the next evolution cycle; false if parents should be discarded

hashCode

public int hashCode()
Overrides:
hashCode in class OptimizerConfiguration<I>

equals

public boolean equals(Object obj)
Overrides:
equals in class OptimizerConfiguration<I>


Copyright © 2011 Christian Kumpe. All Rights Reserved.