Free cookie consent management tool by TermsFeed Policy Generator

Changeset 6797


Ignore:
Timestamp:
09/19/11 14:30:17 (13 years ago)
Author:
svonolfe
Message:

Improved aspiration criterion for PDP moves (#1177)

Location:
branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Moves/PickupDelivery
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Moves/PickupDelivery/PDExchange/PotvinPDExchangeMoveTabuCriterion.cs

    r6773 r6797  
    2828using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2929using HeuristicLab.Problems.VehicleRouting.Interfaces;
     30using HeuristicLab.Problems.VehicleRouting.Variants;
    3031
    3132namespace HeuristicLab.Problems.VehicleRouting.Encodings.Potvin {
     
    115116        PotvinPDRelocateMoveAttribute attribute = tabuMove as PotvinPDRelocateMoveAttribute;
    116117
    117         if (!useAspiration || moveQuality >= attribute.MoveQuality) {
    118           if ((attribute.City == move.City && attribute.Tour == move.Tour) ||
     118        double distance = 0;
     119        if (MoveDistanceParameter.ActualValue != null)
     120          distance = MoveDistanceParameter.ActualValue.Value;
     121
     122        double overload = 0;
     123        if (MoveOverloadParameter.ActualValue != null)
     124          overload = MoveOverloadParameter.ActualValue.Value;
     125
     126        double tardiness = 0;
     127        if (MoveTardinessParameter.ActualValue != null)
     128          tardiness = MoveTardinessParameter.ActualValue.Value;
     129
     130        IVRPProblemInstance instance = ProblemInstanceParameter.ActualValue;
     131        double quality = attribute.Distance * instance.DistanceFactor.Value;
     132
     133        IHomogenousCapacitatedProblemInstance cvrp = instance as IHomogenousCapacitatedProblemInstance;
     134        if (cvrp != null)
     135          quality += attribute.Overload * cvrp.OverloadPenalty.Value;
     136
     137        ITimeWindowedProblemInstance vrptw = instance as ITimeWindowedProblemInstance;
     138        if (vrptw != null)
     139          quality += attribute.Tardiness * vrptw.TardinessPenalty.Value;
     140
     141        if (!useAspiration || moveQuality >= quality) {
     142          if ((attribute.City == move.City && attribute.Tour == move.Tour) ||
    119143            (attribute.City == move.Replaced && attribute.Tour == move.OldTour)) {
    120144            isTabu = true;
    121145            break;
    122146          }
    123 
    124           double distance = 0;
    125           if (MoveDistanceParameter.ActualValue != null)
    126             distance = MoveDistanceParameter.ActualValue.Value;
    127 
    128           double overload = 0;
    129           if (MoveOverloadParameter.ActualValue != null)
    130             overload = MoveOverloadParameter.ActualValue.Value;
    131 
    132           double tardiness = 0;
    133           if (MoveTardinessParameter.ActualValue != null)
    134             tardiness = MoveTardinessParameter.ActualValue.Value;
    135147
    136148          if (attribute.Distance == distance && attribute.Overload == overload && attribute.Tardiness == tardiness) {
  • branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Moves/PickupDelivery/PDRearrange/PotvinPDRearrangeMoveTabuCriterion.cs

    r6773 r6797  
    2828using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2929using HeuristicLab.Problems.VehicleRouting.Interfaces;
     30using HeuristicLab.Problems.VehicleRouting.Variants;
    3031
    3132namespace HeuristicLab.Problems.VehicleRouting.Encodings.Potvin {
     
    115116        PotvinPDRelocateMoveAttribute attribute = tabuMove as PotvinPDRelocateMoveAttribute;
    116117
    117         if (!useAspiration || moveQuality >= attribute.MoveQuality) {
     118        double distance = 0;
     119        if (MoveDistanceParameter.ActualValue != null)
     120          distance = MoveDistanceParameter.ActualValue.Value;
     121
     122        double overload = 0;
     123        if (MoveOverloadParameter.ActualValue != null)
     124          overload = MoveOverloadParameter.ActualValue.Value;
     125
     126        double tardiness = 0;
     127        if (MoveTardinessParameter.ActualValue != null)
     128          tardiness = MoveTardinessParameter.ActualValue.Value;
     129
     130        IVRPProblemInstance instance = ProblemInstanceParameter.ActualValue;
     131        double quality = attribute.Distance * instance.DistanceFactor.Value;
     132
     133        IHomogenousCapacitatedProblemInstance cvrp = instance as IHomogenousCapacitatedProblemInstance;
     134        if (cvrp != null)
     135          quality += attribute.Overload * cvrp.OverloadPenalty.Value;
     136
     137        ITimeWindowedProblemInstance vrptw = instance as ITimeWindowedProblemInstance;
     138        if (vrptw != null)
     139          quality += attribute.Tardiness * vrptw.TardinessPenalty.Value;
     140
     141        if (!useAspiration || moveQuality >= quality) {
    118142          if (attribute.City == move.City && attribute.Tour == move.Tour) {
    119143            isTabu = true;
    120144            break;
    121145          }
    122 
    123           double distance = 0;
    124           if (MoveDistanceParameter.ActualValue != null)
    125             distance = MoveDistanceParameter.ActualValue.Value;
    126 
    127           double overload = 0;
    128           if (MoveOverloadParameter.ActualValue != null)
    129             overload = MoveOverloadParameter.ActualValue.Value;
    130 
    131           double tardiness = 0;
    132           if (MoveTardinessParameter.ActualValue != null)
    133             tardiness = MoveTardinessParameter.ActualValue.Value;
    134146
    135147          if (attribute.Distance == distance && attribute.Overload == overload && attribute.Tardiness == tardiness) {
  • branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Moves/PickupDelivery/PDShift/PotvinPDShiftMoveTabuCriterion.cs

    r6773 r6797  
    2828using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2929using HeuristicLab.Problems.VehicleRouting.Interfaces;
     30using HeuristicLab.Problems.VehicleRouting.Variants;
    3031
    3132namespace HeuristicLab.Problems.VehicleRouting.Encodings.Potvin {
     
    115116        PotvinPDRelocateMoveAttribute attribute = tabuMove as PotvinPDRelocateMoveAttribute;
    116117
    117         if (!useAspiration || moveQuality >= attribute.MoveQuality) {
     118        double distance = 0;
     119        if (MoveDistanceParameter.ActualValue != null)
     120          distance = MoveDistanceParameter.ActualValue.Value;
     121
     122        double overload = 0;
     123        if (MoveOverloadParameter.ActualValue != null)
     124          overload = MoveOverloadParameter.ActualValue.Value;
     125
     126        double tardiness = 0;
     127        if (MoveTardinessParameter.ActualValue != null)
     128          tardiness = MoveTardinessParameter.ActualValue.Value;
     129
     130        IVRPProblemInstance instance = ProblemInstanceParameter.ActualValue;
     131        double quality = attribute.Distance * instance.DistanceFactor.Value;
     132
     133        IHomogenousCapacitatedProblemInstance cvrp = instance as IHomogenousCapacitatedProblemInstance;
     134        if (cvrp != null)
     135          quality += attribute.Overload * cvrp.OverloadPenalty.Value;
     136
     137        ITimeWindowedProblemInstance vrptw = instance as ITimeWindowedProblemInstance;
     138        if (vrptw != null)
     139          quality += attribute.Tardiness * vrptw.TardinessPenalty.Value;
     140
     141        if (!useAspiration || moveQuality >= quality) {
    118142          if (attribute.City == move.City && attribute.Tour == move.Tour) {
    119143            isTabu = true;
    120144            break;
    121145          }
    122 
    123           double distance = 0;
    124           if (MoveDistanceParameter.ActualValue != null)
    125             distance = MoveDistanceParameter.ActualValue.Value;
    126 
    127           double overload = 0;
    128           if (MoveOverloadParameter.ActualValue != null)
    129             overload = MoveOverloadParameter.ActualValue.Value;
    130 
    131           double tardiness = 0;
    132           if (MoveTardinessParameter.ActualValue != null)
    133             tardiness = MoveTardinessParameter.ActualValue.Value;
    134146
    135147          if (attribute.Distance == distance && attribute.Overload == overload && attribute.Tardiness == tardiness) {
Note: See TracChangeset for help on using the changeset viewer.