public static class HelloWorldExample.StringChromosome extends AbstractListChromosome<Character>
| Constructor and Description |
|---|
StringChromosome(List<Character> repr) |
StringChromosome(String str) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
checkValidity(List<Character> repr)
Asserts that
representation can represent a valid chromosome. |
double |
fitness()
Compute the fitness.
|
List<Character> |
getStringRepresentation() |
HelloWorldExample.StringChromosome |
newFixedLengthChromosome(List<Character> repr)
Creates a new instance of the same class as
this is, with a given arrayRepresentation. |
String |
toString() |
getLength, getRepresentationcompareTo, findSameChromosome, getFitness, isSame, searchForFitnessUpdatepublic StringChromosome(String str)
public double fitness()
Fitnessprotected void checkValidity(List<Character> repr) throws MathIllegalArgumentException
AbstractListChromosomerepresentation can represent a valid chromosome.checkValidity in class AbstractListChromosome<Character>repr - representation of the chromosomeMathIllegalArgumentException - iff the representation can not represent a valid chromosomepublic HelloWorldExample.StringChromosome newFixedLengthChromosome(List<Character> repr)
AbstractListChromosomethis 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.
newFixedLengthChromosome in class AbstractListChromosome<Character>repr - the inner array representation of the new chromosome.public String toString()
AbstractListChromosometoString in class AbstractListChromosome<Character>Copyright © 2016 Hipparchus.org. All rights reserved.