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
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
onePointCrossover
(boolean[] parent1, boolean[] parent2) Recombines (cross over) the two parents to generate new offsprings using one-point crossoverstatic void
onePointCrossover
(double[] parent1, double[] parent2) Recombines (cross over) the two parents to generate new offsprings using one-point crossoverstatic <GeneType> void
onePointCrossover
(GeneType[] parent1, GeneType[] parent2) Recombines (cross over) the two parents to generate new offsprings using one-point crossoverstatic 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 index2static 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 index2static <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 index2static void
twoPointCrossover
(boolean[] parent1, boolean[] parent2) Recombines (cross over) the two parents to generate new offsprings using two-point crossoverstatic void
twoPointCrossover
(double[] parent1, double[] parent2) Recombines (cross over) the two parents to generate new offsprings using two-point crossoverstatic <GeneType> void
twoPointCrossover
(GeneType[] parent1, GeneType[] parent2) Recombines (cross over) the two parents to generate new offsprings using two-point crossoverstatic void
uniformCrossover
(boolean[] parent1, boolean[] parent2, double prob) Recombines (cross over) the two parents to generate new offsprings using uniform crossoverstatic void
uniformCrossover
(double[] parent1, double[] parent2, double prob) Recombines (cross over) the two parents to generate new offsprings using uniform crossoverstatic <GeneType> void
uniformCrossover
(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
-