Changeset 3232 for trunk/sources/HeuristicLab.Encodings.PermutationEncoding/3.3/Moves/TwoOpt/ExhaustiveInversionMoveGenerator.cs
- Timestamp:
- 03/29/10 18:49:55 (15 years ago)
- File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Encodings.PermutationEncoding/3.3/Moves/TwoOpt/ExhaustiveInversionMoveGenerator.cs
r3229 r3232 26 26 27 27 namespace HeuristicLab.Encodings.PermutationEncoding { 28 [Item("Exhaustive TwoOptMoveGenerator", "Generates all possible 2-opt moves (inversion) from a given permutation.")]28 [Item("ExhaustiveInversionMoveGenerator", "Generates all possible inversion moves (2-opt) from a given permutation.")] 29 29 [StorableClass] 30 public class Exhaustive TwoOptMoveGenerator : TwoOptMoveGenerator, IExhaustiveMoveGenerator {31 public static TwoOptMove[] Apply(Permutation permutation) {30 public class ExhaustiveInversionMoveGenerator : InversionMoveGenerator, IExhaustiveMoveGenerator { 31 public static InversionMove[] Apply(Permutation permutation) { 32 32 int length = permutation.Length; 33 33 int totalMoves = (length) * (length - 1) / 2; // - 3; 34 TwoOptMove[] moves = new TwoOptMove[totalMoves];34 InversionMove[] moves = new InversionMove[totalMoves]; 35 35 int count = 0; 36 36 for (int i = 0; i < length - 1; i++) … … 39 39 /*if (i == 0 && j >= length - 2) continue; 40 40 else if (i == 1 && j >= length - 1) continue;*/ 41 moves[count++] = new TwoOptMove(i, j);41 moves[count++] = new InversionMove(i, j); 42 42 } 43 43 return moves; 44 44 } 45 45 46 protected override TwoOptMove[] GenerateMoves(Permutation permutation) {46 protected override InversionMove[] GenerateMoves(Permutation permutation) { 47 47 return Apply(permutation); 48 48 }
Note: See TracChangeset
for help on using the changeset viewer.