Index: /branches/VRP/HeuristicLab.Problems.VehicleRouting.Views/3.4/CVRPPDTWView.cs
===================================================================
--- /branches/VRP/HeuristicLab.Problems.VehicleRouting.Views/3.4/CVRPPDTWView.cs	(revision 6850)
+++ /branches/VRP/HeuristicLab.Problems.VehicleRouting.Views/3.4/CVRPPDTWView.cs	(revision 6851)
@@ -95,5 +95,5 @@
 
                   t += Content.GetDistance(
-                    lastCustomer, location);
+                    lastCustomer, location, Solution);
 
                   if (t < readyTime[location]) {
Index: /branches/VRP/HeuristicLab.Problems.VehicleRouting.Views/3.4/CVRPTWView.cs
===================================================================
--- /branches/VRP/HeuristicLab.Problems.VehicleRouting.Views/3.4/CVRPTWView.cs	(revision 6850)
+++ /branches/VRP/HeuristicLab.Problems.VehicleRouting.Views/3.4/CVRPTWView.cs	(revision 6851)
@@ -76,5 +76,5 @@
 
                   t += Content.GetDistance(
-                    lastCustomer, location);
+                    lastCustomer, location, Solution);
 
                   if (t < readyTime[location]) {
Index: /branches/VRP/HeuristicLab.Problems.VehicleRouting.Views/3.4/HeuristicLab.Problems.VehicleRouting.Views-3.4.csproj
===================================================================
--- /branches/VRP/HeuristicLab.Problems.VehicleRouting.Views/3.4/HeuristicLab.Problems.VehicleRouting.Views-3.4.csproj	(revision 6850)
+++ /branches/VRP/HeuristicLab.Problems.VehicleRouting.Views/3.4/HeuristicLab.Problems.VehicleRouting.Views-3.4.csproj	(revision 6851)
@@ -112,4 +112,10 @@
   </ItemGroup>
   <ItemGroup>
+    <Compile Include="MultiDepotVRPView.cs">
+      <SubType>UserControl</SubType>
+    </Compile>
+    <Compile Include="MultiDepotVRPView.Designer.cs">
+      <DependentUpon>MultiDepotVRPView.cs</DependentUpon>
+    </Compile>
     <Compile Include="CVRPPDTWView.cs">
       <SubType>UserControl</SubType>
Index: /branches/VRP/HeuristicLab.Problems.VehicleRouting.Views/3.4/MultiDepotVRPView.Designer.cs
===================================================================
--- /branches/VRP/HeuristicLab.Problems.VehicleRouting.Views/3.4/MultiDepotVRPView.Designer.cs	(revision 6851)
+++ /branches/VRP/HeuristicLab.Problems.VehicleRouting.Views/3.4/MultiDepotVRPView.Designer.cs	(revision 6851)
@@ -0,0 +1,31 @@
+﻿namespace HeuristicLab.Problems.VehicleRouting.Views {
+  partial class MultiDepotVRPView {
+    /// <summary>
+    /// Required designer variable.
+    /// </summary>
+    private System.ComponentModel.IContainer components = null;
+
+    /// <summary>
+    /// Clean up any resources being used.
+    /// </summary>
+    /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+    protected override void Dispose(bool disposing) {
+      if (disposing && (components != null)) {
+        components.Dispose();
+      }
+      base.Dispose(disposing);
+    }
+
+    #region Windows Form Designer generated code
+
+    /// <summary>
+    /// Required method for Designer support - do not modify
+    /// the contents of this method with the code editor.
+    /// </summary>
+    private void InitializeComponent() {
+      this.components = new System.ComponentModel.Container();
+    }
+
+    #endregion
+  }
+}
Index: /branches/VRP/HeuristicLab.Problems.VehicleRouting.Views/3.4/MultiDepotVRPView.cs
===================================================================
--- /branches/VRP/HeuristicLab.Problems.VehicleRouting.Views/3.4/MultiDepotVRPView.cs	(revision 6851)
+++ /branches/VRP/HeuristicLab.Problems.VehicleRouting.Views/3.4/MultiDepotVRPView.cs	(revision 6851)
@@ -0,0 +1,128 @@
+﻿using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Text;
+using System.Windows.Forms;
+using HeuristicLab.MainForm;
+using HeuristicLab.Problems.VehicleRouting.ProblemInstances;
+using HeuristicLab.Data;
+
+namespace HeuristicLab.Problems.VehicleRouting.Views {
+  [View("MultiDepotVRPProblemInstance View")]
+  [Content(typeof(MultiDepotVRPProblemInstance), true)]
+  public partial class MultiDepotVRPView : VRPProblemInstanceView {
+    public new MultiDepotVRPProblemInstance Content {
+      get { return (MultiDepotVRPProblemInstance)base.Content; }
+      set { base.Content = value; }
+    }
+
+    public MultiDepotVRPView() {
+      InitializeComponent();
+    }
+
+    protected override void DrawVisualization(Bitmap bitmap) {
+      DoubleMatrix coordinates = Content.Coordinates;
+      DoubleMatrix distanceMatrix = Content.DistanceMatrix;
+      BoolValue useDistanceMatrix = Content.UseDistanceMatrix;
+
+      Pen[] pens = {new Pen(Color.FromArgb(92,20,237)), new Pen(Color.FromArgb(237,183,20)), new Pen(Color.FromArgb(237,20,219)), new Pen(Color.FromArgb(20,237,76)),
+                    new Pen(Color.FromArgb(237,61,20)), new Pen(Color.FromArgb(115,78,26)), new Pen(Color.FromArgb(20,237,229)), new Pen(Color.FromArgb(39,101,19)),
+                    new Pen(Color.FromArgb(230,170,229)), new Pen(Color.FromArgb(142,136,89)), new Pen(Color.FromArgb(157,217,166)), new Pen(Color.FromArgb(31,19,101)),
+                    new Pen(Color.FromArgb(173,237,20)), new Pen(Color.FromArgb(230,231,161)), new Pen(Color.FromArgb(142,89,89)), new Pen(Color.FromArgb(93,89,142)),
+                    new Pen(Color.FromArgb(146,203,217)), new Pen(Color.FromArgb(101,19,75)), new Pen(Color.FromArgb(198,20,237)), new Pen(Color.FromArgb(185,185,185)),
+                    new Pen(Color.FromArgb(179,32,32)), new Pen(Color.FromArgb(18,119,115)), new Pen(Color.FromArgb(104,158,239)), new Pen(Color.Black)};
+
+
+      if ((coordinates != null) && (coordinates.Rows > 0) && (coordinates.Columns == 2)) {
+        double xMin = double.MaxValue, yMin = double.MaxValue, xMax = double.MinValue, yMax = double.MinValue;
+        for (int i = 0; i < coordinates.Rows; i++) {
+          if (xMin > coordinates[i, 0]) xMin = coordinates[i, 0];
+          if (yMin > coordinates[i, 1]) yMin = coordinates[i, 1];
+          if (xMax < coordinates[i, 0]) xMax = coordinates[i, 0];
+          if (yMax < coordinates[i, 1]) yMax = coordinates[i, 1];
+        }
+
+        int border = 20;
+        double xStep = xMax != xMin ? (bitmap.Width - 2 * border) / (xMax - xMin) : 1;
+        double yStep = yMax != yMin ? (bitmap.Height - 2 * border) / (yMax - yMin) : 1;
+
+        using (Graphics graphics = Graphics.FromImage(bitmap)) {
+          if (Solution != null) {
+            for (int i = 0; i < Content.Depots.Value; i++) {
+              Point locationPoint = new Point(border + ((int)((coordinates[i, 0] - xMin) * xStep)),
+                                bitmap.Height - (border + ((int)((coordinates[i, 1] - yMin) * yStep))));
+              graphics.FillEllipse(Brushes.Blue, locationPoint.X - 5, locationPoint.Y - 5, 10, 10);
+            }
+
+            int currentTour = 0;
+            foreach (Tour tour in Solution.GetTours()) {
+              Point[] tourPoints = new Point[tour.Stops.Count + 2];
+              Brush[] customerBrushes = new Brush[tour.Stops.Count];
+              int lastCustomer = 0;
+
+              for (int i = -1; i <= tour.Stops.Count; i++) {
+                int location = 0;
+
+                if (i == -1 || i == tour.Stops.Count)
+                  location = 0; //depot
+                else
+                  location = tour.Stops[i];
+
+                Point locationPoint;
+
+                if (location == 0) {
+                  int tourIndex = Solution.GetTourIndex(tour);
+                  int vehicle = Solution.GetVehicleAssignment(tourIndex);
+                  int depot = Content.VehicleDepotAssignment[vehicle];
+
+                  locationPoint = new Point(border + ((int)((Content.Coordinates[depot, 0] - xMin) * xStep)),
+                                  bitmap.Height - (border + ((int)((Content.Coordinates[depot, 1] - yMin) * yStep))));
+                } else {
+                  locationPoint = new Point(border + ((int)((Content.GetCoordinates(location)[0] - xMin) * xStep)),
+                                  bitmap.Height - (border + ((int)((Content.GetCoordinates(location)[1] - yMin) * yStep))));
+                }
+                tourPoints[i + 1] = locationPoint;
+
+                if (i != -1 && i != tour.Stops.Count) {
+                  Brush customerBrush = Brushes.Black;
+                  customerBrushes[i] = customerBrush;
+                }
+                lastCustomer = location;
+              }
+
+              graphics.DrawPolygon(pens[((currentTour >= pens.Length) ? (pens.Length - 1) : (currentTour))], tourPoints);
+
+              for (int i = 0; i < tour.Stops.Count; i++) {
+                graphics.FillRectangle(customerBrushes[i], tourPoints[i + 1].X - 3, tourPoints[i + 1].Y - 3, 6, 6);
+              }
+
+              graphics.FillEllipse(Brushes.DarkBlue, tourPoints[0].X - 5, tourPoints[0].Y - 5, 10, 10);
+
+              currentTour++;
+            }
+          } else {
+            Point locationPoint;
+            //just draw customers
+            for (int i = 1; i <= Content.Cities.Value; i++) {
+              locationPoint = new Point(border + ((int)((Content.GetCoordinates(i)[0] - xMin) * xStep)),
+                              bitmap.Height - (border + ((int)((Content.GetCoordinates(i)[1] - yMin) * yStep))));
+
+              graphics.FillRectangle(Brushes.Black, locationPoint.X - 3, locationPoint.Y - 3, 6, 6);
+            }
+
+            for (int i = 0; i < Content.Depots.Value; i++) {
+              locationPoint = new Point(border + ((int)((coordinates[i, 0] - xMin) * xStep)),
+                                bitmap.Height - (border + ((int)((coordinates[i, 1] - yMin) * yStep))));
+              graphics.FillEllipse(Brushes.Blue, locationPoint.X - 5, locationPoint.Y - 5, 10, 10);
+            }
+          }
+        }
+      }
+
+      for (int i = 0; i < pens.Length; i++)
+        pens[i].Dispose();
+    }
+  }
+}
Index: /branches/VRP/HeuristicLab.Problems.VehicleRouting.Views/3.4/VRPImportDialog.Designer.cs
===================================================================
--- /branches/VRP/HeuristicLab.Problems.VehicleRouting.Views/3.4/VRPImportDialog.Designer.cs	(revision 6850)
+++ /branches/VRP/HeuristicLab.Problems.VehicleRouting.Views/3.4/VRPImportDialog.Designer.cs	(revision 6851)
@@ -85,6 +85,6 @@
       this.openVRPFileDialog.DefaultExt = "vrp";
       this.openVRPFileDialog.FileName = "vrp";
-      this.openVRPFileDialog.Filter = "TSPLib Format|*.vrp|Solomon Format|*.txt|ORLib Format|*.txt|LiLim Format|*.txt";
-      this.openVRPFileDialog.Title = "Open TSP File";
+      this.openVRPFileDialog.Filter = "TSPLib Format|*.vrp|Solomon Format|*.txt|ORLib Format|*.txt|LiLim Format|*.txt|Cordeau Format|*.md";
+      this.openVRPFileDialog.Title = "Open VRP File";
       // 
       // tspFileLabel
Index: /branches/VRP/HeuristicLab.Problems.VehicleRouting.Views/3.4/VRPImportDialog.cs
===================================================================
--- /branches/VRP/HeuristicLab.Problems.VehicleRouting.Views/3.4/VRPImportDialog.cs	(revision 6850)
+++ /branches/VRP/HeuristicLab.Problems.VehicleRouting.Views/3.4/VRPImportDialog.cs	(revision 6851)
@@ -27,5 +27,5 @@
 
 namespace HeuristicLab.Problems.VehicleRouting.Views {
-  public enum VRPFormat { Empty, TSPLib, Solomon, ORLib, LiLim }
+  public enum VRPFormat { Empty, TSPLib, Solomon, ORLib, LiLim, Cordeau }
 
   public sealed partial class VRPImportDialog : Form {
Index: /branches/VRP/HeuristicLab.Problems.VehicleRouting.Views/3.4/VehicleRoutingProblemView.cs
===================================================================
--- /branches/VRP/HeuristicLab.Problems.VehicleRouting.Views/3.4/VehicleRoutingProblemView.cs	(revision 6850)
+++ /branches/VRP/HeuristicLab.Problems.VehicleRouting.Views/3.4/VehicleRoutingProblemView.cs	(revision 6851)
@@ -86,4 +86,8 @@
               Content.ImportFromLiLim(vrpImportDialog.VRPFileName);
               break;
+
+            case VRPFormat.Cordeau:
+              Content.ImportFromCordeau(vrpImportDialog.VRPFileName);
+              break;
           }
 
Index: /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Alba/AlbaEncoding.cs
===================================================================
--- /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Alba/AlbaEncoding.cs	(revision 6850)
+++ /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Alba/AlbaEncoding.cs	(revision 6851)
@@ -33,7 +33,8 @@
   [Item("AlbaEncoding", "Represents an Alba encoding of VRP solutions. It is implemented as described in Alba, E. and Dorronsoro, B. (2004). Solving the Vehicle Routing Problem by Using Cellular Genetic Algorithms.")]
   [StorableClass]
-  public class AlbaEncoding : PermutationEncoding, IHeterogenousCapacitatedEncoding  {   
+  public class AlbaEncoding : PermutationEncoding  {   
     #region IVRPEncoding Members
     public override List<Tour> GetTours() {
+      Repair();
       List<Tour> result = new List<Tour>();
 
@@ -55,13 +56,10 @@
       if (tour.Stops.Count > 0) {
         result.Add(tour);
-      }   
+      }
 
       return result;
     }
-    #endregion
 
-    #region IHeterogenousCapacitatedEncoding Members
-
-    public int GetVehicleAssignment(int tour) {
+    public override int GetVehicleAssignment(int tour) {
       int vehicleAssignment = -1;
       Tour currentTour = GetTours()[tour];
@@ -72,6 +70,15 @@
       int lastStopIndex = this.IndexOf(lastStop);
 
-      if (lastStopIndex == this.Length - 1)
-        vehicleAssignment = this.ProblemInstance.Vehicles.Value - 1;
+      if (lastStopIndex == this.Length - 1) {
+        int i = this.Length - 1;
+
+        while (vehicleAssignment == -1) {
+          if (this.array[i] >= ProblemInstance.Cities.Value) {
+            vehicleAssignment = this.array[i] - ProblemInstance.Cities.Value;
+          }
+          
+          i--;
+        }
+      }
       else
         vehicleAssignment = this[lastStopIndex + 1] - this.ProblemInstance.Cities.Value;
@@ -80,4 +87,20 @@
     }
     #endregion
+
+    public void Repair() {
+      int cities = ProblemInstance.Cities.Value;
+
+      if (this[this.Length - 1] < cities) {
+        int index = this.Length - 2;
+        while (this[index] < cities) {
+          index--;
+        }
+
+        int vehicle = this[index];
+        for (int i = index; i < this.Length - 1; i++)
+          this[i] = this[i + 1];
+        this[Length - 1] = vehicle;
+      }
+    }
 
     public AlbaEncoding(Permutation permutation, IVRPProblemInstance instance)
@@ -100,5 +123,4 @@
     public static AlbaEncoding ConvertFrom(List<int> routeParam, IVRPProblemInstance instance) {
       List<int> route = new List<int>(routeParam);
-      route.RemoveAt(routeParam.Count - 1);
       
       int cities = instance.Cities.Value;
@@ -129,5 +151,5 @@
       int emptyVehicles = instance.Vehicles.Value - tours.Count;
 
-      int[] array = new int[cities + tours.Count + emptyVehicles - 1];
+      int[] array = new int[cities + tours.Count + emptyVehicles];
       int delimiter = 0;
       int arrayIndex = 0;
@@ -140,9 +162,5 @@
 
         if (arrayIndex != array.Length) {
-          if (encoding is IHeterogenousCapacitatedEncoding) {
-            array[arrayIndex] = cities + (encoding as IHeterogenousCapacitatedEncoding).GetVehicleAssignment(delimiter);
-          } else {
-            array[arrayIndex] = cities + delimiter;
-          }
+          array[arrayIndex] = cities + encoding.GetVehicleAssignment(delimiter);
           
           delimiter++;
@@ -151,10 +169,6 @@
       }
 
-      for (int i = 0; i < emptyVehicles - 1; i++) {
-        if (encoding is IHeterogenousCapacitatedEncoding) {
-          array[arrayIndex] = cities + (encoding as IHeterogenousCapacitatedEncoding).GetVehicleAssignment(delimiter);
-        } else {
-          array[arrayIndex] = cities + delimiter;
-        }
+      for (int i = 0; i < emptyVehicles; i++) {
+        array[arrayIndex] = cities + encoding.GetVehicleAssignment(delimiter);
 
         delimiter++;
Index: /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Alba/Creators/AlbaCreator.cs
===================================================================
--- /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Alba/Creators/AlbaCreator.cs	(revision 6850)
+++ /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Alba/Creators/AlbaCreator.cs	(revision 6851)
@@ -47,4 +47,10 @@
       : base(original, cloner) {
     }
+
+    public override IOperation Apply() {
+      (VRPToursParameter.ActualValue as AlbaEncoding).Repair();
+
+      return base.Apply();
+    }
   }
 }
Index: /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Alba/Crossovers/AlbaCrossover.cs
===================================================================
--- /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Alba/Crossovers/AlbaCrossover.cs	(revision 6850)
+++ /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Alba/Crossovers/AlbaCrossover.cs	(revision 6851)
@@ -67,5 +67,6 @@
 
       ChildParameter.ActualValue = 
-        Crossover(RandomParameter.ActualValue, parents[0] as AlbaEncoding, parents[1] as AlbaEncoding);  
+        Crossover(RandomParameter.ActualValue, parents[0] as AlbaEncoding, parents[1] as AlbaEncoding);
+      (ChildParameter.ActualValue as AlbaEncoding).Repair();
 
       return base.Apply();
Index: /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Alba/IAlbaOperator.cs
===================================================================
--- /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Alba/IAlbaOperator.cs	(revision 6850)
+++ /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Alba/IAlbaOperator.cs	(revision 6851)
@@ -32,6 +32,6 @@
 
 namespace HeuristicLab.Problems.VehicleRouting.Encodings.Alba {
-  public interface IAlbaOperator: 
-    ISingleDepotOperator, IHeterogenousCapacitatedOperator, ITimeWindowedOperator {    
+  public interface IAlbaOperator:
+    ISingleDepotOperator, IHeterogenousCapacitatedOperator, IMultiDepotOperator, ITimeWindowedOperator {    
   }
 }
Index: /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Alba/Manipulators/AlbaManipulator.cs
===================================================================
--- /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Alba/Manipulators/AlbaManipulator.cs	(revision 6850)
+++ /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Alba/Manipulators/AlbaManipulator.cs	(revision 6851)
@@ -71,4 +71,5 @@
 
       Manipulate(RandomParameter.ActualValue, VRPToursParameter.ActualValue as AlbaEncoding);
+      (VRPToursParameter.ActualValue as AlbaEncoding).Repair();
 
       return base.Apply();
Index: /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/ExtendedPotvin/Creators/ExtendedPotvinCreator.cs
===================================================================
--- /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/ExtendedPotvin/Creators/ExtendedPotvinCreator.cs	(revision 6851)
+++ /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/ExtendedPotvin/Creators/ExtendedPotvinCreator.cs	(revision 6851)
@@ -0,0 +1,51 @@
+﻿#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 HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Operators;
+using HeuristicLab.Parameters;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HeuristicLab.Problems.VehicleRouting.Interfaces;
+using HeuristicLab.Problems.VehicleRouting.Encodings.General;
+using HeuristicLab.Common;
+using HeuristicLab.Problems.VehicleRouting.Encodings.Potvin;
+
+namespace HeuristicLab.Problems.VehicleRouting.Encodings.ExtendedPotvin {
+  [Item("ExtendedPotvinCreator", "A VRP creator.")]
+  [StorableClass]
+  public abstract class ExtendedPotvinCreator : VRPCreator, IExtendedPotvinOperator, IVRPCreator {    
+    public override bool CanChangeName {
+      get { return false; }
+    }
+    
+    [StorableConstructor]
+    protected ExtendedPotvinCreator(bool deserializing) : base(deserializing) { }
+
+    public ExtendedPotvinCreator()
+      : base() {
+    }
+
+    protected ExtendedPotvinCreator(ExtendedPotvinCreator original, Cloner cloner)
+      : base(original, cloner) {
+    }
+  }
+}
Index: /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/ExtendedPotvin/Creators/IterativeInsertionCreator.cs
===================================================================
--- /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/ExtendedPotvin/Creators/IterativeInsertionCreator.cs	(revision 6851)
+++ /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/ExtendedPotvin/Creators/IterativeInsertionCreator.cs	(revision 6851)
@@ -0,0 +1,150 @@
+﻿#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.ExtendedPotvin {
+  [Item("IterativeInsertionCreator", "Creates a randomly initialized VRP solution.")]
+  [StorableClass]
+  public sealed class IterativeInsertionCreator : ExtendedPotvinCreator, 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.GetCoordinates(0)[0];
+      double dy = instance.GetCoordinates(0)[1];
+
+      double cx = instance.GetCoordinates(city)[0];
+      double cy = instance.GetCoordinates(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 ExtendedPotvinEncoding CreateSolution(IVRPProblemInstance instance, IRandom random, bool adhereTimeWindows) {
+      ExtendedPotvinEncoding result = new ExtendedPotvinEncoding(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.GetDemand(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 = 0;
+        if(currentTour.Stops.Count > 0)
+          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.Remove(currentTour);
+          currentTour = new Tour();
+          result.Tours.Add(currentTour);
+          
+          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/ExtendedPotvin/Creators/PushForwardInsertionCreator.cs
===================================================================
--- /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/ExtendedPotvin/Creators/PushForwardInsertionCreator.cs	(revision 6851)
+++ /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/ExtendedPotvin/Creators/PushForwardInsertionCreator.cs	(revision 6851)
@@ -0,0 +1,320 @@
+﻿#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.ExtendedPotvin {
+  [Item("PushForwardInsertionCreator", "Creates a randomly initialized VRP solution.")]
+  [StorableClass]
+  public sealed class PushForwardInsertionCreator : ExtendedPotvinCreator, 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 GetDistance(int start, int end, IVRPProblemInstance problemInstance) {
+      double distance = 0.0;
+
+      double startX = problemInstance.Coordinates[start, 0];
+      double startY = problemInstance.Coordinates[start, 1];
+
+      double endX = problemInstance.Coordinates[end, 0];
+      double endY = problemInstance.Coordinates[end, 1];
+
+      distance =
+          Math.Sqrt(
+            Math.Pow(startX - endX, 2) +
+            Math.Pow(startY - endY, 2));
+
+      return distance;
+    }
+
+    private static ExtendedPotvinEncoding 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) {
+      ExtendedPotvinEncoding result = new ExtendedPotvinEncoding(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);
+
+      int totalTours = 0;
+
+      double distance = 0;
+      double cost = 0;
+      List<int> unroutedList = new List<int>();
+      List<double> costList = new List<double>();
+
+      IPickupAndDeliveryProblemInstance pdp = problemInstance as IPickupAndDeliveryProblemInstance;
+      IMultiDepotProblemInstance mdp = problemInstance as IMultiDepotProblemInstance;
+
+      int depots = 1;
+      if (mdp != null) {
+        depots = mdp.Depots.Value;
+        for (int i = 0; i < result.VehicleAssignment.Length; i++)
+          result.VehicleAssignment[i] = -1;
+      }
+
+      List<int> unrouted = new List<int>();
+      for (int i = 1; i <= problemInstance.Cities.Value; i++)
+        if (pdp == null || problemInstance.GetDemand(i) >= 0)
+          unrouted.Add(i);
+
+      for (int depot = 0; depot < depots; depot++) {
+        int vehicleCount = problemInstance.Vehicles.Value;
+        List<int> vehicles = new List<int>();
+        if (mdp != null) {
+          vehicleCount = 0;
+          for (int i = 0; i < mdp.VehicleDepotAssignment.Length; i++) {
+            if (mdp.VehicleDepotAssignment[i] == depot) {
+              vehicleCount++;
+              vehicles.Add(i);
+            }
+          }
+        } else {
+          for (int i = 0; i < problemInstance.Vehicles.Value; i++)
+            vehicles.Add(i);
+        }
+
+        costList.Clear();
+        unroutedList.Clear();
+
+        double x0 = problemInstance.Coordinates[depot, 0];
+        double y0 = problemInstance.Coordinates[depot, 1];
+
+        /*-----------------------------------------------------------------------------
+        * generate cost list
+        *-----------------------------------------------------------------------------
+        */
+        for (int i = 1; i <= problemInstance.Cities.Value; i++) {
+          //only insert sources
+          if (unrouted.Contains(i) && (pdp == null || problemInstance.GetDemand(i) >= 0)) {
+            distance = GetDistance(i + depots - 1, depot, problemInstance);
+            if (problemInstance.Coordinates[i + depots - 1, 0] < x0) distance = -distance;
+
+            double dueTime = 0;
+            if (problemInstance is ITimeWindowedProblemInstance)
+              dueTime = (problemInstance as ITimeWindowedProblemInstance).DueTime[i];
+
+            cost = -alpha * distance + // distance 0 <-> City[i]
+                   beta * dueTime + // latest arrival time
+                   gamma * (Math.Asin((problemInstance.Coordinates[i + depots - 1, 0] - 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);
+          }
+        }
+
+        int tours = 0;
+        double minimumCost = double.MaxValue;
+        int indexOfMinimumCost = -1;
+        int indexOfMinimumCost2 = -1;
+        int indexOfCustomer = -1;
+
+        Tour tour = new Tour();
+        result.Tours.Add(tour);
+        result.VehicleAssignment[totalTours] = vehicles[0];
+        vehicles.RemoveAt(0);
+        tours++;
+        totalTours++;
+
+        tour.Stops.Add(unroutedList[0]);
+
+        if (pdp != null) {
+          tour.Stops.Add(pdp.PickupDeliveryLocation[unroutedList[0]]);
+        }
+
+        unrouted.Remove(unroutedList[0]);
+        unroutedList.RemoveAt(0);
+
+        while (unroutedList.Count > 0 && (tours < vehicleCount || depot == depots - 1)) {
+          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, result, 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]]);
+            }
+
+            unrouted.Remove(unroutedList[indexOfCustomer]);
+            unroutedList.RemoveAt(indexOfCustomer);
+          } else if (tours < vehicleCount || depot == depots - 1) { // no feasible customer found
+            tour = new Tour();
+            result.Tours.Add(tour);
+            result.VehicleAssignment[totalTours] = vehicles[0];
+            vehicles.RemoveAt(0);
+            tours++;
+            totalTours++;
+
+            tour.Stops.Add(unroutedList[0]);
+            if (pdp != null) {
+              tour.Stops.Add(pdp.PickupDeliveryLocation[unroutedList[0]]);
+            }
+
+            unrouted.Remove(unroutedList[0]);
+            unroutedList.RemoveAt(0);
+          }
+          // reset minimum		
+          minimumCost = double.MaxValue;
+          indexOfMinimumCost = -1;
+          indexOfMinimumCost2 = -1;
+          indexOfCustomer = -1;
+        }
+      }
+
+      if (mdp != null) {
+        List<int> availableVehicles = new List<int>();
+        for (int i = 0; i < mdp.Vehicles.Value; i++)
+          availableVehicles.Add(i);
+
+        for (int i = 0; i < result.VehicleAssignment.Length; i++) {
+          if (result.VehicleAssignment[i] != -1)
+            availableVehicles.Remove(result.VehicleAssignment[i]);
+        }
+
+        for (int i = 0; i < result.VehicleAssignment.Length; i++) {
+          if (result.VehicleAssignment[i] == -1) {
+            result.VehicleAssignment[i] = availableVehicles[0];
+            availableVehicles.RemoveAt(0);
+          }
+        }
+      }
+
+      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/ExtendedPotvin/Crossovers/ExtendedPotvinCrossover.cs
===================================================================
--- /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/ExtendedPotvin/Crossovers/ExtendedPotvinCrossover.cs	(revision 6851)
+++ /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/ExtendedPotvin/Crossovers/ExtendedPotvinCrossover.cs	(revision 6851)
@@ -0,0 +1,85 @@
+﻿#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 HeuristicLab.Core;
+using HeuristicLab.Encodings.PermutationEncoding;
+using HeuristicLab.Parameters;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HeuristicLab.Data;
+using HeuristicLab.Optimization;
+using System.Collections.Generic;
+using HeuristicLab.Problems.VehicleRouting.Encodings.General;
+using HeuristicLab.Problems.VehicleRouting.Interfaces;
+using HeuristicLab.Common;
+using HeuristicLab.Problems.VehicleRouting.Encodings.Potvin;
+
+namespace HeuristicLab.Problems.VehicleRouting.Encodings.ExtendedPotvin {
+  [Item("ExtendedPotvinCrossover", "A VRP crossover operation.")]
+  [StorableClass]
+  public class ExtendedPotvinCrossover : VRPCrossover, IStochasticOperator, IExtendedPotvinOperator {
+    public ILookupParameter<IRandom> RandomParameter {
+      get { return (LookupParameter<IRandom>)Parameters["Random"]; }
+    }
+
+    public IValueParameter<PotvinCrossover> ToursCrossover {
+      get { return (IValueParameter<PotvinCrossover>)Parameters["ToursCrossover"]; }
+    }
+
+    [StorableConstructor]
+    protected ExtendedPotvinCrossover(bool deserializing) : base(deserializing) { }
+
+    public ExtendedPotvinCrossover() {
+      Parameters.Add(new LookupParameter<IRandom>("Random", "The pseudo random number generator which should be used for stochastic manipulation operators."));
+      Parameters.Add(new ValueParameter<PotvinCrossover>("ToursCrossover",
+        "The operator used to crossover the tours.", new PotvinInsertionBasedCrossover()));
+    }
+
+    protected ExtendedPotvinCrossover(ExtendedPotvinCrossover original, Cloner cloner)
+      : base(original, cloner) {
+    }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new ExtendedPotvinCrossover(this, cloner);
+    }
+
+    public override IOperation Apply() {
+      ItemArray<IVRPEncoding> parents = new ItemArray<IVRPEncoding>(ParentsParameter.ActualValue.Length);
+      for (int i = 0; i < ParentsParameter.ActualValue.Length; i++) {
+        IVRPEncoding solution = ParentsParameter.ActualValue[i];
+
+        if (!(solution is ExtendedPotvinEncoding)) {
+          parents[i] = ExtendedPotvinEncoding.ConvertFrom(solution, ProblemInstance);
+        } else {
+          parents[i] = solution;
+        }
+      }
+      ParentsParameter.ActualValue = parents;
+
+      OperationCollection next = new OperationCollection(base.Apply());
+      
+      ToursCrossover.Value.ParentsParameter.ActualName = ParentsParameter.ActualName;
+      ToursCrossover.Value.ChildParameter.ActualName = ChildParameter.ActualName;
+      next.Insert(0, ExecutionContext.CreateOperation(ToursCrossover.Value));
+
+      return next;
+    }
+  }
+}
Index: /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/ExtendedPotvin/ExtendedPotvinEncoding.cs
===================================================================
--- /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/ExtendedPotvin/ExtendedPotvinEncoding.cs	(revision 6851)
+++ /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/ExtendedPotvin/ExtendedPotvinEncoding.cs	(revision 6851)
@@ -0,0 +1,105 @@
+﻿#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 HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Encodings.PermutationEncoding;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using System.Drawing;
+using System.Collections.Generic;
+using HeuristicLab.Problems.VehicleRouting.Encodings.General;
+using HeuristicLab.Problems.VehicleRouting.Variants;
+using HeuristicLab.Problems.VehicleRouting.Interfaces;
+using HeuristicLab.Problems.VehicleRouting.ProblemInstances;
+using HeuristicLab.Problems.VehicleRouting.Encodings.Potvin;
+
+namespace HeuristicLab.Problems.VehicleRouting.Encodings.ExtendedPotvin {
+  [Item("ExtendedPotvinEncoding", "A tour encoding with heterogenous vehicles.")]
+  [StorableClass]
+  public class ExtendedPotvinEncoding : PotvinEncoding {
+    [Storable]
+    public Permutation VehicleAssignment { get; private set; }
+
+    public ExtendedPotvinEncoding(IVRPProblemInstance instance)
+      : base(instance) {
+       VehicleAssignment = new Permutation(PermutationTypes.Absolute, instance.Vehicles.Value);
+    }
+
+    [StorableConstructor]
+    private ExtendedPotvinEncoding(bool serializing)
+      : base(serializing) {
+    }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new ExtendedPotvinEncoding(this, cloner);
+    }
+
+    protected ExtendedPotvinEncoding(ExtendedPotvinEncoding original, Cloner cloner)
+      : base(original, cloner) {
+        this.VehicleAssignment = cloner.Clone<Permutation>(original.VehicleAssignment);
+    }
+
+    public override int GetVehicleAssignment(int tour) {
+      return VehicleAssignment[tour];
+    }
+
+    public static new ExtendedPotvinEncoding ConvertFrom(IVRPEncoding encoding, IVRPProblemInstance instance) {
+      ExtendedPotvinEncoding solution = new ExtendedPotvinEncoding(instance);
+
+      TourEncoding.ConvertFrom(encoding, solution, instance);
+
+      List<int> vehicles = new List<int>();
+      for (int i = 0; i < instance.Vehicles.Value; i++)
+        vehicles.Add(i);
+
+      int[] assignment = new int[instance.Vehicles.Value];
+      for (int i = 0; i < assignment.Length; i++)
+        assignment[i] = -1;
+
+      for (int i = 0; i < solution.Tours.Count; i++) {
+        int vehicle = encoding.GetVehicleAssignment(i);
+        assignment[i] = vehicle;
+        vehicles.Remove(vehicle);
+      }
+
+      for (int i = 0; i < instance.Vehicles.Value; i++) {
+        if (assignment[i] == -1) {
+          int vehicle = vehicles[0];
+          assignment[i] = vehicle;
+          vehicles.RemoveAt(0);
+        }
+      }
+
+      solution.VehicleAssignment = new Permutation(PermutationTypes.Absolute, assignment);
+
+      return solution;
+    }
+
+    public static new ExtendedPotvinEncoding ConvertFrom(List<int> route, IVRPProblemInstance instance) {
+      ExtendedPotvinEncoding solution = new ExtendedPotvinEncoding(instance);
+
+      TourEncoding.ConvertFrom(route, solution);
+
+      return solution;
+    }
+  }
+}
Index: /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/ExtendedPotvin/IExtendedPotvinOperator.cs
===================================================================
--- /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/ExtendedPotvin/IExtendedPotvinOperator.cs	(revision 6851)
+++ /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/ExtendedPotvin/IExtendedPotvinOperator.cs	(revision 6851)
@@ -0,0 +1,38 @@
+﻿#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 System.Linq;
+using System.Text;
+using HeuristicLab.Problems.VehicleRouting.Interfaces;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HeuristicLab.Core;
+using HeuristicLab.Parameters;
+using HeuristicLab.Operators;
+using HeuristicLab.Problems.VehicleRouting.Variants;
+using HeuristicLab.Problems.VehicleRouting.Encodings.Potvin;
+
+namespace HeuristicLab.Problems.VehicleRouting.Encodings.ExtendedPotvin {
+  public interface IExtendedPotvinOperator :
+    IPotvinOperator, IMultiDepotOperator, IHeterogenousCapacitatedOperator {    
+  }
+}
Index: /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/ExtendedPotvin/Manipulators/ExtendedPotvinManipulator.cs
===================================================================
--- /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/ExtendedPotvin/Manipulators/ExtendedPotvinManipulator.cs	(revision 6851)
+++ /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/ExtendedPotvin/Manipulators/ExtendedPotvinManipulator.cs	(revision 6851)
@@ -0,0 +1,99 @@
+﻿#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 HeuristicLab.Core;
+using HeuristicLab.Encodings.PermutationEncoding;
+using HeuristicLab.Parameters;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HeuristicLab.Data;
+using HeuristicLab.Optimization;
+using HeuristicLab.Problems.VehicleRouting.Encodings.General;
+using HeuristicLab.Problems.VehicleRouting.Interfaces;
+using HeuristicLab.Common;
+using HeuristicLab.Problems.VehicleRouting.Encodings.Potvin;
+
+namespace HeuristicLab.Problems.VehicleRouting.Encodings.ExtendedPotvin {
+  [Item("ExtendedPotvinManipulator", "A VRP manipulation operation.")]
+  [StorableClass]
+  public class ExtendedPotvinManipulator : VRPManipulator, IStochasticOperator, IExtendedPotvinOperator {
+    public ILookupParameter<IRandom> RandomParameter {
+      get { return (LookupParameter<IRandom>)Parameters["Random"]; }
+    }
+
+    public IValueParameter<PotvinManipulator> ToursManipuator {
+      get { return (IValueParameter<PotvinManipulator>)Parameters["ToursManipuator"]; }
+    }
+
+    public IValueParameter<IPermutationManipulator> VehicleAssignmentManipuator {
+      get { return (IValueParameter<IPermutationManipulator>)Parameters["VehicleAssignmentManipuator"]; }
+    }
+
+    public IValueParameter<PercentValue> VehicleAssignmentMutationRate {
+      get { return (IValueParameter<PercentValue>)Parameters["VehicleAssignmentMutationRate"];}
+    }
+
+    public ILookupParameter<Permutation> VehicleAssignmentParameter {
+      get { return (ILookupParameter<Permutation>)Parameters["VehicleAssignment"]; }
+    }
+
+    [StorableConstructor]
+    protected ExtendedPotvinManipulator(bool deserializing) : base(deserializing) { }
+
+    public ExtendedPotvinManipulator() {
+      Parameters.Add(new LookupParameter<IRandom>("Random", "The pseudo random number generator which should be used for stochastic manipulation operators."));
+      Parameters.Add(new ValueParameter<PotvinManipulator>("ToursManipuator",
+         "The operator used to menipulate the tours.", new PotvinCustomerRelocationMainpulator()));
+      Parameters.Add(new ValueParameter<IPermutationManipulator>("VehicleAssignmentManipuator",
+        "The operator used to menipulate the vehicle assignments.", new Swap2Manipulator()));
+      Parameters.Add(new LookupParameter<Permutation>("VehicleAssignment"));
+      Parameters.Add(new ValueParameter<PercentValue>("VehicleAssignmentMutationRate", "The mutation rate of the vehicle assignments", new PercentValue(0.1)));
+    }
+
+    protected ExtendedPotvinManipulator(ExtendedPotvinManipulator original, Cloner cloner)
+      : base(original, cloner) {
+    }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new ExtendedPotvinManipulator(this, cloner);
+    }
+
+    public override IOperation Apply()
+    {
+      IVRPEncoding solution = VRPToursParameter.ActualValue;
+      if (!(solution is ExtendedPotvinEncoding)) {
+        VRPToursParameter.ActualValue = ExtendedPotvinEncoding.ConvertFrom(solution, ProblemInstance);
+      }
+
+      OperationCollection next = new OperationCollection(base.Apply());
+
+      ToursManipuator.Value.VRPToursParameter.ActualName = VRPToursParameter.ActualName;
+      next.Insert(0, ExecutionContext.CreateOperation(ToursManipuator.Value));
+
+      if (RandomParameter.ActualValue.NextDouble() < VehicleAssignmentMutationRate.Value.Value) {
+        VehicleAssignmentParameter.ActualValue = (VRPToursParameter.ActualValue as ExtendedPotvinEncoding).VehicleAssignment;
+        VehicleAssignmentManipuator.Value.PermutationParameter.ActualName = VehicleAssignmentParameter.ActualName;
+        next.Insert(1, ExecutionContext.CreateOperation(VehicleAssignmentManipuator.Value));
+      }
+
+      return next;
+    }
+  }
+}
Index: /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/GVR/Crossovers/GVRCrossover.cs
===================================================================
--- /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/GVR/Crossovers/GVRCrossover.cs	(revision 6850)
+++ /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/GVR/Crossovers/GVRCrossover.cs	(revision 6851)
@@ -82,5 +82,5 @@
       for (int i = 1; i <= ProblemInstance.Cities.Value; i++) {
         if (!subroute.Contains(i)) {
-          double distance = ProblemInstance.GetDistance(subroute[0], i);
+          double distance = ProblemInstance.GetDistance(subroute[0], i, child);
 
           if (customer == -1 || distance < minDistance) {
Index: /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/GVR/GVREncoding.cs
===================================================================
--- /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/GVR/GVREncoding.cs	(revision 6850)
+++ /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/GVR/GVREncoding.cs	(revision 6851)
@@ -42,5 +42,4 @@
         double currentDemand = 0;
 
-        DoubleArray demand = ProblemInstance.Demand;
         DoubleValue capacity = new DoubleValue(double.MaxValue);
         if (ProblemInstance is IHomogenousCapacitatedProblemInstance) {
@@ -50,5 +49,5 @@
 
         foreach (int city in tour.Stops) {
-          currentDemand += demand[city];
+          currentDemand += ProblemInstance.GetDemand(city);
 
           if (currentDemand > capacity.Value) {
@@ -58,5 +57,5 @@
             newTour = new Tour();
             newTour.Stops.Add(city);
-            currentDemand = demand[city];
+            currentDemand = ProblemInstance.GetDemand(city);
           } else {
             newTour.Stops.Add(city);
Index: /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/General/Crossovers/BiasedMultiVRPSolutionCrossover.cs
===================================================================
--- /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/General/Crossovers/BiasedMultiVRPSolutionCrossover.cs	(revision 6850)
+++ /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/General/Crossovers/BiasedMultiVRPSolutionCrossover.cs	(revision 6851)
@@ -160,5 +160,5 @@
       OperationCollection next = new OperationCollection(successorOp);
       if (successor != null) {
-        SelectedOperatorParameter.ActualValue = new StringValue(successor.GetType().Name);
+        SelectedOperatorParameter.ActualValue = new StringValue(successor.Name);
 
         if (CreateChildOperation)
Index: /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/General/Manipulators/BiasedMultiVRPSolutionManipulator.cs
===================================================================
--- /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/General/Manipulators/BiasedMultiVRPSolutionManipulator.cs	(revision 6850)
+++ /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/General/Manipulators/BiasedMultiVRPSolutionManipulator.cs	(revision 6851)
@@ -160,5 +160,5 @@
       OperationCollection next = new OperationCollection(successorOp);
       if (successor != null) {
-        SelectedOperatorParameter.ActualValue = new StringValue(successor.GetType().Name);
+        SelectedOperatorParameter.ActualValue = new StringValue(successor.Name);
 
         if (CreateChildOperation)
Index: /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/General/PermutationEncoding.cs
===================================================================
--- /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/General/PermutationEncoding.cs	(revision 6850)
+++ /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/General/PermutationEncoding.cs	(revision 6851)
@@ -35,4 +35,22 @@
     #region IVRPEncoding Members
     public abstract List<Tour> GetTours();
+
+    public int GetTourIndex(Tour tour) {
+      int index = -1;
+
+      List<Tour> tours = GetTours();
+      for (int i = 0; i < tours.Count; i++) {
+        if (tours[i].IsEqual(tour)) {
+          index = i;
+          break;
+        }
+      }
+
+      return index;
+    }
+
+    public virtual int GetVehicleAssignment(int tour) {
+      return tour;
+    }
     #endregion
 
Index: /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/General/TourEncoding.cs
===================================================================
--- /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/General/TourEncoding.cs	(revision 6850)
+++ /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/General/TourEncoding.cs	(revision 6851)
@@ -38,5 +38,5 @@
     
     #region IVRPEncoding Members
-    public void Repair() {
+    public virtual void Repair() {
       List<Tour> toBeRemoved = new List<Tour>();
       foreach (Tour tour in Tours) {
@@ -62,4 +62,21 @@
 
      return result;
+    }
+
+    public int GetTourIndex(Tour tour) {
+      int index = -1;
+
+      for (int i = 0; i < Tours.Count; i++) {
+        if (Tours[i].IsEqual(tour)) {
+          index = i;
+          break;
+        }
+      }
+
+      return index;
+    }
+
+    public virtual int GetVehicleAssignment(int tour) {
+      return tour;
     }
 
Index: anches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Creators/IterativeInsertionCreator.cs
===================================================================
--- /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Creators/IterativeInsertionCreator.cs	(revision 6850)
+++ 	(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: anches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Creators/PushForwardInsertionCreator.cs
===================================================================
--- /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Creators/PushForwardInsertionCreator.cs	(revision 6850)
+++ 	(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 6850)
+++ /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 6850)
+++ /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 6850)
+++ /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 6850)
+++ /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 6850)
+++ /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 6850)
+++ /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 6850)
+++ /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 6850)
+++ /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 6850)
+++ /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 6850)
+++ /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 6850)
+++ /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 6850)
+++ /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) {
Index: /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Tour.cs
===================================================================
--- /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Tour.cs	(revision 6850)
+++ /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Tour.cs	(revision 6851)
@@ -48,5 +48,5 @@
     }
 
-    public double GetTourLength(IVRPProblemInstance instance) {
+    public double GetTourLength(IVRPProblemInstance instance, IVRPEncoding solution) {
       double length = 0;
 
@@ -60,5 +60,5 @@
 
         for (int i = 1; i < cities.Count; i++) {
-          length += instance.GetDistance(cities[i - 1], cities[i]);
+          length += instance.GetDistance(cities[i - 1], cities[i], solution);
         }
       }
@@ -66,4 +66,16 @@
       return length;
     }
+
+    public bool IsEqual(Tour tour) {
+      bool equal = (tour != null) && (tour.Stops.Count == Stops.Count);
+      int index = 0;
+
+      while (equal && index < Stops.Count) {
+        equal = equal && tour.Stops[index] == Stops[index];
+        index++;
+      }      
+
+      return equal;
+    }
   }
 }
Index: /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Zhu/Crossovers/ZhuHeuristicCrossover1.cs
===================================================================
--- /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Zhu/Crossovers/ZhuHeuristicCrossover1.cs	(revision 6850)
+++ /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Zhu/Crossovers/ZhuHeuristicCrossover1.cs	(revision 6851)
@@ -77,8 +77,8 @@
 
         if (ProblemInstance.GetDistance(
-          child[i] + 1, parent1[(i + 1) % child.Length] + 1)
+          child[i] + 1, parent1[(i + 1) % child.Length] + 1, child)
           <
           ProblemInstance.GetDistance(
-          child[i] + 1, parent2[(i + 1) % child.Length] + 1)) {
+          child[i] + 1, parent2[(i + 1) % child.Length] + 1, child)) {
           child[(i + 1) % child.Length] = parent1[(i + 1) % child.Length];
           Swap(parent2, parent2[(i + 1) % child.Length], parent1[(i + 1) % child.Length]);
Index: /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Zhu/Crossovers/ZhuHeuristicCrossover2.cs
===================================================================
--- /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Zhu/Crossovers/ZhuHeuristicCrossover2.cs	(revision 6850)
+++ /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Zhu/Crossovers/ZhuHeuristicCrossover2.cs	(revision 6851)
@@ -79,8 +79,8 @@
 
         if (ProblemInstance.GetDistance(
-         child[i] + 1, p1[parent1Index] + 1)
+         child[i] + 1, p1[parent1Index] + 1, child)
          <
          ProblemInstance.GetDistance(
-         child[i] + 1, p2[parent2Index] + 1)) {
+         child[i] + 1, p2[parent2Index] + 1, child)) {
           child[(i + 1) % child.Length] = p1[parent1Index];
         } else {
Index: /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/HeuristicLab.Problems.VehicleRouting-3.4.csproj
===================================================================
--- /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/HeuristicLab.Problems.VehicleRouting-3.4.csproj	(revision 6850)
+++ /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/HeuristicLab.Problems.VehicleRouting-3.4.csproj	(revision 6851)
@@ -170,4 +170,9 @@
     <Compile Include="Encodings\Alba\Moves\ThreeOpt\AlbaStochasticTranslocationSingleMoveGenerator.cs" />
     <Compile Include="Encodings\Alba\Moves\ThreeOpt\IAlbaTranslocationMoveOperator.cs" />
+    <Compile Include="Encodings\ExtendedPotvin\Creators\ExtendedPotvinCreator.cs" />
+    <Compile Include="Encodings\ExtendedPotvin\Crossovers\ExtendedPotvinCrossover.cs" />
+    <Compile Include="Encodings\ExtendedPotvin\IExtendedPotvinOperator.cs" />
+    <Compile Include="Encodings\ExtendedPotvin\ExtendedPotvinEncoding.cs" />
+    <Compile Include="Encodings\ExtendedPotvin\Manipulators\ExtendedPotvinManipulator.cs" />
     <Compile Include="Encodings\General\Creators\MultiVRPSolutionCreator.cs" />
     <Compile Include="Encodings\General\Creators\VRPCreator.cs" />
@@ -202,7 +207,7 @@
     <Compile Include="Encodings\GVR\Manipulators\GVRManipulator.cs" />
     <Compile Include="Encodings\GVR\Manipulators\GVRSwapManipulator.cs" />
-    <Compile Include="Encodings\Potvin\Creators\PushForwardInsertionCreator.cs" />
+    <Compile Include="Encodings\ExtendedPotvin\Creators\PushForwardInsertionCreator.cs" />
     <Compile Include="Encodings\Potvin\Creators\PotvinCreator.cs" />
-    <Compile Include="Encodings\Potvin\Creators\IterativeInsertionCreator.cs" />
+    <Compile Include="Encodings\ExtendedPotvin\Creators\IterativeInsertionCreator.cs" />
     <Compile Include="Encodings\Potvin\Crossovers\PotvinCrossover.cs" />
     <Compile Include="Encodings\Potvin\Crossovers\PotvinInsertionBasedCrossover.cs" />
@@ -292,12 +297,17 @@
     <Compile Include="Interfaces\IVRPEncoding.cs" />
     <Compile Include="Interfaces\IVRPProblemInstance.cs" />
+    <Compile Include="Parsers\CordeauParser.cs" />
     <Compile Include="Parsers\LiLimParser.cs" />
+    <Compile Include="ProblemInstances\MultiDepotVRP\MDCVRP\MDCVRPEvaluator.cs" />
+    <Compile Include="ProblemInstances\MultiDepotVRP\MDCVRP\MDCVRPProblemInstance.cs" />
+    <Compile Include="ProblemInstances\MultiDepotVRP\MultiDepotVRPProblemInstance.cs" />
+    <Compile Include="ProblemInstances\MultiDepotVRP\MultiDepotVRPEvaluator.cs" />
     <Compile Include="ProblemInstances\SingleDepotVRP\CVRP\CVRPTW\CVRPPDTW\CVRPPDTWProblemInstance.cs" />
     <Compile Include="ProblemInstances\SingleDepotVRP\CVRP\CVRPTW\CVRPPDTW\CVRPPDTWEvaluation.cs" />
     <Compile Include="ProblemInstances\SingleDepotVRP\CVRP\CVRPTW\CVRPPDTW\CVRPPDTWEvaluator.cs" />
+    <Compile Include="ProblemInstances\SingleDepotVRP\SingleDepotVRPEvaluator.cs" />
     <Compile Include="SolutionParser.cs" />
     <Compile Include="Variants\Capacitated\Heterogenous\IHeterogenousCapacitatedProblemInstance.cs" />
     <Compile Include="Variants\Capacitated\Heterogenous\IHeterogenousCapacitatedOperator.cs" />
-    <Compile Include="Variants\Capacitated\Heterogenous\IHeterogenousCapacitatedEncoding.cs" />
     <Compile Include="Variants\Capacitated\Homogenous\IHomogenousCapacitatedOperator.cs" />
     <Compile Include="Variants\Capacitated\Homogenous\IHomogenousCapacitatedProblemInstance.cs" />
@@ -305,4 +315,6 @@
     <Compile Include="Variants\Capacitated\ICapacitatedOperator.cs" />
     <Compile Include="Variants\General\IGeneralVRPOperator.cs" />
+    <Compile Include="Variants\MultiDepot\IMultiDepotOperator.cs" />
+    <Compile Include="Variants\MultiDepot\IMultiDepotProblemInstance.cs" />
     <Compile Include="Variants\PickupAndDelivery\IPickupAndDeliveryOperator.cs" />
     <Compile Include="Variants\PickupAndDelivery\IPickupAndDeliveryProblemInstance.cs" />
@@ -318,5 +330,4 @@
     <Compile Include="ProblemInstances\SingleDepotVRP\CVRP\CVRPTW\CVRPTWEvaluator.cs" />
     <Compile Include="ProblemInstances\SingleDepotVRP\CVRP\CVRPEvaluator.cs" />
-    <Compile Include="ProblemInstances\SingleDepotVRP\SingleDepotVRPEvaluator.cs" />
     <Compile Include="ProblemInstances\VRPEvaluator.cs" />
     <Compile Include="ProblemInstances\VRPEvaluation.cs" />
Index: /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Interfaces/IVRPEncoding.cs
===================================================================
--- /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Interfaces/IVRPEncoding.cs	(revision 6850)
+++ /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Interfaces/IVRPEncoding.cs	(revision 6851)
@@ -29,4 +29,6 @@
   public interface IVRPEncoding: IItem {
     List<Tour> GetTours();
+    int GetTourIndex(Tour tour);
+    int GetVehicleAssignment(int tour);
   }
 }
Index: /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Interfaces/IVRPEvaluator.cs
===================================================================
--- /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Interfaces/IVRPEvaluator.cs	(revision 6850)
+++ /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Interfaces/IVRPEvaluator.cs	(revision 6851)
@@ -35,5 +35,5 @@
     VRPEvaluation EvaluateTour(IVRPProblemInstance instance, Tour tour, IVRPEncoding solution);
     bool Feasible(VRPEvaluation evaluation);
-    double GetInsertionCosts(IVRPProblemInstance instance, VRPEvaluation eval, int customer, int tour, int index, out bool feasible);
+    double GetInsertionCosts(IVRPProblemInstance instance, IVRPEncoding solution, VRPEvaluation eval, int customer, int tour, int index, out bool feasible);
   }
 }
Index: /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Interfaces/IVRPProblemInstance.cs
===================================================================
--- /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Interfaces/IVRPProblemInstance.cs	(revision 6850)
+++ /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Interfaces/IVRPProblemInstance.cs	(revision 6851)
@@ -48,5 +48,8 @@
     DoubleValue DistanceFactor { get; }
 
-    double GetDistance(int start, int end);
+    double[] GetCoordinates(int city);
+    double GetDemand(int city);
+    double GetDistance(int start, int end, IVRPEncoding solution);
+    double GetInsertionDistance(int start, int customer, int end, IVRPEncoding solution);
     bool Feasible(IVRPEncoding solution);
     bool TourFeasible(Tour tour, IVRPEncoding solution);
@@ -54,5 +57,5 @@
     VRPEvaluation EvaluateTour(Tour tour, IVRPEncoding solution);
     bool Feasible(VRPEvaluation eval);
-    double GetInsertionCosts(VRPEvaluation eval, int customer, int tour, int index, out bool feasible);
+    double GetInsertionCosts(VRPEvaluation eval, IVRPEncoding solution, int customer, int tour, int index, out bool feasible);
   }
 }
Index: /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Parsers/CordeauParser.cs
===================================================================
--- /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Parsers/CordeauParser.cs	(revision 6851)
+++ /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Parsers/CordeauParser.cs	(revision 6851)
@@ -0,0 +1,180 @@
+﻿#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 System.IO;
+using System.Text.RegularExpressions;
+
+namespace HeuristicLab.Problems.VehicleRouting.Parsers {
+  class CordeauParser {
+    private string file;
+    private string problemName;
+    private int cities;
+    private int depots;
+    private int vehicles;
+    private List<double> capacity;
+    private List<double> xCoord;
+    private List<double> yCoord;
+    private List<double> demand;
+    private List<double> readyTime;
+    private List<double> dueTime;
+    private List<double> serviceTime;
+
+    public int Cities {
+      get {
+        return cities;
+      }
+    }
+
+    public int Depots {
+      get {
+        return depots;
+      }
+    }
+
+    public int Vehicles {
+      get {
+        return vehicles;
+      }
+    }
+
+    public double[] Capacity {
+      get {
+        return capacity.ToArray();
+      }
+    }
+
+    public double[,] Coordinates {
+      get {
+        double[] x = xCoord.ToArray();
+        double[] y = yCoord.ToArray();
+        double[,] coord = new double[x.Length, 2];
+        for (int i = 0; i < x.Length; i++) {
+          coord[i, 0] = x[i];
+          coord[i, 1] = y[i];
+        }
+        return coord;
+      }
+    }
+
+    public double[] Demands {
+      get {
+        return demand.ToArray();
+      }
+    }
+
+    public double[] Readytimes {
+      get {
+        return readyTime.ToArray();
+      }
+    }
+
+    public double[] Duetimes {
+      get {
+        return dueTime.ToArray();
+      }
+    }
+
+    public double[] Servicetimes {
+      get {
+        return serviceTime.ToArray();
+      }
+    }
+
+    public String ProblemName {
+      get {
+        return problemName;
+      }
+    }
+
+    public CordeauParser(string file) {
+      this.file = file;
+      capacity = new List<double>();
+      xCoord = new List<double>();
+      yCoord = new List<double>();
+      demand = new List<double>();
+      readyTime = new List<double>();
+      dueTime = new List<double>();
+      serviceTime = new List<double>();
+    }
+
+    public void Parse() {
+      string line;
+      Regex reg = new Regex(@"-?\d+(\.\d+)?");
+      MatchCollection m;
+
+      StreamReader reader = new StreamReader(file);
+
+      problemName = Path.GetFileNameWithoutExtension(file);
+      line = reader.ReadLine();
+
+      m = reg.Matches(line);
+      if (m.Count != 4)
+        throw new InvalidDataException("File has wrong format!");
+
+      vehicles = int.Parse(m[3].Value);
+      line = reader.ReadLine();
+
+      for (int i = 0; i < vehicles; i++) {
+        m = reg.Matches(line);
+        if (m.Count != 2) { continue; }
+
+        capacity.Add(double.Parse(m[1].Value, System.Globalization.CultureInfo.InvariantCulture));
+
+        line = reader.ReadLine();
+      }
+
+      List<double> depotXcoord = new List<double>();
+      List<double> depotYcoord = new List<double>();
+      while ((line != null)) {
+        m = reg.Matches(line);
+
+        if (m.Count == 11) {
+          xCoord.Add(double.Parse(m[1].Value, System.Globalization.CultureInfo.InvariantCulture));
+          yCoord.Add(double.Parse(m[2].Value, System.Globalization.CultureInfo.InvariantCulture));
+          demand.Add((double)int.Parse(m[4].Value, System.Globalization.CultureInfo.InvariantCulture));
+        } else if (m.Count == 7) {
+          depotXcoord.Add(double.Parse(m[1].Value, System.Globalization.CultureInfo.InvariantCulture));
+          depotYcoord.Add(double.Parse(m[2].Value, System.Globalization.CultureInfo.InvariantCulture));
+        }
+               
+        line = reader.ReadLine();
+      }
+
+      xCoord.InsertRange(0, depotXcoord);
+      yCoord.InsertRange(0, depotYcoord);
+
+      cities = demand.Count;
+      depots = depotXcoord.Count;
+
+      vehicles *= depots;
+      List<double> originalCapacities = new List<double>(capacity);
+      for (int i = 1; i < depots; i++) {
+        capacity.InsertRange(0, originalCapacities);
+      }
+    }
+
+    internal string OnReset() {
+      throw new NotImplementedException();
+    }
+  }
+}
Index: /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/ProblemInstances/MultiDepotVRP/MDCVRP/MDCVRPEvaluator.cs
===================================================================
--- /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/ProblemInstances/MultiDepotVRP/MDCVRP/MDCVRPEvaluator.cs	(revision 6851)
+++ /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/ProblemInstances/MultiDepotVRP/MDCVRP/MDCVRPEvaluator.cs	(revision 6851)
@@ -0,0 +1,155 @@
+﻿#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 System.Linq;
+using System.Text;
+using HeuristicLab.Problems.VehicleRouting.Interfaces;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HeuristicLab.Core;
+using HeuristicLab.Parameters;
+using HeuristicLab.Data;
+using HeuristicLab.Optimization;
+using HeuristicLab.PluginInfrastructure;
+using HeuristicLab.Problems.VehicleRouting.Variants;
+using HeuristicLab.Problems.VehicleRouting.Encodings;
+using HeuristicLab.Common;
+
+namespace HeuristicLab.Problems.VehicleRouting.ProblemInstances {
+  [Item("MDCVRPEvaluator", "Represents a multi depot CVRP evaluator.")]
+  [StorableClass]
+  public class MDCVRPEvaluator: VRPEvaluator {
+    public ILookupParameter<DoubleValue> OverloadParameter {
+      get { return (ILookupParameter<DoubleValue>)Parameters["Overload"]; }
+    }
+
+    protected override VRPEvaluation CreateTourEvaluation() {
+      return new CVRPEvaluation();
+    }
+
+    protected override void EvaluateTour(VRPEvaluation eval, IVRPProblemInstance instance, Tour tour, IVRPEncoding solution) {
+      TourInsertionInfo tourInfo = new TourInsertionInfo();
+      eval.InsertionInfo.AddTourInsertionInfo(tourInfo);
+
+      IHeterogenousCapacitatedProblemInstance cvrpInstance = instance as IHeterogenousCapacitatedProblemInstance;
+
+      double delivered = 0.0;
+      double overweight = 0.0;
+      double distance = 0.0;
+
+      int tourIndex = solution.GetTourIndex(tour);
+      int vehicle = solution.GetVehicleAssignment(tourIndex);
+
+      double capacity = cvrpInstance.Capacity[vehicle];
+      for (int i = 0; i < tour.Stops.Count; i++) {
+        delivered += instance.GetDemand(tour.Stops[i]);
+      }
+
+      double spareCapacity = capacity - delivered;
+
+      //simulate a tour, start and end at depot
+      for (int i = 0; i <= tour.Stops.Count; i++) {
+        int start = 0;
+        if (i > 0)
+          start = tour.Stops[i - 1];
+        int end = 0;
+        if (i < tour.Stops.Count)
+          end = tour.Stops[i];
+
+        //drive there
+        double currentDistace = instance.GetDistance(start, end, solution);
+        distance += currentDistace;
+
+        CVRPInsertionInfo stopInfo = new CVRPInsertionInfo(start, end, spareCapacity);
+        tourInfo.AddStopInsertionInfo(stopInfo);
+      }
+
+      eval.Quality += instance.FleetUsageFactor.Value;
+      eval.Quality += instance.DistanceFactor.Value * distance;
+
+      eval.Distance += distance;
+      eval.VehicleUtilization += 1;
+
+      if (delivered > capacity) {
+        overweight = delivered - capacity;
+      }
+
+      (eval as CVRPEvaluation).Overload += overweight;
+      double penalty = overweight * cvrpInstance.OverloadPenalty.Value;
+      eval.Penalty += penalty;
+      eval.Quality += penalty;
+      tourInfo.Penalty = penalty;
+    }
+
+    protected override double GetTourInsertionCosts(IVRPProblemInstance instance, IVRPEncoding solution, TourInsertionInfo tourInsertionInfo, int index, int customer, 
+      out bool feasible) {
+      CVRPInsertionInfo insertionInfo = tourInsertionInfo.GetStopInsertionInfo(index) as CVRPInsertionInfo;
+      
+      double costs = 0;
+      feasible = tourInsertionInfo.Penalty < double.Epsilon;
+
+      IHeterogenousCapacitatedProblemInstance cvrp = instance as IHeterogenousCapacitatedProblemInstance;
+      double overloadPenalty = cvrp.OverloadPenalty.Value;
+
+      costs += instance.GetInsertionDistance(insertionInfo.Start, customer, insertionInfo.End, solution);
+
+      double demand = instance.GetDemand(customer);
+      if (demand > insertionInfo.SpareCapacity) {
+        feasible = false;
+
+        if(insertionInfo.SpareCapacity >= 0)
+          costs += (demand - insertionInfo.SpareCapacity) * overloadPenalty;
+        else
+          costs += demand * overloadPenalty;
+      }
+      
+      return costs;
+    }
+
+    protected override void InitResultParameters() {
+      base.InitResultParameters();
+
+      OverloadParameter.ActualValue = new DoubleValue(0);
+    }
+
+    protected override void SetResultParameters(VRPEvaluation tourEvaluation) {
+      base.SetResultParameters(tourEvaluation);
+
+      OverloadParameter.ActualValue.Value = (tourEvaluation as CVRPEvaluation).Overload;
+    }
+    
+    [StorableConstructor]
+    protected MDCVRPEvaluator(bool deserializing) : base(deserializing) { }
+
+    public MDCVRPEvaluator() {
+      Parameters.Add(new LookupParameter<DoubleValue>("Overload", "The overload."));
+    }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new MDCVRPEvaluator(this, cloner);
+    }
+
+    protected MDCVRPEvaluator(MDCVRPEvaluator original, Cloner cloner)
+      : base(original, cloner) {
+    }
+  }
+}
Index: /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/ProblemInstances/MultiDepotVRP/MDCVRP/MDCVRPProblemInstance.cs
===================================================================
--- /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/ProblemInstances/MultiDepotVRP/MDCVRP/MDCVRPProblemInstance.cs	(revision 6851)
+++ /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/ProblemInstances/MultiDepotVRP/MDCVRP/MDCVRPProblemInstance.cs	(revision 6851)
@@ -0,0 +1,132 @@
+﻿#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 System.Linq;
+using System.Text;
+using HeuristicLab.Problems.VehicleRouting.Interfaces;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HeuristicLab.Core;
+using HeuristicLab.Parameters;
+using HeuristicLab.Data;
+using HeuristicLab.Optimization;
+using HeuristicLab.PluginInfrastructure;
+using HeuristicLab.Problems.VehicleRouting.Variants;
+using HeuristicLab.Common;
+
+namespace HeuristicLab.Problems.VehicleRouting.ProblemInstances {
+  [Item("MDCVRPProblemInstance", "Represents a multi depot CVRP instance.")]
+  [StorableClass]
+  public class MDCVRPProblemInstance: MultiDepotVRPProblemInstance, IHeterogenousCapacitatedProblemInstance {
+    protected IValueParameter<DoubleArray> CapacityParameter {
+      get { return (IValueParameter<DoubleArray>)Parameters["Capacity"]; }
+    }
+    protected IValueParameter<DoubleValue> OverloadPenaltyParameter {
+      get { return (IValueParameter<DoubleValue>)Parameters["EvalOverloadPenalty"]; }
+    }
+
+    public DoubleArray Capacity {
+      get { return CapacityParameter.Value; }
+      set { CapacityParameter.Value = value; }
+    }
+
+    [Storable]
+    private DoubleValue currentOverloadPenalty;
+
+    public DoubleValue OverloadPenalty {
+      get {
+        if (currentOverloadPenalty != null)
+          return currentOverloadPenalty;
+        else
+          return OverloadPenaltyParameter.Value; }
+      set { currentOverloadPenalty = value; }
+    }
+
+    protected override IEnumerable<IOperator> GetOperators() {
+        return base.GetOperators()
+          .Where(o => o is IHeterogenousCapacitatedOperator).Cast<IOperator>();
+    }
+
+    protected override IEnumerable<IOperator> GetAnalyzers() {
+      return ApplicationManager.Manager.GetInstances<ICapacitatedOperator>()
+        .Where(o => o is IAnalyzer)
+        .Cast<IOperator>().Union(base.GetAnalyzers());
+    }
+
+    protected override IVRPEvaluator Evaluator {
+      get {
+        return new MDCVRPEvaluator();
+      }
+    }
+    
+    [StorableConstructor]
+    protected MDCVRPProblemInstance(bool deserializing) : base(deserializing) { }
+
+    public MDCVRPProblemInstance() {
+      Parameters.Add(new ValueParameter<DoubleArray>("Capacity", "The capacity of each vehicle.", new DoubleArray()));
+      Parameters.Add(new ValueParameter<DoubleValue>("EvalOverloadPenalty", "The overload penalty considered in the evaluation.", new DoubleValue(100)));
+
+      AttachEventHandlers();
+    }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new MDCVRPProblemInstance(this, cloner);
+    }
+
+    protected MDCVRPProblemInstance(MDCVRPProblemInstance original, Cloner cloner)
+      : base(original, cloner) {
+        currentOverloadPenalty = cloner.Clone(original.currentOverloadPenalty) as DoubleValue;
+
+        AttachEventHandlers();
+    }
+
+    [StorableHook(HookType.AfterDeserialization)]
+    private void AfterDeserializationHook() {
+      AttachEventHandlers();
+    }
+
+    private void AttachEventHandlers() {
+      CapacityParameter.ValueChanged += new EventHandler(CapacityParameter_ValueChanged);
+      OverloadPenaltyParameter.ValueChanged += new EventHandler(OverloadPenaltyParameter_ValueChanged);
+      OverloadPenaltyParameter.Value.ValueChanged += new EventHandler(OverloadPenalty_ValueChanged);
+    }
+
+    public override void InitializeState() {
+      base.InitializeState();
+
+      currentOverloadPenalty = null;
+    }
+
+    #region Event handlers
+    void CapacityParameter_ValueChanged(object sender, EventArgs e) {
+      BestKnownSolution = null;
+    }
+    void OverloadPenaltyParameter_ValueChanged(object sender, EventArgs e) {
+      OverloadPenaltyParameter.Value.ValueChanged += new EventHandler(OverloadPenalty_ValueChanged);
+      EvalBestKnownSolution();
+    }
+    void OverloadPenalty_ValueChanged(object sender, EventArgs e) {
+      EvalBestKnownSolution();
+    }
+    #endregion
+  }
+}
Index: /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/ProblemInstances/MultiDepotVRP/MultiDepotVRPEvaluator.cs
===================================================================
--- /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/ProblemInstances/MultiDepotVRP/MultiDepotVRPEvaluator.cs	(revision 6851)
+++ /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/ProblemInstances/MultiDepotVRP/MultiDepotVRPEvaluator.cs	(revision 6851)
@@ -0,0 +1,103 @@
+﻿#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 System.Linq;
+using System.Text;
+using HeuristicLab.Problems.VehicleRouting.Interfaces;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HeuristicLab.Core;
+using HeuristicLab.Parameters;
+using HeuristicLab.Data;
+using HeuristicLab.Optimization;
+using HeuristicLab.PluginInfrastructure;
+using HeuristicLab.Problems.VehicleRouting.Variants;
+using HeuristicLab.Problems.VehicleRouting.Encodings;
+using HeuristicLab.Common;
+
+
+namespace HeuristicLab.Problems.VehicleRouting.ProblemInstances {
+  [Item("SingleDepotVRPEvaluator", "Represents a single depot VRP evaluator.")]
+  [StorableClass]
+  public class MultiDepotVRPEvaluator: VRPEvaluator {
+    protected override void EvaluateTour(VRPEvaluation eval, IVRPProblemInstance instance, Tour tour, IVRPEncoding solution) {
+      TourInsertionInfo tourInfo = new TourInsertionInfo();
+      eval.InsertionInfo.AddTourInsertionInfo(tourInfo);
+      
+      double distance = 0.0;
+      double quality = 0.0;
+
+      //simulate a tour, start and end at depot
+      for (int i = 0; i <= tour.Stops.Count; i++) {
+        int start = 0;
+        if (i > 0)
+          start = tour.Stops[i - 1];
+        int end = 0;
+        if (i < tour.Stops.Count)
+          end = tour.Stops[i];
+
+        //drive there
+        double currentDistace = instance.GetDistance(start, end, solution);
+        distance += currentDistace;
+
+        StopInsertionInfo stopInfo = new StopInsertionInfo(start, end);
+        tourInfo.AddStopInsertionInfo(stopInfo);
+      }
+
+      //Fleet usage
+      quality += instance.FleetUsageFactor.Value;
+      //Distance
+      quality += instance.DistanceFactor.Value * distance;
+
+      eval.Distance += distance;
+      eval.VehicleUtilization += 1;
+
+      eval.Quality += quality;
+    }
+
+    protected override double GetTourInsertionCosts(IVRPProblemInstance instance, IVRPEncoding solution, TourInsertionInfo tourInsertionInfo, int index, int customer,
+      out bool feasible) {
+      StopInsertionInfo insertionInfo = tourInsertionInfo.GetStopInsertionInfo(index);
+      
+      double costs = 0;
+      feasible = true;
+
+      costs += instance.GetInsertionDistance(insertionInfo.Start, customer, insertionInfo.End, solution);
+
+      return costs;
+    }
+    
+    [StorableConstructor]
+    protected MultiDepotVRPEvaluator(bool deserializing) : base(deserializing) { }
+
+    public MultiDepotVRPEvaluator() {
+    }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new MultiDepotVRPEvaluator(this, cloner);
+    }
+
+    protected MultiDepotVRPEvaluator(MultiDepotVRPEvaluator original, Cloner cloner)
+      : base(original, cloner) {
+    }
+  }
+}
Index: /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/ProblemInstances/MultiDepotVRP/MultiDepotVRPProblemInstance.cs
===================================================================
--- /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/ProblemInstances/MultiDepotVRP/MultiDepotVRPProblemInstance.cs	(revision 6851)
+++ /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/ProblemInstances/MultiDepotVRP/MultiDepotVRPProblemInstance.cs	(revision 6851)
@@ -0,0 +1,189 @@
+﻿#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 System.Linq;
+using System.Text;
+using HeuristicLab.Problems.VehicleRouting.Interfaces;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HeuristicLab.Core;
+using HeuristicLab.Parameters;
+using HeuristicLab.Data;
+using HeuristicLab.Optimization;
+using HeuristicLab.PluginInfrastructure;
+using HeuristicLab.Problems.VehicleRouting.Variants;
+using HeuristicLab.Common;
+
+namespace HeuristicLab.Problems.VehicleRouting.ProblemInstances {
+  [Item("MultiDepotVRPProblemInstance", "Represents a multi depot VRP instance.")]
+  [StorableClass]
+  public class MultiDepotVRPProblemInstance: VRPProblemInstance, IMultiDepotProblemInstance {
+    protected IValueParameter<IntValue> DepotsParameter {
+      get { return (IValueParameter<IntValue>)Parameters["Depots"]; }
+    }
+
+    protected IValueParameter<IntArray> VehicleDepotAssignmentParameter {
+      get { return (IValueParameter<IntArray>)Parameters["VehicleDepotAssignment"]; }
+    }
+
+    public IntValue Depots {
+      get {
+        return DepotsParameter.Value;
+      }
+    }
+
+    public IntArray VehicleDepotAssignment {
+      get {
+        return VehicleDepotAssignmentParameter.Value;
+      }
+      set {
+        VehicleDepotAssignmentParameter.Value = value;
+      }
+    }
+    
+    protected override IEnumerable<IOperator> GetOperators() {
+      return ApplicationManager.Manager.GetInstances<IMultiDepotOperator>().Cast<IOperator>();
+    }
+
+    protected override IEnumerable<IOperator> GetAnalyzers() {
+      return ApplicationManager.Manager.GetInstances<IMultiDepotOperator>()
+        .Where(o => o is IAnalyzer)
+        .Cast<IOperator>();
+    }
+
+    public override IntValue Cities {
+      get {
+        return new IntValue(Demand.Length);
+      }
+    }
+
+    protected override IVRPEvaluator Evaluator {
+      get {
+        return new MultiDepotVRPEvaluator();
+      }
+    }
+
+    protected override IVRPCreator Creator {
+      get {
+        return new HeuristicLab.Problems.VehicleRouting.Encodings.Alba.RandomCreator();
+      }
+    }
+
+    public override double GetDemand(int city) {
+      return base.GetDemand(city - 1);
+    }
+
+    public override double[] GetCoordinates(int city) {
+      double[] coordinates;
+      
+      if (city == 0) {
+        //calculate centroid
+        coordinates = new double[Coordinates.Columns];
+
+        for (int i = 0; i < Depots.Value; i++) {
+          for (int j = 0; j < coordinates.Length; j++) {
+            coordinates[j] += Coordinates[i, j];
+          }
+        }
+
+        for (int j = 0; j < coordinates.Length; j++) {
+          coordinates[j] /= (double)Depots.Value;
+        }
+      } else {
+        city += Depots.Value - 1;
+        coordinates = base.GetCoordinates(city);
+      }
+
+      return coordinates;
+    }
+
+    public int GetDepot(int customer, IVRPEncoding solution) {
+      int depot = -1;
+      
+      Tour tour =
+          solution.GetTours().FirstOrDefault(t => t.Stops.Contains(customer));
+
+      if (tour != null) {
+        int tourIndex = solution.GetTourIndex(tour);
+        int vehicle = solution.GetVehicleAssignment(tourIndex);
+        depot = VehicleDepotAssignment[vehicle];
+      }
+
+      return depot;
+    }
+
+    public override double GetDistance(int start, int end, IVRPEncoding solution) {
+      if (start == 0 && end == 0)
+        return 0;
+      
+      if (start == 0) {
+        start = GetDepot(end, solution);
+        end += Depots.Value - 1;
+      } else if (end == 0) {
+        end = GetDepot(start, solution);
+        start += Depots.Value - 1;
+      } else {
+        start += Depots.Value - 1;
+        end += Depots.Value - 1;
+      }
+      
+      return base.GetDistance(start, end, solution);
+    }
+
+    public override double GetInsertionDistance(int start, int customer, int end, IVRPEncoding solution) {
+      if (start == 0) {
+        start = GetDepot(end, solution);
+        end += Depots.Value - 1;
+      } else if (end == 0) {
+        end = GetDepot(start, solution);
+        start += Depots.Value - 1;
+      } else {
+        start += Depots.Value - 1;
+        end += Depots.Value - 1;
+      }
+      customer += Depots.Value - 1;
+      
+      double distance = base.GetDistance(start, end, solution);
+      double newDistance =
+        base.GetDistance(start, customer, solution) +
+        base.GetDistance(customer, end, solution);
+
+      return newDistance - distance;
+    }
+    
+    [StorableConstructor]
+    protected MultiDepotVRPProblemInstance(bool deserializing) : base(deserializing) { }
+
+    public MultiDepotVRPProblemInstance() {
+      Parameters.Add(new ValueParameter<IntValue>("Depots", "The number of depots", new IntValue(0)));
+      Parameters.Add(new ValueParameter<IntArray>("VehicleDepotAssignment", "The assignment of vehicles to depots", new IntArray()));
+    }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new MultiDepotVRPProblemInstance(this, cloner);
+    }
+
+    protected MultiDepotVRPProblemInstance(MultiDepotVRPProblemInstance original, Cloner cloner)
+      : base(original, cloner) {
+    }
+  }
+}
Index: /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/ProblemInstances/SingleDepotVRP/CVRP/CVRPEvaluator.cs
===================================================================
--- /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/ProblemInstances/SingleDepotVRP/CVRP/CVRPEvaluator.cs	(revision 6850)
+++ /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/ProblemInstances/SingleDepotVRP/CVRP/CVRPEvaluator.cs	(revision 6851)
@@ -38,5 +38,5 @@
   [Item("CVRPEvaluator", "Represents a single depot CVRP evaluator.")]
   [StorableClass]
-  public class CVRPEvaluator: SingleDepotVRPEvaluator {
+  public class CVRPEvaluator: VRPEvaluator {
     public ILookupParameter<DoubleValue> OverloadParameter {
       get { return (ILookupParameter<DoubleValue>)Parameters["Overload"]; }
@@ -79,5 +79,5 @@
 
         //drive there
-        double currentDistace = instance.GetDistance(start, end);
+        double currentDistace = instance.GetDistance(start, end, solution);
         distance += currentDistace;
 
@@ -103,5 +103,5 @@
     }
 
-    protected override double GetTourInsertionCosts(IVRPProblemInstance instance, TourInsertionInfo tourInsertionInfo, int index, int customer, 
+    protected override double GetTourInsertionCosts(IVRPProblemInstance instance, IVRPEncoding solution, TourInsertionInfo tourInsertionInfo, int index, int customer, 
       out bool feasible) {
       CVRPInsertionInfo insertionInfo = tourInsertionInfo.GetStopInsertionInfo(index) as CVRPInsertionInfo;
@@ -113,8 +113,8 @@
       double overloadPenalty = cvrp.OverloadPenalty.Value;
 
-      double distance = instance.GetDistance(insertionInfo.Start, insertionInfo.End);
+      double distance = instance.GetDistance(insertionInfo.Start, insertionInfo.End, solution);
       double newDistance =
-        instance.GetDistance(insertionInfo.Start, customer) +
-        instance.GetDistance(customer, insertionInfo.End);
+        instance.GetDistance(insertionInfo.Start, customer, solution) +
+        instance.GetDistance(customer, insertionInfo.End, solution);
       costs += instance.DistanceFactor.Value * (newDistance - distance);
 
Index: /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/ProblemInstances/SingleDepotVRP/CVRP/CVRPTW/CVRPPDTW/CVRPPDTWEvaluator.cs
===================================================================
--- /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/ProblemInstances/SingleDepotVRP/CVRP/CVRPTW/CVRPPDTW/CVRPPDTWEvaluator.cs	(revision 6850)
+++ /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/ProblemInstances/SingleDepotVRP/CVRP/CVRPTW/CVRPPDTW/CVRPPDTWEvaluator.cs	(revision 6851)
@@ -85,5 +85,5 @@
 
         //drive there
-        double currentDistace = vrptw.GetDistance(start, end);
+        double currentDistace = vrptw.GetDistance(start, end, solution);
         time += currentDistace;
         distance += currentDistace;
@@ -166,5 +166,5 @@
     }
 
-    protected override double GetTourInsertionCosts(IVRPProblemInstance instance, TourInsertionInfo tourInsertionInfo, int index, int customer, 
+    protected override double GetTourInsertionCosts(IVRPProblemInstance instance, IVRPEncoding solution, TourInsertionInfo tourInsertionInfo, int index, int customer, 
       out bool feasible) {
       CVRPPDTWInsertionInfo insertionInfo = tourInsertionInfo.GetStopInsertionInfo(index) as CVRPPDTWInsertionInfo;
@@ -187,8 +187,8 @@
       double pickupPenalty = pdp.PickupViolationPenalty.Value;
 
-      double distance = instance.GetDistance(insertionInfo.Start, insertionInfo.End);
+      double distance = instance.GetDistance(insertionInfo.Start, insertionInfo.End, solution);
       double newDistance =
-        instance.GetDistance(insertionInfo.Start, customer) +
-        instance.GetDistance(customer, insertionInfo.End);
+        instance.GetDistance(insertionInfo.Start, customer, solution) +
+        instance.GetDistance(customer, insertionInfo.End, solution);
       costs += instance.DistanceFactor.Value * (newDistance - distance);
 
@@ -215,5 +215,5 @@
       if (index > 0)
         time = (tourInsertionInfo.GetStopInsertionInfo(index - 1) as CVRPTWInsertionInfo).LeaveTime;
-      time += instance.GetDistance(insertionInfo.Start, customer);
+      time += instance.GetDistance(insertionInfo.Start, customer, solution);
       if (time > dueTime[customer]) {
         tardiness += time - dueTime[customer];
@@ -222,5 +222,5 @@
         time += readyTime[customer] - time;
       time += serviceTimes[customer];
-      time += instance.GetDistance(customer, insertionInfo.End);
+      time += instance.GetDistance(customer, insertionInfo.End, solution);
 
       double additionalTime = time - (tourInsertionInfo.GetStopInsertionInfo(index) as CVRPTWInsertionInfo).ArrivalTime;
Index: /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/ProblemInstances/SingleDepotVRP/CVRP/CVRPTW/CVRPTWEvaluator.cs
===================================================================
--- /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/ProblemInstances/SingleDepotVRP/CVRP/CVRPTW/CVRPTWEvaluator.cs	(revision 6850)
+++ /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/ProblemInstances/SingleDepotVRP/CVRP/CVRPTW/CVRPTWEvaluator.cs	(revision 6851)
@@ -92,5 +92,5 @@
 
         //drive there
-        double currentDistace = vrptw.GetDistance(start, end);
+        double currentDistace = vrptw.GetDistance(start, end, solution);
         time += currentDistace;
         distance += currentDistace;
@@ -150,5 +150,5 @@
     }
 
-    protected override double GetTourInsertionCosts(IVRPProblemInstance instance, TourInsertionInfo tourInsertionInfo, int index, int customer,
+    protected override double GetTourInsertionCosts(IVRPProblemInstance instance, IVRPEncoding solution, TourInsertionInfo tourInsertionInfo, int index, int customer,
       out bool feasible) {
       CVRPTWInsertionInfo insertionInfo = tourInsertionInfo.GetStopInsertionInfo(index) as CVRPTWInsertionInfo;
@@ -166,8 +166,8 @@
       double tardinessPenalty = vrptw.TardinessPenalty.Value;
 
-      double distance = instance.GetDistance(insertionInfo.Start, insertionInfo.End);
+      double distance = instance.GetDistance(insertionInfo.Start, insertionInfo.End, solution);
       double newDistance =
-        instance.GetDistance(insertionInfo.Start, customer) +
-        instance.GetDistance(customer, insertionInfo.End);
+        instance.GetDistance(insertionInfo.Start, customer, solution) +
+        instance.GetDistance(customer, insertionInfo.End, solution);
       costs += instance.DistanceFactor.Value * (newDistance - distance);
 
@@ -186,5 +186,5 @@
       if (index > 0)
         time = (tourInsertionInfo.GetStopInsertionInfo(index - 1) as CVRPTWInsertionInfo).LeaveTime;
-      time += instance.GetDistance(insertionInfo.Start, customer);
+      time += instance.GetDistance(insertionInfo.Start, customer, solution);
       if (time > dueTime[customer]) {
         tardiness += time - dueTime[customer];
@@ -193,5 +193,5 @@
         time += readyTime[customer] - time;
       time += serviceTimes[customer];
-      time += instance.GetDistance(customer, insertionInfo.End);
+      time += instance.GetDistance(customer, insertionInfo.End, solution);
 
       double additionalTime = time - (tourInsertionInfo.GetStopInsertionInfo(index) as CVRPTWInsertionInfo).ArrivalTime;
Index: /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/ProblemInstances/SingleDepotVRP/SingleDepotVRPEvaluator.cs
===================================================================
--- /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/ProblemInstances/SingleDepotVRP/SingleDepotVRPEvaluator.cs	(revision 6850)
+++ /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/ProblemInstances/SingleDepotVRP/SingleDepotVRPEvaluator.cs	(revision 6851)
@@ -57,5 +57,5 @@
 
         //drive there
-        double currentDistace = instance.GetDistance(start, end);
+        double currentDistace = instance.GetDistance(start, end, solution);
         distance += currentDistace;
 
@@ -75,5 +75,5 @@
     }
 
-    protected override double GetTourInsertionCosts(IVRPProblemInstance instance, TourInsertionInfo tourInsertionInfo, int index, int customer,
+    protected override double GetTourInsertionCosts(IVRPProblemInstance instance, IVRPEncoding solution, TourInsertionInfo tourInsertionInfo, int index, int customer,
       out bool feasible) {
       StopInsertionInfo insertionInfo = tourInsertionInfo.GetStopInsertionInfo(index);
@@ -82,8 +82,8 @@
       feasible = true;
 
-      double distance = instance.GetDistance(insertionInfo.Start, insertionInfo.End);
+      double distance = instance.GetDistance(insertionInfo.Start, insertionInfo.End, solution);
       double newDistance =
-        instance.GetDistance(insertionInfo.Start, customer) +
-        instance.GetDistance(customer, insertionInfo.End);
+        instance.GetDistance(insertionInfo.Start, customer, solution) +
+        instance.GetDistance(customer, insertionInfo.End, solution);
 
       costs += instance.DistanceFactor.Value * (newDistance - distance);
Index: /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/ProblemInstances/VRPEvaluator.cs
===================================================================
--- /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/ProblemInstances/VRPEvaluator.cs	(revision 6850)
+++ /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/ProblemInstances/VRPEvaluator.cs	(revision 6851)
@@ -103,10 +103,11 @@
     }
 
-    protected abstract double GetTourInsertionCosts(IVRPProblemInstance instance, TourInsertionInfo tourInsertionInfo, int index, int customer, out bool feasible);
+    protected abstract double GetTourInsertionCosts(IVRPProblemInstance instance, IVRPEncoding solution, TourInsertionInfo tourInsertionInfo, int index, int customer, out bool feasible);
 
-    public double GetInsertionCosts(IVRPProblemInstance instance, VRPEvaluation eval, int customer, int tour, int index, out bool feasible) {
+    public double GetInsertionCosts(IVRPProblemInstance instance, IVRPEncoding solution, VRPEvaluation eval, int customer, int tour, int index, out bool feasible) {
       bool tourFeasible;
       double costs = GetTourInsertionCosts(
         instance,
+        solution,
         eval.InsertionInfo.GetTourInsertionInfo(tour), index,
         customer, out tourFeasible);
Index: /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/ProblemInstances/VRPProblemInstance.cs
===================================================================
--- /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/ProblemInstances/VRPProblemInstance.cs	(revision 6850)
+++ /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/ProblemInstances/VRPProblemInstance.cs	(revision 6851)
@@ -188,9 +188,23 @@
     }
 
+    public virtual double[] GetCoordinates(int city) {
+      double[] coordinates = new double[Coordinates.Columns];
+
+      for (int i = 0; i < Coordinates.Columns; i++) {
+        coordinates[i] = Coordinates[city, i];
+      }
+
+      return coordinates;
+    }
+
+    public virtual double GetDemand(int city) {
+      return Demand[city];
+    }
+
     //cache for performance improvement
     private DoubleMatrix distanceMatrix = null;
     private IVRPEvaluator evaluator = null;
 
-    public double GetDistance(int start, int end) {
+    public virtual double GetDistance(int start, int end, IVRPEncoding solution) {
       double distance = 0.0;
       if (distanceMatrix == null && UseDistanceMatrix.Value) {
@@ -206,4 +220,13 @@
     }
 
+    public virtual double GetInsertionDistance(int start, int customer, int end, IVRPEncoding solution) {
+      double distance = GetDistance(start, end, solution);
+      double newDistance =
+        GetDistance(start, customer, solution) +
+        GetDistance(customer, end, solution);
+
+      return newDistance - distance;
+    }
+
     public bool Feasible(IVRPEncoding solution) {
       return evaluator.Feasible(
@@ -230,6 +253,6 @@
     }
 
-    public double GetInsertionCosts(VRPEvaluation eval, int customer, int tour, int index, out bool feasible) {
-      return evaluator.GetInsertionCosts(this, eval, customer, tour, index, out feasible);
+    public double GetInsertionCosts(VRPEvaluation eval, IVRPEncoding solution, int customer, int tour, int index, out bool feasible) {
+      return evaluator.GetInsertionCosts(this, solution, eval, customer, tour, index, out feasible);
     }
 
Index: anches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Variants/Capacitated/Heterogenous/IHeterogenousCapacitatedEncoding.cs
===================================================================
--- /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Variants/Capacitated/Heterogenous/IHeterogenousCapacitatedEncoding.cs	(revision 6850)
+++ 	(revision )
@@ -1,32 +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 System.Linq;
-using System.Text;
-using HeuristicLab.Problems.VehicleRouting.Interfaces;
-
-namespace HeuristicLab.Problems.VehicleRouting.Variants {
-  public interface IHeterogenousCapacitatedEncoding : IVRPEncoding {
-    int GetVehicleAssignment(int tour);
-  }
-}
Index: /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Variants/MultiDepot/IMultiDepotOperator.cs
===================================================================
--- /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Variants/MultiDepot/IMultiDepotOperator.cs	(revision 6851)
+++ /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Variants/MultiDepot/IMultiDepotOperator.cs	(revision 6851)
@@ -0,0 +1,31 @@
+﻿#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 System.Linq;
+using System.Text;
+using HeuristicLab.Problems.VehicleRouting.Interfaces;
+
+namespace HeuristicLab.Problems.VehicleRouting.Variants {
+  public interface IMultiDepotOperator: IVRPOperator {
+  }
+}
Index: /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Variants/MultiDepot/IMultiDepotProblemInstance.cs
===================================================================
--- /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Variants/MultiDepot/IMultiDepotProblemInstance.cs	(revision 6851)
+++ /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Variants/MultiDepot/IMultiDepotProblemInstance.cs	(revision 6851)
@@ -0,0 +1,34 @@
+﻿#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 System.Linq;
+using System.Text;
+using HeuristicLab.Problems.VehicleRouting.Interfaces;
+using HeuristicLab.Data;
+
+namespace HeuristicLab.Problems.VehicleRouting.Variants {
+  public interface IMultiDepotProblemInstance: IVRPProblemInstance {
+    IntValue Depots { get; }
+    IntArray VehicleDepotAssignment { get; }
+  }
+}
Index: /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/VehicleRoutingProblem.cs
===================================================================
--- /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/VehicleRoutingProblem.cs	(revision 6850)
+++ /branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/VehicleRoutingProblem.cs	(revision 6851)
@@ -243,8 +243,35 @@
     #endregion
 
+    public void ImportFromCordeau(string cordeauFileName) {
+      CordeauParser parser = new CordeauParser(cordeauFileName);
+      parser.Parse();
+
+      MDCVRPProblemInstance problem = new MDCVRPProblemInstance();
+
+      problem.Coordinates = new DoubleMatrix(parser.Coordinates);
+      problem.Vehicles.Value = parser.Vehicles;
+      problem.Capacity = new DoubleArray(parser.Capacity);
+      problem.Demand = new DoubleArray(parser.Demands);
+      problem.Depots.Value = parser.Depots;
+      problem.VehicleDepotAssignment = new IntArray(parser.Vehicles);
+      int depot = 0;
+      int i = 0;
+      while(i < parser.Vehicles) {
+        problem.VehicleDepotAssignment[i] = depot;
+
+        i++;
+        if (i % (parser.Vehicles / parser.Depots) == 0)
+          depot++;
+      }
+
+      this.ProblemInstance = problem;
+
+      OnReset();
+    }
+
     public void ImportFromLiLim(string liLimFileName) {
       LiLimParser parser = new LiLimParser(liLimFileName);
       parser.Parse();
-      
+
       CVRPPDTWProblemInstance problem = new CVRPPDTWProblemInstance();
 
@@ -372,5 +399,5 @@
         } else {
           problem.Demand[i] = rand.Next(10, 50);
-          problem.DueTime[i] = rand.Next((int)Math.Ceiling(problem.GetDistance(0, i)), 1200);
+          problem.DueTime[i] = rand.Next((int)Math.Ceiling(problem.GetDistance(0, i, null)), 1200);
           problem.ReadyTime[i] = problem.DueTime[i] - rand.Next(0, 100);
           problem.ServiceTime[i] = 90;
