public abstract class BinaryChromosome extends AbstractListChromosome<Integer>
| Constructor and Description |
|---|
BinaryChromosome(Integer[] representation)
Constructor.
|
BinaryChromosome(List<Integer> representation)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
checkValidity(List<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 List<Integer> |
randomBinaryRepresentation(int length)
Returns a representation of a random binary array of length
length. |
getLength, getRepresentation, newFixedLengthChromosome, toStringcompareTo, findSameChromosome, getFitness, searchForFitnessUpdatepublic BinaryChromosome(List<Integer> representation) throws InvalidRepresentationException
representation - list of {0,1} values representing the chromosomeInvalidRepresentationException - iff the representation can not represent a valid chromosomepublic BinaryChromosome(Integer[] representation) throws InvalidRepresentationException
representation - array of {0,1} values representing the chromosomeInvalidRepresentationException - iff the representation can not represent a valid chromosomeprotected void checkValidity(List<Integer> chromosomeRepresentation) throws InvalidRepresentationException
representation can represent a valid chromosome.checkValidity in class AbstractListChromosome<Integer>chromosomeRepresentation - representation of the chromosomeInvalidRepresentationException - iff the representation can not represent a valid chromosomepublic static List<Integer> randomBinaryRepresentation(int length)
length.length - length of the arraylengthprotected boolean isSame(Chromosome another)
true 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 © 2003–2016 The Apache Software Foundation. All rights reserved.