Small improvement.

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk@1551014 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Thomas Neidhart 2013-12-15 10:56:49 +00:00
parent 721730b00b
commit 05aae985d9
3 changed files with 6 additions and 6 deletions

View File

@ -139,8 +139,8 @@ public class NPointCrossover<T> implements CrossoverPolicy {
final List<T> parent1Rep = first.getRepresentation();
final List<T> parent2Rep = second.getRepresentation();
// and of the children
final List<T> child1Rep = new ArrayList<T>(first.getLength());
final List<T> child2Rep = new ArrayList<T>(second.getLength());
final List<T> child1Rep = new ArrayList<T>(length);
final List<T> child2Rep = new ArrayList<T>(length);
final RandomGenerator random = GeneticAlgorithm.getRandomGenerator();

View File

@ -105,8 +105,8 @@ public class OnePointCrossover<T> implements CrossoverPolicy {
final List<T> parent1Rep = first.getRepresentation();
final List<T> parent2Rep = second.getRepresentation();
// and of the children
final List<T> child1Rep = new ArrayList<T>(first.getLength());
final List<T> child2Rep = new ArrayList<T>(second.getLength());
final List<T> child1Rep = new ArrayList<T>(length);
final List<T> child2Rep = new ArrayList<T>(length);
// select a crossover point at random (0 and length makes no sense)
final int crossoverIndex = 1 + (GeneticAlgorithm.getRandomGenerator().nextInt(length-2));

View File

@ -112,8 +112,8 @@ public class UniformCrossover<T> implements CrossoverPolicy {
final List<T> parent1Rep = first.getRepresentation();
final List<T> parent2Rep = second.getRepresentation();
// and of the children
final List<T> child1Rep = new ArrayList<T>(first.getLength());
final List<T> child2Rep = new ArrayList<T>(second.getLength());
final List<T> child1Rep = new ArrayList<T>(length);
final List<T> child2Rep = new ArrayList<T>(length);
final RandomGenerator random = GeneticAlgorithm.getRandomGenerator();