CrossoverModule extends OperatorModule { public void perform() { Individual i1; Individual i2; int length = this.population.size() - this.population.size()%2; for(int i=0;i<length;i=i+2) { alI.clear(); i1 = this.population.get(i); i2 = this.population.get(i+1); alI.add(i1); alI.add(i2); this.op.doOperation(alI); } if(this.population.size()%2!=0) { int i =this.population.size()-1; i1 = this.population.get(i); i2 = this.getRandomNotThis(this.population.get(i)); alI.add(i1); alI.add(i2); this.op.doOperation(alI); } } CrossoverModule(RandomNumberGenerator m, CrossoverOperation xOver); void perform(); Operation getOperation(); void setOperation(Operation op);  }
@Test public void testPerform() { System.out.println("* CrossoverModule: perform"); CrossoverModule instance = new CrossoverModule(rng, new SinglePointCrossover(rng, 0.99)); instance.setPopulation(operands); instance.perform(); }