Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
09/29/11 15:51:56 (13 years ago)
Author:
svonolfe
Message:

Added support for multi depot CVRP instances (#1177)

Location:
branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/ProblemInstances/SingleDepotVRP
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/ProblemInstances/SingleDepotVRP/CVRP/CVRPEvaluator.cs

    r6838 r6851  
    3838  [Item("CVRPEvaluator", "Represents a single depot CVRP evaluator.")]
    3939  [StorableClass]
    40   public class CVRPEvaluator: SingleDepotVRPEvaluator {
     40  public class CVRPEvaluator: VRPEvaluator {
    4141    public ILookupParameter<DoubleValue> OverloadParameter {
    4242      get { return (ILookupParameter<DoubleValue>)Parameters["Overload"]; }
     
    7979
    8080        //drive there
    81         double currentDistace = instance.GetDistance(start, end);
     81        double currentDistace = instance.GetDistance(start, end, solution);
    8282        distance += currentDistace;
    8383
     
    103103    }
    104104
    105     protected override double GetTourInsertionCosts(IVRPProblemInstance instance, TourInsertionInfo tourInsertionInfo, int index, int customer,
     105    protected override double GetTourInsertionCosts(IVRPProblemInstance instance, IVRPEncoding solution, TourInsertionInfo tourInsertionInfo, int index, int customer,
    106106      out bool feasible) {
    107107      CVRPInsertionInfo insertionInfo = tourInsertionInfo.GetStopInsertionInfo(index) as CVRPInsertionInfo;
     
    113113      double overloadPenalty = cvrp.OverloadPenalty.Value;
    114114
    115       double distance = instance.GetDistance(insertionInfo.Start, insertionInfo.End);
     115      double distance = instance.GetDistance(insertionInfo.Start, insertionInfo.End, solution);
    116116      double newDistance =
    117         instance.GetDistance(insertionInfo.Start, customer) +
    118         instance.GetDistance(customer, insertionInfo.End);
     117        instance.GetDistance(insertionInfo.Start, customer, solution) +
     118        instance.GetDistance(customer, insertionInfo.End, solution);
    119119      costs += instance.DistanceFactor.Value * (newDistance - distance);
    120120
  • branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/ProblemInstances/SingleDepotVRP/CVRP/CVRPTW/CVRPPDTW/CVRPPDTWEvaluator.cs

    r6838 r6851  
    8585
    8686        //drive there
    87         double currentDistace = vrptw.GetDistance(start, end);
     87        double currentDistace = vrptw.GetDistance(start, end, solution);
    8888        time += currentDistace;
    8989        distance += currentDistace;
     
    166166    }
    167167
    168     protected override double GetTourInsertionCosts(IVRPProblemInstance instance, TourInsertionInfo tourInsertionInfo, int index, int customer,
     168    protected override double GetTourInsertionCosts(IVRPProblemInstance instance, IVRPEncoding solution, TourInsertionInfo tourInsertionInfo, int index, int customer,
    169169      out bool feasible) {
    170170      CVRPPDTWInsertionInfo insertionInfo = tourInsertionInfo.GetStopInsertionInfo(index) as CVRPPDTWInsertionInfo;
     
    187187      double pickupPenalty = pdp.PickupViolationPenalty.Value;
    188188
    189       double distance = instance.GetDistance(insertionInfo.Start, insertionInfo.End);
     189      double distance = instance.GetDistance(insertionInfo.Start, insertionInfo.End, solution);
    190190      double newDistance =
    191         instance.GetDistance(insertionInfo.Start, customer) +
    192         instance.GetDistance(customer, insertionInfo.End);
     191        instance.GetDistance(insertionInfo.Start, customer, solution) +
     192        instance.GetDistance(customer, insertionInfo.End, solution);
    193193      costs += instance.DistanceFactor.Value * (newDistance - distance);
    194194
     
    215215      if (index > 0)
    216216        time = (tourInsertionInfo.GetStopInsertionInfo(index - 1) as CVRPTWInsertionInfo).LeaveTime;
    217       time += instance.GetDistance(insertionInfo.Start, customer);
     217      time += instance.GetDistance(insertionInfo.Start, customer, solution);
    218218      if (time > dueTime[customer]) {
    219219        tardiness += time - dueTime[customer];
     
    222222        time += readyTime[customer] - time;
    223223      time += serviceTimes[customer];
    224       time += instance.GetDistance(customer, insertionInfo.End);
     224      time += instance.GetDistance(customer, insertionInfo.End, solution);
    225225
    226226      double additionalTime = time - (tourInsertionInfo.GetStopInsertionInfo(index) as CVRPTWInsertionInfo).ArrivalTime;
  • branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/ProblemInstances/SingleDepotVRP/CVRP/CVRPTW/CVRPTWEvaluator.cs

    r6838 r6851  
    9292
    9393        //drive there
    94         double currentDistace = vrptw.GetDistance(start, end);
     94        double currentDistace = vrptw.GetDistance(start, end, solution);
    9595        time += currentDistace;
    9696        distance += currentDistace;
     
    150150    }
    151151
    152     protected override double GetTourInsertionCosts(IVRPProblemInstance instance, TourInsertionInfo tourInsertionInfo, int index, int customer,
     152    protected override double GetTourInsertionCosts(IVRPProblemInstance instance, IVRPEncoding solution, TourInsertionInfo tourInsertionInfo, int index, int customer,
    153153      out bool feasible) {
    154154      CVRPTWInsertionInfo insertionInfo = tourInsertionInfo.GetStopInsertionInfo(index) as CVRPTWInsertionInfo;
     
    166166      double tardinessPenalty = vrptw.TardinessPenalty.Value;
    167167
    168       double distance = instance.GetDistance(insertionInfo.Start, insertionInfo.End);
     168      double distance = instance.GetDistance(insertionInfo.Start, insertionInfo.End, solution);
    169169      double newDistance =
    170         instance.GetDistance(insertionInfo.Start, customer) +
    171         instance.GetDistance(customer, insertionInfo.End);
     170        instance.GetDistance(insertionInfo.Start, customer, solution) +
     171        instance.GetDistance(customer, insertionInfo.End, solution);
    172172      costs += instance.DistanceFactor.Value * (newDistance - distance);
    173173
     
    186186      if (index > 0)
    187187        time = (tourInsertionInfo.GetStopInsertionInfo(index - 1) as CVRPTWInsertionInfo).LeaveTime;
    188       time += instance.GetDistance(insertionInfo.Start, customer);
     188      time += instance.GetDistance(insertionInfo.Start, customer, solution);
    189189      if (time > dueTime[customer]) {
    190190        tardiness += time - dueTime[customer];
     
    193193        time += readyTime[customer] - time;
    194194      time += serviceTimes[customer];
    195       time += instance.GetDistance(customer, insertionInfo.End);
     195      time += instance.GetDistance(customer, insertionInfo.End, solution);
    196196
    197197      double additionalTime = time - (tourInsertionInfo.GetStopInsertionInfo(index) as CVRPTWInsertionInfo).ArrivalTime;
  • branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/ProblemInstances/SingleDepotVRP/SingleDepotVRPEvaluator.cs

    r6838 r6851  
    5757
    5858        //drive there
    59         double currentDistace = instance.GetDistance(start, end);
     59        double currentDistace = instance.GetDistance(start, end, solution);
    6060        distance += currentDistace;
    6161
     
    7575    }
    7676
    77     protected override double GetTourInsertionCosts(IVRPProblemInstance instance, TourInsertionInfo tourInsertionInfo, int index, int customer,
     77    protected override double GetTourInsertionCosts(IVRPProblemInstance instance, IVRPEncoding solution, TourInsertionInfo tourInsertionInfo, int index, int customer,
    7878      out bool feasible) {
    7979      StopInsertionInfo insertionInfo = tourInsertionInfo.GetStopInsertionInfo(index);
     
    8282      feasible = true;
    8383
    84       double distance = instance.GetDistance(insertionInfo.Start, insertionInfo.End);
     84      double distance = instance.GetDistance(insertionInfo.Start, insertionInfo.End, solution);
    8585      double newDistance =
    86         instance.GetDistance(insertionInfo.Start, customer) +
    87         instance.GetDistance(customer, insertionInfo.End);
     86        instance.GetDistance(insertionInfo.Start, customer, solution) +
     87        instance.GetDistance(customer, insertionInfo.End, solution);
    8888
    8989      costs += instance.DistanceFactor.Value * (newDistance - distance);
Note: See TracChangeset for help on using the changeset viewer.