- Timestamp:
- 04/20/12 15:45:10 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.TravelingSalesman/3.3/MoveEvaluators/TwoOpt/TSPInversionMovePathEvaluator.cs
r7259 r7743 46 46 } 47 47 48 protected override double EvaluateByCoordinates(Permutation permutation, DoubleMatrix coordinates) { 49 InversionMove move = InversionMoveParameter.ActualValue; 48 public static double EvaluateByCoordinates(Permutation permutation, InversionMove move, DoubleMatrix coordinates, TSPInversionMovePathEvaluator evaluator) { 50 49 int edge1source = permutation.GetCircular(move.Index1 - 1); 51 50 int edge1target = permutation[move.Index1]; … … 55 54 double moveQuality = 0; 56 55 // remove two edges 57 moveQuality -= CalculateDistance(coordinates[edge1source, 0], coordinates[edge1source, 1],56 moveQuality -= evaluator.CalculateDistance(coordinates[edge1source, 0], coordinates[edge1source, 1], 58 57 coordinates[edge1target, 0], coordinates[edge1target, 1]); 59 moveQuality -= CalculateDistance(coordinates[edge2source, 0], coordinates[edge2source, 1],58 moveQuality -= evaluator.CalculateDistance(coordinates[edge2source, 0], coordinates[edge2source, 1], 60 59 coordinates[edge2target, 0], coordinates[edge2target, 1]); 61 60 // add two edges 62 moveQuality += CalculateDistance(coordinates[edge1source, 0], coordinates[edge1source, 1],61 moveQuality += evaluator.CalculateDistance(coordinates[edge1source, 0], coordinates[edge1source, 1], 63 62 coordinates[edge2source, 0], coordinates[edge2source, 1]); 64 moveQuality += CalculateDistance(coordinates[edge1target, 0], coordinates[edge1target, 1],63 moveQuality += evaluator.CalculateDistance(coordinates[edge1target, 0], coordinates[edge1target, 1], 65 64 coordinates[edge2target, 0], coordinates[edge2target, 1]); 66 65 return moveQuality; 67 66 } 68 67 69 protected override double EvaluateByDistanceMatrix(Permutation permutation, DistanceMatrix distanceMatrix) { 70 InversionMove move = InversionMoveParameter.ActualValue; 68 public static double EvaluateByDistanceMatrix(Permutation permutation, InversionMove move, DistanceMatrix distanceMatrix) { 71 69 int edge1source = permutation.GetCircular(move.Index1 - 1); 72 70 int edge1target = permutation[move.Index1]; … … 83 81 return moveQuality; 84 82 } 83 84 protected override double EvaluateByCoordinates(Permutation permutation, DoubleMatrix coordinates) { 85 return EvaluateByCoordinates(permutation, InversionMoveParameter.ActualValue, coordinates, this); 86 } 87 88 protected override double EvaluateByDistanceMatrix(Permutation permutation, DistanceMatrix distanceMatrix) { 89 return EvaluateByDistanceMatrix(permutation, InversionMoveParameter.ActualValue, distanceMatrix); 90 } 85 91 } 86 92 }
Note: See TracChangeset
for help on using the changeset viewer.