@@ -0,0 +1,2437 @@
+package org.uma.jmetal.operator.impl.crossover;%0A%0Aimport org.apache.commons.lang3.ArrayUtils;%0Aimport org.uma.jmetal.operator.CrossoverOperator;%0Aimport org.uma.jmetal.solution.Solution;%0Aimport org.uma.jmetal.util.JMetalException;%0Aimport org.uma.jmetal.util.pseudorandom.JMetalRandom;%0A%0Aimport java.util.ArrayList;%0Aimport java.util.List;%0A%0A/**%0A * Created by khb on 23-03-2017.%0A */%0Apublic class NPointCrossover%3CT%3E implements CrossoverOperator%3CSolution%3CT%3E%3E %7B%0A    private final JMetalRandom RNG = JMetalRandom.getInstance();%0A    private final double probability;%0A    private final int crossovers;%0A%0A    public NPointCrossover(double probability, int crossovers) %7B%0A        this.probability = probability;%0A        this.crossovers = crossovers;%0A    %7D%0A%0A    public NPointCrossover(int crossovers)%7B%0A        this.crossovers = crossovers;%0A        this.probability = 1.0;%0A    %7D%0A%0A    @Override%0A    public int getNumberOfParents() %7B%0A        return 2;%0A    %7D%0A%0A    @Override%0A    public List%3CSolution%3CT%3E%3E execute(List%3CSolution%3CT%3E%3E s)%7B%0A        if(getNumberOfParents() != s.size())%7B%0A            throw new JMetalException(%22Point Crossover requires + %22 + getNumberOfParents() + %22 parents, but got %22 + s.size());%0A        %7D%0A        if(RNG.nextDouble() %3C probability) %7B%0A            return doCrossover(s);%0A        %7D else %7B%0A            return s;%0A        %7D%0A    %7D%0A%0A    private List%3CSolution%3CT%3E%3E doCrossover(List%3CSolution%3CT%3E%3E s)%7B%0A        Solution%3CT%3E mom = s.get(0);%0A        Solution%3CT%3E dad = s.get(1);%0A%0A        if (mom.getNumberOfVariables() != dad.getNumberOfVariables())%7B%0A            throw new JMetalException(%22The 2 parents doesn't have the same number of variables%22);%0A        %7D%0A%0A        int%5B%5D crossoverPoints = new int%5Bcrossovers%5D;%0A        for (int i = 0; i %3C crossoverPoints.length; i++) %7B%0A            crossoverPoints%5Bi%5D = RNG.nextInt(0, mom.getNumberOfVariables()-1);%0A        %7D%0A        Solution%3CT%3E girl = mom.copy();%0A        Solution%3CT%3E boy = dad.copy();%0A        boolean swap = false;%0A%0A        for (int i = 0; i %3C mom.getNumberOfVariables(); i++) %7B%0A            if(swap)%7B%0A                boy.setVariableValue(i, mom.getVariableValue(i));%0A                girl.setVariableValue(i,dad.getVariableValue(i));%0A%0A            %7D%0A%0A            if(ArrayUtils.contains(crossoverPoints,i))%7B%0A                swap = !swap;%0A            %7D%0A        %7D%0A        List%3CSolution%3CT%3E%3E result = new ArrayList%3C%3E();%0A        result.add(girl);%0A        result.add(boy);%0A        return result;%0A    %7D%0A%0A%7D%0A%0A

Add initial version of NPointCrossover