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:
parent
721730b00b
commit
05aae985d9
|
@ -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();
|
||||
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
Loading…
Reference in New Issue