Package org.opt4j.core.genotype
Provides the classes for basic Genotype
s.
The basic Genotype
classes are the following:
BooleanGenotype
- a list of boolean (binary) valuesDoubleGenotype
- a list of double (real) valuesIntegerGenotype
- a list of integer valuesPermutationGenotype
- a permutation of arbitrary objectsCompositeGenotype
- a container for arbitrary genotype objects
Try to stick to the predefined genotype objects. Use the
CompositeGenotype
to assemble complex genotypes.
If you define your own genotype, keep in mind that you also have to define
the corresponding Operator
s.
The DoubleGenotype
and
IntegerGenotype
both can be bounded by an upper
and lower bound for each value. The corresponding bounds classes are the
DoubleBounds
and
IntegerBounds
. These bounds are passed in the
constructor of the DoubleGenotype
or
IntegerGenotype
, respectively.
By default, the BooleanGenotype
, the
DoubleGenotype
, and the
IntegerGenotype
are pure lists. This means, one
has to identify elements by their index. The classes
BooleanMapGenotype
,
DoubleMapGenotype
, and
IntegerMapGenotype
extend the basic genotype
classes by a map functionality. Therefore, a list of the key elements has to
be passed in the constructors. Internally, this list is used for a mapping of
key to indices. Therefore, this list must be in the same order with the same
elements for corresponding genotype instances.
A further extension of the IntegerGenotype
is the
SelectGenotype
and
SelectMapGenotype
. Here, a specific set of
elements is defined such that for each index or key one element is chosen.
Internally, this is implemented as an
IntegerGenotype
such that the elements are encoded
as integer values.
The classes BooleanMapGenotype
,
DoubleMapGenotype
,
IntegerMapGenotype
,
SelectGenotype
, and
SelectMapGenotype
are extended from
BooleanGenotype
,
DoubleGenotype
, and
IntegerGenotype
, respectively. Therefore, the
default operators (in package org.opt4j.operator
) for the simple
Genotype
classes are applied on their
MapGenotype
and
SelectGenotype
classes.
Custom genotypes have to implement the Genotype
interface. If these classes are not extended from existing
Genotype
classes, appropriate operators have to be
implemented (see package org.opt4j.operator
).
The initialization of the genotypes is done in the
Creator
. Each genotype class has an
appropriate init
method to simplify the initialization.
-
Interface Summary Interface Description Bounds<E extends java.lang.Number> ListGenotype<E> MapGenotype<K,V> -
Class Summary Class Description BooleanGenotype TheBooleanGenotype
consists of Boolean values that can be used as aGenotype
.BooleanMapGenotype<K> CompositeGenotype<K,V extends Genotype> DoubleBounds TheDoubleBounds
is an implementation of theBounds
for theDoubleGenotype
that accepts arrays as well as lists as bounds.DoubleGenotype TheDoubleGenotype
consists of double values that can be used as aGenotype
.DoubleMapGenotype<K> IntegerBounds TheIntegerBounds
is an implementation of theBounds
for theIntegerGenotype
that accepts arrays as well as lists for as bounds.IntegerGenotype IntegerMapGenotype<K> PermutationGenotype<E> ThePermutationGenotype
can be used as aGenotype
.SelectGenotype<V> TheSelectGenotype
selects for each index an element from the given list.SelectMapGenotype<K,V> TheSelectMapGenotype
selects for each key an element from a given list.SelectMapGenotype.SelectBounds<O,P>