- Timestamp:
- 09/30/11 11:36:05 (13 years ago)
- Location:
- branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/ExtendedPotvin/Creators/PushForwardInsertionCreator.cs
r6851 r6854 182 182 double dueTime = 0; 183 183 if (problemInstance is ITimeWindowedProblemInstance) 184 dueTime = (problemInstance as ITimeWindowedProblemInstance).DueTime[i ];184 dueTime = (problemInstance as ITimeWindowedProblemInstance).DueTime[i + depots - 1]; 185 185 186 186 cost = -alpha * distance + // distance 0 <-> City[i] -
branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Manipulators/PotvinCustomerRelocationManipulator.cs
r6851 r6854 146 146 DoubleArray serviceTimes = vrptw.ServiceTime; 147 147 148 int depot = 0; 149 int depots = 1; 150 151 int tourIndex = individual.GetTourIndex(route1); 152 int vehicle = individual.GetVehicleAssignment(tourIndex); 153 154 if (ProblemInstance is IMultiDepotProblemInstance) { 155 depots = (ProblemInstance as IMultiDepotProblemInstance).Depots.Value; 156 depot = (ProblemInstance as IMultiDepotProblemInstance).VehicleDepotAssignment[vehicle]; 157 } 158 148 159 List<int> timeWindowViolations = new List<int>(); 149 160 double time = 0; 150 161 151 162 for (int i = 0; i < route1.Stops.Count; i++) { 152 int start = 0; 153 if (i > 0) 154 start = route1.Stops[i - 1]; 155 int end = 0; 156 if (i < route1.Stops.Count) 157 end = route1.Stops[i]; 163 int start = route1.Stops[i - 1]; 164 int end = route1.Stops[i]; 158 165 159 166 //drive there … … 161 168 time += currentDistace; 162 169 170 int endIndex = end + depots - 1; 171 163 172 //check if it was serviced on time 164 if (time > dueTime[end ]) {173 if (time > dueTime[endIndex]) { 165 174 timeWindowViolations.Add(end); 166 175 } … … 168 177 //wait 169 178 double currentWaitingTime = 0.0; 170 if (time < readyTime[end ])171 currentWaitingTime = readyTime[end ] - time;179 if (time < readyTime[endIndex]) 180 currentWaitingTime = readyTime[endIndex] - time; 172 181 time += currentWaitingTime; 173 182 174 183 //service 175 double currentServiceTime = serviceTimes[end ];184 double currentServiceTime = serviceTimes[end - 1]; 176 185 time += currentServiceTime; 177 186 }
Note: See TracChangeset
for help on using the changeset viewer.