Changeset 3221 for trunk/sources/HeuristicLab.Problems.TravelingSalesman/3.3/MoveEvaluators/TwoOpt/TSPTwoOptPathMoveEvaluator.cs
- Timestamp:
- 03/26/10 00:04:24 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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.