Changeset 14677 for branches/OptimizationNetworks/HeuristicLab.Problems.VehicleRouting/3.4/ProblemInstances
- Timestamp:
- 02/16/17 15:16:55 (8 years ago)
- Location:
- branches/OptimizationNetworks/HeuristicLab.Problems.VehicleRouting/3.4/ProblemInstances
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/OptimizationNetworks/HeuristicLab.Problems.VehicleRouting/3.4/ProblemInstances/MultiDepotVRP/MDCVRP/MDCVRPEvaluator.cs
r14185 r14677 41 41 42 42 protected override void EvaluateTour(VRPEvaluation eval, IVRPProblemInstance instance, Tour tour, IVRPEncoding solution) { 43 TourInsertionInfo tourInfo = new TourInsertionInfo(solution.GetVehicleAssignment(solution.GetTourIndex(tour)));44 eval.InsertionInfo.AddTourInsertionInfo(tourInfo);45 43 double originalQuality = eval.Quality; 46 44 … … 55 53 56 54 double capacity = cvrpInstance.Capacity[vehicle]; 57 for (int i = 0; i < tour.Stops.Count; i++) {58 delivered += instance.GetDemand(tour.Stops[i]);59 }60 55 61 double spareCapacity = capacity - delivered; 56 var tourInfo = new CVRPTourInsertionInfo(solution.GetVehicleAssignment(solution.GetTourIndex(tour)), capacity); 57 eval.InsertionInfo.AddTourInsertionInfo(tourInfo); 62 58 63 59 //simulate a tour, start and end at depot … … 67 63 start = tour.Stops[i - 1]; 68 64 int end = 0; 69 if (i < tour.Stops.Count) 65 if (i < tour.Stops.Count) { 70 66 end = tour.Stops[i]; 67 delivered += instance.GetDemand(end); 68 } 69 //drive there 70 double currentDistance = instance.GetDistance(start, end, solution); 71 distance += currentDistance; 71 72 72 //drive there 73 double currentDistace = instance.GetDistance(start, end, solution); 74 distance += currentDistace; 75 76 CVRPInsertionInfo stopInfo = new CVRPInsertionInfo(start, end, spareCapacity); 73 var stopInfo = new CVRPStopInsertionInfo(start, end, currentDistance, capacity - delivered); 77 74 tourInfo.AddStopInsertionInfo(stopInfo); 78 75 } … … 88 85 } 89 86 90 ( eval as CVRPEvaluation).Overload += overweight;87 ((CVRPEvaluation)eval).Overload += overweight; 91 88 double penalty = overweight * cvrpInstance.OverloadPenalty.Value; 92 89 eval.Penalty += penalty; … … 98 95 protected override double GetTourInsertionCosts(IVRPProblemInstance instance, IVRPEncoding solution, TourInsertionInfo tourInsertionInfo, int index, int customer, 99 96 out bool feasible) { 100 CVRPInsertionInfo insertionInfo = tourInsertionInfo.GetStopInsertionInfo(index) as CVRPInsertionInfo;97 var insertionInfo = (CVRPStopInsertionInfo)tourInsertionInfo.GetStopInsertionInfo(index); 101 98 102 99 double costs = 0; 103 100 feasible = tourInsertionInfo.Penalty < double.Epsilon; 104 101 105 IHeterogenousCapacitatedProblemInstance cvrp = instance as IHeterogenousCapacitatedProblemInstance;102 var cvrp = (IHeterogenousCapacitatedProblemInstance)instance; 106 103 double overloadPenalty = cvrp.OverloadPenalty.Value; 107 104 … … 131 128 base.SetResultParameters(tourEvaluation); 132 129 133 OverloadParameter.ActualValue.Value = ( tourEvaluation as CVRPEvaluation).Overload;130 OverloadParameter.ActualValue.Value = ((CVRPEvaluation)tourEvaluation).Overload; 134 131 } 135 132 -
branches/OptimizationNetworks/HeuristicLab.Problems.VehicleRouting/3.4/ProblemInstances/MultiDepotVRP/MDCVRP/MDCVRPTW/MDCVRPPDTW/MDCVRPPDTWEvaluator.cs
r14185 r14677 43 43 44 44 protected override void EvaluateTour(VRPEvaluation eval, IVRPProblemInstance instance, Tour tour, IVRPEncoding solution) { 45 TourInsertionInfo tourInfo = new TourInsertionInfo(solution.GetVehicleAssignment(solution.GetTourIndex(tour)));46 eval.InsertionInfo.AddTourInsertionInfo(tourInfo);47 45 double originalQuality = eval.Quality; 48 46 49 IHeterogenousCapacitatedProblemInstance cvrpInstance = instance as IHeterogenousCapacitatedProblemInstance;47 var cvrpInstance = (IHeterogenousCapacitatedProblemInstance)instance; 50 48 DoubleArray demand = instance.Demand; 51 49 52 ITimeWindowedProblemInstance vrptw = instance as ITimeWindowedProblemInstance;50 var vrptw = (ITimeWindowedProblemInstance)instance; 53 51 DoubleArray dueTime = vrptw.DueTime; 54 52 DoubleArray readyTime = vrptw.ReadyTime; 55 53 DoubleArray serviceTimes = vrptw.ServiceTime; 56 54 57 IPickupAndDeliveryProblemInstance pdp = instance as IPickupAndDeliveryProblemInstance;55 var pdp = (IPickupAndDeliveryProblemInstance)instance; 58 56 IntArray pickupDeliveryLocation = pdp.PickupDeliveryLocation; 59 57 60 IMultiDepotProblemInstance mdp = instance as IMultiDepotProblemInstance;58 var mdp = (IMultiDepotProblemInstance)instance; 61 59 IntArray vehicleAssignment = mdp.VehicleDepotAssignment; 62 60 int depots = mdp.Depots.Value; … … 81 79 double tourStartTime = readyTime[0]; 82 80 time = tourStartTime; 81 82 var tourInfo = new CVRPTWTourInsertionInfo(solution.GetVehicleAssignment(solution.GetTourIndex(tour)), capacity, tourStartTime); 83 eval.InsertionInfo.AddTourInsertionInfo(tourInfo); 83 84 84 85 //simulate a tour, start and end at depot … … 92 93 93 94 //drive there 94 double currentDista ce = vrptw.GetDistance(start, end, solution);95 time += currentDista ce;96 distance += currentDista ce;95 double currentDistance = vrptw.GetDistance(start, end, solution); 96 time += currentDistance; 97 distance += currentDistance; 97 98 98 99 double arrivalTime = time; … … 129 130 //Pickup / deliver 130 131 bool validPickupDelivery = 131 validPickupDelivery =132 132 ((demand[end - 1] >= 0) || 133 133 (stops.ContainsKey(pickupDeliveryLocation[end - 1]))); … … 144 144 145 145 double spareCapacity = capacity - currentLoad; 146 CVRPPDTWInsertionInfo stopInfo = new CVRPPDTWInsertionInfo(start, end, spareCapacity, tourStartTime,146 var stopInfo = new CVRPPDTWStopInsertionInfo(start, end, currentDistance, spareCapacity, 147 147 arrivalTime, time, spareTime, waitTime, new List<int>(stops.Keys), arrivalSpareCapacity); 148 148 tourInfo.AddStopInsertionInfo(stopInfo); … … 156 156 eval.VehicleUtilization += 1; 157 157 158 ( eval as CVRPEvaluation).Overload += overweight;158 ((CVRPEvaluation)eval).Overload += overweight; 159 159 double tourPenalty = 0; 160 160 double penalty = overweight * cvrpInstance.OverloadPenalty.Value; … … 163 163 tourPenalty += penalty; 164 164 165 ( eval as CVRPTWEvaluation).Tardiness += tardiness;165 ((CVRPTWEvaluation)eval).Tardiness += tardiness; 166 166 (eval as CVRPTWEvaluation).TravelTime += time; 167 167 … … 171 171 tourPenalty += penalty; 172 172 173 ( eval as CVRPPDTWEvaluation).PickupViolations += pickupViolations;173 ((CVRPPDTWEvaluation)eval).PickupViolations += pickupViolations; 174 174 penalty = pickupViolations * pdp.PickupViolationPenalty.Value; 175 175 eval.Penalty += penalty; … … 184 184 protected override double GetTourInsertionCosts(IVRPProblemInstance instance, IVRPEncoding solution, TourInsertionInfo tourInsertionInfo, int index, int customer, 185 185 out bool feasible) { 186 CVRPPDTWInsertionInfo insertionInfo = tourInsertionInfo.GetStopInsertionInfo(index) as CVRPPDTWInsertionInfo; 186 var tourInfo = (CVRPTWTourInsertionInfo)tourInsertionInfo; 187 var insertionInfo = (CVRPPDTWStopInsertionInfo)tourInsertionInfo.GetStopInsertionInfo(index); 187 188 188 189 double costs = 0; … … 230 231 231 232 if (index > 0) 232 time = ( tourInsertionInfo.GetStopInsertionInfo(index - 1) as CVRPTWInsertionInfo).LeaveTime;233 time = ((CVRPTWStopInsertionInfo)tourInsertionInfo.GetStopInsertionInfo(index - 1)).LeaveTime; 233 234 else 234 time = insertionInfo.TourStartTime;235 time = tourInfo.TourStartTime; 235 236 236 237 time += startDistance; … … 246 247 time += endDistance; 247 248 248 double additionalTime = time - ( tourInsertionInfo.GetStopInsertionInfo(index) as CVRPTWInsertionInfo).ArrivalTime;249 double additionalTime = time - ((CVRPTWStopInsertionInfo)tourInsertionInfo.GetStopInsertionInfo(index)).ArrivalTime; 249 250 for (int i = index; i < tourInsertionInfo.GetStopCount(); i++) { 250 CVRPTWInsertionInfo nextStop = tourInsertionInfo.GetStopInsertionInfo(i) as CVRPTWInsertionInfo;251 var nextStop = (CVRPTWStopInsertionInfo)tourInsertionInfo.GetStopInsertionInfo(i); 251 252 252 253 if (demand >= 0) { -
branches/OptimizationNetworks/HeuristicLab.Problems.VehicleRouting/3.4/ProblemInstances/MultiDepotVRP/MDCVRP/MDCVRPTW/MDCVRPTWEvaluator.cs
r14185 r14677 46 46 47 47 protected override void EvaluateTour(VRPEvaluation eval, IVRPProblemInstance instance, Tour tour, IVRPEncoding solution) { 48 TourInsertionInfo tourInfo = new TourInsertionInfo(solution.GetVehicleAssignment(solution.GetTourIndex(tour)));49 eval.InsertionInfo.AddTourInsertionInfo(tourInfo);50 48 double originalQuality = eval.Quality; 51 49 52 IHeterogenousCapacitatedProblemInstance cvrpInstance = instance as IHeterogenousCapacitatedProblemInstance;50 var cvrpInstance = (IHeterogenousCapacitatedProblemInstance)instance; 53 51 DoubleArray demand = instance.Demand; 54 55 ITimeWindowedProblemInstance vrptw = instance as ITimeWindowedProblemInstance;52 53 var vrptw = (ITimeWindowedProblemInstance)instance; 56 54 DoubleArray dueTime = vrptw.DueTime; 57 55 DoubleArray readyTime = vrptw.ReadyTime; 58 56 DoubleArray serviceTimes = vrptw.ServiceTime; 59 57 60 IMultiDepotProblemInstance mdp = instance as IMultiDepotProblemInstance;58 var mdp = (IMultiDepotProblemInstance)instance; 61 59 IntArray vehicleAssignment = mdp.VehicleDepotAssignment; 62 60 int depots = mdp.Depots.Value; … … 75 73 76 74 double capacity = cvrpInstance.Capacity[vehicle]; 77 for (int i = 0; i < tour.Stops.Count; i++) {78 delivered += instance.GetDemand(tour.Stops[i]);79 }80 81 double spareCapacity = capacity - delivered;82 75 83 76 double tourStartTime = vrptw.ReadyTime[depot]; 84 77 time = tourStartTime; 78 79 var tourInfo = new CVRPTWTourInsertionInfo(solution.GetVehicleAssignment(solution.GetTourIndex(tour)), capacity, tourStartTime); 80 eval.InsertionInfo.AddTourInsertionInfo(tourInfo); 85 81 86 82 //simulate a tour, start and end at depot … … 90 86 start = tour.Stops[i - 1]; 91 87 int end = 0; 92 if (i < tour.Stops.Count) 88 if (i < tour.Stops.Count) { 93 89 end = tour.Stops[i]; 90 delivered += instance.GetDemand(end); 91 } 94 92 95 93 //drive there 96 double currentDista ce = vrptw.GetDistance(start, end, solution);97 time += currentDista ce;98 distance += currentDista ce;94 double currentDistance = vrptw.GetDistance(start, end, solution); 95 time += currentDistance; 96 distance += currentDistance; 99 97 100 98 double arrivalTime = time; … … 129 127 time += currentServiceTime; 130 128 131 CVRPTWInsertionInfo stopInfo = new CVRPTWInsertionInfo(start, end, spareCapacity, tourStartTime, arrivalTime, time, spareTime, waitTime);129 var stopInfo = new CVRPTWStopInsertionInfo(start, end, currentDistance, capacity - delivered, arrivalTime, time, spareTime, waitTime); 132 130 tourInfo.AddStopInsertionInfo(stopInfo); 133 131 } … … 142 140 } 143 141 144 ( eval as CVRPEvaluation).Overload += overweight;142 ((CVRPEvaluation)eval).Overload += overweight; 145 143 double tourPenalty = 0; 146 144 double penalty = overweight * cvrpInstance.OverloadPenalty.Value; … … 149 147 tourPenalty += penalty; 150 148 151 ( eval as CVRPTWEvaluation).Tardiness += tardiness;152 ( eval as CVRPTWEvaluation).TravelTime += time;149 ((CVRPTWEvaluation)eval).Tardiness += tardiness; 150 ((CVRPTWEvaluation)eval).TravelTime += time; 153 151 154 152 penalty = tardiness * vrptw.TardinessPenalty.Value; … … 163 161 protected override double GetTourInsertionCosts(IVRPProblemInstance instance, IVRPEncoding solution, TourInsertionInfo tourInsertionInfo, int index, int customer, 164 162 out bool feasible) { 165 CVRPTWInsertionInfo insertionInfo = tourInsertionInfo.GetStopInsertionInfo(index) as CVRPTWInsertionInfo; 163 var tourInfo = (CVRPTWTourInsertionInfo)tourInsertionInfo; 164 var insertionInfo = (CVRPTWStopInsertionInfo)tourInsertionInfo.GetStopInsertionInfo(index); 166 165 167 166 double costs = 0; 168 167 feasible = tourInsertionInfo.Penalty < double.Epsilon; 169 168 170 ICapacitatedProblemInstance cvrp = instance as ICapacitatedProblemInstance;169 var cvrp = (ICapacitatedProblemInstance)instance; 171 170 double overloadPenalty = cvrp.OverloadPenalty.Value; 172 171 173 ITimeWindowedProblemInstance vrptw = instance as ITimeWindowedProblemInstance;172 var vrptw = (ITimeWindowedProblemInstance)instance; 174 173 DoubleArray dueTime = vrptw.DueTime; 175 174 DoubleArray readyTime = vrptw.ReadyTime; … … 177 176 double tardinessPenalty = vrptw.TardinessPenalty.Value; 178 177 179 IMultiDepotProblemInstance mdp = instance as IMultiDepotProblemInstance;178 var mdp = (IMultiDepotProblemInstance)instance; 180 179 int depots = mdp.Depots.Value; 181 180 … … 184 183 185 184 double demand = instance.GetDemand(customer); 186 if (demand > insertionInfo.SpareCapacity) {185 if (demand > tourInfo.SpareCapacity) { 187 186 feasible = false; 188 187 189 if ( insertionInfo.SpareCapacity >= 0)190 costs += (demand - insertionInfo.SpareCapacity) * overloadPenalty;188 if (tourInfo.SpareCapacity >= 0) 189 costs += (demand - tourInfo.SpareCapacity) * overloadPenalty; 191 190 else 192 191 costs += demand * overloadPenalty; … … 197 196 198 197 if (index > 0) 199 time = ( tourInsertionInfo.GetStopInsertionInfo(index - 1) as CVRPTWInsertionInfo).LeaveTime;198 time = ((CVRPTWStopInsertionInfo)tourInsertionInfo.GetStopInsertionInfo(index - 1)).LeaveTime; 200 199 else 201 time = insertionInfo.TourStartTime;200 time = tourInfo.TourStartTime; 202 201 203 202 time += startDistance; … … 213 212 time += endDistance; 214 213 215 double additionalTime = time - ( tourInsertionInfo.GetStopInsertionInfo(index) as CVRPTWInsertionInfo).ArrivalTime;214 double additionalTime = time - ((CVRPTWStopInsertionInfo)tourInsertionInfo.GetStopInsertionInfo(index)).ArrivalTime; 216 215 for (int i = index; i < tourInsertionInfo.GetStopCount(); i++) { 217 CVRPTWInsertionInfo nextStop = tourInsertionInfo.GetStopInsertionInfo(i) as CVRPTWInsertionInfo;216 var nextStop = (CVRPTWStopInsertionInfo)tourInsertionInfo.GetStopInsertionInfo(i); 218 217 219 218 if (additionalTime < 0) { … … 270 269 base.SetResultParameters(tourEvaluation); 271 270 272 TardinessParameter.ActualValue.Value = ( tourEvaluation as CVRPTWEvaluation).Tardiness;273 TravelTimeParameter.ActualValue.Value = ( tourEvaluation as CVRPTWEvaluation).TravelTime;271 TardinessParameter.ActualValue.Value = ((CVRPTWEvaluation)tourEvaluation).Tardiness; 272 TravelTimeParameter.ActualValue.Value = ((CVRPTWEvaluation)tourEvaluation).TravelTime; 274 273 } 275 274 -
branches/OptimizationNetworks/HeuristicLab.Problems.VehicleRouting/3.4/ProblemInstances/MultiDepotVRP/MultiDepotVRPEvaluator.cs
r14185 r14677 47 47 48 48 //drive there 49 double currentDista ce = instance.GetDistance(start, end, solution);50 distance += currentDista ce;49 double currentDistance = instance.GetDistance(start, end, solution); 50 distance += currentDistance; 51 51 52 StopInsertionInfo stopInfo = new StopInsertionInfo(start, end);52 var stopInfo = new StopInsertionInfo(start, end, currentDistance); 53 53 tourInfo.AddStopInsertionInfo(stopInfo); 54 54 } … … 68 68 protected override double GetTourInsertionCosts(IVRPProblemInstance instance, IVRPEncoding solution, TourInsertionInfo tourInsertionInfo, int index, int customer, 69 69 out bool feasible) { 70 StopInsertionInfoinsertionInfo = tourInsertionInfo.GetStopInsertionInfo(index);70 var insertionInfo = tourInsertionInfo.GetStopInsertionInfo(index); 71 71 72 72 double costs = 0; -
branches/OptimizationNetworks/HeuristicLab.Problems.VehicleRouting/3.4/ProblemInstances/SingleDepotVRP/CVRP/CVRPEvaluation.cs
r14185 r14677 20 20 #endregion 21 21 22 using System.Globalization; 23 using System.Linq; 24 using System.Text; 22 25 23 26 namespace HeuristicLab.Problems.VehicleRouting.ProblemInstances { 24 public class CVRP InsertionInfo : StopInsertionInfo {27 public class CVRPStopInsertionInfo : StopInsertionInfo { 25 28 private double spareCapacity; 26 29 … … 29 32 } 30 33 31 public CVRP InsertionInfo(int start, int end, double spareCapacity)32 : base(start, end ) {34 public CVRPStopInsertionInfo(int start, int end, double distance, double spareCapacity) 35 : base(start, end, distance) { 33 36 this.spareCapacity = spareCapacity; 37 } 38 39 protected override void GetStopInsertionReport(StringBuilder builder) { 40 base.GetStopInsertionReport(builder); 41 builder.Append("Capacity left:\t"); 42 builder.AppendLine(SpareCapacity.ToString(CultureInfo.CurrentCulture)); 43 } 44 } 45 46 public class CVRPTourInsertionInfo : TourInsertionInfo { 47 private double capacity; 48 49 public virtual double SpareCapacity { 50 get { return stopInsertionInfos.Count == 0 ? capacity : ((CVRPStopInsertionInfo)stopInsertionInfos.Last()).SpareCapacity; } 51 } 52 53 public CVRPTourInsertionInfo(int vehicle, double capacity) 54 : base(vehicle) { 55 this.capacity = capacity; 56 } 57 58 protected override void GetTourInsertionReport(StringBuilder builder) { 59 base.GetTourInsertionReport(builder); 60 builder.Append("Capacity left:\t"); 61 builder.AppendLine(SpareCapacity.ToString(CultureInfo.CurrentCulture)); 34 62 } 35 63 } … … 37 65 public class CVRPEvaluation : VRPEvaluation { 38 66 public double Overload { get; set; } 67 68 protected override void GetEvaluationReport(StringBuilder builder) { 69 base.GetEvaluationReport(builder); 70 builder.Append("Overload:\t"); 71 builder.AppendLine(Overload.ToString(CultureInfo.CurrentCulture)); 72 } 39 73 } 40 74 } -
branches/OptimizationNetworks/HeuristicLab.Problems.VehicleRouting/3.4/ProblemInstances/SingleDepotVRP/CVRP/CVRPEvaluator.cs
r14185 r14677 41 41 42 42 protected override void EvaluateTour(VRPEvaluation eval, IVRPProblemInstance instance, Tour tour, IVRPEncoding solution) { 43 TourInsertionInfo tourInfo = new TourInsertionInfo(solution.GetVehicleAssignment(solution.GetTourIndex(tour))); ; 43 var cvrpInstance = (IHomogenousCapacitatedProblemInstance)instance; 44 double capacity = cvrpInstance.Capacity.Value; 45 var tourInfo = new CVRPTourInsertionInfo(solution.GetVehicleAssignment(solution.GetTourIndex(tour)), capacity); 44 46 eval.InsertionInfo.AddTourInsertionInfo(tourInfo); 45 47 double originalQuality = eval.Quality; 46 48 47 IHomogenousCapacitatedProblemInstance cvrpInstance = instance as IHomogenousCapacitatedProblemInstance;48 49 DoubleArray demand = instance.Demand; 49 50 … … 51 52 double overweight = 0.0; 52 53 double distance = 0.0; 53 54 double capacity = cvrpInstance.Capacity.Value;55 for (int i = 0; i <= tour.Stops.Count; i++) {56 int end = 0;57 if (i < tour.Stops.Count)58 end = tour.Stops[i];59 60 delivered += demand[end];61 }62 63 double spareCapacity = capacity - delivered;64 54 65 55 //simulate a tour, start and end at depot … … 72 62 end = tour.Stops[i]; 73 63 64 delivered += demand[end]; 65 74 66 //drive there 75 double currentDista ce = instance.GetDistance(start, end, solution);76 distance += currentDista ce;67 double currentDistance = instance.GetDistance(start, end, solution); 68 distance += currentDistance; 77 69 78 CVRPInsertionInfo stopInfo = new CVRPInsertionInfo(start, end, spareCapacity);70 var stopInfo = new CVRPStopInsertionInfo(start, end, currentDistance, capacity - delivered); 79 71 tourInfo.AddStopInsertionInfo(stopInfo); 80 72 } … … 90 82 } 91 83 92 ( eval as CVRPEvaluation).Overload += overweight;84 ((CVRPEvaluation)eval).Overload += overweight; 93 85 double penalty = overweight * cvrpInstance.OverloadPenalty.Value; 94 86 eval.Penalty += penalty; … … 100 92 protected override double GetTourInsertionCosts(IVRPProblemInstance instance, IVRPEncoding solution, TourInsertionInfo tourInsertionInfo, int index, int customer, 101 93 out bool feasible) { 102 CVRPInsertionInfo insertionInfo = tourInsertionInfo.GetStopInsertionInfo(index) as CVRPInsertionInfo; 94 var tourInfo = (CVRPTourInsertionInfo)tourInsertionInfo; 95 var insertionInfo = (CVRPStopInsertionInfo)tourInsertionInfo.GetStopInsertionInfo(index); 103 96 104 97 double costs = 0; 105 98 feasible = tourInsertionInfo.Penalty < double.Epsilon; 106 99 107 ICapacitatedProblemInstance cvrp = instance as ICapacitatedProblemInstance;100 var cvrp = (ICapacitatedProblemInstance)instance; 108 101 double overloadPenalty = cvrp.OverloadPenalty.Value; 109 102 … … 115 108 116 109 double demand = instance.Demand[customer]; 117 if (demand > insertionInfo.SpareCapacity) {110 if (demand > tourInfo.SpareCapacity) { 118 111 feasible = false; 119 112 120 if ( insertionInfo.SpareCapacity >= 0)121 costs += (demand - insertionInfo.SpareCapacity) * overloadPenalty;113 if (tourInfo.SpareCapacity >= 0) 114 costs += (demand - tourInfo.SpareCapacity) * overloadPenalty; 122 115 else 123 116 costs += demand * overloadPenalty; … … 136 129 base.SetResultParameters(tourEvaluation); 137 130 138 OverloadParameter.ActualValue.Value = ( tourEvaluation as CVRPEvaluation).Overload;131 OverloadParameter.ActualValue.Value = ((CVRPEvaluation)tourEvaluation).Overload; 139 132 } 140 133 -
branches/OptimizationNetworks/HeuristicLab.Problems.VehicleRouting/3.4/ProblemInstances/SingleDepotVRP/CVRP/CVRPTW/CVRPPDTW/CVRPPDTWEvaluation.cs
r14185 r14677 23 23 24 24 namespace HeuristicLab.Problems.VehicleRouting.ProblemInstances { 25 public class CVRPPDTW InsertionInfo : CVRPTWInsertionInfo {25 public class CVRPPDTWStopInsertionInfo : CVRPTWStopInsertionInfo { 26 26 private List<int> visited; 27 27 … … 36 36 } 37 37 38 public CVRPPDTW InsertionInfo(int start, int end, double spareCapacity, double tourStartTime,38 public CVRPPDTWStopInsertionInfo(int start, int end, double distance, double spareCapacity, 39 39 double arrivalTime, double leaveTime, double spareTime, double waitingTime, List<int> visited, double arrivalSpareCapacity) 40 : base(start, end, spareCapacity, tourStartTime, arrivalTime, leaveTime, spareTime, waitingTime) {40 : base(start, end, distance, spareCapacity, arrivalTime, leaveTime, spareTime, waitingTime) { 41 41 this.visited = visited; 42 42 this.arrivalSpareCapacity = arrivalSpareCapacity; -
branches/OptimizationNetworks/HeuristicLab.Problems.VehicleRouting/3.4/ProblemInstances/SingleDepotVRP/CVRP/CVRPTW/CVRPPDTW/CVRPPDTWEvaluator.cs
r14185 r14677 43 43 44 44 protected override void EvaluateTour(VRPEvaluation eval, IVRPProblemInstance instance, Tour tour, IVRPEncoding solution) { 45 TourInsertionInfo tourInfo = new TourInsertionInfo(solution.GetVehicleAssignment(solution.GetTourIndex(tour)));46 eval.InsertionInfo.AddTourInsertionInfo(tourInfo);45 var cvrpInstance = (IHomogenousCapacitatedProblemInstance)instance; 46 double capacity = cvrpInstance.Capacity.Value; 47 47 double originalQuality = eval.Quality; 48 48 49 IHomogenousCapacitatedProblemInstance cvrpInstance = instance as IHomogenousCapacitatedProblemInstance;50 49 DoubleArray demand = instance.Demand; 51 50 52 ITimeWindowedProblemInstance vrptw = instance as ITimeWindowedProblemInstance;51 var vrptw = (ITimeWindowedProblemInstance)instance; 53 52 DoubleArray dueTime = vrptw.DueTime; 54 53 DoubleArray readyTime = vrptw.ReadyTime; 55 54 DoubleArray serviceTimes = vrptw.ServiceTime; 56 55 57 IPickupAndDeliveryProblemInstance pdp = instance as IPickupAndDeliveryProblemInstance;56 var pdp = (IPickupAndDeliveryProblemInstance)instance; 58 57 IntArray pickupDeliveryLocation = pdp.PickupDeliveryLocation; 59 58 60 double capacity = cvrpInstance.Capacity.Value;61 59 62 60 double time = 0.0; … … 73 71 double tourStartTime = readyTime[0]; 74 72 time = tourStartTime; 73 74 var tourInfo = new CVRPTWTourInsertionInfo(solution.GetVehicleAssignment(solution.GetTourIndex(tour)), capacity, tourStartTime); 75 eval.InsertionInfo.AddTourInsertionInfo(tourInfo); 75 76 76 77 //simulate a tour, start and end at depot … … 84 85 85 86 //drive there 86 double currentDista ce = vrptw.GetDistance(start, end, solution);87 time += currentDista ce;88 distance += currentDista ce;87 double currentDistance = vrptw.GetDistance(start, end, solution); 88 time += currentDistance; 89 distance += currentDistance; 89 90 90 91 double arrivalTime = time; … … 115 116 116 117 bool validPickupDelivery = 117 validPickupDelivery =118 118 ((demand[end] >= 0) || 119 119 (stops.ContainsKey(pickupDeliveryLocation[end]))); … … 129 129 130 130 double spareCapacity = capacity - currentLoad; 131 CVRPPDTWInsertionInfo stopInfo = new CVRPPDTWInsertionInfo(start, end, spareCapacity, tourStartTime,131 var stopInfo = new CVRPPDTWStopInsertionInfo(start, end, currentDistance, spareCapacity, 132 132 arrivalTime, time, spareTime, waitTime, new List<int>(stops.Keys), arrivalSpareCapacity); 133 133 tourInfo.AddStopInsertionInfo(stopInfo); … … 141 141 eval.VehicleUtilization += 1; 142 142 143 ( eval as CVRPEvaluation).Overload += overweight;143 ((CVRPEvaluation)eval).Overload += overweight; 144 144 double tourPenalty = 0; 145 145 double penalty = overweight * cvrpInstance.OverloadPenalty.Value; … … 148 148 tourPenalty += penalty; 149 149 150 ( eval as CVRPTWEvaluation).Tardiness += tardiness;151 ( eval as CVRPTWEvaluation).TravelTime += time;150 ((CVRPTWEvaluation)eval).Tardiness += tardiness; 151 ((CVRPTWEvaluation)eval).TravelTime += time; 152 152 153 153 penalty = tardiness * vrptw.TardinessPenalty.Value; … … 156 156 tourPenalty += penalty; 157 157 158 ( eval as CVRPPDTWEvaluation).PickupViolations += pickupViolations;158 ((CVRPPDTWEvaluation)eval).PickupViolations += pickupViolations; 159 159 penalty = pickupViolations * pdp.PickupViolationPenalty.Value; 160 160 eval.Penalty += penalty; … … 169 169 protected override double GetTourInsertionCosts(IVRPProblemInstance instance, IVRPEncoding solution, TourInsertionInfo tourInsertionInfo, int index, int customer, 170 170 out bool feasible) { 171 CVRPPDTWInsertionInfo insertionInfo = tourInsertionInfo.GetStopInsertionInfo(index) as CVRPPDTWInsertionInfo; 171 var tourInfo = (CVRPTWTourInsertionInfo)tourInsertionInfo; 172 var insertionInfo = (CVRPPDTWStopInsertionInfo)tourInsertionInfo.GetStopInsertionInfo(index); 172 173 173 174 double costs = 0; … … 175 176 bool tourFeasible = true; 176 177 177 ICapacitatedProblemInstance cvrp = instance as ICapacitatedProblemInstance;178 var cvrp = (ICapacitatedProblemInstance)instance; 178 179 double overloadPenalty = cvrp.OverloadPenalty.Value; 179 180 180 ITimeWindowedProblemInstance vrptw = instance as ITimeWindowedProblemInstance;181 var vrptw = (ITimeWindowedProblemInstance)instance; 181 182 DoubleArray dueTime = vrptw.DueTime; 182 183 DoubleArray readyTime = vrptw.ReadyTime; … … 184 185 double tardinessPenalty = vrptw.TardinessPenalty.Value; 185 186 186 IPickupAndDeliveryProblemInstance pdp = instance as IPickupAndDeliveryProblemInstance;187 IPickupAndDeliveryProblemInstance pdp = (IPickupAndDeliveryProblemInstance)instance; 187 188 IntArray pickupDeliveryLocation = pdp.PickupDeliveryLocation; 188 189 double pickupPenalty = pdp.PickupViolationPenalty.Value; … … 215 216 216 217 if (index > 0) 217 time = ( tourInsertionInfo.GetStopInsertionInfo(index - 1) as CVRPTWInsertionInfo).LeaveTime;218 time = ((CVRPTWStopInsertionInfo)tourInsertionInfo.GetStopInsertionInfo(index - 1)).LeaveTime; 218 219 else 219 time = insertionInfo.TourStartTime;220 time = tourInfo.TourStartTime; 220 221 221 222 time += instance.GetDistance(insertionInfo.Start, customer, solution); … … 228 229 time += instance.GetDistance(customer, insertionInfo.End, solution); 229 230 230 double additionalTime = time - ( tourInsertionInfo.GetStopInsertionInfo(index) as CVRPTWInsertionInfo).ArrivalTime;231 double additionalTime = time - ((CVRPTWStopInsertionInfo)tourInsertionInfo.GetStopInsertionInfo(index)).ArrivalTime; 231 232 for (int i = index; i < tourInsertionInfo.GetStopCount(); i++) { 232 CVRPTWInsertionInfo nextStop = tourInsertionInfo.GetStopInsertionInfo(i) as CVRPTWInsertionInfo;233 var nextStop = (CVRPTWStopInsertionInfo)tourInsertionInfo.GetStopInsertionInfo(i); 233 234 234 235 if (demand >= 0) { … … 246 247 } else if (validPickup) { 247 248 if (nextStop.SpareCapacity < 0) { 249 // ABE: The costs decrease when there is overload!? 248 250 costs += Math.Max(demand, nextStop.SpareCapacity) * overloadPenalty; 249 251 } … … 263 265 //check due date, decrease tardiness 264 266 if (nextStop.SpareTime < 0) { 267 // ABE: Again, the costs decrease when there is tardiness!? 265 268 costs += Math.Max(nextStop.SpareTime, additionalTime) * tardinessPenalty; 266 269 } -
branches/OptimizationNetworks/HeuristicLab.Problems.VehicleRouting/3.4/ProblemInstances/SingleDepotVRP/CVRP/CVRPTW/CVRPTWEvaluation.cs
r14185 r14677 20 20 #endregion 21 21 22 using System; 23 using System.Globalization; 24 using System.Text; 22 25 23 26 namespace HeuristicLab.Problems.VehicleRouting.ProblemInstances { 24 public class CVRPTWInsertionInfo : CVRPInsertionInfo { 25 private double tourStartTime; 26 27 public double TourStartTime { 28 get { return tourStartTime; } 29 } 27 public class CVRPTWStopInsertionInfo : CVRPStopInsertionInfo { 30 28 31 29 private double arrivalTime; … … 53 51 } 54 52 55 public CVRPTWInsertionInfo(int start, int end, double spareCapacity, double tourStartTime, double arrivalTime, double leaveTime, double spareTime, double waitingTime) 56 : base(start, end, spareCapacity) { 57 this.tourStartTime = tourStartTime; 53 public CVRPTWStopInsertionInfo(int start, int end, double distance, double spareCapacity, double arrivalTime, double leaveTime, double spareTime, double waitingTime) 54 : base(start, end, distance, spareCapacity) { 58 55 this.arrivalTime = arrivalTime; 59 56 this.leaveTime = leaveTime; 60 57 this.spareTime = spareTime; 61 58 this.waitingTime = waitingTime; 59 } 60 61 protected override void GetStopInsertionReport(StringBuilder builder) { 62 base.GetStopInsertionReport(builder); 63 builder.Append("SpareTime:\t"); 64 builder.AppendLine(SpareTime.ToString(CultureInfo.CurrentCulture)); 65 builder.Append("ArrivalTime:\t"); 66 builder.AppendLine(ArrivalTime.ToString(CultureInfo.CurrentCulture)); 67 builder.Append("WaitingTime:\t"); 68 builder.AppendLine(Math.Max(0, WaitingTime).ToString(CultureInfo.CurrentCulture)); 69 builder.Append("LeaveTime:\t"); 70 builder.AppendLine(LeaveTime.ToString(CultureInfo.CurrentCulture)); 71 } 72 } 73 74 public class CVRPTWTourInsertionInfo : CVRPTourInsertionInfo { 75 private double tourStartTime; 76 77 public double TourStartTime { 78 get { return tourStartTime; } 79 } 80 81 public CVRPTWTourInsertionInfo(int vehicle, double capacity, double tourStartTime) 82 : base(vehicle, capacity) { 83 this.tourStartTime = tourStartTime; 84 } 85 86 protected override void GetTourInsertionReport(StringBuilder builder) { 87 base.GetTourInsertionReport(builder); 88 builder.Append("Tour start:\t"); 89 builder.AppendLine(TourStartTime.ToString(CultureInfo.CurrentCulture)); 62 90 } 63 91 } … … 66 94 public double Tardiness { get; set; } 67 95 public double TravelTime { get; set; } 96 97 protected override void GetEvaluationReport(StringBuilder builder) { 98 base.GetEvaluationReport(builder); 99 builder.Append("TravelTime:\t"); 100 builder.AppendLine(TravelTime.ToString(CultureInfo.CurrentCulture)); 101 builder.Append("Tardiness:\t"); 102 builder.AppendLine(Tardiness.ToString(CultureInfo.CurrentCulture)); 103 } 68 104 } 69 105 } -
branches/OptimizationNetworks/HeuristicLab.Problems.VehicleRouting/3.4/ProblemInstances/SingleDepotVRP/CVRP/CVRPTW/CVRPTWEvaluator.cs
r14185 r14677 46 46 47 47 protected override void EvaluateTour(VRPEvaluation eval, IVRPProblemInstance instance, Tour tour, IVRPEncoding solution) { 48 TourInsertionInfo tourInfo = new TourInsertionInfo(solution.GetVehicleAssignment(solution.GetTourIndex(tour)));49 eval.InsertionInfo.AddTourInsertionInfo(tourInfo); 48 var cvrpInstance = (IHomogenousCapacitatedProblemInstance)instance; 49 50 50 double originalQuality = eval.Quality; 51 51 52 IHomogenousCapacitatedProblemInstance cvrpInstance = instance as IHomogenousCapacitatedProblemInstance;53 52 DoubleArray demand = instance.Demand; 54 53 55 ITimeWindowedProblemInstance vrptw = instance as ITimeWindowedProblemInstance;54 var vrptw = (ITimeWindowedProblemInstance)instance; 56 55 DoubleArray dueTime = vrptw.DueTime; 57 56 DoubleArray readyTime = vrptw.ReadyTime; … … 67 66 68 67 double capacity = cvrpInstance.Capacity.Value; 69 for (int i = 0; i <= tour.Stops.Count; i++) { 70 int end = 0; 71 if (i < tour.Stops.Count) 72 end = tour.Stops[i]; 73 74 delivered += demand[end]; 75 } 76 77 double spareCapacity = capacity - delivered; 78 68 79 69 double tourStartTime = readyTime[0]; 80 70 time = tourStartTime; 71 72 var tourInfo = new CVRPTWTourInsertionInfo(solution.GetVehicleAssignment(solution.GetTourIndex(tour)), cvrpInstance.Capacity.Value, tourStartTime); 73 eval.InsertionInfo.AddTourInsertionInfo(tourInfo); 81 74 82 75 //simulate a tour, start and end at depot … … 90 83 91 84 //drive there 92 double currentDistace = vrptw.GetDistance(start, end, solution); 93 time += currentDistace; 94 distance += currentDistace; 85 double currentDistance = vrptw.GetDistance(start, end, solution); 86 time += currentDistance; 87 distance += currentDistance; 88 delivered += demand[end]; 95 89 96 90 double arrivalTime = time; … … 117 111 time += currentServiceTime; 118 112 119 CVRPTWInsertionInfo stopInfo = new CVRPTWInsertionInfo(start, end, spareCapacity, tourStartTime, arrivalTime, time, spareTime, waitTime);113 var stopInfo = new CVRPTWStopInsertionInfo(start, end, currentDistance, capacity - delivered, arrivalTime, time, spareTime, waitTime); 120 114 tourInfo.AddStopInsertionInfo(stopInfo); 121 115 } … … 130 124 } 131 125 132 ( eval as CVRPEvaluation).Overload += overweight;126 ((CVRPEvaluation)eval).Overload += overweight; 133 127 double tourPenalty = 0; 134 128 double penalty = overweight * cvrpInstance.OverloadPenalty.Value; … … 151 145 protected override double GetTourInsertionCosts(IVRPProblemInstance instance, IVRPEncoding solution, TourInsertionInfo tourInsertionInfo, int index, int customer, 152 146 out bool feasible) { 153 CVRPTWInsertionInfo insertionInfo = tourInsertionInfo.GetStopInsertionInfo(index) as CVRPTWInsertionInfo; 147 var tourInfo = (CVRPTWTourInsertionInfo)tourInsertionInfo; 148 var insertionInfo = (CVRPTWStopInsertionInfo)tourInsertionInfo.GetStopInsertionInfo(index); 154 149 155 150 double costs = 0; 156 151 feasible = tourInsertionInfo.Penalty < double.Epsilon; 157 152 158 ICapacitatedProblemInstance cvrp = instance as ICapacitatedProblemInstance;153 var cvrp = (ICapacitatedProblemInstance)instance; 159 154 double overloadPenalty = cvrp.OverloadPenalty.Value; 160 155 161 ITimeWindowedProblemInstance vrptw = instance as ITimeWindowedProblemInstance;156 var vrptw = (ITimeWindowedProblemInstance)instance; 162 157 DoubleArray dueTime = vrptw.DueTime; 163 158 DoubleArray readyTime = vrptw.ReadyTime; … … 172 167 173 168 double demand = instance.Demand[customer]; 174 if (demand > insertionInfo.SpareCapacity) {169 if (demand > tourInfo.SpareCapacity) { 175 170 feasible = false; 176 if ( insertionInfo.SpareCapacity >= 0)177 costs += (demand - insertionInfo.SpareCapacity) * overloadPenalty;171 if (tourInfo.SpareCapacity >= 0) 172 costs += (demand - tourInfo.SpareCapacity) * overloadPenalty; 178 173 else 179 174 costs += demand * overloadPenalty; … … 184 179 185 180 if (index > 0) 186 time = ( tourInsertionInfo.GetStopInsertionInfo(index - 1) as CVRPTWInsertionInfo).LeaveTime;181 time = ((CVRPTWStopInsertionInfo)tourInsertionInfo.GetStopInsertionInfo(index - 1)).LeaveTime; 187 182 else 188 time = insertionInfo.TourStartTime;183 time = tourInfo.TourStartTime; 189 184 190 185 time += instance.GetDistance(insertionInfo.Start, customer, solution); … … 197 192 time += instance.GetDistance(customer, insertionInfo.End, solution); 198 193 199 double additionalTime = time - ( tourInsertionInfo.GetStopInsertionInfo(index) as CVRPTWInsertionInfo).ArrivalTime;194 double additionalTime = time - ((CVRPTWStopInsertionInfo)tourInsertionInfo.GetStopInsertionInfo(index)).ArrivalTime; 200 195 for (int i = index; i < tourInsertionInfo.GetStopCount(); i++) { 201 CVRPTWInsertionInfo nextStop = tourInsertionInfo.GetStopInsertionInfo(i) as CVRPTWInsertionInfo;196 var nextStop = (CVRPTWStopInsertionInfo)tourInsertionInfo.GetStopInsertionInfo(i); 202 197 203 198 if (additionalTime < 0) { … … 254 249 base.SetResultParameters(tourEvaluation); 255 250 256 TardinessParameter.ActualValue.Value = ( tourEvaluation as CVRPTWEvaluation).Tardiness;257 TravelTimeParameter.ActualValue.Value = ( tourEvaluation as CVRPTWEvaluation).TravelTime;251 TardinessParameter.ActualValue.Value = ((CVRPTWEvaluation)tourEvaluation).Tardiness; 252 TravelTimeParameter.ActualValue.Value = ((CVRPTWEvaluation)tourEvaluation).TravelTime; 258 253 } 259 254 -
branches/OptimizationNetworks/HeuristicLab.Problems.VehicleRouting/3.4/ProblemInstances/SingleDepotVRP/SingleDepotVRPEvaluator.cs
r14185 r14677 31 31 public class SingleDepotVRPEvaluator : VRPEvaluator { 32 32 protected override void EvaluateTour(VRPEvaluation eval, IVRPProblemInstance instance, Tour tour, IVRPEncoding solution) { 33 TourInsertionInfotourInfo = new TourInsertionInfo(solution.GetVehicleAssignment(solution.GetTourIndex(tour)));33 var tourInfo = new TourInsertionInfo(solution.GetVehicleAssignment(solution.GetTourIndex(tour))); 34 34 eval.InsertionInfo.AddTourInsertionInfo(tourInfo); 35 35 … … 47 47 48 48 //drive there 49 double currentDista ce = instance.GetDistance(start, end, solution);50 distance += currentDista ce;49 double currentDistance = instance.GetDistance(start, end, solution); 50 distance += currentDistance; 51 51 52 StopInsertionInfo stopInfo = new StopInsertionInfo(start, end);52 var stopInfo = new StopInsertionInfo(start, end, currentDistance); 53 53 tourInfo.AddStopInsertionInfo(stopInfo); 54 54 } … … 68 68 protected override double GetTourInsertionCosts(IVRPProblemInstance instance, IVRPEncoding solution, TourInsertionInfo tourInsertionInfo, int index, int customer, 69 69 out bool feasible) { 70 StopInsertionInfoinsertionInfo = tourInsertionInfo.GetStopInsertionInfo(index);70 var insertionInfo = tourInsertionInfo.GetStopInsertionInfo(index); 71 71 72 72 double costs = 0; -
branches/OptimizationNetworks/HeuristicLab.Problems.VehicleRouting/3.4/ProblemInstances/VRPEvaluation.cs
r14185 r14677 21 21 22 22 using System.Collections.Generic; 23 using System.Globalization; 24 using System.Linq; 25 using System.Text; 23 26 24 27 namespace HeuristicLab.Problems.VehicleRouting.ProblemInstances { 25 28 public class StopInsertionInfo { 26 29 private int start; 27 28 30 public int Start { 29 31 get { return start; } … … 31 33 32 34 private int end; 33 34 35 public int End { 35 36 get { return end; } 36 37 } 37 38 38 public StopInsertionInfo(int start, int end) 39 private double distance; 40 public double Distance { 41 get { return distance; } 42 } 43 44 public StopInsertionInfo(int start, int end, double distance) 39 45 : base() { 40 46 this.start = start; 41 47 this.end = end; 48 this.distance = distance; 49 } 50 51 protected virtual void GetStopInsertionReport(StringBuilder builder) { 52 builder.Append("From\t"); 53 builder.Append(Start.ToString(CultureInfo.CurrentCulture)); 54 builder.Append("\tto\t"); 55 builder.AppendLine(End.ToString(CultureInfo.CurrentCulture)); 56 builder.Append("Distance:\t"); 57 builder.AppendLine(Distance.ToString(CultureInfo.CurrentCulture)); 58 } 59 60 public virtual void GetReport(StringBuilder builder) { 61 GetStopInsertionReport(builder); 42 62 } 43 63 } … … 46 66 public double Penalty { get; set; } 47 67 public double Quality { get; set; } 68 public double Distance { get { return stopInsertionInfos.Count > 0 ? stopInsertionInfos.Sum(x => x.Distance) : 0; } } 48 69 49 70 public int Vehicle { get; set; } 50 71 51 pr ivateList<StopInsertionInfo> stopInsertionInfos;72 protected List<StopInsertionInfo> stopInsertionInfos; 52 73 53 74 public TourInsertionInfo(int vehicle) … … 68 89 return stopInsertionInfos.Count; 69 90 } 91 92 protected virtual void GetTourInsertionReport(StringBuilder builder) { 93 builder.AppendLine("=== Tour ==="); 94 builder.Append("Vehicle:\t"); 95 builder.AppendLine(Vehicle.ToString(CultureInfo.CurrentCulture)); 96 builder.Append("Distance:\t"); 97 builder.AppendLine(Distance.ToString(CultureInfo.CurrentCulture)); 98 builder.Append("Quality:\t"); 99 builder.AppendLine(Quality.ToString(CultureInfo.CurrentCulture)); 100 builder.Append("Penalty:\t"); 101 builder.AppendLine(Penalty.ToString(CultureInfo.CurrentCulture)); 102 } 103 104 public virtual void GetReport(StringBuilder builder) { 105 GetTourInsertionReport(builder); 106 builder.AppendLine("==== Stops ===="); 107 for (var i = 0; i < stopInsertionInfos.Count; i++) { 108 stopInsertionInfos[i].GetReport(builder); 109 } 110 } 70 111 } 71 112 … … 85 126 return tourInsertionInfos[tour]; 86 127 } 128 129 protected virtual void GetInsertionReport(StringBuilder builder) { 130 builder.AppendLine("== VRP Route Report =="); 131 } 132 133 public virtual void GetReport(StringBuilder builder) { 134 GetInsertionReport(builder); 135 for (var i = 0; i < tourInsertionInfos.Count; i++) { 136 tourInsertionInfos[i].GetReport(builder); 137 } 138 } 87 139 } 88 140 … … 98 150 InsertionInfo = new InsertionInfo(); 99 151 } 152 153 protected virtual void GetEvaluationReport(StringBuilder builder) { 154 builder.AppendLine("= VRP Solution Report ="); 155 builder.Append("Quality:\t"); 156 builder.AppendLine(Quality.ToString(CultureInfo.CurrentCulture)); 157 builder.Append("Penalty:\t"); 158 builder.AppendLine(Penalty.ToString(CultureInfo.CurrentCulture)); 159 builder.Append("Distance:\t"); 160 builder.AppendLine(Distance.ToString(CultureInfo.CurrentCulture)); 161 builder.Append("Vehicles used:\t"); 162 builder.AppendLine(VehicleUtilization.ToString(CultureInfo.CurrentCulture)); 163 } 164 165 public virtual void GetReport(StringBuilder builder) { 166 GetEvaluationReport(builder); 167 InsertionInfo.GetReport(builder); 168 } 100 169 } 101 170 }
Note: See TracChangeset
for help on using the changeset viewer.