Changeset 6449 for trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Potvin/PotvinEncoding.cs
- Timestamp:
- 06/20/11 13:36:49 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Potvin/PotvinEncoding.cs
r5445 r6449 69 69 DoubleArray dueTimeArray, 70 70 DoubleArray serviceTimeArray, DoubleArray readyTimeArray, DoubleArray demandArray, DoubleValue capacity, 71 D oubleMatrix coordinates, ILookupParameter<DoubleMatrix> distanceMatrix, BoolValue useDistanceMatrix,71 DistanceMatrix distMatrix, 72 72 int city, int routeToAvoid, out int route, out int place) { 73 73 route = -1; 74 74 place = -1; 75 bool bestFeasible = false; 75 76 double minDetour = 0; 76 77 … … 78 79 if (tour != routeToAvoid) { 79 80 for (int i = 0; i <= Tours[tour].Cities.Count; i++) { 80 double length = Tours[tour].GetLength( coordinates, distanceMatrix, useDistanceMatrix);81 double length = Tours[tour].GetLength(distMatrix); 81 82 82 83 Tours[tour].Cities.Insert(i, city); 83 84 84 if (Tours[tour].Feasible(dueTimeArray, serviceTimeArray, readyTimeArray, demandArray, 85 capacity, coordinates, distanceMatrix, useDistanceMatrix)) { 86 double newLength = Tours[tour].GetLength(coordinates, distanceMatrix, useDistanceMatrix); 85 bool feasible = Tours[tour].Feasible(dueTimeArray, serviceTimeArray, readyTimeArray, demandArray, 86 capacity, distMatrix); 87 87 88 if (!bestFeasible || feasible) { 89 double newLength = Tours[tour].GetLength(distMatrix); 88 90 double detour = newLength - length; 89 91 90 if (route <= 0 || detour < minDetour ) {92 if (route <= 0 || detour < minDetour || (!(bestFeasible && !feasible)) && detour < minDetour || (feasible && !bestFeasible)) { 91 93 route = tour; 92 94 place = i; 93 95 minDetour = detour; 96 97 if (feasible) 98 bestFeasible = true; 94 99 } 95 100 }
Note: See TracChangeset
for help on using the changeset viewer.