Package org.apache.commons.math.genetics
Class BinaryChromosome
java.lang.Object
org.apache.commons.math.genetics.Chromosome
org.apache.commons.math.genetics.AbstractListChromosome<Integer>
org.apache.commons.math.genetics.BinaryChromosome
- All Implemented Interfaces:
Comparable<Chromosome>,Fitness
Chromosome represented by a vector of 0s and 1s.
- Since:
- 2.0
-
Constructor Summary
ConstructorsConstructorDescriptionBinaryChromosome(Integer[] representation) Constructor.BinaryChromosome(List<Integer> representation) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionrandomBinaryRepresentation(int length) Returns a representation of a random binary array of lengthlength.Methods inherited from class org.apache.commons.math.genetics.AbstractListChromosome
getLength, newFixedLengthChromosome, toStringMethods inherited from class org.apache.commons.math.genetics.Chromosome
compareTo, getFitness, searchForFitnessUpdate
-
Constructor Details
-
BinaryChromosome
Constructor.- Parameters:
representation- list of {0,1} values representing the chromosome
-
BinaryChromosome
Constructor.- Parameters:
representation- array of {0,1} values representing the chromosome
-
-
Method Details
-
randomBinaryRepresentation
Returns a representation of a random binary array of lengthlength.- Parameters:
length- length of the array- Returns:
- a random binary array of length
length
-