|
||||||||||
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<T>
T
- type of the representation listpublic abstract class AbstractListChromosome<T>
Chromosome represented by an immutable list of a fixed length.
Constructor Summary | |
---|---|
AbstractListChromosome(List<T> representation)
Constructor. |
|
AbstractListChromosome(T[] representation)
Constructor. |
Method Summary | |
---|---|
protected abstract void |
checkValidity(List<T> chromosomeRepresentation)
Asserts that representation can represent a valid chromosome. |
int |
getLength()
Returns the length of the chromosome. |
protected List<T> |
getRepresentation()
Returns the (immutable) inner representation of the chromosome. |
abstract AbstractListChromosome<T> |
newFixedLengthChromosome(List<T> chromosomeRepresentation)
Creates a new instance of the same class as this is, with a given arrayRepresentation . |
String |
toString()
|
Methods inherited from class org.apache.commons.math3.genetics.Chromosome |
---|
compareTo, findSameChromosome, getFitness, isSame, 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 AbstractListChromosome(List<T> representation) throws InvalidRepresentationException
representation
- inner representation of the chromosome
InvalidRepresentationException
- iff the representation
can not represent a valid chromosomepublic AbstractListChromosome(T[] representation) throws InvalidRepresentationException
representation
- inner representation of the chromosome
InvalidRepresentationException
- iff the representation
can not represent a valid chromosomeMethod Detail |
---|
protected abstract void checkValidity(List<T> chromosomeRepresentation) throws InvalidRepresentationException
representation
can represent a valid chromosome.
chromosomeRepresentation
- representation of the chromosome
InvalidRepresentationException
- iff the representation
can not represent a valid chromosomeprotected List<T> getRepresentation()
public int getLength()
public abstract AbstractListChromosome<T> newFixedLengthChromosome(List<T> chromosomeRepresentation)
this
is, with a given arrayRepresentation
.
This is needed in crossover and mutation operators, where we need a new instance of the same class, but with
different array representation.
Usually, this method just calls a constructor of the class.
chromosomeRepresentation
- the inner array representation of the new chromosome.
public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |