public class DoubleGenotype extends java.util.ArrayList<java.lang.Double> implements ListGenotype<java.lang.Double>
The DoubleGenotype consists of double values that can be used as a
Genotype.
Example problem: Select filling level of five bottles
Example usage:
Example instance: [0.5035947840006195, 0.9693492473483428, 0.12786372316728167, 0.5299369900029843, 0.8055193291478467]DoubleGenotype<Switch> genotype = new DoubleGenotype(); genotype.init(new Random(), 5);
| Modifier and Type | Field and Description |
|---|---|
protected Bounds<java.lang.Double> |
bounds |
| Constructor and Description |
|---|
DoubleGenotype()
|
DoubleGenotype(Bounds<java.lang.Double> bounds)
Constructs a
DoubleGenotype with the given Bounds. |
DoubleGenotype(double lowerBound,
double upperBound)
Constructs a
DoubleGenotype with a specified lower and upper
bound for all values. |
| Modifier and Type | Method and Description |
|---|---|
double |
getLowerBound(int index)
Returns the lower bound for the
i-th element. |
double |
getUpperBound(int index)
Returns the upper bound for the
i-th element. |
void |
init(java.util.Random random,
int n)
Initialize this genotype with
n random values. |
<G extends Genotype> |
newInstance()
Constructs a new (empty) instance of this
Genotype. |
add, add, addAll, addAll, clear, clone, contains, ensureCapacity, forEach, get, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeIf, removeRange, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArray, trimToSizefinalize, getClass, notify, notifyAll, wait, wait, waitadd, add, addAll, addAll, clear, contains, containsAll, equals, get, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArrayprotected final Bounds<java.lang.Double> bounds
public DoubleGenotype()
public DoubleGenotype(double lowerBound,
double upperBound)
DoubleGenotype with a specified lower and upper
bound for all values.lowerBound - the lower boundupperBound - the upper boundpublic DoubleGenotype(Bounds<java.lang.Double> bounds)
DoubleGenotype with the given Bounds.bounds - the boundspublic double getLowerBound(int index)
i-th element.index - the i-th elementi-th elementpublic double getUpperBound(int index)
i-th element.index - the i-th elementi-th elementpublic <G extends Genotype> G newInstance()
GenotypeGenotype.newInstance in interface GenotypeG - the type of genotype for an implicit castpublic void init(java.util.Random random,
int n)
n random values.random - the random number generatorn - the number of elements in the resulting genotype