| java.lang.Object org.jgap.BaseGeneticOperator org.jgap.impl.CrossoverOperator
CrossoverOperator | public class CrossoverOperator extends BaseGeneticOperator implements Comparable(Code) | | The 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.
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.
This CrossoverOperator supports both fixed and dynamic crossover rates.
A fixed rate is one specified at construction time by the user. This
operation is performed 1/m_crossoverRate as many times as there are
Chromosomes in the population. Another possibility is giving the crossover
rate as a percentage. A dynamic rate is one determined by this class on the
fly if no fixed rate is provided.
author: Neil Rotstan author: Klaus Meffert author: Chris Knowles since: 1.0 |
Constructor Summary | |
public | CrossoverOperator() Constructs a new instance of this CrossoverOperator without a specified
crossover rate, this results in dynamic crossover rate being turned off. | public | CrossoverOperator(Configuration a_configuration) Constructs a new instance of this CrossoverOperator without a specified
crossover rate, this results in dynamic crossover rate being turned off. | public | CrossoverOperator(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. | public | CrossoverOperator(Configuration a_configuration, IUniversalRateCalculator a_crossoverRateCalculator, boolean a_allowFullCrossOver) Constructs a new instance of this CrossoverOperator with a specified
crossover rate calculator, which results in dynamic crossover being turned
on. | public | CrossoverOperator(Configuration a_configuration, int a_desiredCrossoverRate) Constructs a new instance of this CrossoverOperator with the given
crossover rate. | public | CrossoverOperator(Configuration a_configuration, int a_desiredCrossoverRate, boolean a_allowFullCrossOver) Constructs a new instance of this CrossoverOperator with the given
crossover rate. | public | CrossoverOperator(Configuration a_configuration, int a_desiredCrossoverRate, boolean a_allowFullCrossOver, boolean a_xoverNewAge) Constructs a new instance of this CrossoverOperator with the given
crossover rate. | public | CrossoverOperator(Configuration a_configuration, double a_crossoverRatePercentage) Constructs a new instance of this CrossoverOperator with the given
crossover rate. | public | CrossoverOperator(Configuration a_configuration, double a_crossoverRatePercentage, boolean a_allowFullCrossOver) Constructs a new instance of this CrossoverOperator with the given
crossover rate. | public | CrossoverOperator(Configuration a_configuration, double a_crossoverRatePercentage, boolean a_allowFullCrossOver, boolean a_xoverNewAge) Constructs a new instance of this CrossoverOperator with the given
crossover rate. |
CrossoverOperator | public CrossoverOperator() throws InvalidConfigurationException(Code) | | Constructs a new instance of this CrossoverOperator without a specified
crossover rate, this results in dynamic crossover rate being turned off.
This means that the crossover rate will be fixed at populationsize/2.
Attention: The configuration used is the one set with the static method
Genotype.setConfiguration.
throws: InvalidConfigurationException - author: Chris Knowles since: 2.0 |
CrossoverOperator | public CrossoverOperator(Configuration a_configuration) throws InvalidConfigurationException(Code) | | Constructs a new instance of this CrossoverOperator without a specified
crossover rate, this results in dynamic crossover rate being turned off.
This means that the crossover rate will be fixed at populationsize/2.
Parameters: a_configuration - the configuration to use throws: InvalidConfigurationException - author: Klaus Meffert since: 3.0 |
CrossoverOperator | public CrossoverOperator(Configuration a_configuration, IUniversalRateCalculator a_crossoverRateCalculator) throws InvalidConfigurationException(Code) | | Constructs a new instance of this CrossoverOperator with a specified
crossover rate calculator, which results in dynamic crossover being turned
on.
Parameters: a_configuration - the configuration to use Parameters: a_crossoverRateCalculator - calculator for dynamic crossover ratecomputation throws: InvalidConfigurationException - author: Chris Knowles author: Klaus Meffert since: 3.0 (since 2.0 without a_configuration) |
CrossoverOperator | public CrossoverOperator(Configuration a_configuration, IUniversalRateCalculator a_crossoverRateCalculator, boolean a_allowFullCrossOver) throws InvalidConfigurationException(Code) | | Constructs a new instance of this CrossoverOperator with a specified
crossover rate calculator, which results in dynamic crossover being turned
on.
Parameters: a_configuration - the configuration to use Parameters: a_crossoverRateCalculator - calculator for dynamic crossover ratecomputation Parameters: a_allowFullCrossOver - true: x-over before AND after x-over point,false: only x-over after x-over point throws: InvalidConfigurationException - author: Klaus Meffert since: 3.3.2 |
CrossoverOperator | public CrossoverOperator(Configuration a_configuration, int a_desiredCrossoverRate) throws InvalidConfigurationException(Code) | | Constructs a new instance of this CrossoverOperator with the given
crossover rate.
Parameters: a_configuration - the configuration to use Parameters: a_desiredCrossoverRate - the desired rate of crossover throws: InvalidConfigurationException - author: Chris Knowles author: Klaus Meffert since: 3.0 (since 2.0 without a_configuration) |
CrossoverOperator | public CrossoverOperator(Configuration a_configuration, int a_desiredCrossoverRate, boolean a_allowFullCrossOver) throws InvalidConfigurationException(Code) | | Constructs a new instance of this CrossoverOperator with the given
crossover rate. No new chromosomes are x-overed.
Parameters: a_configuration - the configuration to use Parameters: a_desiredCrossoverRate - the desired rate of crossover Parameters: a_allowFullCrossOver - true: x-over before AND after x-over point,false: only x-over after x-over point throws: InvalidConfigurationException - author: Klaus Meffert since: 3.3.2 |
CrossoverOperator | public CrossoverOperator(Configuration a_configuration, int a_desiredCrossoverRate, boolean a_allowFullCrossOver, boolean a_xoverNewAge) throws InvalidConfigurationException(Code) | | Constructs a new instance of this CrossoverOperator with the given
crossover rate.
Parameters: a_configuration - the configuration to use Parameters: a_desiredCrossoverRate - the desired rate of crossover Parameters: a_allowFullCrossOver - true: x-over before AND after x-over point,false: only x-over after x-over point throws: InvalidConfigurationException - Parameters: a_xoverNewAge - true: also x-over chromosomes with age of zero (newlycreated chromosomes) author: Klaus Meffert since: 3.3.2 |
CrossoverOperator | public CrossoverOperator(Configuration a_configuration, double a_crossoverRatePercentage) throws InvalidConfigurationException(Code) | | Constructs a new instance of this CrossoverOperator with the given
crossover rate. No new chromosomes are x-overed.
Parameters: a_configuration - the configuration to use Parameters: a_crossoverRatePercentage - the desired rate of crossover inpercentage of the population throws: InvalidConfigurationException - author: Chris Knowles author: Klaus Meffert since: 3.0 (since 2.0 without a_configuration) |
CrossoverOperator | public CrossoverOperator(Configuration a_configuration, double a_crossoverRatePercentage, boolean a_allowFullCrossOver) throws InvalidConfigurationException(Code) | | Constructs a new instance of this CrossoverOperator with the given
crossover rate. No new chromosomes are x-overed.
Parameters: a_configuration - the configuration to use Parameters: a_crossoverRatePercentage - the desired rate of crossover inpercentage of the population Parameters: a_allowFullCrossOver - true: x-over before AND after x-over point,false: only x-over after x-over point throws: InvalidConfigurationException - author: Klaus Meffert since: 3.3.2. |
CrossoverOperator | public CrossoverOperator(Configuration a_configuration, double a_crossoverRatePercentage, boolean a_allowFullCrossOver, boolean a_xoverNewAge) throws InvalidConfigurationException(Code) | | Constructs a new instance of this CrossoverOperator with the given
crossover rate.
Parameters: a_configuration - the configuration to use Parameters: a_crossoverRatePercentage - the desired rate of crossover inpercentage of the population Parameters: a_allowFullCrossOver - true: x-over before AND after x-over point,false: only x-over after x-over point Parameters: a_xoverNewAge - true: also x-over chromosomes with age of zero (newlycreated chromosomes) throws: InvalidConfigurationException - author: Klaus Meffert since: 3.3.2. |
compareTo | public int compareTo(Object a_other)(Code) | | Compares the given object to this one.
Parameters: a_other - the instance against which to compare this instance a negative number if this instance is "less than" the giveninstance, zero if they are equal to each other, and a positive number ifthis is "greater than" the given instance author: Klaus Meffert since: 2.6 |
getCrossOverRate | public int getCrossOverRate()(Code) | | the crossover rate set author: Klaus Meffert since: 3.3.2 |
getCrossOverRatePercent | public double getCrossOverRatePercent()(Code) | | the crossover rate set author: Klaus Meffert since: 3.3.2 |
init | protected void init()(Code) | | Initializes certain parameters.
author: Klaus Meffert since: 3.3.2 |
isAllowFullCrossOver | public boolean isAllowFullCrossOver()(Code) | | x-over before and after a randomly chosen x-over point author: Klaus Meffert since: 3.3.2 |
isXoverNewAge | public boolean isXoverNewAge()(Code) | | a_xoverNewAge true: also x-over chromosomes with age of zero (newlycreated chromosomes) author: Klaus Meffert since: 3.3.2 |
operate | public void operate(Population a_population, List a_candidateChromosomes)(Code) | | Does the crossing over.
Parameters: a_population - the population of chromosomes from the currentevolution prior to exposure to crossing over Parameters: a_candidateChromosomes - the pool of chromosomes that have beenselected for the next evolved population author: Neil Rotstan author: Klaus Meffert since: 2.0 |
setAllowFullCrossOver | public void setAllowFullCrossOver(boolean a_allowFullXOver)(Code) | | Parameters: a_allowFullXOver - x-over before and after a randomly chosen point author: Klaus Meffert since: 3.3.2 |
setXoverNewAge | public void setXoverNewAge(boolean a_xoverNewAge)(Code) | | Parameters: a_xoverNewAge - true: also x-over chromosomes with age of zero (newlycreated chromosomes) author: Klaus Meffert since: 3.3.2 |
|
|