Class RealChromosome
java.lang.Object
org.episteme.natural.computing.ai.evolutionary.RealChromosome
- All Implemented Interfaces:
Comparable<Chromosome<Real>>, Chromosome<Real>
A chromosome representing a candidate solution as an array of Real numbers.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncrossover(Chromosome<Real> other) Creates a new chromosome by crossing over with another.doubleCalculates the fitness of this chromosome.getGenes()Gets the sequence of genes.mutate(double probability) Mutates this chromosome.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Chromosome
compareTo
-
Constructor Details
-
RealChromosome
-
-
Method Details
-
getGenes
Description copied from interface:ChromosomeGets the sequence of genes.- Specified by:
getGenesin interfaceChromosome<Real>- Returns:
- an unmodifiable list of genes
-
getFitness
public double getFitness()Description copied from interface:ChromosomeCalculates the fitness of this chromosome. Higher fitness is better.- Specified by:
getFitnessin interfaceChromosome<Real>- Returns:
- the fitness score
-
crossover
Description copied from interface:ChromosomeCreates a new chromosome by crossing over with another.- Specified by:
crossoverin interfaceChromosome<Real>- Parameters:
other- the partner chromosome- Returns:
- a pair of new chromosomes (offspring)
-
mutate
Description copied from interface:ChromosomeMutates this chromosome.- Specified by:
mutatein interfaceChromosome<Real>- Parameters:
probability- chance of mutation per gene- Returns:
- a new mutated chromosome
-