Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
05/11/17 14:01:22 (7 years ago)
Author:
abeham
Message:

#2731: merged 14662 to stable

Location:
stable
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • stable

  • stable/HeuristicLab.Encodings.PermutationEncoding

  • stable/HeuristicLab.Encodings.PermutationEncoding/3.3/Manipulators/Swap3Manipulator.cs

    r14186 r14967  
    5757    public static void Apply(IRandom random, Permutation permutation) {
    5858      if (permutation.Length < 3) throw new ArgumentException("Swap3Manipulator: The permutation must be at least of size 3.", "permutation");
    59       int index1, index2, index3, temp;
     59      int index1, index2, index3;
    6060
    6161      do {
     
    6565      } while (index1 == index2 || index2 == index3 || index1 == index3);
    6666
    67       // swap positions 1 and 2
    68       temp = permutation[index1];
    69       permutation[index1] = permutation[index2];
    70       permutation[index2] = temp;
    71       // swap positions 2 and 3
    72       temp = permutation[index2];
    73       permutation[index2] = permutation[index3];
    74       permutation[index3] = temp;
     67      permutation.Swap(index1, index2);
     68      permutation.Swap(index2, index3);
    7569    }
    7670
Note: See TracChangeset for help on using the changeset viewer.