Changeset 6966 for branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Manipulators/PotvinPairwiseOneLevelExchangeManipulator.cs
- Timestamp:
- 11/08/11 12:46:51 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Manipulators/PotvinPairwiseOneLevelExchangeManipulator.cs
r6960 r6966 133 133 protected override void Manipulate(IRandom random, PotvinEncoding individual) { 134 134 bool allowInfeasible = AllowInfeasibleSolutions.Value.Value; 135 IPickupAndDeliveryProblemInstance pdp = ProblemInstance as IPickupAndDeliveryProblemInstance; 135 136 136 int selectedIndex = SelectRandomTourBiasedByLength(random, individual); 137 if (selectedIndex >= 0) { 138 Tour route1 = 139 individual.Tours[selectedIndex]; 137 if (pdp != null) { 138 int selectedIndex = SelectRandomTourBiasedByLength(random, individual); 139 if (selectedIndex >= 0) { 140 Tour route1 = 141 individual.Tours[selectedIndex]; 140 142 141 int count = route1.Stops.Count;143 int count = route1.Stops.Count; 142 144 143 if (count > 0) {144 int i = random.Next(0, count);145 int city = route1.Stops[i];145 if (count > 0) { 146 int i = random.Next(0, count); 147 int city = route1.Stops[i]; 146 148 147 if (!PairwiseMove(individual, city, allowInfeasible))148 i++;149 if (!PairwiseMove(individual, city, allowInfeasible)) 150 i++; 149 151 150 count = route1.Stops.Count; 152 count = route1.Stops.Count; 153 } 151 154 } 152 155 }
Note: See TracChangeset
for help on using the changeset viewer.