For example, the random key [0.2, 0.3, 0.8, 0.1] corresponds to the permutation of indices (3,0,1,2). If the original (unpermuted) sequence would be (a,b,c,d), this would mean the sequence (d,a,b,c).
With this representation, common operators like n-point crossover can be used, because any such chromosome represents a valid permutation.
Since the chromosome (and thus its arrayRepresentation) is immutable, the array representation is sorted only once in the constructor.
For details, see:
| Modifier and Type | Field and Description |
|---|---|
| private final List | baseSeqPermutation
Base sequence [0,1,...,n-1], permuted according to the representation (unmodifiable). |
| private final List | sortedRepresentation
Cache of sorted representation (unmodifiable). |
| Access | Constructor and Description |
|---|---|
| public | |
| public |
| Modifier and Type | Method and Description |
|---|---|
| private static List | Returns: list of integers from 0 to l-1length of list to generate l)Helper for constructor. |
| protected void | checkValidity(final List<Double>
representation of the chromosome chromosomeRepresentation)Implements abstract org. Asserts that |
| public static < type of the data S> List | Returns: list representation of the permutation corresponding to the parameterslist of data determining the order data, final Comparator<S> how the data will be compared comparator)Generates a representation of a permutation corresponding to the
|
| public List | decode(final List<T>
the unpermuted (original) sequence of objects sequence)Implements org. Permutes the |
| private static < generic type of the sequence values S> List | Returns: list with the sequence values permuted according to the representationthe unpermuted sequence sequence, List<Double> representation of the permutation ([0,1] vector) representation, final List<Double> sorted sortedRepr)representationDecodes a permutation represented by |
| public static final List | Returns: representation of an identity permutationlength of the permutation l)Generates a representation corresponding to an identity permutation of length l which can be passed to the RandomKey constructor. |
| public static < type of the data S> List | Returns: representation of a permutation corresponding to the permutationoriginalData -> permutedDatathe original, unpermuted data originalData, final List<S> the data, somehow permuted permutedData)Generates a representation of a permutation corresponding to a
permutation which yields |
| protected boolean | Returns: true iff chromosomes encode the same permutationchromosome to compare another)Overrides org. Returns |
| public static final List | Returns: representation of a random permutationlength of the permutation l)Generates a representation corresponding to a random permutation of length l which can be passed to the RandomKey constructor. |
| public String | toString()
Overrides org. Returns a string representation of the object. |
| baseSeqPermutation | back to summary |
|---|---|
| private final List<Integer> baseSeqPermutation Base sequence [0,1,...,n-1], permuted according to the representation (unmodifiable). | |
| sortedRepresentation | back to summary |
|---|---|
| private final List<Double> sortedRepresentation Cache of sorted representation (unmodifiable). | |
| RandomKey | back to summary |
|---|---|
| public RandomKey(final List<Double> representation) throws InvalidRepresentationException Constructor.
| |
| RandomKey | back to summary |
|---|---|
| public RandomKey(final Double[] representation) throws InvalidRepresentationException Constructor.
| |
| baseSequence | back to summary |
|---|---|
| private static List Helper for constructor. Generates a list of natural numbers (0,1,...,l-1). | |
| checkValidity | back to summary |
|---|---|
| protected void checkValidity(final List<Double> chromosomeRepresentation) throws InvalidRepresentationException Implements abstract org. Doc from org. Asserts that
| |
| comparatorPermutation | back to summary |
|---|---|
| public static <S> List Generates a representation of a permutation corresponding to the
| |
| decode | back to summary |
|---|---|
| public List Implements org. Doc from org. Permutes the | |
| decodeGeneric | back to summary |
|---|---|
| private static <S> List Decodes a permutation represented by
| |
| identityPermutation | back to summary |
|---|---|
| public static final List Generates a representation corresponding to an identity permutation of length l which can be passed to the RandomKey constructor. | |
| inducedPermutation | back to summary |
|---|---|
| public static <S> List Generates a representation of a permutation corresponding to a
permutation which yields
| |
| isSame | back to summary |
|---|---|
| protected boolean isSame(final Chromosome another) Overrides org. Returns
| |
| randomPermutation | back to summary |
|---|---|
| public static final List Generates a representation corresponding to a random permutation of length l which can be passed to the RandomKey constructor. | |
| toString | back to summary |
|---|---|
| public String toString() Overrides org. Doc from org. Returns a string representation of the object.
Satisfying this method's contract implies a non-
| |