Changeset 6907 for branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Manipulators/PotvinOneLevelExchangeManipulator.cs
- Timestamp:
- 10/12/11 13:41:14 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Manipulators/PotvinOneLevelExchangeManipulator.cs
r6796 r6907 49 49 50 50 int selectedIndex = SelectRandomTourBiasedByLength(random, individual); 51 Tour route1 = 52 individual.Tours[selectedIndex]; 51 if (selectedIndex >= 0) { 52 Tour route1 = 53 individual.Tours[selectedIndex]; 53 54 54 int count = route1.Stops.Count;55 int i = 0;56 while(i < count) {57 int insertedRoute, insertedPlace;55 int count = route1.Stops.Count; 56 int i = 0; 57 while (i < count) { 58 int insertedRoute, insertedPlace; 58 59 59 int city = route1.Stops[i];60 route1.Stops.Remove(city);60 int city = route1.Stops[i]; 61 route1.Stops.Remove(city); 61 62 62 if (FindInsertionPlace(individual, city, selectedIndex, allowInfeasible, out insertedRoute, out insertedPlace)) { 63 individual.Tours[insertedRoute].Stops.Insert(insertedPlace, city); 64 } else { 65 route1.Stops.Insert(i, city); 66 i++; 63 if (FindInsertionPlace(individual, city, selectedIndex, allowInfeasible, out insertedRoute, out insertedPlace)) { 64 individual.Tours[insertedRoute].Stops.Insert(insertedPlace, city); 65 } else { 66 route1.Stops.Insert(i, city); 67 i++; 68 } 69 70 count = route1.Stops.Count; 67 71 } 68 69 count = route1.Stops.Count;70 72 } 71 72 73 } 73 74 }
Note: See TracChangeset
for help on using the changeset viewer.