|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.commons.math3.genetics.Chromosome org.apache.commons.math3.genetics.AbstractListChromosome<Integer> org.apache.commons.math3.genetics.BinaryChromosome
public abstract class BinaryChromosome
Chromosome represented by a vector of 0s and 1s.
Constructor Summary | |
---|---|
BinaryChromosome(Integer[] representation)
Constructor. |
|
BinaryChromosome(List<Integer> representation)
Constructor. |
Method Summary | |
---|---|
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 . |
Methods inherited from class org.apache.commons.math3.genetics.AbstractListChromosome |
---|
getLength, getRepresentation, newFixedLengthChromosome, toString |
Methods inherited from class org.apache.commons.math3.genetics.Chromosome |
---|
compareTo, findSameChromosome, getFitness, searchForFitnessUpdate |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.apache.commons.math3.genetics.Fitness |
---|
fitness |
Constructor Detail |
---|
public BinaryChromosome(List<Integer> representation) throws InvalidRepresentationException
representation
- list of {0,1} values representing the chromosome
InvalidRepresentationException
- iff the representation
can not represent a valid chromosomepublic BinaryChromosome(Integer[] representation) throws InvalidRepresentationException
representation
- array of {0,1} values representing the chromosome
InvalidRepresentationException
- iff the representation
can not represent a valid chromosomeMethod Detail |
---|
protected void checkValidity(List<Integer> chromosomeRepresentation) throws InvalidRepresentationException
representation
can represent a valid chromosome.
checkValidity
in class AbstractListChromosome<Integer>
chromosomeRepresentation
- representation of the chromosome
InvalidRepresentationException
- iff the representation
can not represent a valid chromosomepublic static List<Integer> randomBinaryRepresentation(int length)
length
.
length
- length of the array
length
protected boolean isSame(Chromosome another)
Chromosome
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 Chromosome
another
- chromosome to compare
another
is equivalent to this chromosome
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |