Changeset 6710 for branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Crossovers
- Timestamp:
- 09/06/11 13:00:12 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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
Note: See TracChangeset
for help on using the changeset viewer.