Package smile.gap
Interface Chromosome<T extends Chromosome<T>>
- All Superinterfaces:
Comparable<Chromosome<T>>
- All Known Subinterfaces:
LamarckianChromosome<T>
- All Known Implementing Classes:
BitString
Artificial chromosomes in genetic algorithm/programming encoding candidate
solutions to an optimization problem. Note that chromosomes have to
implement Comparable interface to support comparison of their fitness.
-
Method Summary
Modifier and TypeMethodDescriptionT[]
Returns a pair of offsprings by crossovering this one with another one according to the crossover rate, which determines how often will be crossover performed.double
fitness()
Returns the fitness of chromosome.void
mutate()
For genetic algorithms, this method mutates the chromosome randomly.Returns a new random instance.Methods inherited from interface java.lang.Comparable
compareTo
-
Method Details
-
fitness
double fitness()Returns the fitness of chromosome.- Returns:
- the fitness of chromosome.
-
newInstance
T newInstance()Returns a new random instance.- Returns:
- a new random instance.
-
crossover
Returns a pair of offsprings by crossovering this one with another one according to the crossover rate, which determines how often will be crossover performed. If there is no crossover, offspring is exact copy of parents. Various crossover strategies can be employed.- Parameters:
other
- the other parent.- Returns:
- a pair of offsprings.
-
mutate
void mutate()For genetic algorithms, this method mutates the chromosome randomly. The offspring may have no changes since the mutation rate is usually very low. For Lamarckian algorithms, this method actually does the local search such as hill-climbing.
-