T
- type of the representation listpublic abstract class AbstractListChromosome<T> extends Chromosome
Constructor and Description |
---|
AbstractListChromosome(List<T> representation)
Constructor, copying the input representation.
|
AbstractListChromosome(List<T> representation,
boolean copyList)
Constructor.
|
AbstractListChromosome(T[] representation)
Constructor, copying the input representation.
|
Modifier and Type | Method and Description |
---|---|
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() |
compareTo, findSameChromosome, getFitness, isSame, searchForFitnessUpdate
public AbstractListChromosome(List<T> representation) throws MathIllegalArgumentException
representation
- inner representation of the chromosomeMathIllegalArgumentException
- iff the representation
can not represent a valid chromosomepublic AbstractListChromosome(T[] representation) throws MathIllegalArgumentException
representation
- inner representation of the chromosomeMathIllegalArgumentException
- iff the representation
can not represent a valid chromosomeprotected abstract void checkValidity(List<T> chromosomeRepresentation) throws MathIllegalArgumentException
representation
can represent a valid chromosome.chromosomeRepresentation
- representation of the chromosomeMathIllegalArgumentException
- 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.Copyright © 2016 Hipparchus.org. All rights reserved.