Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
09/30/11 15:23:48 (13 years ago)
Author:
svonolfe
Message:

Added vehicle assignment manipulator and move for multi depot instances (#1177)

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

Legend:

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

    r6856 r6857  
    9898      PotvinEncoding newSolution = move.Individual.Clone() as PotvinEncoding;
    9999      Apply(newSolution, move, ProblemInstance);
     100      newSolution.Repair();
    100101      VRPToursParameter.ActualValue = newSolution;
    101 
    102       //reset move quality
    103       VRPEvaluation eval = ProblemInstance.Evaluate(newSolution);
    104       MoveQualityParameter.ActualValue.Value = eval.Quality;
    105102    }
    106103  }
  • branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Moves/PickupDelivery/PDExchange/PotvinPDExchangeMoveTabuCriterion.cs

    r6797 r6857  
    116116        PotvinPDRelocateMoveAttribute attribute = tabuMove as PotvinPDRelocateMoveAttribute;
    117117
    118         double distance = 0;
    119         if (MoveDistanceParameter.ActualValue != null)
    120           distance = MoveDistanceParameter.ActualValue.Value;
     118        if (attribute != null) {
     119          double distance = 0;
     120          if (MoveDistanceParameter.ActualValue != null)
     121            distance = MoveDistanceParameter.ActualValue.Value;
    121122
    122         double overload = 0;
    123         if (MoveOverloadParameter.ActualValue != null)
    124           overload = MoveOverloadParameter.ActualValue.Value;
     123          double overload = 0;
     124          if (MoveOverloadParameter.ActualValue != null)
     125            overload = MoveOverloadParameter.ActualValue.Value;
    125126
    126         double tardiness = 0;
    127         if (MoveTardinessParameter.ActualValue != null)
    128           tardiness = MoveTardinessParameter.ActualValue.Value;
     127          double tardiness = 0;
     128          if (MoveTardinessParameter.ActualValue != null)
     129            tardiness = MoveTardinessParameter.ActualValue.Value;
    129130
    130         IVRPProblemInstance instance = ProblemInstanceParameter.ActualValue;
    131         double quality = attribute.Distance * instance.DistanceFactor.Value;
     131          IVRPProblemInstance instance = ProblemInstanceParameter.ActualValue;
     132          double quality = attribute.Distance * instance.DistanceFactor.Value;
    132133
    133         IHomogenousCapacitatedProblemInstance cvrp = instance as IHomogenousCapacitatedProblemInstance;
    134         if (cvrp != null)
    135           quality += attribute.Overload * cvrp.OverloadPenalty.Value;
     134          IHomogenousCapacitatedProblemInstance cvrp = instance as IHomogenousCapacitatedProblemInstance;
     135          if (cvrp != null)
     136            quality += attribute.Overload * cvrp.OverloadPenalty.Value;
    136137
    137         ITimeWindowedProblemInstance vrptw = instance as ITimeWindowedProblemInstance;
    138         if (vrptw != null)
    139           quality += attribute.Tardiness * vrptw.TardinessPenalty.Value;
     138          ITimeWindowedProblemInstance vrptw = instance as ITimeWindowedProblemInstance;
     139          if (vrptw != null)
     140            quality += attribute.Tardiness * vrptw.TardinessPenalty.Value;
    140141
    141         if (!useAspiration || moveQuality >= quality) {
    142           if ((attribute.City == move.City && attribute.Tour == move.Tour) ||
    143             (attribute.City == move.Replaced && attribute.Tour == move.OldTour)) {
    144             isTabu = true;
    145             break;
    146           }
     142          if (!useAspiration || moveQuality >= quality) {
     143            if ((attribute.City == move.City && attribute.Tour == move.Tour) ||
     144              (attribute.City == move.Replaced && attribute.Tour == move.OldTour)) {
     145              isTabu = true;
     146              break;
     147            }
    147148
    148           if (attribute.Distance == distance && attribute.Overload == overload && attribute.Tardiness == tardiness) {
    149             isTabu = true;
    150             break;
     149            if (attribute.Distance == distance && attribute.Overload == overload && attribute.Tardiness == tardiness) {
     150              isTabu = true;
     151              break;
     152            }
    151153          }
    152154        }
  • branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Moves/PickupDelivery/PDRearrange/PotvinPDRearrangeMoveMaker.cs

    r6856 r6857  
    117117      PotvinEncoding newSolution = move.Individual.Clone() as PotvinEncoding;
    118118      Apply(newSolution, move, ProblemInstance);
     119      newSolution.Repair();
    119120      VRPToursParameter.ActualValue = newSolution;
    120 
    121       //reset move quality
    122       VRPEvaluation eval = ProblemInstance.Evaluate(newSolution);
    123       MoveQualityParameter.ActualValue.Value = eval.Quality;
    124121    }
    125122  }
  • branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Moves/PickupDelivery/PDRearrange/PotvinPDRearrangeMoveTabuCriterion.cs

    r6797 r6857  
    116116        PotvinPDRelocateMoveAttribute attribute = tabuMove as PotvinPDRelocateMoveAttribute;
    117117
    118         double distance = 0;
    119         if (MoveDistanceParameter.ActualValue != null)
    120           distance = MoveDistanceParameter.ActualValue.Value;
     118        if (attribute != null) {
     119          double distance = 0;
     120          if (MoveDistanceParameter.ActualValue != null)
     121            distance = MoveDistanceParameter.ActualValue.Value;
    121122
    122         double overload = 0;
    123         if (MoveOverloadParameter.ActualValue != null)
    124           overload = MoveOverloadParameter.ActualValue.Value;
     123          double overload = 0;
     124          if (MoveOverloadParameter.ActualValue != null)
     125            overload = MoveOverloadParameter.ActualValue.Value;
    125126
    126         double tardiness = 0;
    127         if (MoveTardinessParameter.ActualValue != null)
    128           tardiness = MoveTardinessParameter.ActualValue.Value;
     127          double tardiness = 0;
     128          if (MoveTardinessParameter.ActualValue != null)
     129            tardiness = MoveTardinessParameter.ActualValue.Value;
    129130
    130         IVRPProblemInstance instance = ProblemInstanceParameter.ActualValue;
    131         double quality = attribute.Distance * instance.DistanceFactor.Value;
     131          IVRPProblemInstance instance = ProblemInstanceParameter.ActualValue;
     132          double quality = attribute.Distance * instance.DistanceFactor.Value;
    132133
    133         IHomogenousCapacitatedProblemInstance cvrp = instance as IHomogenousCapacitatedProblemInstance;
    134         if (cvrp != null)
    135           quality += attribute.Overload * cvrp.OverloadPenalty.Value;
     134          IHomogenousCapacitatedProblemInstance cvrp = instance as IHomogenousCapacitatedProblemInstance;
     135          if (cvrp != null)
     136            quality += attribute.Overload * cvrp.OverloadPenalty.Value;
    136137
    137         ITimeWindowedProblemInstance vrptw = instance as ITimeWindowedProblemInstance;
    138         if (vrptw != null)
    139           quality += attribute.Tardiness * vrptw.TardinessPenalty.Value;
     138          ITimeWindowedProblemInstance vrptw = instance as ITimeWindowedProblemInstance;
     139          if (vrptw != null)
     140            quality += attribute.Tardiness * vrptw.TardinessPenalty.Value;
    140141
    141         if (!useAspiration || moveQuality >= quality) {
    142           if (attribute.City == move.City && attribute.Tour == move.Tour) {
    143             isTabu = true;
    144             break;
    145           }
     142          if (!useAspiration || moveQuality >= quality) {
     143            if (attribute.City == move.City && attribute.Tour == move.Tour) {
     144              isTabu = true;
     145              break;
     146            }
    146147
    147           if (attribute.Distance == distance && attribute.Overload == overload && attribute.Tardiness == tardiness) {
    148             isTabu = true;
    149             break;
     148            if (attribute.Distance == distance && attribute.Overload == overload && attribute.Tardiness == tardiness) {
     149              isTabu = true;
     150              break;
     151            }
    150152          }
    151153        }
  • branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Moves/PickupDelivery/PDShift/PotvinPDShiftMoveMaker.cs

    r6856 r6857  
    8686      PotvinEncoding newSolution = move.Individual.Clone() as PotvinEncoding;
    8787      Apply(newSolution, move, ProblemInstance);
     88      newSolution.Repair();
    8889      VRPToursParameter.ActualValue = newSolution;
    89 
    90       //reset move quality
    91       VRPEvaluation eval = ProblemInstance.Evaluate(newSolution);
    92       MoveQualityParameter.ActualValue.Value = eval.Quality;
    9390    }
    9491  }
  • branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Moves/PickupDelivery/PDShift/PotvinPDShiftMoveTabuCriterion.cs

    r6797 r6857  
    116116        PotvinPDRelocateMoveAttribute attribute = tabuMove as PotvinPDRelocateMoveAttribute;
    117117
    118         double distance = 0;
    119         if (MoveDistanceParameter.ActualValue != null)
    120           distance = MoveDistanceParameter.ActualValue.Value;
     118        if (attribute != null) {
     119          double distance = 0;
     120          if (MoveDistanceParameter.ActualValue != null)
     121            distance = MoveDistanceParameter.ActualValue.Value;
    121122
    122         double overload = 0;
    123         if (MoveOverloadParameter.ActualValue != null)
    124           overload = MoveOverloadParameter.ActualValue.Value;
     123          double overload = 0;
     124          if (MoveOverloadParameter.ActualValue != null)
     125            overload = MoveOverloadParameter.ActualValue.Value;
    125126
    126         double tardiness = 0;
    127         if (MoveTardinessParameter.ActualValue != null)
    128           tardiness = MoveTardinessParameter.ActualValue.Value;
     127          double tardiness = 0;
     128          if (MoveTardinessParameter.ActualValue != null)
     129            tardiness = MoveTardinessParameter.ActualValue.Value;
    129130
    130         IVRPProblemInstance instance = ProblemInstanceParameter.ActualValue;
    131         double quality = attribute.Distance * instance.DistanceFactor.Value;
     131          IVRPProblemInstance instance = ProblemInstanceParameter.ActualValue;
     132          double quality = attribute.Distance * instance.DistanceFactor.Value;
    132133
    133         IHomogenousCapacitatedProblemInstance cvrp = instance as IHomogenousCapacitatedProblemInstance;
    134         if (cvrp != null)
    135           quality += attribute.Overload * cvrp.OverloadPenalty.Value;
     134          IHomogenousCapacitatedProblemInstance cvrp = instance as IHomogenousCapacitatedProblemInstance;
     135          if (cvrp != null)
     136            quality += attribute.Overload * cvrp.OverloadPenalty.Value;
    136137
    137         ITimeWindowedProblemInstance vrptw = instance as ITimeWindowedProblemInstance;
    138         if (vrptw != null)
    139           quality += attribute.Tardiness * vrptw.TardinessPenalty.Value;
     138          ITimeWindowedProblemInstance vrptw = instance as ITimeWindowedProblemInstance;
     139          if (vrptw != null)
     140            quality += attribute.Tardiness * vrptw.TardinessPenalty.Value;
    140141
    141         if (!useAspiration || moveQuality >= quality) {
    142           if (attribute.City == move.City && attribute.Tour == move.Tour) {
    143             isTabu = true;
    144             break;
    145           }
     142          if (!useAspiration || moveQuality >= quality) {
     143            if (attribute.City == move.City && attribute.Tour == move.Tour) {
     144              isTabu = true;
     145              break;
     146            }
    146147
    147           if (attribute.Distance == distance && attribute.Overload == overload && attribute.Tardiness == tardiness) {
    148             isTabu = true;
    149             break;
     148            if (attribute.Distance == distance && attribute.Overload == overload && attribute.Tardiness == tardiness) {
     149              isTabu = true;
     150              break;
     151            }
    150152          }
    151153        }
Note: See TracChangeset for help on using the changeset viewer.