E
- the type of elementspublic class PermutationGenotype<E> extends java.util.ArrayList<E> implements ListGenotype<E>
The PermutationGenotype
can be used as a Genotype
. The order
of these elements is to be optimized.
Example problem: Select the order of five balls ball1,
ball2, ball3, ball4, ball5
Example usage:
Example instance: [ball5, ball2, ball1, ball3, ball4]PermutationGenotype<Ball> genotype = new PermutationGenotype<Ball>(Arrays.asList(ball1, ball2, ball3, ball4, ball5)); genotype.init(new Random());
Constructor and Description |
---|
PermutationGenotype()
Constructs a
PermutationGenotype . |
PermutationGenotype(java.util.Collection<E> values)
Constructs a
PermutationGenotype . |
Modifier and Type | Method and Description |
---|---|
void |
init(java.util.Random random)
Randomizes this genotype by a random permutation.
|
<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 PermutationGenotype()
PermutationGenotype
.public PermutationGenotype(java.util.Collection<E> values)
PermutationGenotype
.values
- the initial valuespublic <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)
random
- the random number generator