Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
02/11/17 00:27:04 (7 years ago)
Author:
abeham
Message:

#2731: Added better performing manipulation methods to Permutation and adapted the manipulators to use them

  • Added unit tests
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Encodings.PermutationEncoding/3.3/Manipulators/InversionManipulator.cs

    r14185 r14662  
    6060
    6161    public static void Apply(Permutation permutation, int breakPoint1, int breakPoint2) {
    62       for (int i = 0; i <= (breakPoint2 - breakPoint1) / 2; i++) {  // invert permutation between breakpoints
    63         int temp = permutation[breakPoint1 + i];
    64         permutation[breakPoint1 + i] = permutation[breakPoint2 - i];
    65         permutation[breakPoint2 - i] = temp;
    66       }
     62      permutation.Reverse(breakPoint1, breakPoint2 - breakPoint1 + 1);
    6763    }
    6864
Note: See TracChangeset for help on using the changeset viewer.