Changeset 17533 for branches/2521_ProblemRefactoring/HeuristicLab.Problems.Orienteering/3.3/Improvers
- Timestamp:
- 05/08/20 16:55:51 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2521_ProblemRefactoring/HeuristicLab.Problems.Orienteering/3.3/Improvers/OrienteeringLocalImprovementOperator.cs
r17525 r17533 126 126 127 127 // Determine all points that have not yet been visited by this tour 128 var visitablePoints = Enumerable.Range(0, data. RoutingData.Cities).Except(tour).ToList();128 var visitablePoints = Enumerable.Range(0, data.Cities).Except(tour).ToList(); 129 129 130 130 // Determine if any of the visitable points can be included at any position within the tour … … 168 168 double newLength = tourLength; 169 169 // Recalculate length of whole swapped part, in case distances are not symmetric 170 for (int index = position - 1; index < position + blockLength; index++) newLength -= data. RoutingData.GetDistance(tour[index], tour[index + 1]);171 for (int index = position + blockLength - 1; index > position; index--) newLength += data. RoutingData.GetDistance(tour[index], tour[index - 1]);172 newLength += data. RoutingData.GetDistance(tour[position - 1], tour[position + blockLength - 1]);173 newLength += data. RoutingData.GetDistance(tour[position], tour[position + blockLength]);170 for (int index = position - 1; index < position + blockLength; index++) newLength -= data.GetDistance(tour[index], tour[index + 1]); 171 for (int index = position + blockLength - 1; index > position; index--) newLength += data.GetDistance(tour[index], tour[index - 1]); 172 newLength += data.GetDistance(tour[position - 1], tour[position + blockLength - 1]); 173 newLength += data.GetDistance(tour[position], tour[position + blockLength]); 174 174 175 175 if (newLength < tourLength - 0.00001) {
Note: See TracChangeset
for help on using the changeset viewer.