- Timestamp:
- 06/19/12 13:17:29 (13 years ago)
- Location:
- trunk/sources/HeuristicLab.Problems.VehicleRouting/3.4/ProblemInstances
- Files:
-
- 22 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.4/ProblemInstances/MultiDepotVRP/MDCVRP/MDCVRPEvaluator.cs
r7276 r8053 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 0Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 20 20 #endregion 21 21 22 using System; 23 using System.Collections.Generic; 24 using System.Linq; 25 using System.Text; 22 using HeuristicLab.Common; 23 using HeuristicLab.Core; 24 using HeuristicLab.Data; 25 using HeuristicLab.Parameters; 26 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 26 27 using HeuristicLab.Problems.VehicleRouting.Interfaces; 27 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;28 using HeuristicLab.Core;29 using HeuristicLab.Parameters;30 using HeuristicLab.Data;31 using HeuristicLab.Optimization;32 using HeuristicLab.PluginInfrastructure;33 28 using HeuristicLab.Problems.VehicleRouting.Variants; 34 using HeuristicLab.Problems.VehicleRouting.Encodings;35 using HeuristicLab.Common;36 29 37 30 namespace HeuristicLab.Problems.VehicleRouting.ProblemInstances { 38 31 [Item("MDCVRPEvaluator", "Represents a multi depot CVRP evaluator.")] 39 32 [StorableClass] 40 public class MDCVRPEvaluator : VRPEvaluator {33 public class MDCVRPEvaluator : VRPEvaluator { 41 34 public ILookupParameter<DoubleValue> OverloadParameter { 42 35 get { return (ILookupParameter<DoubleValue>)Parameters["Overload"]; } … … 103 96 } 104 97 105 protected override double GetTourInsertionCosts(IVRPProblemInstance instance, IVRPEncoding solution, TourInsertionInfo tourInsertionInfo, int index, int customer, 98 protected override double GetTourInsertionCosts(IVRPProblemInstance instance, IVRPEncoding solution, TourInsertionInfo tourInsertionInfo, int index, int customer, 106 99 out bool feasible) { 107 100 CVRPInsertionInfo insertionInfo = tourInsertionInfo.GetStopInsertionInfo(index) as CVRPInsertionInfo; 108 101 109 102 double costs = 0; 110 103 feasible = tourInsertionInfo.Penalty < double.Epsilon; … … 120 113 feasible = false; 121 114 122 if (insertionInfo.SpareCapacity >= 0)115 if (insertionInfo.SpareCapacity >= 0) 123 116 costs += (demand - insertionInfo.SpareCapacity) * overloadPenalty; 124 117 else 125 118 costs += demand * overloadPenalty; 126 119 } 127 120 128 121 return costs; 129 122 } … … 140 133 OverloadParameter.ActualValue.Value = (tourEvaluation as CVRPEvaluation).Overload; 141 134 } 142 135 143 136 [StorableConstructor] 144 137 protected MDCVRPEvaluator(bool deserializing) : base(deserializing) { } -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.4/ProblemInstances/MultiDepotVRP/MDCVRP/MDCVRPProblemInstance.cs
r7934 r8053 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 0Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.4/ProblemInstances/MultiDepotVRP/MDCVRP/MDCVRPTW/MDCVRPPDTW/MDCVRPPDTWEvaluator.cs
r7276 r8053 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 0Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 22 22 using System; 23 23 using System.Collections.Generic; 24 using System.Linq; 25 using System.Text; 24 using HeuristicLab.Common; 25 using HeuristicLab.Core; 26 using HeuristicLab.Data; 27 using HeuristicLab.Parameters; 28 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 26 29 using HeuristicLab.Problems.VehicleRouting.Interfaces; 27 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;28 using HeuristicLab.Core;29 using HeuristicLab.Parameters;30 using HeuristicLab.Data;31 using HeuristicLab.Optimization;32 using HeuristicLab.PluginInfrastructure;33 30 using HeuristicLab.Problems.VehicleRouting.Variants; 34 using HeuristicLab.Problems.VehicleRouting.Encodings;35 using HeuristicLab.Common;36 31 37 32 namespace HeuristicLab.Problems.VehicleRouting.ProblemInstances { 38 33 [Item("MDCVRPPDTWEvaluator", "Represents a multi depot CVRPPDTW evaluator.")] 39 34 [StorableClass] 40 public class MDCVRPPDTWEvaluator : MDCVRPTWEvaluator {35 public class MDCVRPPDTWEvaluator : MDCVRPTWEvaluator { 41 36 public ILookupParameter<IntValue> PickupViolationsParameter { 42 37 get { return (ILookupParameter<IntValue>)Parameters["PickupViolations"]; } … … 149 144 150 145 double spareCapacity = capacity - currentLoad; 151 CVRPPDTWInsertionInfo stopInfo = new CVRPPDTWInsertionInfo(start, end, spareCapacity, tourStartTime, 146 CVRPPDTWInsertionInfo stopInfo = new CVRPPDTWInsertionInfo(start, end, spareCapacity, tourStartTime, 152 147 arrivalTime, time, spareTime, waitTime, new List<int>(stops.Keys), arrivalSpareCapacity); 153 148 tourInfo.AddStopInsertionInfo(stopInfo); … … 187 182 } 188 183 189 protected override double GetTourInsertionCosts(IVRPProblemInstance instance, IVRPEncoding solution, TourInsertionInfo tourInsertionInfo, int index, int customer, 184 protected override double GetTourInsertionCosts(IVRPProblemInstance instance, IVRPEncoding solution, TourInsertionInfo tourInsertionInfo, int index, int customer, 190 185 out bool feasible) { 191 186 CVRPPDTWInsertionInfo insertionInfo = tourInsertionInfo.GetStopInsertionInfo(index) as CVRPPDTWInsertionInfo; … … 327 322 PickupViolationsParameter.ActualValue.Value = (tourEvaluation as CVRPPDTWEvaluation).PickupViolations; 328 323 } 329 324 330 325 [StorableConstructor] 331 326 protected MDCVRPPDTWEvaluator(bool deserializing) : base(deserializing) { } -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.4/ProblemInstances/MultiDepotVRP/MDCVRP/MDCVRPTW/MDCVRPPDTW/MDCVRPPDTWProblemInstance.cs
r7934 r8053 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 0Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.4/ProblemInstances/MultiDepotVRP/MDCVRP/MDCVRPTW/MDCVRPTWEvaluator.cs
r7276 r8053 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 0Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 21 21 22 22 using System; 23 using System.Collections.Generic; 24 using System.Linq; 25 using System.Text; 23 using HeuristicLab.Common; 24 using HeuristicLab.Core; 25 using HeuristicLab.Data; 26 using HeuristicLab.Parameters; 27 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 26 28 using HeuristicLab.Problems.VehicleRouting.Interfaces; 27 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;28 using HeuristicLab.Core;29 using HeuristicLab.Parameters;30 using HeuristicLab.Data;31 using HeuristicLab.Optimization;32 using HeuristicLab.PluginInfrastructure;33 29 using HeuristicLab.Problems.VehicleRouting.Variants; 34 using HeuristicLab.Problems.VehicleRouting.Encodings;35 using HeuristicLab.Common;36 30 37 31 namespace HeuristicLab.Problems.VehicleRouting.ProblemInstances { 38 32 [Item("MDCVRPTWEvaluator", "Represents a multi depot CVRPTW evaluator.")] 39 33 [StorableClass] 40 public class MDCVRPTWEvaluator : MDCVRPEvaluator {34 public class MDCVRPTWEvaluator : MDCVRPEvaluator { 41 35 public ILookupParameter<DoubleValue> TardinessParameter { 42 36 get { return (ILookupParameter<DoubleValue>)Parameters["Tardiness"]; } … … 130 124 //service 131 125 double currentServiceTime = 0; 132 if (end > 0)126 if (end > 0) 133 127 currentServiceTime = serviceTimes[end - 1]; 134 128 serviceTime += currentServiceTime; … … 193 187 feasible = false; 194 188 195 if (insertionInfo.SpareCapacity >= 0)189 if (insertionInfo.SpareCapacity >= 0) 196 190 costs += (demand - insertionInfo.SpareCapacity) * overloadPenalty; 197 191 else … … 241 235 //arrive later than before, probably don't have to wait 242 236 if (nextStop.WaitingTime > 0) { 243 additionalTime -= Math.Min(additionalTime, nextStop.WaitingTime); 237 additionalTime -= Math.Min(additionalTime, nextStop.WaitingTime); 244 238 } 245 239 … … 248 242 double spare = nextStop.SpareTime - additionalTime; 249 243 if (spare < 0) 250 tardiness += -spare; 244 tardiness += -spare; 251 245 } else { 252 246 tardiness += additionalTime; … … 279 273 TravelTimeParameter.ActualValue.Value = (tourEvaluation as CVRPTWEvaluation).TravelTime; 280 274 } 281 275 282 276 [StorableConstructor] 283 277 protected MDCVRPTWEvaluator(bool deserializing) : base(deserializing) { } -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.4/ProblemInstances/MultiDepotVRP/MDCVRP/MDCVRPTW/MDCVRPTWProblemInstance.cs
r7934 r8053 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 0Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.4/ProblemInstances/MultiDepotVRP/MultiDepotVRPEvaluator.cs
r7276 r8053 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 0Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 20 20 #endregion 21 21 22 using System; 23 using System.Collections.Generic; 24 using System.Linq; 25 using System.Text; 22 using HeuristicLab.Common; 23 using HeuristicLab.Core; 24 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 26 25 using HeuristicLab.Problems.VehicleRouting.Interfaces; 27 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;28 using HeuristicLab.Core;29 using HeuristicLab.Parameters;30 using HeuristicLab.Data;31 using HeuristicLab.Optimization;32 using HeuristicLab.PluginInfrastructure;33 using HeuristicLab.Problems.VehicleRouting.Variants;34 using HeuristicLab.Problems.VehicleRouting.Encodings;35 using HeuristicLab.Common;36 26 37 27 … … 39 29 [Item("SingleDepotVRPEvaluator", "Represents a single depot VRP evaluator.")] 40 30 [StorableClass] 41 public class MultiDepotVRPEvaluator : VRPEvaluator {31 public class MultiDepotVRPEvaluator : VRPEvaluator { 42 32 protected override void EvaluateTour(VRPEvaluation eval, IVRPProblemInstance instance, Tour tour, IVRPEncoding solution) { 43 33 TourInsertionInfo tourInfo = new TourInsertionInfo(solution.GetVehicleAssignment(solution.GetTourIndex(tour))); 44 34 eval.InsertionInfo.AddTourInsertionInfo(tourInfo); 45 35 46 36 double distance = 0.0; 47 37 double quality = 0.0; … … 79 69 out bool feasible) { 80 70 StopInsertionInfo insertionInfo = tourInsertionInfo.GetStopInsertionInfo(index); 81 71 82 72 double costs = 0; 83 73 feasible = true; … … 88 78 return costs; 89 79 } 90 80 91 81 [StorableConstructor] 92 82 protected MultiDepotVRPEvaluator(bool deserializing) : base(deserializing) { } -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.4/ProblemInstances/MultiDepotVRP/MultiDepotVRPProblemInstance.cs
r6854 r8053 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 0Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 20 20 #endregion 21 21 22 using System;23 22 using System.Collections.Generic; 24 23 using System.Linq; 25 using System.Text; 26 using HeuristicLab.Problems.VehicleRouting.Interfaces; 27 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 24 using HeuristicLab.Common; 28 25 using HeuristicLab.Core; 29 using HeuristicLab.Parameters;30 26 using HeuristicLab.Data; 31 27 using HeuristicLab.Optimization; 28 using HeuristicLab.Parameters; 29 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 32 30 using HeuristicLab.PluginInfrastructure; 31 using HeuristicLab.Problems.VehicleRouting.Interfaces; 33 32 using HeuristicLab.Problems.VehicleRouting.Variants; 34 using HeuristicLab.Common;35 33 36 34 namespace HeuristicLab.Problems.VehicleRouting.ProblemInstances { 37 35 [Item("MultiDepotVRPProblemInstance", "Represents a multi depot VRP instance.")] 38 36 [StorableClass] 39 public class MultiDepotVRPProblemInstance : VRPProblemInstance, IMultiDepotProblemInstance {37 public class MultiDepotVRPProblemInstance : VRPProblemInstance, IMultiDepotProblemInstance { 40 38 protected IValueParameter<IntValue> DepotsParameter { 41 39 get { return (IValueParameter<IntValue>)Parameters["Depots"]; } … … 60 58 } 61 59 } 62 60 63 61 protected override IEnumerable<IOperator> GetOperators() { 64 62 return ApplicationManager.Manager.GetInstances<IMultiDepotOperator>().Cast<IOperator>(); … … 95 93 public override double[] GetCoordinates(int city) { 96 94 double[] coordinates; 97 95 98 96 if (city == 0) { 99 97 //calculate centroid … … 119 117 public int GetDepot(int customer, IVRPEncoding solution) { 120 118 int depot = -1; 121 119 122 120 Tour tour = 123 121 solution.GetTours().FirstOrDefault(t => t.Stops.Contains(customer)); … … 135 133 if (start == 0 && end == 0) 136 134 return 0; 137 135 138 136 if (start == 0) { 139 137 start = GetDepot(end, solution); … … 146 144 end += Depots.Value - 1; 147 145 } 148 146 149 147 return base.GetDistance(start, end, solution); 150 148 } 151 149 152 public override double GetInsertionDistance(int start, int customer, int end, IVRPEncoding solution, 150 public override double GetInsertionDistance(int start, int customer, int end, IVRPEncoding solution, 153 151 out double startDistance, out double endDistance) { 154 152 if (start == 0) { … … 163 161 } 164 162 customer += Depots.Value - 1; 165 163 166 164 double distance = base.GetDistance(start, end, solution); 167 165 … … 173 171 return newDistance - distance; 174 172 } 175 173 176 174 [StorableConstructor] 177 175 protected MultiDepotVRPProblemInstance(bool deserializing) : base(deserializing) { } -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.4/ProblemInstances/SingleDepotVRP/CVRP/CVRPEvaluation.cs
r6752 r8053 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 0Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 20 20 #endregion 21 21 22 using System;23 using System.Collections.Generic;24 using System.Linq;25 using System.Text;26 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;27 using HeuristicLab.Core;28 using HeuristicLab.Common;29 22 30 23 namespace HeuristicLab.Problems.VehicleRouting.ProblemInstances { … … 41 34 } 42 35 } 43 44 public class CVRPEvaluation : VRPEvaluation {36 37 public class CVRPEvaluation : VRPEvaluation { 45 38 public double Overload { get; set; } 46 39 } -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.4/ProblemInstances/SingleDepotVRP/CVRP/CVRPEvaluator.cs
r7276 r8053 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 0Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 20 20 #endregion 21 21 22 using System; 23 using System.Collections.Generic; 24 using System.Linq; 25 using System.Text; 22 using HeuristicLab.Common; 23 using HeuristicLab.Core; 24 using HeuristicLab.Data; 25 using HeuristicLab.Parameters; 26 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 26 27 using HeuristicLab.Problems.VehicleRouting.Interfaces; 27 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;28 using HeuristicLab.Core;29 using HeuristicLab.Parameters;30 using HeuristicLab.Data;31 using HeuristicLab.Optimization;32 using HeuristicLab.PluginInfrastructure;33 28 using HeuristicLab.Problems.VehicleRouting.Variants; 34 using HeuristicLab.Problems.VehicleRouting.Encodings;35 using HeuristicLab.Common;36 29 37 30 namespace HeuristicLab.Problems.VehicleRouting.ProblemInstances { 38 31 [Item("CVRPEvaluator", "Represents a single depot CVRP evaluator.")] 39 32 [StorableClass] 40 public class CVRPEvaluator : VRPEvaluator {33 public class CVRPEvaluator : VRPEvaluator { 41 34 public ILookupParameter<DoubleValue> OverloadParameter { 42 35 get { return (ILookupParameter<DoubleValue>)Parameters["Overload"]; } … … 51 44 eval.InsertionInfo.AddTourInsertionInfo(tourInfo); 52 45 double originalQuality = eval.Quality; 53 46 54 47 IHomogenousCapacitatedProblemInstance cvrpInstance = instance as IHomogenousCapacitatedProblemInstance; 55 48 DoubleArray demand = instance.Demand; … … 105 98 } 106 99 107 protected override double GetTourInsertionCosts(IVRPProblemInstance instance, IVRPEncoding solution, TourInsertionInfo tourInsertionInfo, int index, int customer, 100 protected override double GetTourInsertionCosts(IVRPProblemInstance instance, IVRPEncoding solution, TourInsertionInfo tourInsertionInfo, int index, int customer, 108 101 out bool feasible) { 109 102 CVRPInsertionInfo insertionInfo = tourInsertionInfo.GetStopInsertionInfo(index) as CVRPInsertionInfo; 110 103 111 104 double costs = 0; 112 105 feasible = tourInsertionInfo.Penalty < double.Epsilon; … … 125 118 feasible = false; 126 119 127 if (insertionInfo.SpareCapacity >= 0)120 if (insertionInfo.SpareCapacity >= 0) 128 121 costs += (demand - insertionInfo.SpareCapacity) * overloadPenalty; 129 122 else 130 123 costs += demand * overloadPenalty; 131 124 } 132 125 133 126 return costs; 134 127 } … … 145 138 OverloadParameter.ActualValue.Value = (tourEvaluation as CVRPEvaluation).Overload; 146 139 } 147 140 148 141 [StorableConstructor] 149 142 protected CVRPEvaluator(bool deserializing) : base(deserializing) { } -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.4/ProblemInstances/SingleDepotVRP/CVRP/CVRPProblemInstance.cs
r7934 r8053 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 0Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.4/ProblemInstances/SingleDepotVRP/CVRP/CVRPTW/CVRPPDTW/CVRPPDTWEvaluation.cs
r6855 r8053 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 0Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 20 20 #endregion 21 21 22 using System;23 22 using System.Collections.Generic; 24 using System.Linq;25 using System.Text;26 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;27 using HeuristicLab.Common;28 23 29 24 namespace HeuristicLab.Problems.VehicleRouting.ProblemInstances { … … 38 33 39 34 public double ArrivalSpareCapacity { 40 get { return arrivalSpareCapacity; 35 get { return arrivalSpareCapacity; } 41 36 } 42 37 43 public CVRPPDTWInsertionInfo(int start, int end, double spareCapacity, double tourStartTime, 38 public CVRPPDTWInsertionInfo(int start, int end, double spareCapacity, double tourStartTime, 44 39 double arrivalTime, double leaveTime, double spareTime, double waitingTime, List<int> visited, double arrivalSpareCapacity) 45 40 : base(start, end, spareCapacity, tourStartTime, arrivalTime, leaveTime, spareTime, waitingTime) { 46 47 41 this.visited = visited; 42 this.arrivalSpareCapacity = arrivalSpareCapacity; 48 43 } 49 44 } 50 51 public class CVRPPDTWEvaluation : CVRPTWEvaluation {45 46 public class CVRPPDTWEvaluation : CVRPTWEvaluation { 52 47 public int PickupViolations { get; set; } 53 48 } -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.4/ProblemInstances/SingleDepotVRP/CVRP/CVRPTW/CVRPPDTW/CVRPPDTWEvaluator.cs
r7276 r8053 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 0Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 22 22 using System; 23 23 using System.Collections.Generic; 24 using System.Linq; 25 using System.Text; 24 using HeuristicLab.Common; 25 using HeuristicLab.Core; 26 using HeuristicLab.Data; 27 using HeuristicLab.Parameters; 28 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 26 29 using HeuristicLab.Problems.VehicleRouting.Interfaces; 27 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;28 using HeuristicLab.Core;29 using HeuristicLab.Parameters;30 using HeuristicLab.Data;31 using HeuristicLab.Optimization;32 using HeuristicLab.PluginInfrastructure;33 30 using HeuristicLab.Problems.VehicleRouting.Variants; 34 using HeuristicLab.Problems.VehicleRouting.Encodings;35 using HeuristicLab.Common;36 31 37 32 namespace HeuristicLab.Problems.VehicleRouting.ProblemInstances { 38 33 [Item("CVRPPDTWEvaluator", "Represents a single depot CVRPPDTW evaluator.")] 39 34 [StorableClass] 40 public class CVRPPDTWEvaluator : CVRPTWEvaluator {35 public class CVRPPDTWEvaluator : CVRPTWEvaluator { 41 36 public ILookupParameter<IntValue> PickupViolationsParameter { 42 37 get { return (ILookupParameter<IntValue>)Parameters["PickupViolations"]; } … … 119 114 double arrivalSpareCapacity = capacity - currentLoad; 120 115 121 bool validPickupDelivery = 116 bool validPickupDelivery = 122 117 validPickupDelivery = 123 118 ((demand[end] >= 0) || … … 134 129 135 130 double spareCapacity = capacity - currentLoad; 136 CVRPPDTWInsertionInfo stopInfo = new CVRPPDTWInsertionInfo(start, end, spareCapacity, tourStartTime, 131 CVRPPDTWInsertionInfo stopInfo = new CVRPPDTWInsertionInfo(start, end, spareCapacity, tourStartTime, 137 132 arrivalTime, time, spareTime, waitTime, new List<int>(stops.Keys), arrivalSpareCapacity); 138 133 tourInfo.AddStopInsertionInfo(stopInfo); … … 172 167 } 173 168 174 protected override double GetTourInsertionCosts(IVRPProblemInstance instance, IVRPEncoding solution, TourInsertionInfo tourInsertionInfo, int index, int customer, 169 protected override double GetTourInsertionCosts(IVRPProblemInstance instance, IVRPEncoding solution, TourInsertionInfo tourInsertionInfo, int index, int customer, 175 170 out bool feasible) { 176 171 CVRPPDTWInsertionInfo insertionInfo = tourInsertionInfo.GetStopInsertionInfo(index) as CVRPPDTWInsertionInfo; … … 309 304 PickupViolationsParameter.ActualValue.Value = (tourEvaluation as CVRPPDTWEvaluation).PickupViolations; 310 305 } 311 306 312 307 [StorableConstructor] 313 308 protected CVRPPDTWEvaluator(bool deserializing) : base(deserializing) { } -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.4/ProblemInstances/SingleDepotVRP/CVRP/CVRPTW/CVRPPDTW/CVRPPDTWProblemInstance.cs
r7934 r8053 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 0Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.4/ProblemInstances/SingleDepotVRP/CVRP/CVRPTW/CVRPTWEvaluation.cs
r6855 r8053 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 0Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 20 20 #endregion 21 21 22 using System;23 using System.Collections.Generic;24 using System.Linq;25 using System.Text;26 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;27 using HeuristicLab.Common;28 22 29 23 namespace HeuristicLab.Problems.VehicleRouting.ProblemInstances { … … 34 28 get { return tourStartTime; } 35 29 } 36 30 37 31 private double arrivalTime; 38 32 … … 61 55 public CVRPTWInsertionInfo(int start, int end, double spareCapacity, double tourStartTime, double arrivalTime, double leaveTime, double spareTime, double waitingTime) 62 56 : base(start, end, spareCapacity) { 63 64 65 66 67 57 this.tourStartTime = tourStartTime; 58 this.arrivalTime = arrivalTime; 59 this.leaveTime = leaveTime; 60 this.spareTime = spareTime; 61 this.waitingTime = waitingTime; 68 62 } 69 63 } 70 71 public class CVRPTWEvaluation : CVRPEvaluation {64 65 public class CVRPTWEvaluation : CVRPEvaluation { 72 66 public double Tardiness { get; set; } 73 67 public double TravelTime { get; set; } -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.4/ProblemInstances/SingleDepotVRP/CVRP/CVRPTW/CVRPTWEvaluator.cs
r7276 r8053 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 0Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 21 21 22 22 using System; 23 using System.Collections.Generic; 24 using System.Linq; 25 using System.Text; 23 using HeuristicLab.Common; 24 using HeuristicLab.Core; 25 using HeuristicLab.Data; 26 using HeuristicLab.Parameters; 27 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 26 28 using HeuristicLab.Problems.VehicleRouting.Interfaces; 27 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;28 using HeuristicLab.Core;29 using HeuristicLab.Parameters;30 using HeuristicLab.Data;31 using HeuristicLab.Optimization;32 using HeuristicLab.PluginInfrastructure;33 29 using HeuristicLab.Problems.VehicleRouting.Variants; 34 using HeuristicLab.Problems.VehicleRouting.Encodings;35 using HeuristicLab.Common;36 30 37 31 namespace HeuristicLab.Problems.VehicleRouting.ProblemInstances { 38 32 [Item("CVRPTWEvaluator", "Represents a single depot CVRPTW evaluator.")] 39 33 [StorableClass] 40 public class CVRPTWEvaluator : CVRPEvaluator {34 public class CVRPTWEvaluator : CVRPEvaluator { 41 35 public ILookupParameter<DoubleValue> TardinessParameter { 42 36 get { return (ILookupParameter<DoubleValue>)Parameters["Tardiness"]; } … … 55 49 eval.InsertionInfo.AddTourInsertionInfo(tourInfo); 56 50 double originalQuality = eval.Quality; 57 51 58 52 IHomogenousCapacitatedProblemInstance cvrpInstance = instance as IHomogenousCapacitatedProblemInstance; 59 53 DoubleArray demand = instance.Demand; … … 111 105 currentWaitingTime = readyTime[end] - time; 112 106 113 double waitTime = readyTime[end] -time;107 double waitTime = readyTime[end] - time; 114 108 115 109 waitingTime += currentWaitingTime; … … 225 219 //arrive later than before, probably don't have to wait 226 220 if (nextStop.WaitingTime > 0) { 227 additionalTime -= Math.Min(additionalTime, nextStop.WaitingTime); 221 additionalTime -= Math.Min(additionalTime, nextStop.WaitingTime); 228 222 } 229 223 … … 232 226 double spare = nextStop.SpareTime - additionalTime; 233 227 if (spare < 0) 234 tardiness += -spare; 228 tardiness += -spare; 235 229 } else { 236 230 tardiness += additionalTime; … … 263 257 TravelTimeParameter.ActualValue.Value = (tourEvaluation as CVRPTWEvaluation).TravelTime; 264 258 } 265 259 266 260 [StorableConstructor] 267 261 protected CVRPTWEvaluator(bool deserializing) : base(deserializing) { } -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.4/ProblemInstances/SingleDepotVRP/CVRP/CVRPTW/CVRPTWProblemInstance.cs
r7934 r8053 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 0Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.4/ProblemInstances/SingleDepotVRP/SingleDepotVRPEvaluator.cs
r7276 r8053 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 0Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 20 20 #endregion 21 21 22 using System; 23 using System.Collections.Generic; 24 using System.Linq; 25 using System.Text; 22 using HeuristicLab.Common; 23 using HeuristicLab.Core; 24 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 26 25 using HeuristicLab.Problems.VehicleRouting.Interfaces; 27 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;28 using HeuristicLab.Core;29 using HeuristicLab.Parameters;30 using HeuristicLab.Data;31 using HeuristicLab.Optimization;32 using HeuristicLab.PluginInfrastructure;33 using HeuristicLab.Problems.VehicleRouting.Variants;34 using HeuristicLab.Problems.VehicleRouting.Encodings;35 using HeuristicLab.Common;36 26 37 27 … … 39 29 [Item("SingleDepotVRPEvaluator", "Represents a single depot VRP evaluator.")] 40 30 [StorableClass] 41 public class SingleDepotVRPEvaluator : VRPEvaluator {31 public class SingleDepotVRPEvaluator : VRPEvaluator { 42 32 protected override void EvaluateTour(VRPEvaluation eval, IVRPProblemInstance instance, Tour tour, IVRPEncoding solution) { 43 33 TourInsertionInfo tourInfo = new TourInsertionInfo(solution.GetVehicleAssignment(solution.GetTourIndex(tour))); 44 34 eval.InsertionInfo.AddTourInsertionInfo(tourInfo); 45 35 46 36 double distance = 0.0; 47 37 double quality = 0.0; … … 79 69 out bool feasible) { 80 70 StopInsertionInfo insertionInfo = tourInsertionInfo.GetStopInsertionInfo(index); 81 71 82 72 double costs = 0; 83 73 feasible = true; … … 92 82 return costs; 93 83 } 94 84 95 85 [StorableConstructor] 96 86 protected SingleDepotVRPEvaluator(bool deserializing) : base(deserializing) { } -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.4/ProblemInstances/SingleDepotVRP/SingleDepotVRPProblemInstance.cs
r4752 r8053 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 0Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 20 20 #endregion 21 21 22 using System;23 22 using System.Collections.Generic; 24 23 using System.Linq; 25 using System.Text; 26 using HeuristicLab.Problems.VehicleRouting.Interfaces; 27 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 24 using HeuristicLab.Common; 28 25 using HeuristicLab.Core; 29 using HeuristicLab.Parameters;30 26 using HeuristicLab.Data; 31 27 using HeuristicLab.Optimization; 28 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 32 29 using HeuristicLab.PluginInfrastructure; 30 using HeuristicLab.Problems.VehicleRouting.Interfaces; 33 31 using HeuristicLab.Problems.VehicleRouting.Variants; 34 using HeuristicLab.Common;35 32 36 33 namespace HeuristicLab.Problems.VehicleRouting.ProblemInstances { 37 34 [Item("SingleDepotVRPProblemInstance", "Represents a single depot VRP instance.")] 38 35 [StorableClass] 39 public class SingleDepotVRPProblemInstance : VRPProblemInstance, ISingleDepotProblemInstance {36 public class SingleDepotVRPProblemInstance : VRPProblemInstance, ISingleDepotProblemInstance { 40 37 protected override IEnumerable<IOperator> GetOperators() { 41 38 return ApplicationManager.Manager.GetInstances<ISingleDepotOperator>().Cast<IOperator>(); … … 65 62 } 66 63 } 67 64 68 65 [StorableConstructor] 69 66 protected SingleDepotVRPProblemInstance(bool deserializing) : base(deserializing) { } -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.4/ProblemInstances/VRPEvaluation.cs
r7276 r8053 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 0Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 20 20 #endregion 21 21 22 using System;23 22 using System.Collections.Generic; 24 using System.Linq;25 using System.Text;26 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;27 using HeuristicLab.Core;28 using HeuristicLab.Common;29 23 30 24 namespace HeuristicLab.Problems.VehicleRouting.ProblemInstances { 31 public class StopInsertionInfo { 25 public class StopInsertionInfo { 32 26 private int start; 33 27 … … 41 35 get { return end; } 42 36 } 43 37 44 38 public StopInsertionInfo(int start, int end) 45 39 : base() { 46 47 40 this.start = start; 41 this.end = end; 48 42 } 49 43 } … … 67 61 } 68 62 69 public StopInsertionInfo GetStopInsertionInfo(int stop) {63 public StopInsertionInfo GetStopInsertionInfo(int stop) { 70 64 return stopInsertionInfos[stop]; 71 } 65 } 72 66 73 67 public int GetStopCount() { … … 78 72 public class InsertionInfo { 79 73 private List<TourInsertionInfo> tourInsertionInfos; 80 74 81 75 public InsertionInfo() 82 76 : base() { 83 77 tourInsertionInfos = new List<TourInsertionInfo>(); 84 78 } 85 79 86 public void AddTourInsertionInfo(TourInsertionInfo info) { 80 public void AddTourInsertionInfo(TourInsertionInfo info) { 87 81 tourInsertionInfos.Add(info); 88 82 } … … 92 86 } 93 87 } 94 88 95 89 public class VRPEvaluation { 96 90 public double Quality { get; set; } -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.4/ProblemInstances/VRPEvaluator.cs
r7276 r8053 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 0Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 20 20 #endregion 21 21 22 using System; 23 using System.Collections.Generic; 24 using System.Linq; 25 using System.Text; 22 using HeuristicLab.Common; 23 using HeuristicLab.Core; 24 using HeuristicLab.Data; 25 using HeuristicLab.Parameters; 26 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 27 using HeuristicLab.Problems.VehicleRouting.Encodings; 26 28 using HeuristicLab.Problems.VehicleRouting.Interfaces; 27 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;28 using HeuristicLab.Core;29 using HeuristicLab.Parameters;30 using HeuristicLab.Data;31 using HeuristicLab.Optimization;32 using HeuristicLab.PluginInfrastructure;33 using HeuristicLab.Problems.VehicleRouting.Variants;34 using HeuristicLab.Problems.VehicleRouting.Encodings;35 using HeuristicLab.Common;36 29 37 30 namespace HeuristicLab.Problems.VehicleRouting.ProblemInstances { 38 31 [Item("VRPEvaluator", "Represents a VRP evaluator.")] 39 32 [StorableClass] 40 public abstract class VRPEvaluator : VRPOperator, IVRPEvaluator {33 public abstract class VRPEvaluator : VRPOperator, IVRPEvaluator { 41 34 public ILookupParameter<IVRPEncoding> VRPToursParameter { 42 35 get { return (ILookupParameter<IVRPEncoding>)Parameters["VRPTours"]; } 43 36 } 44 37 45 38 #region ISingleObjectiveEvaluator Members 46 39 public ILookupParameter<DoubleValue> QualityParameter { … … 59 52 get { return (ILookupParameter<DoubleValue>)Parameters["Penalty"]; } 60 53 } 61 54 62 55 [StorableConstructor] 63 56 protected VRPEvaluator(bool deserializing) : base(deserializing) { } … … 110 103 instance, 111 104 solution, 112 eval.InsertionInfo.GetTourInsertionInfo(tour), 105 eval.InsertionInfo.GetTourInsertionInfo(tour), 113 106 index, 114 107 customer, out tourFeasible); -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.4/ProblemInstances/VRPProblemInstance.cs
r8006 r8053 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 0Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab.
Note: See TracChangeset
for help on using the changeset viewer.