public void crossover() {

    int j, countCross = 0;

    Sampling samp = new Sampling(popSize);
    int p1 = -1;

    for (j = 0; j < popSize; j++) {

      if (Randomize.Rand() < Parameters.crossoverProbability) {

        if (p1 == -1) {
          p1 = samp.getSample();
        } else {
          int p2 = samp.getSample();
          crossTwoParents(p1, p2, countCross, countCross + 1);
          countCross += 2;
          p1 = -1;
        }
      } else {
        crossOneParent(samp.getSample(), countCross++);
      }
    }

    if (p1 != -1) {
      crossOneParent(p1, countCross++);
    }
  }
  public void TournamentSelectionWOR() {
    int i, j, winner, candidate;

    Sampling samp = new Sampling(popSize);
    for (i = 0; i < popSize; i++) {
      // There can be only one
      winner = samp.getSample();
      for (j = 1; j < tournamentSize; j++) {
        candidate = samp.getSample();
        if (population[candidate].compareToIndividual(
                population[winner], Parameters.optimizationMethod)
            > 0) {
          winner = candidate;
        }
      }
      offspringPopulation[i] = cf.cloneClassifier(population[winner]);
    }
  }