public class BooleanGenotype extends java.util.ArrayList<java.lang.Boolean> implements ListGenotype<java.lang.Boolean>
The BooleanGenotype
consists of Boolean values that can be used as a
Genotype
.
Example problem: Select on/off state of five switches
Example usage:
Example instance: [false, true, true, true, true]BooleanGenotype genotype = new BooleanGenotype(); genotype.init(new Random(), 5);
Constructor and Description |
---|
BooleanGenotype()
Constructs a
BooleanGenotype . |
Modifier and Type | Method and Description |
---|---|
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, trimToSize
finalize, getClass, notify, notifyAll, wait, wait, wait
add, 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, toArray
public BooleanGenotype()
BooleanGenotype
.public <G extends Genotype> G newInstance()
Genotype
Genotype
.newInstance
in interface Genotype
G
- 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