return false;
}
});
MutatePerturb opp = new MutatePerturb(0.1);
train.addOperation(1.0, opp);
// Create a peterb operator. Use it 1.0 (100%) of the time.
DoubleArrayGenome[] parents = new DoubleArrayGenome[1];
parents[0] = (DoubleArrayGenome) pop.getGenomeFactory().factor();
parents[0].setPopulation(pop);
for (int i = 1; i <= 5; i++) {
parents[0].getData()[i - 1] = i;
}
// Create an array to hold the offspring.
DoubleArrayGenome[] offspring = new DoubleArrayGenome[1];
offspring[0] = new DoubleArrayGenome(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()));