Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/26/10 00:04:24 (14 years ago)
Author:
abeham
Message:

updated permutation moves, fixed 3-opt #889

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Encodings.PermutationEncoding/3.3/Moves/TwoOpt/ExhaustiveTwoOptMoveGenerator.cs

    r3098 r3221  
    2626
    2727namespace HeuristicLab.Encodings.PermutationEncoding {
    28   [Item("ExhaustiveTwoOptMoveGenerator", "Generates all possible 2-opt moves from a given permutation.")]
     28  [Item("ExhaustiveTwoOptMoveGenerator", "Generates all possible 2-opt moves (inversion) from a given permutation.")]
    2929  [StorableClass]
    3030  public class ExhaustiveTwoOptMoveGenerator : TwoOptMoveGenerator, IExhaustiveMoveGenerator {
    3131    public static TwoOptMove[] Apply(Permutation permutation) {
    3232      int length = permutation.Length;
    33       int totalMoves = (length) * (length - 1) / 2 - 3;
     33      int totalMoves = (length) * (length - 1) / 2; // - 3;
    3434      TwoOptMove[] moves = new TwoOptMove[totalMoves];
    3535      int count = 0;
     
    3737        for (int j = i + 1; j < length; j++) {
    3838          // doesn't make sense to inverse the whole permutation or the whole but one
    39           if (i == 0 && j >= length - 2) continue;
    40           else if (i == 1 && j >= length - 1) continue;
     39          /*if (i == 0 && j >= length - 2) continue;
     40          else if (i == 1 && j >= length - 1) continue;*/
    4141          moves[count++] = new TwoOptMove(i, j);
    4242        }
Note: See TracChangeset for help on using the changeset viewer.