Changeset 3221 for trunk/sources/HeuristicLab.Encodings.PermutationEncoding/3.3/Moves/TwoOpt/ExhaustiveTwoOptMoveGenerator.cs
- Timestamp:
- 03/26/10 00:04:24 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Encodings.PermutationEncoding/3.3/Moves/TwoOpt/ExhaustiveTwoOptMoveGenerator.cs
r3098 r3221 26 26 27 27 namespace 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.")] 29 29 [StorableClass] 30 30 public class ExhaustiveTwoOptMoveGenerator : TwoOptMoveGenerator, IExhaustiveMoveGenerator { 31 31 public static TwoOptMove[] Apply(Permutation permutation) { 32 32 int length = permutation.Length; 33 int totalMoves = (length) * (length - 1) / 2 - 3;33 int totalMoves = (length) * (length - 1) / 2; // - 3; 34 34 TwoOptMove[] moves = new TwoOptMove[totalMoves]; 35 35 int count = 0; … … 37 37 for (int j = i + 1; j < length; j++) { 38 38 // 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;*/ 41 41 moves[count++] = new TwoOptMove(i, j); 42 42 }
Note: See TracChangeset
for help on using the changeset viewer.