Class CrossoverOperator
java.lang.Object
unifeat.featureSelection.wrapper.GABasedMethods.CrossoverOperator
This java class is used to implement various crossover operators for
 recombining the two parents to generate new offsprings
 
The methods in this class is contained brief description of the applications.
- Author:
- Sina Tabakhi
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionstatic voidonePointCrossover(boolean[] parent1, boolean[] parent2) Recombines (cross over) the two parents to generate new offsprings using one-point crossoverstatic voidonePointCrossover(double[] parent1, double[] parent2) Recombines (cross over) the two parents to generate new offsprings using one-point crossoverstatic <GeneType> voidonePointCrossover(GeneType[] parent1, GeneType[] parent2) Recombines (cross over) the two parents to generate new offsprings using one-point crossoverstatic voidswap(boolean[] parent1, int index1, boolean[] parent2, int index2) Changes the values of the two elements in the two arrays identified by index1 and index2static voidswap(double[] parent1, int index1, double[] parent2, int index2) Changes the values of the two elements in the two arrays identified by index1 and index2static <GeneType> voidswap(GeneType[] parent1, int index1, GeneType[] parent2, int index2) Changes the values of the two elements in the two arrays identified by index1 and index2static voidtwoPointCrossover(boolean[] parent1, boolean[] parent2) Recombines (cross over) the two parents to generate new offsprings using two-point crossoverstatic voidtwoPointCrossover(double[] parent1, double[] parent2) Recombines (cross over) the two parents to generate new offsprings using two-point crossoverstatic <GeneType> voidtwoPointCrossover(GeneType[] parent1, GeneType[] parent2) Recombines (cross over) the two parents to generate new offsprings using two-point crossoverstatic voiduniformCrossover(boolean[] parent1, boolean[] parent2, double prob) Recombines (cross over) the two parents to generate new offsprings using uniform crossoverstatic voiduniformCrossover(double[] parent1, double[] parent2, double prob) Recombines (cross over) the two parents to generate new offsprings using uniform crossoverstatic <GeneType> voiduniformCrossover(GeneType[] parent1, GeneType[] parent2, double prob) Recombines (cross over) the two parents to generate new offsprings using uniform crossover
- 
Constructor Details- 
CrossoverOperatorpublic CrossoverOperator()
 
- 
- 
Method Details- 
swappublic static <GeneType> void swap(GeneType[] parent1, int index1, GeneType[] parent2, int index2) Changes the values of the two elements in the two arrays identified by index1 and index2- Type Parameters:
- GeneType- the type of elements in the input arrays
- Parameters:
- parent1- the first input array
- index1- the index of element in the parent1 array that should be changed
- parent2- the second input array
- index2- the index of element in the parent2 array that should be changed
 
- 
swappublic static void swap(boolean[] parent1, int index1, boolean[] parent2, int index2) Changes the values of the two elements in the two arrays identified by index1 and index2- Parameters:
- parent1- the first input array
- index1- the index of element in the parent1 array that should be changed
- parent2- the second input array
- index2- the index of element in the parent2 array that should be changed
 
- 
swappublic static void swap(double[] parent1, int index1, double[] parent2, int index2) Changes the values of the two elements in the two arrays identified by index1 and index2- Parameters:
- parent1- the first input array
- index1- the index of element in the parent1 array that should be changed
- parent2- the second input array
- index2- the index of element in the parent2 array that should be changed
 
- 
onePointCrossoverpublic static <GeneType> void onePointCrossover(GeneType[] parent1, GeneType[] parent2) Recombines (cross over) the two parents to generate new offsprings using one-point crossover- Type Parameters:
- GeneType- the type of elements in the input arrays
- Parameters:
- parent1- the first parent
- parent2- the second parent
 
- 
onePointCrossoverpublic static void onePointCrossover(boolean[] parent1, boolean[] parent2) Recombines (cross over) the two parents to generate new offsprings using one-point crossover- Parameters:
- parent1- the first parent
- parent2- the second parent
 
- 
onePointCrossoverpublic static void onePointCrossover(double[] parent1, double[] parent2) Recombines (cross over) the two parents to generate new offsprings using one-point crossover- Parameters:
- parent1- the first parent
- parent2- the second parent
 
- 
twoPointCrossoverpublic static <GeneType> void twoPointCrossover(GeneType[] parent1, GeneType[] parent2) Recombines (cross over) the two parents to generate new offsprings using two-point crossover- Type Parameters:
- GeneType- the type of elements in the input arrays
- Parameters:
- parent1- the first parent
- parent2- the second parent
 
- 
twoPointCrossoverpublic static void twoPointCrossover(boolean[] parent1, boolean[] parent2) Recombines (cross over) the two parents to generate new offsprings using two-point crossover- Parameters:
- parent1- the first parent
- parent2- the second parent
 
- 
twoPointCrossoverpublic static void twoPointCrossover(double[] parent1, double[] parent2) Recombines (cross over) the two parents to generate new offsprings using two-point crossover- Parameters:
- parent1- the first parent
- parent2- the second parent
 
- 
uniformCrossoverpublic static <GeneType> void uniformCrossover(GeneType[] parent1, GeneType[] parent2, double prob) Recombines (cross over) the two parents to generate new offsprings using uniform crossover- Type Parameters:
- GeneType- the type of elements in the input arrays
- Parameters:
- parent1- the first parent
- parent2- the second parent
- prob- the probability of crossover operation
 
- 
uniformCrossoverpublic static void uniformCrossover(boolean[] parent1, boolean[] parent2, double prob) Recombines (cross over) the two parents to generate new offsprings using uniform crossover- Parameters:
- parent1- the first parent
- parent2- the second parent
- prob- the probability of crossover operation
 
- 
uniformCrossoverpublic static void uniformCrossover(double[] parent1, double[] parent2, double prob) Recombines (cross over) the two parents to generate new offsprings using uniform crossover- Parameters:
- parent1- the first parent
- parent2- the second parent
- prob- the probability of crossover operation
 
 
-