@@ -0,0 +1,2889 @@
+//  This program is free software: you can redistribute it and/or modify%0D%0A//  it under the terms of the GNU Lesser General Public License as published by%0D%0A//  the Free Software Foundation, either version 3 of the License, or%0D%0A//  (at your option) any later version.%0D%0A//%0D%0A//  This program is distributed in the hope that it will be useful,%0D%0A//  but WITHOUT ANY WARRANTY; without even the implied warranty of%0D%0A//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the%0D%0A//  GNU Lesser General Public License for more details.%0D%0A//%0D%0A//  You should have received a copy of the GNU Lesser General Public License%0D%0A//  along with this program.  If not, see %3Chttp://www.gnu.org/licenses/%3E.%0D%0A%0D%0Apackage org.uma.jmetal.operator.impl.selection;%0D%0A%0D%0Aimport org.uma.jmetal.operator.SelectionOperator;%0D%0Aimport org.uma.jmetal.solution.Solution;%0D%0Aimport org.uma.jmetal.util.JMetalException;%0D%0Aimport org.uma.jmetal.util.SolutionListUtils;%0D%0Aimport org.uma.jmetal.util.comparator.DominanceComparator;%0D%0Aimport org.uma.jmetal.util.pseudorandom.JMetalRandom;%0D%0A%0D%0Aimport java.util.Comparator;%0D%0Aimport java.util.List;%0D%0A%0D%0A/**%0D%0A * @author Antonio J. Nebro%0D%0A * @version 1.0%0D%0A * %0D%0A * Applies a N-ary tournament selection to return the best solution between N that have been%0D%0A * chosen at random from a solution list.%0D%0A */%0D%0Apublic class NaryTournamentSelection implements SelectionOperator%3CList%3CSolution%3E, Solution%3E %7B%0D%0A  private Comparator%3CSolution%3E comparator;%0D%0A  private JMetalRandom randomGenerator ;%0D%0A  private int numberOfSolutionsToBeReturned ;%0D%0A%0D%0A  /** Constructor */%0D%0A  public NaryTournamentSelection() %7B%0D%0A    this(2, new DominanceComparator()) ;%0D%0A  %7D%0D%0A%0D%0A  /** Constructor */%0D%0A  public NaryTournamentSelection(int numberOfSolutionsToBeReturned, Comparator%3CSolution%3E comparator) %7B%0D%0A    randomGenerator = JMetalRandom.getInstance() ;%0D%0A    this.numberOfSolutionsToBeReturned = numberOfSolutionsToBeReturned ;%0D%0A    this.comparator = comparator ;%0D%0A  %7D%0D%0A%0D%0A  @Override%0D%0A  /** Execute() method */%0D%0A  public Solution execute(List%3CSolution%3E solutionList) %7B%0D%0A    if (null == solutionList) %7B%0D%0A      throw new JMetalException(%22The solution list is null%22) ;%0D%0A    %7D else if (solutionList.size() == 0) %7B%0D%0A      throw new JMetalException(%22The solution list is empty%22) ;%0D%0A    %7D else if (solutionList.size() %3C numberOfSolutionsToBeReturned) %7B%0D%0A      throw new JMetalException(%22The solution list size (%22 + solutionList.size() +%22) is less than %22%0D%0A          + %22the number of requested solutions (%22+numberOfSolutionsToBeReturned+%22)%22) ;%0D%0A    %7D%0D%0A%0D%0A    Solution result ;%0D%0A    if (solutionList.size() == 1) %7B%0D%0A      result = solutionList.get(0) ;%0D%0A    %7D else %7B%0D%0A      List%3CSolution%3E selectedSolutions = SolutionListUtils.selectNRandomDifferentSolutions(%0D%0A          numberOfSolutionsToBeReturned, solutionList) ;%0D%0A      result = SolutionListUtils.findBestSolution(selectedSolutions, comparator) ;%0D%0A    %7D%0D%0A%0D%0A    return result;%0D%0A  %7D%0D%0A%7D%0D%0A

Add class NaryTournamentSolution