Changeset 6710 for branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4
- Timestamp:
- 09/06/11 13:00:12 (13 years ago)
- Location:
- branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4
- Files:
-
- 14 added
- 3 deleted
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Analyzer/BestSolution/Capacitated/BestCapacitatedVRPSolutionAnalyzer.cs
r4752 r6710 70 70 Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>("Overload", "The overloads of the VRP solutions which should be analyzed.")); 71 71 72 Parameters.Add(new LookupParameter<VRPSolution>("BestSolution", "The best TSP solution."));72 Parameters.Add(new LookupParameter<VRPSolution>("BestSolution", "The best VRP solution.")); 73 73 Parameters.Add(new ValueLookupParameter<ResultCollection>("Results", "The result collection where the best VRP solution should be stored.")); 74 74 } … … 91 91 int i = qualities.Select((x, index) => new { index, x.Value }).OrderBy(x => x.Value).First().index; 92 92 93 IVRPEncoding best = solutions[i] as IVRPEncoding;94 93 VRPSolution solution = BestSolutionParameter.ActualValue; 95 if (!results.ContainsKey("Best VRP Solution Overload")) { 96 results.Add(new Result("Best VRP Solution Overload", new DoubleValue(overloads[i].Value))); 97 } else { 98 if (qualities[i].Value <= solution.Quality.Value) { 99 (results["Best VRP Solution Overload"].Value as DoubleValue).Value = overloads[i].Value; 94 if (solution != null) { 95 if (!results.ContainsKey("Best VRP Solution Overload")) { 96 results.Add(new Result("Best VRP Solution Overload", new DoubleValue(overloads[i].Value))); 97 } else { 98 if (qualities[i].Value <= solution.Quality.Value) { 99 (results["Best VRP Solution Overload"].Value as DoubleValue).Value = overloads[i].Value; 100 } 100 101 } 101 102 } -
branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Analyzer/BestSolution/TimeWindowed/BestTimeWindowedVRPSolutionAnalyzer.cs
r4752 r6710 73 73 Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>("Tardiness", "The tardiness of the VRP solutions which should be analyzed.")); 74 74 Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>("TravelTime", "The travel times of the VRP solutions which should be analyzed.")); 75 76 Parameters.Add(new LookupParameter<VRPSolution>("BestSolution", "The best TSP solution."));75 76 Parameters.Add(new LookupParameter<VRPSolution>("BestSolution", "The best VRP solution.")); 77 77 Parameters.Add(new ValueLookupParameter<ResultCollection>("Results", "The result collection where the best VRP solution should be stored.")); 78 78 } … … 96 96 int i = qualities.Select((x, index) => new { index, x.Value }).OrderBy(x => x.Value).First().index; 97 97 98 IVRPEncoding best = solutions[i] as IVRPEncoding;99 98 VRPSolution solution = BestSolutionParameter.ActualValue; 100 if (!results.ContainsKey("Best VRP Solution Tardiness")) { 101 results.Add(new Result("Best VRP Solution Tardiness", new DoubleValue(tardinesses[i].Value))); 102 results.Add(new Result("Best VRP Solution TravelTime", new DoubleValue(travelTimes[i].Value))); 103 } else { 104 if (qualities[i].Value <= solution.Quality.Value) { 105 (results["Best VRP Solution Tardiness"].Value as DoubleValue).Value = tardinesses[i].Value; 106 (results["Best VRP Solution TravelTime"].Value as DoubleValue).Value = travelTimes[i].Value; 99 if (solution != null) { 100 if (!results.ContainsKey("Best VRP Solution Tardiness")) { 101 results.Add(new Result("Best VRP Solution Tardiness", new DoubleValue(tardinesses[i].Value))); 102 results.Add(new Result("Best VRP Solution TravelTime", new DoubleValue(travelTimes[i].Value))); 103 } else { 104 if (qualities[i].Value <= solution.Quality.Value) { 105 (results["Best VRP Solution Tardiness"].Value as DoubleValue).Value = tardinesses[i].Value; 106 (results["Best VRP Solution TravelTime"].Value as DoubleValue).Value = travelTimes[i].Value; 107 } 107 108 } 108 109 } -
branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Alba/AlbaEncoding.cs
r5201 r6710 33 33 [Item("AlbaEncoding", "Represents an Alba encoding of VRP solutions. It is implemented as described in Alba, E. and Dorronsoro, B. (2004). Solving the Vehicle Routing Problem by Using Cellular Genetic Algorithms.")] 34 34 [StorableClass] 35 public class AlbaEncoding : PermutationEncoding, I SingleDepotEncoding, ITimeWindowedEncoding, IHeterogenousCapacitatedEncoding {35 public class AlbaEncoding : PermutationEncoding, IHeterogenousCapacitatedEncoding { 36 36 #region IVRPEncoding Members 37 37 public override List<Tour> GetTours() { -
branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Crossovers/PotvinInsertionBasedCrossover.cs
r6608 r6710 27 27 using System; 28 28 using HeuristicLab.Parameters; 29 using HeuristicLab.Problems.VehicleRouting.ProblemInstances; 29 30 30 31 namespace HeuristicLab.Problems.VehicleRouting.Encodings.Potvin { … … 151 152 int city, bool allowInfeasible, out int place) { 152 153 place = -1; 154 155 if (tour.Stops.Contains(city)) 156 return false; 157 153 158 bool bestFeasible = false; 154 159 double minDetour = 0; 155 160 161 VRPEvaluation eval = ProblemInstance.Evaluate(tour); 162 double length = eval.Quality; 156 163 for (int i = 0; i <= tour.Stops.Count; i++) { 157 double length = tour.GetTourLength(ProblemInstance);158 159 164 tour.Stops.Insert(i, city); 160 165 161 bool feasible = ProblemInstance.Feasible(tour); 166 eval = ProblemInstance.Evaluate(tour); 167 bool feasible = ProblemInstance.Feasible(eval); 162 168 163 169 if (feasible || allowInfeasible && !bestFeasible) { 164 double newLength = tour.GetTourLength(ProblemInstance);170 double newLength = eval.Quality; 165 171 double detour = newLength - length; 166 172 -
branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/PotvinEncoding.cs
r6607 r6710 35 35 [Item("PotvinEncoding", "Represents a potvin encoding of VRP solutions. It is implemented as described in Potvin, J.-Y. and Bengio, S. (1996). The Vehicle Routing Problem with Time Windows - Part II: Genetic Search. INFORMS Journal of Computing, 8:165–172.")] 36 36 [StorableClass] 37 public class PotvinEncoding : TourEncoding , ISingleDepotEncoding, ITimeWindowedEncoding, IHomogenousCapacitatedEncoding{37 public class PotvinEncoding : TourEncoding { 38 38 [Storable] 39 39 public List<int> Unrouted { get; set; } … … 115 115 for (int tour = 0; tour < Tours.Count; tour++) { 116 116 if (tour != routeToAvoid) { 117 VRPEvaluation eval = ProblemInstance.Evaluate(Tours[tour]); 118 double length = eval.Quality; 119 117 120 for (int i = 0; i <= Tours[tour].Stops.Count; i++) { 118 double length = GetTourLength(Tours[tour]);119 120 121 Tours[tour].Stops.Insert(i, city); 121 122 122 bool feasible = ProblemInstance.Feasible(Tours[tour]); 123 eval = ProblemInstance.Evaluate(Tours[tour]); 124 bool feasible = ProblemInstance.Feasible(eval); 123 125 124 126 if (feasible || allowInfeasible && !bestFeasible) { 125 double newLength = GetTourLength(Tours[tour]);127 double newLength = eval.Quality; 126 128 double detour = newLength - length; 127 129 -
branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Prins/PrinsEncoding.cs
r6607 r6710 66 66 feasible = ProblemInstance.Feasible(eval); 67 67 68 if (feasible ) {68 if (feasible || j == i) { 69 69 if (V[i - 1] + cost < V[j]) { 70 70 V[j] = V[i - 1] + cost; -
branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/HeuristicLab.Problems.VehicleRouting-3.4.csproj
r6607 r6710 113 113 <Compile Include="Analyzer\BestAverageWorstTours\Capacitated\BestAverageWorstCapacitatedVRPToursCalculator.cs" /> 114 114 <Compile Include="Analyzer\BestAverageWorstTours\Capacitated\BestCapacitatedVRPToursMemorizer.cs" /> 115 <Compile Include="Analyzer\BestAverageWorstTours\PickupAndDelivery\BestAverageWorstPickupAndDeliveryVRPToursAnalyzer.cs" /> 116 <Compile Include="Analyzer\BestAverageWorstTours\PickupAndDelivery\BestAverageWorstPickupAndDeliveryVRPToursCalculator.cs" /> 117 <Compile Include="Analyzer\BestAverageWorstTours\PickupAndDelivery\BestPickupAndDeliveryVRPToursMemorizer.cs" /> 115 118 <Compile Include="Analyzer\BestAverageWorstTours\TimeWindowed\BestAverageWorstTimeWindowedVRPToursAnalyzer.cs" /> 116 119 <Compile Include="Analyzer\BestAverageWorstTours\TimeWindowed\BestAverageWorstTimeWindowedVRPToursCalculator.cs" /> … … 118 121 <Compile Include="Analyzer\BestSolution\BestVRPSolutionAnalyzer.cs" /> 119 122 <Compile Include="Analyzer\BestSolution\Capacitated\BestCapacitatedVRPSolutionAnalyzer.cs" /> 123 <Compile Include="Analyzer\BestSolution\PickupAndDelivery\BestPickupAndDeliveryVRPSolutionAnalyzer.cs" /> 120 124 <Compile Include="Analyzer\BestSolution\TimeWindowed\BestTimeWindowedVRPSolutionAnalyzer.cs" /> 121 125 <Compile Include="Analyzer\VRPSolution.cs" /> … … 249 253 <Compile Include="Interfaces\IVRPEncoding.cs" /> 250 254 <Compile Include="Interfaces\IVRPProblemInstance.cs" /> 255 <Compile Include="Parsers\LiLimParser.cs" /> 256 <Compile Include="ProblemInstances\SingleDepotVRP\CVRP\CVRPTW\CVRPPDTW\CVRPPDTWProblemInstance.cs" /> 257 <Compile Include="ProblemInstances\SingleDepotVRP\CVRP\CVRPTW\CVRPPDTW\CVRPPDTWEvaluation.cs" /> 258 <Compile Include="ProblemInstances\SingleDepotVRP\CVRP\CVRPTW\CVRPPDTW\CVRPPDTWEvaluator.cs" /> 251 259 <Compile Include="SolutionParser.cs" /> 252 260 <Compile Include="Variants\Capacitated\Heterogenous\IHeterogenousCapacitatedProblemInstance.cs" /> 253 261 <Compile Include="Variants\Capacitated\Heterogenous\IHeterogenousCapacitatedOperator.cs" /> 254 262 <Compile Include="Variants\Capacitated\Heterogenous\IHeterogenousCapacitatedEncoding.cs" /> 255 <Compile Include="Variants\Capacitated\Homogenous\IHomogenousCapacitatedEncoding.cs" />256 263 <Compile Include="Variants\Capacitated\Homogenous\IHomogenousCapacitatedOperator.cs" /> 257 264 <Compile Include="Variants\Capacitated\Homogenous\IHomogenousCapacitatedProblemInstance.cs" /> … … 259 266 <Compile Include="Variants\Capacitated\ICapacitatedOperator.cs" /> 260 267 <Compile Include="Variants\General\IGeneralVRPOperator.cs" /> 268 <Compile Include="Variants\PickupAndDelivery\IPickupAndDeliveryOperator.cs" /> 269 <Compile Include="Variants\PickupAndDelivery\IPickupAndDeliveryProblemInstance.cs" /> 261 270 <Compile Include="Variants\SingleDepot\ISingleDepotOperator.cs" /> 262 <Compile Include="Variants\SingleDepot\ISingleDepotEncoding.cs" />263 271 <Compile Include="Variants\SingleDepot\ISingleDepotProblemInstance.cs" /> 264 272 <Compile Include="Variants\TimeWindowed\ITimeWindowedProblemInstance.cs" /> 265 273 <Compile Include="Variants\TimeWindowed\ITimeWindowedOperator.cs" /> 266 <Compile Include="Variants\TimeWindowed\ITimeWindowedEncoding.cs" />267 274 <Compile Include="Parsers\ORLIBParser.cs" /> 268 275 <Compile Include="ProblemInstances\SingleDepotVRP\CVRP\CVRPTW\CVRPTWProblemInstance.cs" /> -
branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/ProblemInstances/SingleDepotVRP/CVRP/CVRPProblemInstance.cs
r5127 r6710 76 76 public CVRPProblemInstance() { 77 77 Parameters.Add(new ValueParameter<DoubleValue>("Capacity", "The capacity of each vehicle.", new DoubleValue(0))); 78 Parameters.Add(new ValueParameter<DoubleValue>("EvalOverloadPenalty", "The overload penalty considered in the evaluation.", new DoubleValue(1 )));78 Parameters.Add(new ValueParameter<DoubleValue>("EvalOverloadPenalty", "The overload penalty considered in the evaluation.", new DoubleValue(100))); 79 79 80 80 AttachEventHandlers(); -
branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/ProblemInstances/SingleDepotVRP/CVRP/CVRPTW/CVRPTWProblemInstance.cs
r5127 r6710 102 102 103 103 Parameters.Add(new ValueParameter<DoubleValue>("EvalTimeFactor", "The time factor considered in the evaluation.", new DoubleValue(0))); 104 Parameters.Add(new ValueParameter<DoubleValue>("EvalTardinessPenalty", "The tardiness penalty considered in the evaluation.", new DoubleValue(1 )));104 Parameters.Add(new ValueParameter<DoubleValue>("EvalTardinessPenalty", "The tardiness penalty considered in the evaluation.", new DoubleValue(100))); 105 105 106 106 AttachEventHandlers(); -
branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Variants/Capacitated/Heterogenous/IHeterogenousCapacitatedEncoding.cs
r4376 r6710 24 24 using System.Linq; 25 25 using System.Text; 26 using HeuristicLab.Problems.VehicleRouting.Interfaces; 26 27 27 28 namespace HeuristicLab.Problems.VehicleRouting.Variants { 28 public interface IHeterogenousCapacitatedEncoding : I HomogenousCapacitatedEncoding {29 public interface IHeterogenousCapacitatedEncoding : IVRPEncoding { 29 30 int GetVehicleAssignment(int tour); 30 31 } -
branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/VehicleRoutingProblem.cs
r5867 r6710 243 243 #endregion 244 244 245 public void ImportFromLiLim(string liLimFileName) { 246 LiLimParser parser = new LiLimParser(liLimFileName); 247 parser.Parse(); 248 249 CVRPPDTWProblemInstance problem = new CVRPPDTWProblemInstance(); 250 251 problem.Coordinates = new DoubleMatrix(parser.Coordinates); 252 problem.Vehicles.Value = parser.Vehicles; 253 problem.Capacity.Value = parser.Capacity; 254 problem.Demand = new DoubleArray(parser.Demands); 255 problem.ReadyTime = new DoubleArray(parser.Readytimes); 256 problem.DueTime = new DoubleArray(parser.Duetimes); 257 problem.ServiceTime = new DoubleArray(parser.Servicetimes); 258 problem.PickupDeliveryLocation = new IntArray(parser.PickupDeliveryLocations); 259 260 this.ProblemInstance = problem; 261 262 OnReset(); 263 } 264 245 265 public void ImportFromSolomon(string solomonFileName) { 246 266 SolomonParser parser = new SolomonParser(solomonFileName);
Note: See TracChangeset
for help on using the changeset viewer.