Changeset 17533 for branches/2521_ProblemRefactoring/HeuristicLab.Problems.Orienteering/3.3/OrienteeringProblem.cs
- Timestamp:
- 05/08/20 16:55:51 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2521_ProblemRefactoring/HeuristicLab.Problems.Orienteering/3.3/OrienteeringProblem.cs
r17529 r17533 96 96 } 97 97 public static double CalculateTravelCosts(IOrienteeringProblemData data, IntegerVector solution) { 98 var distance = data. RoutingData.GetPathDistance(solution, closed: false);98 var distance = data.GetPathDistance(solution, closed: false); 99 99 distance += (solution.Length - 2) * data.PointVisitingCosts; 100 100 return distance; 101 101 } 102 102 public static double CalculateTravelCosts(IOrienteeringProblemData data, IList<int> solution) { 103 var distance = data. RoutingData.GetPathDistance(solution, closed: false);103 var distance = data.GetPathDistance(solution, closed: false); 104 104 distance += (solution.Count - 2) * data.PointVisitingCosts; 105 105 return distance; … … 127 127 } 128 128 public static double CalculateInsertionCosts(IOrienteeringProblemData data, IList<int> path, int insertPosition, int point) { 129 double detour = data. RoutingData.GetDistance(path[insertPosition - 1], point) + data.RoutingData.GetDistance(point, path[insertPosition]);129 double detour = data.GetDistance(path[insertPosition - 1], point) + data.GetDistance(point, path[insertPosition]); 130 130 detour += data.PointVisitingCosts; 131 detour -= data. RoutingData.GetDistance(path[insertPosition - 1], path[insertPosition]);131 detour -= data.GetDistance(path[insertPosition - 1], path[insertPosition]); 132 132 return detour; 133 133 } 134 134 public static double CalculateReplacementCosts(IOrienteeringProblemData data, IList<int> path, int replacePosition, int point) { 135 double detour = data. RoutingData.GetDistance(path[replacePosition - 1], point) + data.RoutingData.GetDistance(point, path[replacePosition + 1]);136 detour -= data. RoutingData.GetDistance(path[replacePosition - 1], path[replacePosition]) + data.RoutingData.GetDistance(path[replacePosition], path[replacePosition + 1]);135 double detour = data.GetDistance(path[replacePosition - 1], point) + data.GetDistance(point, path[replacePosition + 1]); 136 detour -= data.GetDistance(path[replacePosition - 1], path[replacePosition]) + data.GetDistance(path[replacePosition], path[replacePosition + 1]); 137 137 return detour; 138 138 } 139 139 public static double CalculateRemovementSaving(IOrienteeringProblemData data, IList<int> path, int removePosition) { 140 double saving = data. RoutingData.GetDistance(path[removePosition - 1], path[removePosition]);141 saving += data. RoutingData.GetDistance(path[removePosition], path[removePosition + 1]);142 saving -= data. RoutingData.GetDistance(path[removePosition - 1], path[removePosition + 1]);140 double saving = data.GetDistance(path[removePosition - 1], path[removePosition]); 141 saving += data.GetDistance(path[removePosition], path[removePosition + 1]); 142 saving -= data.GetDistance(path[removePosition - 1], path[removePosition + 1]); 143 143 saving += data.PointVisitingCosts; 144 144 return saving;
Note: See TracChangeset
for help on using the changeset viewer.