Changeset 3233 for trunk/sources/HeuristicLab.Encodings.PermutationEncoding/3.3/Moves/TwoOpt/ExhaustiveInversionMoveGenerator.cs
- Timestamp:
- 03/30/10 14:52:30 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Encodings.PermutationEncoding/3.3/Moves/TwoOpt/ExhaustiveInversionMoveGenerator.cs
r3232 r3233 34 34 InversionMove[] moves = new InversionMove[totalMoves]; 35 35 int count = 0; 36 for (int i = 0; i < length - 1; i++) 37 for (int j = i + 1; j < length; j++) { 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;*/ 41 moves[count++] = new InversionMove(i, j); 36 37 if (permutation.PermutationType == PermutationTypes.RelativeUndirected) { 38 for (int i = 0; i < length - 1; i++) { 39 for (int j = i + 1; j < length; j++) { 40 // doesn't make sense to inverse the whole permutation or the whole but one in case of relative undirected permutations 41 if (j - i >= length - 2) continue; 42 moves[count++] = new InversionMove(i, j); 43 } 42 44 } 45 } else { 46 for (int i = 0; i < length - 1; i++) 47 for (int j = i + 1; j < length; j++) { 48 moves[count++] = new InversionMove(i, j); 49 } 50 } 43 51 return moves; 44 52 }
Note: See TracChangeset
for help on using the changeset viewer.