|
JGAP | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jgap.BaseGeneticOperator
org.jgap.impl.AveragingCrossoverOperator
public class AveragingCrossoverOperator
The averaging crossover operator randomly selects two Chromosomes from the population and "mates" them by randomly picking a gene and then swapping that gene and all subsequent genes between the two Chromosomes. The two modified Chromosomes are then added to the list of candidate Chromosomes. This operation is performed half as many times as there are Chromosomes in the population. Additionally, the loci of crossing over are cached for each index, i.e., after randomizing the loci for each index once, they don't change again. If you work with CompositeGene's, this operator expects them to contain genes of the same type (e.g. IntegerGene). If you have mixed types, please provide your own crossover operator.
Field Summary |
---|
Fields inherited from class org.jgap.BaseGeneticOperator |
---|
m_monitor, m_monitorActive |
Constructor Summary | |
---|---|
AveragingCrossoverOperator()
Using the same random generator for randomizing the loci for crossing over as for selecting the genes to be crossed over. |
|
AveragingCrossoverOperator(Configuration a_configuration)
Using the same random generator for randomizing the loci for crossing over as for selecting the genes to be crossed over. |
|
AveragingCrossoverOperator(Configuration a_configuration,
IUniversalRateCalculator a_crossoverRateCalculator)
Constructs a new instance of this CrossoverOperator with a specified crossover rate calculator, which results in dynamic crossover being turned on. |
|
AveragingCrossoverOperator(Configuration a_configuration,
RandomGenerator a_generatorForAveraging)
Using a different random generator for randomizing the loci for crossing over than for selecting the genes to be crossed over |
Method Summary | |
---|---|
int |
compareTo(java.lang.Object a_other)
Compares the given object to this one. |
boolean |
equals(java.lang.Object a_other)
Compares this GeneticOperator against the specified object. |
protected int |
getLocus(RandomGenerator a_generator,
int a_index,
int a_max)
Returns the crossover location for a given index. |
void |
operate(Population a_population,
java.util.List a_candidateChromosomes)
Crossover that acts as a perturbed mean of two individuals. |
void |
setCrossoverRate(int a_rate)
|
Methods inherited from class org.jgap.BaseGeneticOperator |
---|
getConfiguration |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AveragingCrossoverOperator() throws InvalidConfigurationException
Attention: The configuration used is the one set with the static method Genotype.setConfiguration.
InvalidConfigurationException
public AveragingCrossoverOperator(Configuration a_configuration) throws InvalidConfigurationException
a_configuration
- the configuration to use
InvalidConfigurationException
public AveragingCrossoverOperator(Configuration a_configuration, RandomGenerator a_generatorForAveraging) throws InvalidConfigurationException
a_configuration
- the configuration to usea_generatorForAveraging
- RandomGenerator to use
InvalidConfigurationException
public AveragingCrossoverOperator(Configuration a_configuration, IUniversalRateCalculator a_crossoverRateCalculator) throws InvalidConfigurationException
a_configuration
- the configuration to usea_crossoverRateCalculator
- calculator for dynamic crossover rate
computation
InvalidConfigurationException
Method Detail |
---|
public void operate(Population a_population, java.util.List a_candidateChromosomes)
a_population
- Chromosome[]a_candidateChromosomes
- Listprotected int getLocus(RandomGenerator a_generator, int a_index, int a_max)
a_generator
- to generate random values the first timea_index
- the index of the crossover operationa_max
- upper boundary for random generator
public boolean equals(java.lang.Object a_other)
equals
in class BaseGeneticOperator
a_other
- the object to compare against
public int compareTo(java.lang.Object a_other)
a_other
- the instance against which to compare this instance
public void setCrossoverRate(int a_rate)
a_rate
- crossover rate to use by this crossover operator
|
JGAP | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |