Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
09/30/11 13:51:01 (13 years ago)
Author:
svonolfe
Message:

Added support for the multi depot pickup and delivery problem with time windows (#1177)

Location:
branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/ExtendedPotvin/Creators/IterativeInsertionCreator.cs

    r6851 r6856  
    113113
    114114        if (pdp != null) {
    115           stopIdx = result.FindBestInsertionPlace(currentTour, pdp.PickupDeliveryLocation[customers[index]]);
    116           currentTour.Stops.Insert(stopIdx, pdp.PickupDeliveryLocation[customers[index]]);
     115          stopIdx = result.FindBestInsertionPlace(currentTour, pdp.GetPickupDeliveryLocation(customers[index]));
     116          currentTour.Stops.Insert(stopIdx, pdp.GetPickupDeliveryLocation(customers[index]));
    117117        }
    118118
     
    122122            currentTour.Stops.Remove(customers[index]);
    123123            if (pdp != null)
    124               currentTour.Stops.Remove(pdp.PickupDeliveryLocation[customers[index]]);
     124              currentTour.Stops.Remove(pdp.GetPickupDeliveryLocation(customers[index]));
    125125
    126126          if (currentTour.Stops.Count == 0)
     
    131131          currentTour.Stops.Add(customers[index]);
    132132          if (pdp != null) {
    133             currentTour.Stops.Add(pdp.PickupDeliveryLocation[customers[index]]);
     133            currentTour.Stops.Add(pdp.GetPickupDeliveryLocation(customers[index]));
    134134          }
    135135        }
  • branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/ExtendedPotvin/Creators/PushForwardInsertionCreator.cs

    r6854 r6856  
    213213
    214214        if (pdp != null) {
    215           tour.Stops.Add(pdp.PickupDeliveryLocation[unroutedList[0]]);
     215          tour.Stops.Add(pdp.GetPickupDeliveryLocation(unroutedList[0]));
    216216        }
    217217
     
    234234                  bool feasible;
    235235                  cost = tourCost +
    236                     problemInstance.GetInsertionCosts(eval, result, pdp.PickupDeliveryLocation[unroutedList[c]], 0, j, out feasible);
     236                    problemInstance.GetInsertionCosts(eval, result, pdp.GetPickupDeliveryLocation(unroutedList[c]), 0, j, out feasible);
    237237                  if (cost < minimumCost && feasible) {
    238238                    minimumCost = cost;
     
    260260            tour.Stops.Insert(indexOfMinimumCost, unroutedList[indexOfCustomer]);
    261261            if (pdp != null) {
    262               tour.Stops.Insert(indexOfMinimumCost2, pdp.PickupDeliveryLocation[unroutedList[indexOfCustomer]]);
     262              tour.Stops.Insert(indexOfMinimumCost2, pdp.GetPickupDeliveryLocation(unroutedList[indexOfCustomer]));
    263263            }
    264264
     
    275275            tour.Stops.Add(unroutedList[0]);
    276276            if (pdp != null) {
    277               tour.Stops.Add(pdp.PickupDeliveryLocation[unroutedList[0]]);
     277              tour.Stops.Add(pdp.GetPickupDeliveryLocation(unroutedList[0]));
    278278            }
    279279
  • branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Manipulators/PotvinCustomerRelocationManipulator.cs

    r6854 r6856  
    6868          int stop = route1.Stops[i];
    6969          if (ProblemInstance.GetDemand(stop) < 0) {
    70             int source = pdp.PickupDeliveryLocation[stop];
     70            int source = pdp.GetPickupDeliveryLocation(stop);
    7171
    7272            if (!visited.ContainsKey(source))
     
    8181            deliveryViolations[random.Next(deliveryViolations.Count)];
    8282
    83           int source = pdp.PickupDeliveryLocation[selected];
     83          int source = pdp.GetPickupDeliveryLocation(selected);
    8484
    8585          //find route of source
  • branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Moves/PickupDelivery/PDExchange/PotvinPDExchangeExhaustiveMoveGenerator.cs

    r6851 r6856  
    6767                  if (pdp == null || pdp.GetDemand(city2) >= 0) {
    6868                    bool valid = pdp == null ||
    69                       (pdp.PickupDeliveryLocation[city2] != pdp.PickupDeliveryLocation[city1] &&
    70                        pdp.PickupDeliveryLocation[city2] != city1 &&
    71                        pdp.PickupDeliveryLocation[city1] != city2);
     69                      (pdp.GetPickupDeliveryLocation(city2) != pdp.GetPickupDeliveryLocation(city1) &&
     70                       pdp.GetPickupDeliveryLocation(city2) != city1 &&
     71                       pdp.GetPickupDeliveryLocation(city1) != city2);
    7272
    7373                    if (valid) {
  • branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Moves/PickupDelivery/PDExchange/PotvinPDExchangeMoveMaker.cs

    r6773 r6856  
    6868
    6969      if (problemInstance is IPickupAndDeliveryProblemInstance) {
    70         IntArray pickupLocation =
    71           (problemInstance as IPickupAndDeliveryProblemInstance).PickupDeliveryLocation;
     70        IPickupAndDeliveryProblemInstance pdp = problemInstance as IPickupAndDeliveryProblemInstance;
    7271
    73         int location = pickupLocation[move.City];
     72        int location = pdp.GetPickupDeliveryLocation(move.City);
    7473        Tour oldTour2 = solution.Tours.Find(t => t.Stops.Contains(location));
    7574        oldTour2.Stops.Remove(location);
    7675
    77         location = pickupLocation[move.Replaced];
     76        location = pdp.GetPickupDeliveryLocation(move.Replaced);
    7877        oldTour2 = solution.Tours.Find(t => t.Stops.Contains(location));
    7978
     
    8180        tour.Stops.Remove(move.Replaced);
    8281
    83         PotvinPDRearrangeMoveMaker.InsertPair(solution, tour, move.City, pickupLocation[move.City], problemInstance);
    84         PotvinPDRearrangeMoveMaker.InsertPair(solution, oldTour, move.Replaced, pickupLocation[move.Replaced], problemInstance);
     82        PotvinPDRearrangeMoveMaker.InsertPair(solution, tour, move.City, pdp.GetPickupDeliveryLocation(move.City), problemInstance);
     83        PotvinPDRearrangeMoveMaker.InsertPair(solution, oldTour, move.Replaced, pdp.GetPickupDeliveryLocation(move.Replaced), problemInstance);
    8584      } else {
    8685        tour.Stops.Remove(move.Replaced);
  • branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Moves/PickupDelivery/PDExchange/PotvinPDExchangeSingleMoveGenerator.cs

    r6851 r6856  
    8585          if (pdp == null ||
    8686            (pdp.GetDemand(stop) >= 0 &&
    87              pdp.PickupDeliveryLocation[stop] != pdp.PickupDeliveryLocation[city] &&
    88              pdp.PickupDeliveryLocation[stop] != city &&
    89              pdp.PickupDeliveryLocation[city] != stop))
     87            pdp.GetPickupDeliveryLocation(stop) != pdp.GetPickupDeliveryLocation(city) &&
     88            pdp.GetPickupDeliveryLocation(stop) != city &&
     89            pdp.GetPickupDeliveryLocation(city) != stop))
    9090            tourCities.Add(stop);
    9191        }
  • branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Moves/PickupDelivery/PDRearrange/PotvinPDRearrangeMoveMaker.cs

    r6851 r6856  
    9797      IPickupAndDeliveryProblemInstance pdp = problemInstance as IPickupAndDeliveryProblemInstance;
    9898      if (pdp != null) {
    99         int location = pdp.PickupDeliveryLocation[move.City];
     99        int location = pdp.GetPickupDeliveryLocation(move.City);
    100100        Tour tour2 = solution.Tours.Find(t => t.Stops.Contains(location));
    101101        int position2 = tour2.Stops.IndexOf(location);
  • branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Moves/PickupDelivery/PDShift/PotvinPDShiftMoveMaker.cs

    r6773 r6856  
    6868
    6969      if (problemInstance is IPickupAndDeliveryProblemInstance) {
    70         IntArray pickupLocation =
    71           (problemInstance as IPickupAndDeliveryProblemInstance).PickupDeliveryLocation;
    72 
    73         int location = pickupLocation[move.City];
     70        IPickupAndDeliveryProblemInstance pdp = problemInstance as IPickupAndDeliveryProblemInstance;
     71       
     72        int location = pdp.GetPickupDeliveryLocation(move.City);
    7473        Tour oldTour2 = solution.Tours.Find(t => t.Stops.Contains(location));
    7574        oldTour2.Stops.Remove(location);
    7675
    77         PotvinPDRearrangeMoveMaker.InsertPair(solution, tour, move.City, pickupLocation[move.City], problemInstance);
     76        PotvinPDRearrangeMoveMaker.InsertPair(solution, tour, move.City, location, problemInstance);
    7877      } else {
    7978        int place = solution.FindBestInsertionPlace(tour, move.City);
Note: See TracChangeset for help on using the changeset viewer.