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 InvalidRepresentationException
representation
- inner representation of the chromosomeInvalidRepresentationException
- iff the representation
can not represent a valid chromosomepublic AbstractListChromosome(T[] representation) throws InvalidRepresentationException
representation
- inner representation of the chromosomeInvalidRepresentationException
- iff the representation
can not represent a valid chromosomeprotected abstract void checkValidity(List<T> chromosomeRepresentation) throws InvalidRepresentationException
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 © 2003–2016 The Apache Software Foundation. All rights reserved.