T
- type of the representation listpublic abstract class AbstractListChromosome<T> extends Chromosome
Constructor and Description |
---|
AbstractListChromosome(List<T> representationIn)
Constructor.
|
AbstractListChromosome(T[] representationIn)
Constructor.
|
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> representationIn)
representationIn
- inner representation of the chromosomeInvalidRepresentationException
- iff the representation
can not represent a valid chromosomepublic AbstractListChromosome(T[] representationIn)
representationIn
- inner representation of the chromosomeInvalidRepresentationException
- iff the representation
can not represent a valid chromosomeprotected abstract void checkValidity(List<T> chromosomeRepresentation)
representation
can represent a valid chromosome.chromosomeRepresentation
- representation of the chromosomeInvalidRepresentationException
- 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 © 2018 CNES. All Rights Reserved.