Index: branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Creators/IterativeInsertionCreator.cs
===================================================================
--- branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Creators/IterativeInsertionCreator.cs	(revision 6839)
+++ 	(revision )
@@ -1,147 +1,0 @@
-﻿#region License Information
-/* HeuristicLab
- * Copyright (C) 2002-2010 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;
-using System.Collections.Generic;
-using HeuristicLab.Core;
-using HeuristicLab.Data;
-using HeuristicLab.Encodings.PermutationEncoding;
-using HeuristicLab.Optimization;
-using HeuristicLab.Parameters;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
-using HeuristicLab.Common;
-using HeuristicLab.Problems.VehicleRouting.Interfaces;
-using HeuristicLab.Problems.VehicleRouting.ProblemInstances;
-using HeuristicLab.Problems.VehicleRouting.Variants;
-
-namespace HeuristicLab.Problems.VehicleRouting.Encodings.Potvin {
-  [Item("IterativeInsertionCreator", "Creates a randomly initialized VRP solution.")]
-  [StorableClass]
-  public sealed class IterativeInsertionCreator : PotvinCreator, IStochasticOperator {
-    #region IStochasticOperator Members
-    public ILookupParameter<IRandom> RandomParameter {
-      get { return (LookupParameter<IRandom>)Parameters["Random"]; }
-    }
-    #endregion
-
-    public IValueParameter<BoolValue> AdhereTimeWindowsParameter {
-      get { return (IValueParameter<BoolValue>)Parameters["AdhereTimeWindows"]; }
-    }
-
-    [StorableConstructor]
-    private IterativeInsertionCreator(bool deserializing) : base(deserializing) { }
-
-    public IterativeInsertionCreator()
-      : base() {
-      Parameters.Add(new LookupParameter<IRandom>("Random", "The pseudo random number generator."));
-      Parameters.Add(new ValueParameter<BoolValue>("AdhereTimeWindows", "Specifies if the time windows should be considered during construction.", new BoolValue(true)));
-    }
-
-    public override IDeepCloneable Clone(Cloner cloner) {
-      return new IterativeInsertionCreator(this, cloner);
-    }
-
-    private IterativeInsertionCreator(IterativeInsertionCreator original, Cloner cloner)
-      : base(original, cloner) {
-    }
-
-    private static double CalculateAngleToDepot(IVRPProblemInstance instance, int city) {
-      double dx = instance.Coordinates[0, 0];
-      double dy = instance.Coordinates[0, 1];
-
-      double cx = instance.Coordinates[city, 0];
-      double cy = instance.Coordinates[city, 1];
-
-      double alpha = Math.Atan((cx - dx) / (dy - cy)) * (180.0 / Math.PI);
-      if (cx > dx && cy > dy)
-        alpha = (90.0 + alpha) + 90.0;
-      else if (cx < dx && cy > dy)
-        alpha = alpha + 180.0;
-      else if (cx < dx && cy < dy)
-        alpha = (90.0 + alpha) + 270.0;
-
-      return alpha;
-    }
-
-    private static PotvinEncoding CreateSolution(IVRPProblemInstance instance, IRandom random, bool adhereTimeWindows) {
-      PotvinEncoding result = new PotvinEncoding(instance);
-
-      IPickupAndDeliveryProblemInstance pdp = instance as IPickupAndDeliveryProblemInstance; 
-
-      List<int> customers = new List<int>();
-      for (int i = 1; i <= instance.Cities.Value; i++)
-        if(pdp == null || pdp.Demand[i] >= 0)
-          customers.Add(i);
-
-      customers.Sort(delegate(int city1, int city2)
-          {
-            double angle1 = CalculateAngleToDepot(instance, city1);
-            double angle2 = CalculateAngleToDepot(instance, city2);
-
-            return angle1.CompareTo(angle2);
-          });
-
-      Tour currentTour = new Tour();
-      result.Tours.Add(currentTour);
-
-      int j = random.Next(customers.Count);
-      for (int i = 0; i < customers.Count; i++) {
-        int index = (i + j) % customers.Count;
-
-        int stopIdx = result.FindBestInsertionPlace(currentTour, customers[index]);
-        currentTour.Stops.Insert(stopIdx, customers[index]);
-
-        if (pdp != null) {
-          stopIdx = result.FindBestInsertionPlace(currentTour, pdp.PickupDeliveryLocation[customers[index]]);
-          currentTour.Stops.Insert(stopIdx, pdp.PickupDeliveryLocation[customers[index]]);
-        }
-
-        CVRPEvaluation evaluation = instance.EvaluateTour(currentTour, result) as CVRPEvaluation;
-        if (result.Tours.Count < instance.Vehicles.Value && 
-          ((adhereTimeWindows && !instance.Feasible(evaluation)) || ((!adhereTimeWindows) && evaluation.Overload > double.Epsilon))) {
-            currentTour.Stops.Remove(customers[index]);
-            if (pdp != null)
-              currentTour.Stops.Remove(pdp.PickupDeliveryLocation[customers[index]]);
-
-          if(currentTour.Stops.Count > 0)
-            result.Tours.Add(currentTour);
-          currentTour = new Tour();
-          
-          currentTour.Stops.Add(customers[index]);
-          if (pdp != null) {
-            currentTour.Stops.Add(pdp.PickupDeliveryLocation[customers[index]]);
-          }
-        }
-      }
-
-      if (currentTour.Stops.Count == 0)
-        result.Tours.Remove(currentTour);
-
-      return result;
-    }
-
-    public override IOperation Apply() {
-      VRPToursParameter.ActualValue = CreateSolution(ProblemInstance, RandomParameter.ActualValue, AdhereTimeWindowsParameter.Value.Value);
-
-      return base.Apply();
-    }
-  }
-}
Index: branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Creators/PushForwardInsertionCreator.cs
===================================================================
--- branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Creators/PushForwardInsertionCreator.cs	(revision 6839)
+++ 	(revision )
@@ -1,238 +1,0 @@
-﻿#region License Information
-/* HeuristicLab
- * Copyright (C) 2002-2010 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;
-using System.Collections.Generic;
-using HeuristicLab.Core;
-using HeuristicLab.Data;
-using HeuristicLab.Encodings.PermutationEncoding;
-using HeuristicLab.Optimization;
-using HeuristicLab.Parameters;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
-using HeuristicLab.Common;
-using HeuristicLab.Problems.VehicleRouting.Interfaces;
-using HeuristicLab.Problems.VehicleRouting.ProblemInstances;
-using HeuristicLab.Problems.VehicleRouting.Variants;
-
-namespace HeuristicLab.Problems.VehicleRouting.Encodings.Potvin {
-  [Item("PushForwardInsertionCreator", "Creates a randomly initialized VRP solution.")]
-  [StorableClass]
-  public sealed class PushForwardInsertionCreator : PotvinCreator, IStochasticOperator {
-    #region IStochasticOperator Members
-    public ILookupParameter<IRandom> RandomParameter {
-      get { return (LookupParameter<IRandom>)Parameters["Random"]; }
-    }
-    #endregion
-
-    public IValueParameter<DoubleValue> Alpha {
-      get { return (IValueParameter<DoubleValue>)Parameters["Alpha"]; }
-    }
-    public IValueParameter<DoubleValue> AlphaVariance {
-      get { return (IValueParameter<DoubleValue>)Parameters["AlphaVariance"]; }
-    }
-    public IValueParameter<DoubleValue> Beta {
-      get { return (IValueParameter<DoubleValue>)Parameters["Beta"]; }
-    }
-    public IValueParameter<DoubleValue> BetaVariance {
-      get { return (IValueParameter<DoubleValue>)Parameters["BetaVariance"]; }
-    }
-    public IValueParameter<DoubleValue> Gamma {
-      get { return (IValueParameter<DoubleValue>)Parameters["Gamma"]; }
-    }
-    public IValueParameter<DoubleValue> GammaVariance {
-      get { return (IValueParameter<DoubleValue>)Parameters["GammaVariance"]; }
-    }
-
-    [StorableConstructor]
-    private PushForwardInsertionCreator(bool deserializing) : base(deserializing) { }
-
-    public PushForwardInsertionCreator()
-      : base() {
-      Parameters.Add(new LookupParameter<IRandom>("Random", "The pseudo random number generator."));
-      Parameters.Add(new ValueParameter<DoubleValue>("Alpha", "The alpha value.", new DoubleValue(0.7)));
-      Parameters.Add(new ValueParameter<DoubleValue>("AlphaVariance", "The alpha variance.", new DoubleValue(0.5)));
-      Parameters.Add(new ValueParameter<DoubleValue>("Beta", "The beta value.", new DoubleValue(0.1)));
-      Parameters.Add(new ValueParameter<DoubleValue>("BetaVariance", "The beta variance.", new DoubleValue(0.07)));
-      Parameters.Add(new ValueParameter<DoubleValue>("Gamma", "The gamma value.", new DoubleValue(0.2)));
-      Parameters.Add(new ValueParameter<DoubleValue>("GammaVariance", "The gamma variance.", new DoubleValue(0.14)));
-    }
-
-    public override IDeepCloneable Clone(Cloner cloner) {
-      return new PushForwardInsertionCreator(this, cloner);
-    }
-
-    private PushForwardInsertionCreator(PushForwardInsertionCreator original, Cloner cloner)
-      : base(original, cloner) {
-    }
-
-    // use the Box-Mueller transform in the polar form to generate a N(0,1) random variable out of two uniformly distributed random variables
-    private static double Gauss(IRandom random) {
-      double u = 0.0, v = 0.0, s = 0.0;
-      do {
-        u = (random.NextDouble() * 2) - 1;
-        v = (random.NextDouble() * 2) - 1;
-        s = Math.Sqrt(u * u + v * v);
-      } while (s < Double.Epsilon || s > 1);
-      return u * Math.Sqrt((-2.0 * Math.Log(s)) / s);
-    }
-
-    private static double N(double mu, double sigma, IRandom random) {
-      return mu + (sigma * Gauss(random)); // transform the random variable sampled from N(0,1) to N(mu,sigma)
-    }
-
-    private static double Distance(IVRPProblemInstance problemInstance, int start, int end) {
-      return problemInstance.GetDistance(start, end);
-    }
-
-    private static PotvinEncoding CreateSolution(IVRPProblemInstance problemInstance, IRandom random,
-      double alphaValue = 0.7, double betaValue = 0.1, double gammaValue = 0.2,
-      double alphaVariance = 0.5, double betaVariance = 0.07, double gammaVariance = 0.14) {
-      PotvinEncoding result = new PotvinEncoding(problemInstance);
-
-      double alpha, beta, gamma;
-      alpha = N(alphaValue, Math.Sqrt(alphaVariance), random);
-      beta = N(betaValue, Math.Sqrt(betaVariance), random);
-      gamma = N(gammaValue, Math.Sqrt(gammaVariance), random);
-
-      double x0 = problemInstance.Coordinates[0, 0];
-      double y0 = problemInstance.Coordinates[0, 1];
-      double distance = 0;
-      double cost = 0;
-      List<int> unroutedList = new List<int>();
-      List<double> costList = new List<double>();
-
-      IPickupAndDeliveryProblemInstance pdp = problemInstance as IPickupAndDeliveryProblemInstance;
-
-      /*-----------------------------------------------------------------------------
-       * generate cost list
-       *-----------------------------------------------------------------------------
-       */
-      for (int i = 1; i <= problemInstance.Cities.Value; i++) {
-        //only insert sources
-        if (pdp == null || problemInstance.Demand[i] >= 0) {
-          distance = Distance(problemInstance, i, 0);
-          if (problemInstance.Coordinates[i, 0] < x0) distance = -distance;
-
-          cost = -alpha * distance + // distance 0 <-> City[i]
-                 beta * (problemInstance as ITimeWindowedProblemInstance).DueTime[i] + // latest arrival time
-                 gamma * (Math.Asin((problemInstance.Coordinates[i, 1] - y0) / distance) / 360 * distance); // polar angle
-
-          int index = 0;
-          while (index < costList.Count && costList[index] < cost) index++;
-
-          costList.Insert(index, cost);
-
-          unroutedList.Insert(index, i);
-        }
-      }
-
-      double minimumCost = double.MaxValue;
-      int indexOfMinimumCost = -1;
-      int indexOfMinimumCost2 = -1;
-      int indexOfCustomer = -1;
-
-      Tour tour = new Tour();
-      result.Tours.Add(tour);
-
-      tour.Stops.Add(unroutedList[0]);
-
-      if (pdp != null) {
-        tour.Stops.Add(pdp.PickupDeliveryLocation[unroutedList[0]]);
-      }
-
-      unroutedList.RemoveAt(0);
-
-      while (unroutedList.Count > 0) {
-        for (int c = 0; c < unroutedList.Count; c++) {
-          VRPEvaluation eval =
-          problemInstance.EvaluateTour(tour, result);
-          double originalCosts = eval.Quality;
-          int customer = unroutedList[c];
-
-          for (int i = 0; i <= tour.Stops.Count; i++) {
-            tour.Stops.Insert(i, customer);
-            eval = problemInstance.EvaluateTour(tour, result);
-            double tourCost = eval.Quality - originalCosts;
-
-            if (pdp != null) {
-              for (int j = i + 1; j <= tour.Stops.Count; j++) {
-                bool feasible;
-                cost = tourCost +
-                  problemInstance.GetInsertionCosts(eval, pdp.PickupDeliveryLocation[unroutedList[c]], 0, j, out feasible);
-                if (cost < minimumCost && feasible) {
-                  minimumCost = cost;
-                  indexOfMinimumCost = i;
-                  indexOfMinimumCost2 = j;
-                  indexOfCustomer = c;
-                }
-              }
-            } else {
-              cost = tourCost;
-              bool feasible = problemInstance.Feasible(eval);
-              if (cost < minimumCost && feasible) {
-                minimumCost = cost;
-                indexOfMinimumCost = i;
-                indexOfCustomer = c;
-              }
-            }
-
-            tour.Stops.RemoveAt(i);            
-          }
-        }
-
-        // insert customer if found
-        if (indexOfMinimumCost != -1) {
-          tour.Stops.Insert(indexOfMinimumCost, unroutedList[indexOfCustomer]);
-          if (pdp != null) {
-            tour.Stops.Insert(indexOfMinimumCost2, pdp.PickupDeliveryLocation[unroutedList[indexOfCustomer]]);
-          }
-
-          unroutedList.RemoveAt(indexOfCustomer);
-        } else { // no feasible customer found
-          tour = new Tour();
-          result.Tours.Add(tour);
-
-          tour.Stops.Add(unroutedList[0]);
-          if (pdp != null) {
-            tour.Stops.Add(pdp.PickupDeliveryLocation[unroutedList[0]]);
-          }
-
-          unroutedList.RemoveAt(0);
-        }
-        // reset minimum		
-        minimumCost = double.MaxValue;
-        indexOfMinimumCost = -1;
-        indexOfMinimumCost2 = -1;
-        indexOfCustomer = -1;
-      }
-
-      return result;
-    }
-
-    public override IOperation Apply() {
-      VRPToursParameter.ActualValue = CreateSolution(ProblemInstance, RandomParameter.ActualValue,
-        Alpha.Value.Value, Beta.Value.Value, Gamma.Value.Value,
-        AlphaVariance.Value.Value, BetaVariance.Value.Value, GammaVariance.Value.Value);
-
-      return base.Apply();
-    }
-  }
-}
Index: branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Crossovers/PotvinInsertionBasedCrossover.cs
===================================================================
--- branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Crossovers/PotvinInsertionBasedCrossover.cs	(revision 6839)
+++ branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Crossovers/PotvinInsertionBasedCrossover.cs	(revision 6851)
@@ -28,4 +28,5 @@
 using HeuristicLab.Parameters;
 using HeuristicLab.Problems.VehicleRouting.ProblemInstances;
+using HeuristicLab.Problems.VehicleRouting.Interfaces;
 
 namespace HeuristicLab.Problems.VehicleRouting.Encodings.Potvin {
@@ -74,5 +75,5 @@
     }
 
-    private double CalculateCentroidDistance(Tour t1, Tour t2, DoubleMatrix coordinates) {
+    private double CalculateCentroidDistance(Tour t1, Tour t2, IVRPProblemInstance instance) {
       double xSum = 0;
       double ySum = 0;
@@ -80,6 +81,6 @@
 
       for (int i = 0; i < t1.Stops.Count; i++) {
-        xSum += coordinates[t1.Stops[i], 0];
-        ySum += coordinates[t1.Stops[i], 1];
+        xSum += instance.GetCoordinates(t1.Stops[i])[0];
+        ySum += instance.GetCoordinates(t1.Stops[i])[1];
       }
       c1X = xSum / t1.Stops.Count;
@@ -87,6 +88,6 @@
 
       for (int i = 0; i < t2.Stops.Count; i++) {
-        xSum += coordinates[t2.Stops[i], 0];
-        ySum += coordinates[t2.Stops[i], 1];
+        xSum += instance.GetCoordinates(t2.Stops[i])[0];
+        ySum += instance.GetCoordinates(t2.Stops[i])[1];
       }
       c2X = xSum / t1.Stops.Count;
@@ -98,9 +99,9 @@
     }
 
-    private double CalculateMeanCentroidDistance(Tour t1, IList<Tour> tours, DoubleMatrix coordinates) {
+    private double CalculateMeanCentroidDistance(Tour t1, IList<Tour> tours, IVRPProblemInstance instance) {
       double sum = 0;
 
       for (int i = 0; i < tours.Count; i++) {
-        sum += CalculateCentroidDistance(t1, tours[i], coordinates);
+        sum += CalculateCentroidDistance(t1, tours[i], instance);
       }
 
@@ -108,5 +109,5 @@
     }
 
-    private int SelectCityBiasedByNeighborDistance(IRandom random, Tour tour) {
+    private int SelectCityBiasedByNeighborDistance(IRandom random, Tour tour, IVRPEncoding solution) {
       int cityIndex = -1;
 
@@ -120,5 +121,5 @@
           next = tour.Stops[i + 1];
         double distance = ProblemInstance.GetDistance(
-          tour.Stops[i], next);
+          tour.Stops[i], next, solution);
 
         int prev;
@@ -128,5 +129,5 @@
           prev = tour.Stops[i - 1];
         distance += ProblemInstance.GetDistance(
-          tour.Stops[i], prev);
+          tour.Stops[i], prev, solution);
 
         probabilities[i] = distance;
@@ -168,5 +169,5 @@
       for (int i = 0; i <= tour.Stops.Count; i++) {
         bool feasible;
-        double detour = ProblemInstance.GetInsertionCosts(eval, city, 0, i, out feasible);
+        double detour = ProblemInstance.GetInsertionCosts(eval, individual, city, 0, i, out feasible);
         if (feasible || allowInfeasible) {
           if (place < 0 || detour < minDetour) {
@@ -195,5 +196,6 @@
 
     protected override PotvinEncoding Crossover(IRandom random, PotvinEncoding parent1, PotvinEncoding parent2) {
-      PotvinEncoding child = new PotvinEncoding(ProblemInstance);
+      PotvinEncoding child = parent1.Clone() as PotvinEncoding;
+      child.Tours.Clear();
 
       bool allowInfeasible = AllowInfeasibleSolutions.Value.Value;
@@ -213,7 +215,7 @@
         List<int> R2 = new List<int>();
 
-        double r = CalculateMeanCentroidDistance(r1, parent2.Tours, ProblemInstance.Coordinates);
+        double r = CalculateMeanCentroidDistance(r1, parent2.Tours, ProblemInstance);
         foreach (Tour tour in parent2.Tours) {
-          if (CalculateCentroidDistance(r1, tour, ProblemInstance.Coordinates) <= r) {
+          if (CalculateCentroidDistance(r1, tour, ProblemInstance) <= r) {
             R2.AddRange(tour.Stops);
           }
@@ -227,9 +229,11 @@
         int removed = random.Next(1, r1.Stops.Count + 1);
         for (int i = 0; i < removed; i++) {
-          childTour.Stops.RemoveAt(SelectCityBiasedByNeighborDistance(random, childTour));
+          childTour.Stops.RemoveAt(SelectCityBiasedByNeighborDistance(random, childTour, child));
         }
 
         //REPAIR - add cities from R2
-        int maxCount = random.Next(1, Math.Min(5, R2.Count));
+        int maxCount = 1;
+        if(R2.Count > 1)
+          maxCount = random.Next(1, Math.Min(5, R2.Count));
         int count = 0;
 
Index: branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Crossovers/PotvinRouteBasedCrossover.cs
===================================================================
--- branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Crossovers/PotvinRouteBasedCrossover.cs	(revision 6839)
+++ branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Crossovers/PotvinRouteBasedCrossover.cs	(revision 6851)
@@ -26,4 +26,5 @@
 using HeuristicLab.Data;
 using HeuristicLab.Common;
+using HeuristicLab.Problems.VehicleRouting.Encodings.ExtendedPotvin;
 
 namespace HeuristicLab.Problems.VehicleRouting.Encodings.Potvin {
@@ -57,5 +58,20 @@
 
       child.Tours.Remove(replaced);
-      child.Tours.Add(replacing);
+      child.Tours.Insert(tourParent2, replacing);
+
+      if (parent1 is ExtendedPotvinEncoding && child is ExtendedPotvinEncoding) {
+        Permutation vehicleAssignment = (child as ExtendedPotvinEncoding).VehicleAssignment;
+
+        int vehicle = vehicleAssignment[tourParent2];
+        int vehicle2 = (parent1 as ExtendedPotvinEncoding).VehicleAssignment[tourParent1];
+        vehicleAssignment[tourParent2] = vehicle2;
+
+        for (int i = 0; i < vehicleAssignment.Length; i++) {
+          if (vehicleAssignment[i] == vehicle2 && i != tourParent2) {
+            vehicleAssignment[i] = vehicle;
+            break;
+          }
+        }        
+      }
 
       foreach (int city in replaced.Stops)
Index: branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Crossovers/PotvinSequenceBasedCrossover.cs
===================================================================
--- branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Crossovers/PotvinSequenceBasedCrossover.cs	(revision 6839)
+++ branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Crossovers/PotvinSequenceBasedCrossover.cs	(revision 6851)
@@ -67,6 +67,7 @@
         newTour.Stops.Add(tour2.Stops[i]);
 
+      int tour1Index = child.Tours.IndexOf(tour1);
       child.Tours.Remove(tour1);
-      child.Tours.Add(newTour);
+      child.Tours.Insert(tour1Index, newTour);
 
       foreach (int city in tour1.Stops)
Index: branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Manipulators/PotvinCustomerRelocationManipulator.cs
===================================================================
--- branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Manipulators/PotvinCustomerRelocationManipulator.cs	(revision 6839)
+++ branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Manipulators/PotvinCustomerRelocationManipulator.cs	(revision 6851)
@@ -67,5 +67,5 @@
         for (int i = 0; i < route1.Stops.Count; i++) {
           int stop = route1.Stops[i];
-          if (ProblemInstance.Demand[stop] < 0) {
+          if (ProblemInstance.GetDemand(stop) < 0) {
             int source = pdp.PickupDeliveryLocation[stop];
 
@@ -158,5 +158,5 @@
 
             //drive there
-            double currentDistace = vrptw.GetDistance(start, end);
+            double currentDistace = vrptw.GetDistance(start, end, individual);
             time += currentDistace;
 
Index: branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Moves/PickupDelivery/PDExchange/PotvinPDExchangeExhaustiveMoveGenerator.cs
===================================================================
--- branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Moves/PickupDelivery/PDExchange/PotvinPDExchangeExhaustiveMoveGenerator.cs	(revision 6839)
+++ branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Moves/PickupDelivery/PDExchange/PotvinPDExchangeExhaustiveMoveGenerator.cs	(revision 6851)
@@ -62,8 +62,8 @@
             if (k != i) {
               int city1 = individual.Tours[i].Stops[j];
-              if (pdp == null || pdp.Demand[city1] >= 0) {
+              if (pdp == null || pdp.GetDemand(city1) >= 0) {
                 for (int l = 0; l < individual.Tours[k].Stops.Count; l++) {
                   int city2 = individual.Tours[k].Stops[l];
-                  if (pdp == null || pdp.Demand[city2] >= 0) {
+                  if (pdp == null || pdp.GetDemand(city2) >= 0) {
                     bool valid = pdp == null ||
                       (pdp.PickupDeliveryLocation[city2] != pdp.PickupDeliveryLocation[city1] &&
Index: branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Moves/PickupDelivery/PDExchange/PotvinPDExchangeSingleMoveGenerator.cs
===================================================================
--- branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Moves/PickupDelivery/PDExchange/PotvinPDExchangeSingleMoveGenerator.cs	(revision 6839)
+++ branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Moves/PickupDelivery/PDExchange/PotvinPDExchangeSingleMoveGenerator.cs	(revision 6851)
@@ -62,5 +62,5 @@
       IPickupAndDeliveryProblemInstance pdp = problemInstance as IPickupAndDeliveryProblemInstance;
       for (int i = 1; i <= individual.Cities; i++) {
-        if (pdp == null || pdp.Demand[i] >= 0)
+        if (pdp == null || pdp.GetDemand(i) >= 0)
           cities.Add(i);
       }
@@ -84,5 +84,5 @@
         foreach (int stop in newTour.Stops) {
           if (pdp == null ||
-            (pdp.Demand[stop] >= 0 &&
+            (pdp.GetDemand(stop) >= 0 &&
              pdp.PickupDeliveryLocation[stop] != pdp.PickupDeliveryLocation[city] &&
              pdp.PickupDeliveryLocation[stop] != city &&
Index: branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Moves/PickupDelivery/PDRearrange/PotvinPDRearrangeExhaustiveMoveGenerator.cs
===================================================================
--- branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Moves/PickupDelivery/PDRearrange/PotvinPDRearrangeExhaustiveMoveGenerator.cs	(revision 6839)
+++ branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Moves/PickupDelivery/PDRearrange/PotvinPDRearrangeExhaustiveMoveGenerator.cs	(revision 6851)
@@ -54,5 +54,5 @@
 
       for (int i = 1; i <= problemInstance.Cities.Value; i++) {
-        if (pdp == null || pdp.Demand[i] >= 0) {
+        if (pdp == null || pdp.GetDemand(i) >= 0) {
           int tour = individual.Tours.FindIndex(t => t.Stops.Contains(i));
 
Index: branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Moves/PickupDelivery/PDRearrange/PotvinPDRearrangeMoveMaker.cs
===================================================================
--- branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Moves/PickupDelivery/PDRearrange/PotvinPDRearrangeMoveMaker.cs	(revision 6839)
+++ branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Moves/PickupDelivery/PDRearrange/PotvinPDRearrangeMoveMaker.cs	(revision 6851)
@@ -74,5 +74,5 @@
           if (positionToAvoid != i || positionToAvoid2 != j || stops == 0) {
             bool feasible;
-            double targetCosts = problemInstance.GetInsertionCosts(tourEval, target, 0, j, out feasible);
+            double targetCosts = problemInstance.GetInsertionCosts(tourEval, solution, target, 0, j, out feasible);
 
             double costs = sourceCosts + targetCosts;
Index: branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Moves/PickupDelivery/PDRearrange/PotvinPDRearrangeSingleMoveGenerator.cs
===================================================================
--- branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Moves/PickupDelivery/PDRearrange/PotvinPDRearrangeSingleMoveGenerator.cs	(revision 6839)
+++ branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Moves/PickupDelivery/PDRearrange/PotvinPDRearrangeSingleMoveGenerator.cs	(revision 6851)
@@ -62,5 +62,5 @@
       IPickupAndDeliveryProblemInstance pdp = problemInstance as IPickupAndDeliveryProblemInstance;
       for (int i = 1; i <= individual.Cities; i++) {
-        if(pdp == null || pdp.Demand[i] >= 0)
+        if(pdp == null || pdp.GetDemand(i) >= 0)
           cities.Add(i);
       }
Index: branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Moves/PickupDelivery/PDShift/PotvinPDShiftExhaustiveMoveGenerator.cs
===================================================================
--- branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Moves/PickupDelivery/PDShift/PotvinPDShiftExhaustiveMoveGenerator.cs	(revision 6839)
+++ branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Moves/PickupDelivery/PDShift/PotvinPDShiftExhaustiveMoveGenerator.cs	(revision 6851)
@@ -62,5 +62,5 @@
             if (k != i) {
               int city = individual.Tours[i].Stops[j];
-              if (pdp == null || pdp.Demand[city] >= 0) {
+              if (pdp == null || pdp.GetDemand(city) >= 0) {
                 PotvinPDShiftMove move = new PotvinPDShiftMove(
                   city, i, k, individual);
Index: branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Moves/PickupDelivery/PDShift/PotvinPDShiftSingleMoveGenerator.cs
===================================================================
--- branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Moves/PickupDelivery/PDShift/PotvinPDShiftSingleMoveGenerator.cs	(revision 6839)
+++ branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Moves/PickupDelivery/PDShift/PotvinPDShiftSingleMoveGenerator.cs	(revision 6851)
@@ -62,5 +62,5 @@
       IPickupAndDeliveryProblemInstance pdp = problemInstance as IPickupAndDeliveryProblemInstance;
       for (int i = 1; i <= individual.Cities; i++) {
-        if(pdp == null || pdp.Demand[i] >= 0)
+        if(pdp == null || pdp.GetDemand(i) >= 0)
           cities.Add(i);
       }
Index: branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/PotvinEncoding.cs
===================================================================
--- branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/PotvinEncoding.cs	(revision 6839)
+++ branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/PotvinEncoding.cs	(revision 6851)
@@ -45,5 +45,5 @@
 
     [StorableConstructor]
-    private PotvinEncoding(bool serializing)
+    protected PotvinEncoding(bool serializing)
       : base(serializing) {
     }
@@ -75,5 +75,5 @@
 
     public double GetTourLength(Tour tour) {
-      return tour.GetTourLength(ProblemInstance);
+      return tour.GetTourLength(ProblemInstance, this);
     }
 
@@ -87,5 +87,5 @@
         if (positionToAvoid != i) {
           bool feasible;
-          double quality = ProblemInstance.GetInsertionCosts(eval, city, 0, i, out feasible);
+          double quality = ProblemInstance.GetInsertionCosts(eval, this, city, 0, i, out feasible);
           if (place < 0 || quality < minQuality) {
             place = i;
@@ -115,6 +115,6 @@
           for (int i = 0; i <= Tours[tour].Stops.Count; i++) {
             bool feasible;
-            double detour = ProblemInstance.GetInsertionCosts(eval, city, tour, i, out feasible);
-            
+            double detour = ProblemInstance.GetInsertionCosts(eval, this, city, tour, i, out feasible);
+
             if (feasible || allowInfeasible) {
               if (route < 0 || detour < minDetour) {
