|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.kumpe.hadooptimizer.OptimizerConfiguration<I>
de.kumpe.hadooptimizer.EaOptimizerConfigurationBase<I>
I
- the individuals' typepublic abstract class EaOptimizerConfigurationBase<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:
Halter
to check
if
the evolution cycle has terminated.
Mutator
to mutate
the
children.
Evaluator
to evaluate
the
mutants.
flag
to indicate if the parents
should be merged with the newly created and evaluated individuals of the
current generation.
parents
that will be selected for the
next generation.
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 |
---|
public EaOptimizerConfigurationBase()
Method Detail |
---|
public void injectRandomGenerator(org.apache.commons.math.random.RandomGenerator randomGenerator)
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
.
injectRandomGenerator
in class OptimizerConfiguration<I>
randomGenerator
- the RandomGenerator
instance to injectpublic void validate()
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.
validate
in class OptimizerConfiguration<I>
IllegalStateException
- if this configuration is not validpublic final Halter<I> getHalter()
Halter
; null
if none has been
setpublic final void setHalter(Halter<I> halter)
halter
- the Halter
for this configuration
NullPointerException
- if halter
is null
public final Mutator<I> getMutator()
Mutator
; null
if none has
been setpublic final void setMutator(Mutator<I> mutator)
mutator
- the Mutator
for this configuration
NullPointerException
- if mutator
is null
public final Evaluator<I> getEvaluator()
Evaluator
; null
if none has
been setpublic final void setEvaluator(Evaluator<I> evaluator)
evaluator
- the Evaluator
for this configuration
NullPointerException
- if evaluator
is null
public final int getParents()
setParents(int)
public final void setParents(int parents)
For an E(μ+/,λ)-evolution strategy, this would sets μ.
The default-value is 1
.
parents
- the number of parents
IllegalArgumentException
- if parents
is zero or negativepublic final boolean isPreserveParents()
true
if parents will be preserved in the next
evolution cycle; false
if parents will be discardedpublic final void setPreserveParents(boolean preserveParents)
preserveParents
- true
if parents should be preserved in the next
evolution cycle; false
if parents should be
discardedpublic int hashCode()
hashCode
in class OptimizerConfiguration<I>
public boolean equals(Object obj)
equals
in class OptimizerConfiguration<I>
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |