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 Summary
Constructors -
Method Summary
Modifier 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
-
CrossoverOperator
public CrossoverOperator()
-
-
Method Details
-
swap
public 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 arrayindex1- the index of element in the parent1 array that should be changedparent2- the second input arrayindex2- the index of element in the parent2 array that should be changed
-
swap
public 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 arrayindex1- the index of element in the parent1 array that should be changedparent2- the second input arrayindex2- the index of element in the parent2 array that should be changed
-
swap
public 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 arrayindex1- the index of element in the parent1 array that should be changedparent2- the second input arrayindex2- the index of element in the parent2 array that should be changed
-
onePointCrossover
public 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 parentparent2- the second parent
-
onePointCrossover
public 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 parentparent2- the second parent
-
onePointCrossover
public 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 parentparent2- the second parent
-
twoPointCrossover
public 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 parentparent2- the second parent
-
twoPointCrossover
public 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 parentparent2- the second parent
-
twoPointCrossover
public 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 parentparent2- the second parent
-
uniformCrossover
public 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 parentparent2- the second parentprob- the probability of crossover operation
-
uniformCrossover
public 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 parentparent2- the second parentprob- the probability of crossover operation
-
uniformCrossover
public 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 parentparent2- the second parentprob- the probability of crossover operation
-