public abstract class BinaryChromosome extends AbstractListChromosome<java.lang.Integer>
| Constructor and Description |
|---|
BinaryChromosome(java.lang.Integer[] representation)
Constructor.
|
BinaryChromosome(java.util.List<java.lang.Integer> representation)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
checkValidity(java.util.List<java.lang.Integer> chromosomeRepresentation)
Asserts that
representation can represent a valid chromosome. |
protected boolean |
isSame(Chromosome another)
Returns
true iff another has the same representation and therefore the same fitness. |
static java.util.List<java.lang.Integer> |
randomBinaryRepresentation(int length)
Returns a representation of a random binary array of length
length. |
getLength, getRepresentation, newFixedLengthChromosome, toStringcompareTo, findSameChromosome, getFitness, searchForFitnessUpdatepublic BinaryChromosome(java.util.List<java.lang.Integer> representation)
throws InvalidRepresentationException
representation - list of {0,1} values representing the chromosomeInvalidRepresentationException - iff the representation can not represent a valid chromosomepublic BinaryChromosome(java.lang.Integer[] representation)
throws InvalidRepresentationException
representation - array of {0,1} values representing the chromosomeInvalidRepresentationException - iff the representation can not represent a valid chromosomeprotected void checkValidity(java.util.List<java.lang.Integer> chromosomeRepresentation)
throws InvalidRepresentationException
representation can represent a valid chromosome.checkValidity in class AbstractListChromosome<java.lang.Integer>chromosomeRepresentation - representation of the chromosomeInvalidRepresentationException - iff the representation can not represent a valid chromosomepublic static java.util.List<java.lang.Integer> randomBinaryRepresentation(int length)
length.length - length of the arraylengthprotected boolean isSame(Chromosome another)
Chromosometrue iff another has the same representation and therefore the same fitness. By
default, it returns false -- override it in your implementation if you need it.isSame in class Chromosomeanother - chromosome to compareanother is equivalent to this chromosomeCopyright (c) 2003-2015 Apache Software Foundation