- Timestamp:
- 09/27/11 13:29:56 (13 years ago)
- Location:
- branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin
- Files:
-
- 1 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Creators/IterativeInsertionCreator.cs
r6788 r6838 101 101 102 102 Tour currentTour = new Tour(); 103 result.Tours.Add(currentTour); 103 104 104 105 int j = random.Next(customers.Count); … … 114 115 } 115 116 116 CVRPEvaluation evaluation = instance.Evaluate (currentTour) as CVRPEvaluation;117 CVRPEvaluation evaluation = instance.EvaluateTour(currentTour, result) as CVRPEvaluation; 117 118 if (result.Tours.Count < instance.Vehicles.Value && 118 119 ((adhereTimeWindows && !instance.Feasible(evaluation)) || ((!adhereTimeWindows) && evaluation.Overload > double.Epsilon))) { … … 132 133 } 133 134 134 if (currentTour.Stops.Count >0)135 result.Tours. Add(currentTour);135 if (currentTour.Stops.Count == 0) 136 result.Tours.Remove(currentTour); 136 137 137 138 return result; -
branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Crossovers/PotvinInsertionBasedCrossover.cs
r6752 r6838 149 149 150 150 private bool FindRouteInsertionPlace( 151 PotvinEncoding individual, 151 152 Tour tour, 152 153 int city, bool allowInfeasible, out int place) { … … 162 163 163 164 double minDetour = 0; 164 VRPEvaluation eval = ProblemInstance.Evaluate (tour);165 VRPEvaluation eval = ProblemInstance.EvaluateTour(tour, individual); 165 166 bool originalFeasible = ProblemInstance.Feasible(eval); 166 167 … … 220 221 221 222 Tour childTour = new Tour(); 223 child.Tours.Add(childTour); 222 224 childTour.Stops.AddRange(r1.Stops); 223 225 … … 233 235 234 236 while (count < maxCount && R2.Count != 0) { 235 PotvinEncoding newChild = child.Clone() as PotvinEncoding;236 newChild.Tours.Add(childTour);237 238 237 int index = random.Next(R2.Count); 239 238 int city = R2[index]; … … 241 240 242 241 int place = -1; 243 bool found = FindRouteInsertionPlace(child Tour, city, allowInfeasible, out place);242 bool found = FindRouteInsertionPlace(child, childTour, city, allowInfeasible, out place); 244 243 if (found) { 245 244 childTour.Stops.Insert(place, city); … … 253 252 } 254 253 255 child.Tours.Add(childTour);256 254 Repair(random, child, childTour, ProblemInstance, allowInfeasible); 257 255 } -
branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Manipulators/PotvinLocalSearchManipulator.cs
r4752 r6838 69 69 distance = individual.GetTourLength(individual.Tours[currentTour]); 70 70 individual.Tours[currentTour].Stops.InsertRange(currentCity, toBeDeleted); 71 if (ProblemInstance. Feasible(individual.Tours[currentTour])) {71 if (ProblemInstance.TourFeasible(individual.Tours[currentTour], individual)) { 72 72 double lengthIncrease = 73 73 individual.GetTourLength(individual.Tours[currentTour]) - distance; -
branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Manipulators/PotvinTwoLevelExchangeManipulator.cs
r6796 r6838 66 66 route1.Stops.RemoveAt(customer1Position); 67 67 68 if (ProblemInstance. Feasible(tour)) {68 if (ProblemInstance.TourFeasible(tour, individual)) { 69 69 int routeIdx, place; 70 70 if (FindInsertionPlace(individual, -
branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Moves/PickupDelivery/PDRearrange/PotvinPDRearrangeMoveMaker.cs
r6806 r6838 61 61 public static void InsertPair(PotvinEncoding solution, Tour tour, int source, int target, IVRPProblemInstance problemInstance, int positionToAvoid = -1, int positionToAvoid2 = -1) { 62 62 int stops = tour.Stops.Count; 63 VRPEvaluation eval = problemInstance.Evaluate (tour);63 VRPEvaluation eval = problemInstance.EvaluateTour(tour, solution); 64 64 double minCosts = double.MaxValue; 65 65 int sourceLocation = -1; … … 68 68 for (int i = 0; i <= stops; i++) { 69 69 tour.Stops.Insert(i, source); 70 VRPEvaluation tourEval = problemInstance.Evaluate (tour);70 VRPEvaluation tourEval = problemInstance.EvaluateTour(tour, solution); 71 71 double sourceCosts = tourEval.Quality - eval.Quality; 72 72 -
branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/PotvinEncoding.cs
r6771 r6838 82 82 double minQuality = -1; 83 83 84 VRPEvaluation eval = ProblemInstance.Evaluate (tour);84 VRPEvaluation eval = ProblemInstance.EvaluateTour(tour, this); 85 85 86 86 for (int i = 0; i <= tour.Stops.Count; i++) {
Note: See TracChangeset
for help on using the changeset viewer.