Index: trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Potvin/Crossovers/PotvinInsertionBasedCrossover.cs
===================================================================
--- trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Potvin/Crossovers/PotvinInsertionBasedCrossover.cs	(revision 6459)
+++ trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Potvin/Crossovers/PotvinInsertionBasedCrossover.cs	(revision 6491)
@@ -34,5 +34,5 @@
     public IValueParameter<IntValue> Length {
       get { return (IValueParameter<IntValue>)Parameters["Length"]; }
-    } 
+    }
 
     [StorableConstructor]
@@ -46,8 +46,8 @@
     public PotvinInsertionBasedCrossover()
       : base() {
-        Parameters.Add(new ValueParameter<IntValue>("Length", "The maximum length of the replaced route.", new IntValue(1)));
-    }
-
-    protected static int SelectRandomTourBiasedByLength(IRandom random, PotvinEncoding individual) {
+      Parameters.Add(new ValueParameter<IntValue>("Length", "The maximum length of the replaced route.", new IntValue(1)));
+    }
+
+    private static int SelectRandomTourBiasedByLength(IRandom random, PotvinEncoding individual) {
       int tourIndex = -1;
 
@@ -119,5 +119,5 @@
         if (next >= tour.Cities.Count)
           next = 0;
-        else 
+        else
           next = tour.Cities[next];
         double distance = VRPUtilities.GetDistance(
@@ -192,5 +192,4 @@
     protected override PotvinEncoding Crossover(IRandom random, PotvinEncoding parent1, PotvinEncoding parent2) {
       PotvinEncoding child = new PotvinEncoding();
-      bool success = true;
 
       BoolValue useDistanceMatrix = UseDistanceMatrixParameter.ActualValue;
@@ -236,5 +235,4 @@
 
         //REPAIR - add cities from R2
-        bool insertSuccess = true;
         int maxCount = random.Next(1, Math.Min(5, R2.Count));
         int count = 0;
@@ -249,5 +247,5 @@
 
           int place = -1;
-          if(FindRouteInsertionPlace(childTour, dueTime, serviceTime, readyTime,
+          if (FindRouteInsertionPlace(childTour, dueTime, serviceTime, readyTime,
             demand, capacity, distMatrix, city, allowInfeasible, out place)) {
             childTour.Cities.Insert(place, city);
@@ -255,39 +253,29 @@
             if (!Repair(random, child, childTour, distMatrix, dueTime, readyTime, serviceTime, demand, capacity, allowInfeasible)) {
               childTour.Cities.RemoveAt(place);
-              insertSuccess = false;
             } else {
               count++;
-            } 
-          } 
+            }
+          }
         }
 
         child.Tours.Add(childTour);
-        if (!Repair(random, child, childTour, distMatrix, dueTime, readyTime, serviceTime, demand, capacity, allowInfeasible)) {
-          /*success = false;
-          break;*/
-        }
-      }
-
-      if (success) {
-        for (int i = 0; i < p1Clone.Tours.Count; i++) {
-          Tour childTour = p1Clone.Tours[i].Clone() as Tour;
-          child.Tours.Add(childTour);
-          if (!Repair(random, child, childTour, distMatrix, dueTime, readyTime, serviceTime, demand, capacity, allowInfeasible)) {
-            /*success = false;
-            break;*/
-          }
-        }
-      }
-
-      if (success) {
-        //route unrouted customers
-        for (int i = 1; i <= parent1.Cities; i++) {
-          if (FindRoute(child, i) == null)
-            child.Unrouted.Add(i);
-        }
-
-        if (!RouteUnrouted(child, distMatrix, dueTime, readyTime, serviceTime, demand, capacity, allowInfeasible)) {
-          success = false;
-        }
+        Repair(random, child, childTour, distMatrix, dueTime, readyTime, serviceTime, demand, capacity, allowInfeasible);
+      }
+
+      for (int i = 0; i < p1Clone.Tours.Count; i++) {
+        Tour childTour = p1Clone.Tours[i].Clone() as Tour;
+        child.Tours.Add(childTour);
+        Repair(random, child, childTour, distMatrix, dueTime, readyTime, serviceTime, demand, capacity, allowInfeasible);
+      }
+
+      //route unrouted customers
+      for (int i = 1; i <= parent1.Cities; i++) {
+        if (FindRoute(child, i) == null)
+          child.Unrouted.Add(i);
+      }
+
+      bool success = true;
+      if (!RouteUnrouted(child, distMatrix, dueTime, readyTime, serviceTime, demand, capacity, allowInfeasible)) {
+        success = false;
       }
 
@@ -298,5 +286,5 @@
           return parent1.Clone() as PotvinEncoding;
         else
-          return parent2.Clone() as PotvinEncoding;   
+          return parent2.Clone() as PotvinEncoding;
       }
     }
