Changeset 6857 for branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Moves/PickupDelivery
- Timestamp:
- 09/30/11 15:23:48 (13 years ago)
- 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 98 98 PotvinEncoding newSolution = move.Individual.Clone() as PotvinEncoding; 99 99 Apply(newSolution, move, ProblemInstance); 100 newSolution.Repair(); 100 101 VRPToursParameter.ActualValue = newSolution; 101 102 //reset move quality103 VRPEvaluation eval = ProblemInstance.Evaluate(newSolution);104 MoveQualityParameter.ActualValue.Value = eval.Quality;105 102 } 106 103 } -
branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Moves/PickupDelivery/PDExchange/PotvinPDExchangeMoveTabuCriterion.cs
r6797 r6857 116 116 PotvinPDRelocateMoveAttribute attribute = tabuMove as PotvinPDRelocateMoveAttribute; 117 117 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; 121 122 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; 125 126 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; 129 130 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; 132 133 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; 136 137 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; 140 141 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 } 147 148 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 } 151 153 } 152 154 } -
branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Moves/PickupDelivery/PDRearrange/PotvinPDRearrangeMoveMaker.cs
r6856 r6857 117 117 PotvinEncoding newSolution = move.Individual.Clone() as PotvinEncoding; 118 118 Apply(newSolution, move, ProblemInstance); 119 newSolution.Repair(); 119 120 VRPToursParameter.ActualValue = newSolution; 120 121 //reset move quality122 VRPEvaluation eval = ProblemInstance.Evaluate(newSolution);123 MoveQualityParameter.ActualValue.Value = eval.Quality;124 121 } 125 122 } -
branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Moves/PickupDelivery/PDRearrange/PotvinPDRearrangeMoveTabuCriterion.cs
r6797 r6857 116 116 PotvinPDRelocateMoveAttribute attribute = tabuMove as PotvinPDRelocateMoveAttribute; 117 117 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; 121 122 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; 125 126 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; 129 130 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; 132 133 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; 136 137 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; 140 141 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 } 146 147 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 } 150 152 } 151 153 } -
branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Moves/PickupDelivery/PDShift/PotvinPDShiftMoveMaker.cs
r6856 r6857 86 86 PotvinEncoding newSolution = move.Individual.Clone() as PotvinEncoding; 87 87 Apply(newSolution, move, ProblemInstance); 88 newSolution.Repair(); 88 89 VRPToursParameter.ActualValue = newSolution; 89 90 //reset move quality91 VRPEvaluation eval = ProblemInstance.Evaluate(newSolution);92 MoveQualityParameter.ActualValue.Value = eval.Quality;93 90 } 94 91 } -
branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Moves/PickupDelivery/PDShift/PotvinPDShiftMoveTabuCriterion.cs
r6797 r6857 116 116 PotvinPDRelocateMoveAttribute attribute = tabuMove as PotvinPDRelocateMoveAttribute; 117 117 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; 121 122 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; 125 126 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; 129 130 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; 132 133 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; 136 137 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; 140 141 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 } 146 147 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 } 150 152 } 151 153 }
Note: See TracChangeset
for help on using the changeset viewer.