return false;
}
});
// Create a shuffle operator. Use it 1.0 (100%) of the time.
MutateShuffle opp = new MutateShuffle();
train.addOperation(1.0, opp);
// Create a single parent, the genes are set to 1,2,3,4,5.
IntegerArrayGenome[] parents = new IntegerArrayGenome[1];
parents[0] = (IntegerArrayGenome) pop.getGenomeFactory().factor();
for (int i = 1; i <= 5; i++) {
parents[0].getData()[i - 1] = i;
}
// Create an array to hold the offspring.
IntegerArrayGenome[] offspring = new IntegerArrayGenome[1];
offspring[0] = new IntegerArrayGenome(5);
// Perform the operation
opp.performOperation(rnd, parents, 0, offspring, 0);
// Display the results
System.out.println("Parent: " + Arrays.toString(parents[0].getData()));
System.out.println("Offspring: " + Arrays.toString(offspring[0].getData()));