Class CrossoverOperator

java.lang.Object
unifeat.featureSelection.wrapper.GABasedMethods.CrossoverOperator

public class CrossoverOperator extends Object
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
    Constructor
    Description
     
  • Method Summary

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

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 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
    • 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 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
    • 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 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
    • 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 parent
      parent2 - 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 parent
      parent2 - 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 parent
      parent2 - 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 parent
      parent2 - 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 parent
      parent2 - 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 parent
      parent2 - 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 parent
      parent2 - the second parent
      prob - 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 parent
      parent2 - the second parent
      prob - 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 parent
      parent2 - the second parent
      prob - the probability of crossover operation