Index: branches/FitnessLandscapeAnalysis/HeuristicLab.Analysis.FitnessLandscape.VRP/HeuristicLab.Analysis.FitnessLandscape.VRP.csproj
===================================================================
--- branches/FitnessLandscapeAnalysis/HeuristicLab.Analysis.FitnessLandscape.VRP/HeuristicLab.Analysis.FitnessLandscape.VRP.csproj	(revision 7141)
+++ branches/FitnessLandscapeAnalysis/HeuristicLab.Analysis.FitnessLandscape.VRP/HeuristicLab.Analysis.FitnessLandscape.VRP.csproj	(revision 7145)
@@ -102,4 +102,5 @@
   </PropertyGroup>
   <ItemGroup>
+    <Reference Include="HeuristicLab.Collections-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL" />
     <Reference Include="HeuristicLab.Common-3.3">
       <HintPath>..\..\..\trunk\sources\bin\HeuristicLab.Common-3.3.dll</HintPath>
@@ -115,4 +116,6 @@
       <HintPath>..\..\..\trunk\sources\bin\HeuristicLab.Encodings.PermutationEncoding-3.3.dll</HintPath>
     </Reference>
+    <Reference Include="HeuristicLab.Operators-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL" />
+    <Reference Include="HeuristicLab.Optimization-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL" />
     <Reference Include="HeuristicLab.Persistence-3.3">
       <HintPath>..\..\..\trunk\sources\bin\HeuristicLab.Persistence-3.3.dll</HintPath>
@@ -134,4 +137,9 @@
     <Compile Include="DistanceCalcualtors\VRPDistanceCalculator.cs" />
     <Compile Include="HeuristicLabAnalysisFitnessLandscapeVRPPlugin.cs" />
+    <Compile Include="Manipulators\OrOptManipulator.cs" />
+    <Compile Include="Manipulators\ExchangeManipulator.cs" />
+    <Compile Include="Manipulators\RelocateManipulator.cs" />
+    <Compile Include="Manipulators\TwoOptManipulator.cs" />
+    <Compile Include="Manipulators\TwoOptStarManipulator.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
   </ItemGroup>
@@ -147,4 +155,5 @@
     <None Include="Properties\AssemblyInfo.cs.frame" />
   </ItemGroup>
+  <ItemGroup />
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
   <PropertyGroup>
Index: branches/FitnessLandscapeAnalysis/HeuristicLab.Analysis.FitnessLandscape.VRP/Manipulators/ExchangeManipulator.cs
===================================================================
--- branches/FitnessLandscapeAnalysis/HeuristicLab.Analysis.FitnessLandscape.VRP/Manipulators/ExchangeManipulator.cs	(revision 7145)
+++ branches/FitnessLandscapeAnalysis/HeuristicLab.Analysis.FitnessLandscape.VRP/Manipulators/ExchangeManipulator.cs	(revision 7145)
@@ -0,0 +1,131 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2011 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System.Collections.Generic;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HeuristicLab.Data;
+using HeuristicLab.Parameters;
+using HeuristicLab.Problems.VehicleRouting.Encodings.Potvin;
+using HeuristicLab.Problems.VehicleRouting.Encodings;
+using HeuristicLab.Problems.VehicleRouting;
+
+namespace HeuristicLab.Anaylsis.FitnessLandscape.VRP {
+  [Item("ExchangeMainpulator", "Exchange manipulation")]
+  [StorableClass]
+  public sealed class ExchangeMainpulator : PotvinManipulator {
+    [StorableConstructor]
+    private ExchangeMainpulator(bool deserializing) : base(deserializing) { }
+    private ExchangeMainpulator(ExchangeMainpulator original, Cloner cloner)
+      : base(original, cloner) {
+    }
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new ExchangeMainpulator(this, cloner);
+    }
+    public ExchangeMainpulator()
+      : base() {
+    }
+
+    private static bool RouteFeasible(Tour tour, DoubleArray demand, DoubleValue capacity) {
+      double routeLoad = 0;
+      for (int i = 0; i < tour.Cities.Count; i++) {
+        routeLoad += demand[tour.Cities[i]];
+      }
+
+      return routeLoad <= capacity.Value;
+    }
+
+    public static void Apply(IRandom random, PotvinEncoding individual, DoubleArray demand, DoubleValue capacity, bool allowInfeasible) {
+      bool feasible;
+
+      do {
+        feasible = true;
+
+        if (individual.Tours.Count > 1) {
+          int tour1Idx = random.Next(individual.Tours.Count);
+          int tour2Idx = random.Next(individual.Tours.Count - 1);
+          if (tour2Idx >= tour1Idx)
+            tour2Idx++;
+
+          Tour tour1 = individual.Tours[tour1Idx];
+          Tour tour2 = individual.Tours[tour2Idx];
+
+          int index1 = random.Next(tour1.Cities.Count);
+          int city1 = tour1.Cities[index1];
+
+          int index2 = random.Next(tour2.Cities.Count);
+          int city2 = tour2.Cities[index2];
+
+          if (!allowInfeasible) {
+            bool originalFeasible =
+              RouteFeasible(tour1, demand, capacity) &&
+              RouteFeasible(tour2, demand, capacity);
+
+            if (originalFeasible) {
+              double routeLoad = 0;
+              for (int i = 0; i < tour1.Cities.Count; i++) {
+                if (i != index1)
+                  routeLoad += demand[tour1.Cities[i]];
+              }
+              routeLoad += demand[city2];
+
+              if (routeLoad > capacity.Value) {
+                feasible = false;
+              } else {
+                routeLoad = 0;
+                for (int i = 0; i < tour2.Cities.Count; i++) {
+                  if (i != index2)
+                    routeLoad += demand[tour2.Cities[i]];
+                }
+                routeLoad += demand[city1];
+
+                if (routeLoad > capacity.Value) {
+                  feasible = false;
+                }
+              }
+
+            }
+          }
+
+          if (feasible) {
+            tour1.Cities.RemoveAt(index1);
+            tour1.Cities.Insert(index1, city2);
+
+            tour2.Cities.RemoveAt(index2);
+            tour2.Cities.Insert(index2, city1);
+          }
+        }
+      } while (!feasible);
+    }
+
+    protected override void Manipulate(IRandom random, PotvinEncoding individual) {
+      BoolValue useDistanceMatrix = UseDistanceMatrixParameter.ActualValue;
+      DoubleMatrix coordinates = CoordinatesParameter.ActualValue;
+      DistanceMatrix distMatrix = VRPUtilities.GetDistanceMatrix(coordinates, DistanceMatrixParameter, useDistanceMatrix);
+      DoubleArray demand = DemandParameter.ActualValue;
+      DoubleValue capacity = CapacityParameter.ActualValue;
+
+      bool allowInfeasible = AllowInfeasibleSolutions.Value.Value;
+      Apply(random, individual, demand, capacity, allowInfeasible);
+    }
+  }
+}
Index: branches/FitnessLandscapeAnalysis/HeuristicLab.Analysis.FitnessLandscape.VRP/Manipulators/OrOptManipulator.cs
===================================================================
--- branches/FitnessLandscapeAnalysis/HeuristicLab.Analysis.FitnessLandscape.VRP/Manipulators/OrOptManipulator.cs	(revision 7145)
+++ branches/FitnessLandscapeAnalysis/HeuristicLab.Analysis.FitnessLandscape.VRP/Manipulators/OrOptManipulator.cs	(revision 7145)
@@ -0,0 +1,82 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2011 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System.Collections.Generic;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HeuristicLab.Data;
+using HeuristicLab.Parameters;
+using HeuristicLab.Problems.VehicleRouting.Encodings.Potvin;
+using HeuristicLab.Problems.VehicleRouting.Encodings;
+using HeuristicLab.Problems.VehicleRouting;
+using System;
+
+namespace HeuristicLab.Anaylsis.FitnessLandscape.VRP {
+  [Item("OrOptMainpulator", "Or opt manipulation")]
+  [StorableClass]
+  public sealed class OrOptMainpulator : PotvinManipulator {
+    [StorableConstructor]
+    private OrOptMainpulator(bool deserializing) : base(deserializing) { }
+    private OrOptMainpulator(OrOptMainpulator original, Cloner cloner)
+      : base(original, cloner) {
+    }
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new OrOptMainpulator(this, cloner);
+    }
+    public OrOptMainpulator()
+      : base() {
+    }
+
+    public static void Apply(IRandom random, PotvinEncoding individual) {
+      List<Tour> tours = individual.Tours.FindAll(t => t.Cities.Count >= 2);
+
+      if (tours.Count > 0) {
+        int tourIdx = random.Next(tours.Count);
+        Tour tour = tours[tourIdx];
+
+        int segmentStart = random.Next(tour.Cities.Count);
+        int segmentLength;
+        if (segmentStart == 0) {
+          segmentLength = 1 + random.Next(tour.Cities.Count - 1);
+        } else {
+          segmentLength = 1 + random.Next(tour.Cities.Count - segmentStart);
+        }
+
+        List<int> segment = tour.Cities.GetRange(segmentStart, segmentLength);
+        tour.Cities.RemoveRange(segmentStart, segmentLength);
+        int newPos;
+        if(tour.Cities.Count == 1)
+          newPos = 0;
+        else
+          newPos = random.Next(tour.Cities.Count - 1);
+
+        if (newPos >= segmentStart)
+          newPos++;
+        tour.Cities.InsertRange(newPos, segment);
+      }
+    }
+
+    protected override void Manipulate(IRandom random, PotvinEncoding individual) {
+      Apply(random, individual);
+    }
+  }
+}
Index: branches/FitnessLandscapeAnalysis/HeuristicLab.Analysis.FitnessLandscape.VRP/Manipulators/RelocateManipulator.cs
===================================================================
--- branches/FitnessLandscapeAnalysis/HeuristicLab.Analysis.FitnessLandscape.VRP/Manipulators/RelocateManipulator.cs	(revision 7145)
+++ branches/FitnessLandscapeAnalysis/HeuristicLab.Analysis.FitnessLandscape.VRP/Manipulators/RelocateManipulator.cs	(revision 7145)
@@ -0,0 +1,122 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2011 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System.Collections.Generic;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HeuristicLab.Data;
+using HeuristicLab.Parameters;
+using HeuristicLab.Problems.VehicleRouting.Encodings.Potvin;
+using HeuristicLab.Problems.VehicleRouting.Encodings;
+using HeuristicLab.Problems.VehicleRouting;
+
+namespace HeuristicLab.Anaylsis.FitnessLandscape.VRP {
+  [Item("RelocateMainpulator", "Relocate manipulation")]
+  [StorableClass]
+  public sealed class RelocateMainpulator : PotvinManipulator {
+    [StorableConstructor]
+    private RelocateMainpulator(bool deserializing) : base(deserializing) { }
+    private RelocateMainpulator(RelocateMainpulator original, Cloner cloner)
+      : base(original, cloner) {
+    }
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new RelocateMainpulator(this, cloner);
+    }
+    public RelocateMainpulator()
+      : base() {
+    }
+
+    private static bool RouteFeasible(Tour tour, DoubleArray demand, DoubleValue capacity) {
+      double routeLoad = 0;
+      for (int i = 0; i < tour.Cities.Count; i++) {
+        routeLoad += demand[tour.Cities[i]];
+      }
+
+      return routeLoad <= capacity.Value;
+    }
+
+    public static void Apply(IRandom random, PotvinEncoding individual, DoubleArray demand, DoubleValue capacity, bool allowInfeasible) {
+      bool feasible;
+
+      do {
+        feasible = true;
+
+        int cities = individual.Cities;
+        int city = 1 + random.Next(cities);
+        Tour originalTour = individual.Tours.Find(t => t.Cities.Contains(city));
+        //consider creating new route
+        individual.Tours.Add(new Tour());
+
+        int position = 1 + random.Next(cities + individual.Tours.Count - 1);
+        if (position >= city) {
+          position++;
+        }
+
+        int originalPosition = originalTour.Cities.IndexOf(city);
+        originalTour.Cities.RemoveAt(originalPosition);
+
+        Tour insertionTour;
+        int insertionPosition;
+        if (position <= cities) {
+          insertionTour = individual.Tours.Find(t => t.Cities.Contains(position));
+          insertionPosition = insertionTour.Cities.IndexOf(position) + 1;
+        } else {
+          insertionTour = individual.Tours[position - cities - 1];
+          insertionPosition = 0;
+        }
+
+        if (!allowInfeasible && insertionTour != originalTour) {
+          bool originalFeasible = RouteFeasible(insertionTour, demand, capacity);
+
+          if (originalFeasible) {
+            double routeLoad = 0;
+            for (int i = 0; i < insertionTour.Cities.Count; i++) {
+              routeLoad += demand[insertionTour.Cities[i]];
+            }
+            routeLoad += demand[city];
+
+            feasible = routeLoad <= capacity.Value;
+          }
+        }
+
+        if (feasible) {
+          insertionTour.Cities.Insert(insertionPosition, city);
+        } else {
+          originalTour.Cities.Insert(originalPosition, city);
+        }
+
+        individual.Tours.RemoveAll(t => t.Cities.Count == 0);
+      } while (!feasible);
+    }
+
+    protected override void Manipulate(IRandom random, PotvinEncoding individual) {
+      BoolValue useDistanceMatrix = UseDistanceMatrixParameter.ActualValue;
+      DoubleMatrix coordinates = CoordinatesParameter.ActualValue;
+      DistanceMatrix distMatrix = VRPUtilities.GetDistanceMatrix(coordinates, DistanceMatrixParameter, useDistanceMatrix);
+      DoubleArray demand = DemandParameter.ActualValue;
+      DoubleValue capacity = CapacityParameter.ActualValue;
+
+      bool allowInfeasible = AllowInfeasibleSolutions.Value.Value;
+      Apply(random, individual, demand, capacity, allowInfeasible);
+    }
+  }
+}
Index: branches/FitnessLandscapeAnalysis/HeuristicLab.Analysis.FitnessLandscape.VRP/Manipulators/TwoOptManipulator.cs
===================================================================
--- branches/FitnessLandscapeAnalysis/HeuristicLab.Analysis.FitnessLandscape.VRP/Manipulators/TwoOptManipulator.cs	(revision 7145)
+++ branches/FitnessLandscapeAnalysis/HeuristicLab.Analysis.FitnessLandscape.VRP/Manipulators/TwoOptManipulator.cs	(revision 7145)
@@ -0,0 +1,96 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2011 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System.Collections.Generic;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HeuristicLab.Data;
+using HeuristicLab.Parameters;
+using HeuristicLab.Problems.VehicleRouting.Encodings.Potvin;
+using HeuristicLab.Problems.VehicleRouting.Encodings;
+using HeuristicLab.Problems.VehicleRouting;
+using System;
+
+namespace HeuristicLab.Anaylsis.FitnessLandscape.VRP {
+  [Item("TwoOptMainpulator", "Two opt manipulation")]
+  [StorableClass]
+  public sealed class TwoOptMainpulator : PotvinManipulator {
+    [StorableConstructor]
+    private TwoOptMainpulator(bool deserializing) : base(deserializing) { }
+    private TwoOptMainpulator(TwoOptMainpulator original, Cloner cloner)
+      : base(original, cloner) {
+    }
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new TwoOptMainpulator(this, cloner);
+    }
+    public TwoOptMainpulator()
+      : base() {
+    }
+
+    public static void Apply(IRandom random, PotvinEncoding individual) {
+      List<Tour> tours = individual.Tours.FindAll(t => t.Cities.Count >= 4);
+
+      if (tours.Count > 0) {
+        int tourIdx = random.Next(tours.Count);
+        Tour tour = tours[tourIdx];
+
+        int a;
+        if (tour.Cities.Count == 4) {
+            a = 0;
+        } else if (tour.Cities.Count == 5) {
+          int idx = random.Next(4);
+          if (idx >= 2)
+            idx++;
+          a = idx;
+        } else {
+          a = random.Next(tour.Cities.Count);
+        }
+
+        int b;
+        List<int> indices = new List<int>();
+        for (int i = 0; i < tour.Cities.Count; i++) {
+          if (Math.Abs(i - a) > 2) {
+            indices.Add(i);
+          }
+        }
+        b = indices[random.Next(indices.Count)];
+
+        if (b < a) {
+          int tmp = a;
+          a = b;
+          b = tmp;
+        }
+
+        int index = a + 1;
+        int count = b - a - 1;
+        List<int> segment = tour.Cities.GetRange(index, count);
+        tour.Cities.RemoveRange(index, count);
+        segment.Reverse();
+        tour.Cities.InsertRange(index, segment);
+      }
+    }
+
+    protected override void Manipulate(IRandom random, PotvinEncoding individual) {
+      Apply(random, individual);
+    }
+  }
+}
Index: branches/FitnessLandscapeAnalysis/HeuristicLab.Analysis.FitnessLandscape.VRP/Manipulators/TwoOptStarManipulator.cs
===================================================================
--- branches/FitnessLandscapeAnalysis/HeuristicLab.Analysis.FitnessLandscape.VRP/Manipulators/TwoOptStarManipulator.cs	(revision 7145)
+++ branches/FitnessLandscapeAnalysis/HeuristicLab.Analysis.FitnessLandscape.VRP/Manipulators/TwoOptStarManipulator.cs	(revision 7145)
@@ -0,0 +1,138 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2011 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System.Collections.Generic;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HeuristicLab.Data;
+using HeuristicLab.Parameters;
+using HeuristicLab.Problems.VehicleRouting.Encodings.Potvin;
+using HeuristicLab.Problems.VehicleRouting.Encodings;
+using HeuristicLab.Problems.VehicleRouting;
+
+namespace HeuristicLab.Anaylsis.FitnessLandscape.VRP {
+  [Item("TwoOptStarMainpulator", "Two opt star manipulation")]
+  [StorableClass]
+  public sealed class TwoOptStarMainpulator : PotvinManipulator {
+    [StorableConstructor]
+    private TwoOptStarMainpulator(bool deserializing) : base(deserializing) { }
+    private TwoOptStarMainpulator(TwoOptStarMainpulator original, Cloner cloner)
+      : base(original, cloner) {
+    }
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new TwoOptStarMainpulator(this, cloner);
+    }
+    public TwoOptStarMainpulator()
+      : base() {
+    }
+
+    private static bool RouteFeasible(Tour tour, DoubleArray demand, DoubleValue capacity) {
+      double routeLoad = 0;
+      for (int i = 0; i < tour.Cities.Count; i++) {
+        routeLoad += demand[tour.Cities[i]];
+      }
+
+      return routeLoad <= capacity.Value;
+    }
+
+    public static void Apply(IRandom random, PotvinEncoding individual, DoubleArray demand, DoubleValue capacity, bool allowInfeasible) {
+      bool feasible;
+
+      do {
+        feasible = true;
+
+        if (individual.Tours.Count > 1) {
+          int route1Idx = random.Next(individual.Tours.Count);
+          int route2Idx = random.Next(individual.Tours.Count - 1);
+          if (route2Idx >= route1Idx)
+            route2Idx++;
+
+          Tour route1 = individual.Tours[route1Idx];
+          Tour route2 = individual.Tours[route2Idx];
+
+          int x1 = random.Next(route1.Cities.Count + 1);
+          int x2 = random.Next(route2.Cities.Count + 1);
+
+          if (!allowInfeasible) {
+            bool originalFeasible =
+              RouteFeasible(route1, demand, capacity) &&
+              RouteFeasible(route2, demand, capacity);
+
+            if (originalFeasible) {
+              double routeLoad = 0;
+              for (int i = 0; i < x1; i++)
+                routeLoad += demand[route1.Cities[i]];
+              for (int i = x2; i < route2.Cities.Count; i++)
+                routeLoad += demand[route2.Cities[i]];
+
+              if (routeLoad > capacity.Value) {
+                feasible = false;
+              } else {
+                routeLoad = 0;
+                for (int i = 0; i < x2; i++)
+                  routeLoad += demand[route2.Cities[i]];
+                for (int i = x1; i < route1.Cities.Count; i++)
+                  routeLoad += demand[route1.Cities[i]];
+
+                if (routeLoad > capacity.Value) {
+                  feasible = false;
+                }
+              }
+            }
+          }
+
+          if (feasible) {
+            int count = route1.Cities.Count - x1;
+            List<int> segmentX1 = new List<int>();
+            if (count > 0) {
+              segmentX1 = route1.Cities.GetRange(x1, count);
+              route1.Cities.RemoveRange(x1, count);
+            }
+
+            count = route2.Cities.Count - x2;
+            List<int> segmentX2 = new List<int>();
+            if (count > 0) {
+              segmentX2 = route2.Cities.GetRange(x2, count);
+              route2.Cities.RemoveRange(x2, count);
+            }
+
+            route1.Cities.AddRange(segmentX2);
+            route2.Cities.AddRange(segmentX1);
+
+            individual.Tours.RemoveAll(t => t.Cities.Count == 0);
+          }
+        }
+      } while (!feasible);
+    }
+
+    protected override void Manipulate(IRandom random, PotvinEncoding individual) {
+      BoolValue useDistanceMatrix = UseDistanceMatrixParameter.ActualValue;
+      DoubleMatrix coordinates = CoordinatesParameter.ActualValue;
+      DistanceMatrix distMatrix = VRPUtilities.GetDistanceMatrix(coordinates, DistanceMatrixParameter, useDistanceMatrix);
+      DoubleArray demand = DemandParameter.ActualValue;
+      DoubleValue capacity = CapacityParameter.ActualValue;
+
+      bool allowInfeasible = AllowInfeasibleSolutions.Value.Value;
+      Apply(random, individual, demand, capacity, allowInfeasible);
+    }
+  }
+}
