- Timestamp:
- 03/26/10 00:04:24 (15 years ago)
- Location:
- trunk/sources/HeuristicLab.Problems.TravelingSalesman/3.3/MoveEvaluators
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.TravelingSalesman/3.3/MoveEvaluators/ThreeOpt/TSPThreeOptPathMoveEvaluator.cs
r3209 r3221 58 58 edge3target = permutation[move.Index3]; 59 59 } 60 if (move.Index1 == move.Index3 61 || move.Index2 - move.Index1 >= permutation.Length - 2 62 || move.Index1 == permutation.Length - 1 && move.Index3 == 0 63 || move.Index1 == 0 && move.Index3 == permutation.Length - 1) return 0; 60 64 double moveQuality = 0; 61 65 // remove three edges … … 91 95 } 92 96 if (move.Index1 == move.Index3 93 || move.Index2 - move.Index1 >= permutation.Length - 2) return 0; 97 || move.Index2 - move.Index1 >= permutation.Length - 2 98 || move.Index1 == permutation.Length - 1 && move.Index3 == 0 99 || move.Index1 == 0 && move.Index3 == permutation.Length - 1) return 0; 94 100 double moveQuality = 0; 95 101 // remove three edges -
trunk/sources/HeuristicLab.Problems.TravelingSalesman/3.3/MoveEvaluators/TwoOpt/TSPTwoOptPathMoveEvaluator.cs
r3209 r3221 45 45 46 46 protected override double EvaluateByCoordinates(Permutation permutation, DoubleMatrix coordinates) { 47 TwoOptMove m = TwoOptMoveParameter.ActualValue; 48 int edge1source = permutation.GetCircular(m.Index1 - 1); 49 int edge1target = permutation[m.Index1]; 50 int edge2source = permutation[m.Index2]; 51 int edge2target = permutation.GetCircular(m.Index2 + 1); 47 TwoOptMove move = TwoOptMoveParameter.ActualValue; 48 int edge1source = permutation.GetCircular(move.Index1 - 1); 49 int edge1target = permutation[move.Index1]; 50 int edge2source = permutation[move.Index2]; 51 int edge2target = permutation.GetCircular(move.Index2 + 1); 52 if (move.Index2 - move.Index1 >= permutation.Length - 2) return 0; 52 53 double moveQuality = 0; 53 54 // remove two edges … … 65 66 66 67 protected override double EvaluateByDistanceMatrix(Permutation permutation, DoubleMatrix distanceMatrix) { 67 TwoOptMove m = TwoOptMoveParameter.ActualValue; 68 int edge1source = permutation.GetCircular(m.Index1 - 1); 69 int edge1target = permutation[m.Index1]; 70 int edge2source = permutation[m.Index2]; 71 int edge2target = permutation.GetCircular(m.Index2 + 1); 68 TwoOptMove move = TwoOptMoveParameter.ActualValue; 69 int edge1source = permutation.GetCircular(move.Index1 - 1); 70 int edge1target = permutation[move.Index1]; 71 int edge2source = permutation[move.Index2]; 72 int edge2target = permutation.GetCircular(move.Index2 + 1); 73 if (move.Index2 - move.Index1 >= permutation.Length - 2) return 0; 72 74 double moveQuality = 0; 73 75 // remove two edges
Note: See TracChangeset
for help on using the changeset viewer.