See: Description
Interface | Description |
---|---|
Alterer<G extends Gene<?,G>,C extends Comparable<? super C>> |
The Alterer is responsible for the changing/recombining the Population.
|
BoundedChromosome<A extends Comparable<? super A>,G extends BoundedGene<A,G>> |
Chromosome interface for
BoundedGene s. |
BoundedGene<A extends Comparable<? super A>,G extends BoundedGene<A,G>> |
Base interface for genes where the alleles are bound by a minimum and a
maximum value.
|
Chromosome<G extends Gene<?,G>> |
A chromosome consists of one or more genes.
|
Gene<A,G extends Gene<A,G>> |
Genes are the atoms of the Jenetics library.
|
NumericChromosome<N extends Number & Comparable<? super N>,G extends NumericGene<N,G>> |
Numeric chromosome interface.
|
NumericGene<N extends Number & Comparable<? super N>,G extends NumericGene<N,G>> |
Base interface for numeric genes.
|
Selector<G extends Gene<?,G>,C extends Comparable<? super C>> |
Selectors are responsible for selecting a given number of individuals from
the population.
|
Class | Description |
---|---|
AbstractAlterer<G extends Gene<?,G>,C extends Comparable<? super C>> |
Abstract implementation of the alterer interface.
|
AbstractChromosome<G extends Gene<?,G>> |
The abstract base implementation of the Chromosome interface.
|
AltererResult<G extends Gene<?,G>,C extends Comparable<? super C>> |
Represents the result pair of a
Alterer.alter(Seq, long) call, which
consists of the altered population and the number of altered individuals. |
AnyChromosome<A> |
Chromosome implementation, which allows to create genes without
explicit implementing the Chromosome interface. |
AnyGene<A> |
Gene implementation, which allows to create genes without explicit
implementing the Gene interface. |
BitChromosome |
Implementation of the classical BitChromosome.
|
BoltzmannSelector<G extends Gene<?,G>,N extends Number & Comparable<? super N>> |
In this
Selector , the probability for selection is defined as. |
CharacterChromosome |
CharacterChromosome which represents character sequences.
|
CharacterGene |
Character gene implementation.
|
Crossover<G extends Gene<?,G>,C extends Comparable<? super C>> |
Performs a
Crossover of two
Chromosome . |
DoubleChromosome |
Numeric chromosome implementation which holds 64 bit floating point numbers.
|
DoubleGene |
Implementation of the NumericGene which holds a 64 bit floating point number.
|
EliteSelector<G extends Gene<?,G>,C extends Comparable<? super C>> |
The
EliteSelector copies a small proportion of the fittest candidates,
without changes, into the next generation. |
EnumGene<A> |
Gene which holds enumerable (countable) genes.
|
ExponentialRankSelector<G extends Gene<?,G>,C extends Comparable<? super C>> |
An alternative to the "weak"
LinearRankSelector is to assign
survival probabilities to the sorted individuals using an exponential
function. |
GaussianMutator<G extends NumericGene<?,G>,C extends Comparable<? super C>> |
The GaussianMutator class performs the mutation of a
NumericGene . |
Genotype<G extends Gene<?,G>> |
The central class the GA is working with, is the
Genotype . |
IntegerChromosome |
Numeric chromosome implementation which holds 32 bit integer numbers.
|
IntegerGene |
NumericGene implementation which holds a 32 bit integer number.
|
IntermediateCrossover<G extends NumericGene<?,G>,C extends Comparable<? super C>> |
This alterer takes two chromosome (treating it as vectors) and creates a
linear combination of this vectors as result.
|
LinearRankSelector<G extends Gene<?,G>,C extends Comparable<? super C>> |
In linear-ranking selection the individuals are sorted according to their
fitness values.
|
LineCrossover<G extends NumericGene<?,G>,C extends Comparable<? super C>> |
This alterer takes two chromosome (treating it as vectors) and creates a
linear combination of this vectors as result.
|
LongChromosome |
Numeric chromosome implementation which holds 64 bit integer numbers.
|
LongGene |
NumericGene implementation which holds a 64 bit integer number.
|
MeanAlterer<G extends Gene<?,G> & Mean<G>,C extends Comparable<? super C>> |
The order (
Recombinator.getOrder() ) of this Recombination implementation is two. |
MonteCarloSelector<G extends Gene<?,G>,C extends Comparable<? super C>> |
The Monte Carlo selector selects the individuals from a given population
randomly.
|
MultiPointCrossover<G extends Gene<?,G>,C extends Comparable<? super C>> |
Multiple point crossover
|
Mutator<G extends Gene<?,G>,C extends Comparable<? super C>> |
This class is for mutating a chromosomes of an given population.
|
MutatorResult<T> |
Represents the result pair of one of the four
Mutator.mutate calls. |
PartialAlterer<G extends Gene<?,G>,C extends Comparable<? super C>> |
This alterer wraps a given alterer which works on a given section of the
genotype's chromosomes.
|
PartiallyMatchedCrossover<T,C extends Comparable<? super C>> |
The
PartiallyMatchedCrossover (PMX) guarantees that all Gene s
are found exactly once in each chromosome. |
PermutationChromosome<T> |
This chromosome can be used to model permutations of a given (sub) set of
alleles.
|
Phenotype<G extends Gene<?,G>,C extends Comparable<? super C>> |
The
Phenotype consists of a Genotype , the current generation
and an optional fitness value. |
ProbabilitySelector<G extends Gene<?,G>,C extends Comparable<? super C>> |
Probability selectors are a variation of fitness proportional selectors and
selects individuals from a given population based on it's selection
probability P(i).
|
Recombinator<G extends Gene<?,G>,C extends Comparable<? super C>> |
An enhanced genetic algorithm (EGA) combine elements of existing solutions in
order to create a new solution, with some of the properties of each parent.
|
RouletteWheelSelector<G extends Gene<?,G>,N extends Number & Comparable<? super N>> |
The roulette-wheel selector is also known as fitness proportional selector,
but in the Jenetics library it is implemented as probability selector.
|
SinglePointCrossover<G extends Gene<?,G>,C extends Comparable<? super C>> |
Single point crossover
|
StochasticUniversalSelector<G extends Gene<?,G>,N extends Number & Comparable<? super N>> |
StochasticUniversalSelector is a method for selecting a
population according to some given probability in a way that minimize chance
fluctuations. |
SwapMutator<G extends Gene<?,G>,C extends Comparable<? super C>> |
The
SwapMutation changes the order of genes in a chromosome, with the
hope of bringing related genes closer together, thereby facilitating the
production of building blocks. |
TournamentSelector<G extends Gene<?,G>,C extends Comparable<? super C>> |
In tournament selection the best individual from a random sample of s
individuals is chosen from the population Pg.
|
TruncationSelector<G extends Gene<?,G>,C extends Comparable<? super C>> |
In truncation selection individuals are sorted according to their fitness.
|
UniformCrossover<G extends Gene<?,G>,C extends Comparable<? super C>> |
The uniform crossover uses swaps single genes between two chromosomes, instead
of whole ranges as in single- and multi-point crossover.
|
Enum | Description |
---|---|
BitGene |
Implementation of a BitGene.
|
Optimize |
This
enum determines whether the GA should maximize or minimize the
fitness function. |
Jenetics is an Genetic Algorithm, respectively an Evolutionary Algorithm, library written in Java. It is designed with a clear separation of the several concepts of the algorithm, e. g. Gene, Chromosome, Genotype, Phenotype, Population and fitness Function. Jenetics allows you to minimize and maximize the given fitness function without tweaking it. In contrast to other GA implementations, the library uses the concept of an evolution stream (EvolutionStream) for executing the evolution steps. Since the EvolutionStream implements the Java Stream interface, it works smoothly with the rest of the Java streaming API.
The minimum evolution Engine setup needs a genotype factory, Factory<Genotype<?>>, and a fitness Function. The Genotype implements the Factory interface and can therefore be used as prototype for creating the initial Population and for creating new random Genotypes.
import io.jenetics.BitChromosome;
import io.jenetics.BitGene;
import io.jenetics.Genotype;
import io.jenetics.engine.Engine;
import io.jenetics.engine.EvolutionResult;
import io.jenetics.util.Factory;
public class HelloWorld {
// 2.) Definition of the fitness function.
private static Integer eval(Genotype<BitGene> gt) {
return ((BitChromosome)gt.getChromosome()).bitCount();
}
public static void main(String[] args) {
// 1.) Define the genotype (factory) suitable
// for the problem.
Factory<Genotype<BitGene>> gtf =
Genotype.of(BitChromosome.of(10, 0.5));
// 3.) Create the execution environment.
Engine<BitGene, Integer> engine = Engine
.builder(HelloWorld::eval, gtf)
.build();
// 4.) Start the execution (evolution) and
// collect the result.
Genotype<BitGene> result = engine.stream()
.limit(100)
.collect(EvolutionResult.toBestGenotype());
System.out.println("Hello World:\n" + result);
}
}
In contrast to other GA implementations, the library uses the concept of an evolution stream (EvolutionStream) for executing the evolution steps. Since the EvolutionStream implements the Java Stream interface, it works smoothly with the rest of the Java streaming API. Now let's have a closer look at listing above and discuss this simple program step by step:
© 2007-2019 Franz Wilhelmstötter (2019-06-23 15:39)