Index: trunk/sources/HeuristicLab.Problems.VehicleRouting/3.4/HeuristicLab.Problems.VehicleRouting-3.4.csproj
===================================================================
--- trunk/sources/HeuristicLab.Problems.VehicleRouting/3.4/HeuristicLab.Problems.VehicleRouting-3.4.csproj	(revision 8600)
+++ trunk/sources/HeuristicLab.Problems.VehicleRouting/3.4/HeuristicLab.Problems.VehicleRouting-3.4.csproj	(revision 8649)
@@ -142,4 +142,6 @@
     <Compile Include="Improver\VRPImprovementOperator.cs" />
     <Compile Include="Interfaces\IVRPLocalSearchManipulator.cs" />
+    <Compile Include="Interpreters\MDCVRPInterpreter.cs" />
+    <Compile Include="Interpreters\VRPInterpreter.cs" />
     <Compile Include="Interpreters\MDCVRPTWInterpreter.cs" />
     <Compile Include="Interpreters\PDPTWInterpreter.cs" />
Index: trunk/sources/HeuristicLab.Problems.VehicleRouting/3.4/Interpreters/CVRPInterpreter.cs
===================================================================
--- trunk/sources/HeuristicLab.Problems.VehicleRouting/3.4/Interpreters/CVRPInterpreter.cs	(revision 8600)
+++ trunk/sources/HeuristicLab.Problems.VehicleRouting/3.4/Interpreters/CVRPInterpreter.cs	(revision 8649)
@@ -24,15 +24,21 @@
 using HeuristicLab.Problems.VehicleRouting.Encodings.Potvin;
 using HeuristicLab.Problems.VehicleRouting.ProblemInstances;
+using HeuristicLab.Problems.VehicleRouting.Interfaces;
+using System;
 
 namespace HeuristicLab.Problems.VehicleRouting.Interpreters {
-  public class CVRPInterpreter : IVRPDataInterpreter<CVRPData> {
-    public VRPInstanceDescription Interpret(IVRPData data) {
+  public class CVRPInterpreter : VRPInterpreter, IVRPDataInterpreter<CVRPData> {
+    public override Type GetDataType() {
+      return typeof(CVRPData);
+    }
+    
+    protected override IVRPProblemInstance CreateProblemInstance() {
+      return new CVRPProblemInstance();
+    }
+
+    protected override void Interpret(IVRPData data, IVRPProblemInstance problemInstance) {
       CVRPData cvrpData = data as CVRPData;
-
-      VRPInstanceDescription result = new VRPInstanceDescription();
-      result.Name = cvrpData.Name;
-      result.Description = cvrpData.Description;
-
-      CVRPProblemInstance problem = new CVRPProblemInstance();
+      CVRPProblemInstance problem = problemInstance as CVRPProblemInstance;
+      
       if (cvrpData.Coordinates != null)
         problem.Coordinates = new DoubleMatrix(cvrpData.Coordinates);
@@ -47,23 +53,4 @@
         problem.DistanceMatrix = new DoubleMatrix(cvrpData.GetDistanceMatrix());
       }
-      result.ProblemInstance = problem;
-
-      result.BestKnownQuality = cvrpData.BestKnownQuality;
-      if (cvrpData.BestKnownTour != null) {
-        PotvinEncoding solution = new PotvinEncoding(problem);
-
-        for (int i = 0; i < cvrpData.BestKnownTour.GetLength(0); i++) {
-          Tour tour = new Tour();
-          solution.Tours.Add(tour);
-
-          foreach (int stop in cvrpData.BestKnownTour[i]) {
-            tour.Stops.Add(stop + 1);
-          }
-        }
-
-        result.BestKnownSolution = solution;
-      }
-
-      return result;
     }
   }
Index: trunk/sources/HeuristicLab.Problems.VehicleRouting/3.4/Interpreters/CVRPTWInterpreter.cs
===================================================================
--- trunk/sources/HeuristicLab.Problems.VehicleRouting/3.4/Interpreters/CVRPTWInterpreter.cs	(revision 8600)
+++ trunk/sources/HeuristicLab.Problems.VehicleRouting/3.4/Interpreters/CVRPTWInterpreter.cs	(revision 8649)
@@ -24,49 +24,26 @@
 using HeuristicLab.Problems.VehicleRouting.Encodings.Potvin;
 using HeuristicLab.Problems.VehicleRouting.ProblemInstances;
+using HeuristicLab.Problems.VehicleRouting.Interfaces;
+using System;
 
 namespace HeuristicLab.Problems.VehicleRouting.Interpreters {
-  public class CVRPTWInterpreter : IVRPDataInterpreter<CVRPTWData> {
-    public VRPInstanceDescription Interpret(IVRPData data) {
-      CVRPTWData cvrpData = data as CVRPTWData;
+  public class CVRPTWInterpreter: CVRPInterpreter, IVRPDataInterpreter<CVRPTWData> {
+    public override Type GetDataType() {
+      return typeof(CVRPTWData);
+    }
+    
+    protected override IVRPProblemInstance CreateProblemInstance() {
+      return new CVRPTWProblemInstance();
+    }
 
-      VRPInstanceDescription result = new VRPInstanceDescription();
-      result.Name = cvrpData.Name;
-      result.Description = cvrpData.Description;
+    protected override void Interpret(IVRPData data, IVRPProblemInstance problemInstance) {
+      base.Interpret(data, problemInstance);
 
-      CVRPTWProblemInstance problem = new CVRPTWProblemInstance();
-      if (cvrpData.Coordinates != null)
-        problem.Coordinates = new DoubleMatrix(cvrpData.Coordinates);
-      if (cvrpData.MaximumVehicles != null)
-        problem.Vehicles.Value = (int)cvrpData.MaximumVehicles;
-      else
-        problem.Vehicles.Value = cvrpData.Dimension - 1;
-      problem.Capacity.Value = cvrpData.Capacity;
-      problem.Demand = new DoubleArray(cvrpData.Demands);
-      if (cvrpData.DistanceMeasure != DistanceMeasure.Euclidean) {
-        problem.UseDistanceMatrix.Value = true;
-        problem.DistanceMatrix = new DoubleMatrix(cvrpData.GetDistanceMatrix());
-      }
-      problem.ReadyTime = new DoubleArray(cvrpData.ReadyTimes);
-      problem.ServiceTime = new DoubleArray(cvrpData.ServiceTimes);
-      problem.DueTime = new DoubleArray(cvrpData.DueTimes);
-      result.ProblemInstance = problem;
+      CVRPTWData cvrptwData = data as CVRPTWData;
+      CVRPTWProblemInstance problem = problemInstance as CVRPTWProblemInstance;
 
-      result.BestKnownQuality = cvrpData.BestKnownQuality;
-      if (cvrpData.BestKnownTour != null) {
-        PotvinEncoding solution = new PotvinEncoding(problem);
-
-        for (int i = 0; i < cvrpData.BestKnownTour.GetLength(0); i++) {
-          Tour tour = new Tour();
-          solution.Tours.Add(tour);
-
-          foreach (int stop in cvrpData.BestKnownTour[i]) {
-            tour.Stops.Add(stop + 1);
-          }
-        }
-
-        result.BestKnownSolution = solution;
-      }
-
-      return result;
+      problem.ReadyTime = new DoubleArray(cvrptwData.ReadyTimes);
+      problem.ServiceTime = new DoubleArray(cvrptwData.ServiceTimes);
+      problem.DueTime = new DoubleArray(cvrptwData.DueTimes);
     }
   }
Index: trunk/sources/HeuristicLab.Problems.VehicleRouting/3.4/Interpreters/IVRPDataInterpreter.cs
===================================================================
--- trunk/sources/HeuristicLab.Problems.VehicleRouting/3.4/Interpreters/IVRPDataInterpreter.cs	(revision 8600)
+++ trunk/sources/HeuristicLab.Problems.VehicleRouting/3.4/Interpreters/IVRPDataInterpreter.cs	(revision 8649)
@@ -22,4 +22,5 @@
 using HeuristicLab.Problems.Instances;
 using HeuristicLab.Problems.VehicleRouting.Interfaces;
+using System;
 
 namespace HeuristicLab.Problems.VehicleRouting.Interpreters {
@@ -33,4 +34,5 @@
 
   public interface IVRPDataInterpreter {
+    Type GetDataType();
     VRPInstanceDescription Interpret(IVRPData data);
   }
Index: trunk/sources/HeuristicLab.Problems.VehicleRouting/3.4/Interpreters/MDCVRPInterpreter.cs
===================================================================
--- trunk/sources/HeuristicLab.Problems.VehicleRouting/3.4/Interpreters/MDCVRPInterpreter.cs	(revision 8649)
+++ trunk/sources/HeuristicLab.Problems.VehicleRouting/3.4/Interpreters/MDCVRPInterpreter.cs	(revision 8649)
@@ -0,0 +1,60 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2012 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.Data;
+using HeuristicLab.Problems.Instances;
+using HeuristicLab.Problems.VehicleRouting.Encodings.Potvin;
+using HeuristicLab.Problems.VehicleRouting.ProblemInstances;
+using HeuristicLab.Problems.VehicleRouting.Interfaces;
+using System;
+
+namespace HeuristicLab.Problems.VehicleRouting.Interpreters {
+  public class MDCVRPInterpreter : VRPInterpreter, IVRPDataInterpreter<MDCVRPData> {
+    public override Type GetDataType() {
+      return typeof(MDCVRPData);
+    }
+    
+    protected override IVRPProblemInstance CreateProblemInstance() {
+      return new MDCVRPProblemInstance();
+    }
+
+    protected override void Interpret(IVRPData data, IVRPProblemInstance problemInstance) {
+      MDCVRPData cvrpData = data as MDCVRPData;
+      MDCVRPProblemInstance problem = problemInstance as MDCVRPProblemInstance;
+
+      if (cvrpData.Coordinates != null)
+        problem.Coordinates = new DoubleMatrix(cvrpData.Coordinates);
+      if (cvrpData.MaximumVehicles != null)
+        problem.Vehicles.Value = (int)cvrpData.MaximumVehicles;
+      else
+        problem.Vehicles.Value = cvrpData.Dimension - 1;
+      problem.Capacity = new DoubleArray(cvrpData.Capacity);
+      problem.Demand = new DoubleArray(cvrpData.Demands);
+      if (cvrpData.DistanceMeasure != DistanceMeasure.Euclidean) {
+        problem.UseDistanceMatrix.Value = true;
+        problem.DistanceMatrix = new DoubleMatrix(cvrpData.GetDistanceMatrix());
+      }
+
+      problem.Depots.Value = cvrpData.Depots;
+      problem.VehicleDepotAssignment = new IntArray(cvrpData.VehicleDepotAssignment);
+    }
+  }
+}
Index: trunk/sources/HeuristicLab.Problems.VehicleRouting/3.4/Interpreters/MDCVRPTWInterpreter.cs
===================================================================
--- trunk/sources/HeuristicLab.Problems.VehicleRouting/3.4/Interpreters/MDCVRPTWInterpreter.cs	(revision 8600)
+++ trunk/sources/HeuristicLab.Problems.VehicleRouting/3.4/Interpreters/MDCVRPTWInterpreter.cs	(revision 8649)
@@ -24,53 +24,26 @@
 using HeuristicLab.Problems.VehicleRouting.Encodings.Potvin;
 using HeuristicLab.Problems.VehicleRouting.ProblemInstances;
+using HeuristicLab.Problems.VehicleRouting.Interfaces;
+using System;
 
 namespace HeuristicLab.Problems.VehicleRouting.Interpreters {
-  public class MDCVRPTWInterpreter : IVRPDataInterpreter<MDCVRPTWData> {
-    public VRPInstanceDescription Interpret(IVRPData data) {
-      MDCVRPTWData cvrpData = data as MDCVRPTWData;
+  public class MDCVRPTWInterpreter : MDCVRPInterpreter, IVRPDataInterpreter<MDCVRPTWData> {
+    public override Type GetDataType() {
+      return typeof(MDCVRPTWData);
+    }
+    
+    protected override IVRPProblemInstance CreateProblemInstance() {
+      return new MDCVRPTWProblemInstance();
+    }
 
-      VRPInstanceDescription result = new VRPInstanceDescription();
-      result.Name = cvrpData.Name;
-      result.Description = cvrpData.Description;
+    protected override void Interpret(IVRPData data, IVRPProblemInstance problemInstance) {
+      base.Interpret(data, problemInstance);
 
-      MDCVRPTWProblemInstance problem = new MDCVRPTWProblemInstance();
-      if (cvrpData.Coordinates != null)
-        problem.Coordinates = new DoubleMatrix(cvrpData.Coordinates);
-      if (cvrpData.MaximumVehicles != null)
-        problem.Vehicles.Value = (int)cvrpData.MaximumVehicles;
-      else
-        problem.Vehicles.Value = cvrpData.Dimension - 1;
-      problem.Capacity = new DoubleArray(cvrpData.Capacity);
-      problem.Demand = new DoubleArray(cvrpData.Demands);
-      if (cvrpData.DistanceMeasure != DistanceMeasure.Euclidean) {
-        problem.UseDistanceMatrix.Value = true;
-        problem.DistanceMatrix = new DoubleMatrix(cvrpData.GetDistanceMatrix());
-      }
+      MDCVRPTWData cvrptwData = data as MDCVRPTWData;
+      MDCVRPTWProblemInstance problem = problemInstance as MDCVRPTWProblemInstance;
 
-      problem.Depots.Value = cvrpData.Depots;
-      problem.VehicleDepotAssignment = new IntArray(cvrpData.VehicleDepotAssignment);
-
-      problem.ReadyTime = new DoubleArray(cvrpData.ReadyTimes);
-      problem.ServiceTime = new DoubleArray(cvrpData.ServiceTimes);
-      problem.DueTime = new DoubleArray(cvrpData.DueTimes);
-      result.ProblemInstance = problem;
-
-      result.BestKnownQuality = cvrpData.BestKnownQuality;
-      if (cvrpData.BestKnownTour != null) {
-        PotvinEncoding solution = new PotvinEncoding(problem);
-
-        for (int i = 0; i < cvrpData.BestKnownTour.GetLength(0); i++) {
-          Tour tour = new Tour();
-          solution.Tours.Add(tour);
-
-          foreach (int stop in cvrpData.BestKnownTour[i]) {
-            tour.Stops.Add(stop + 1);
-          }
-        }
-
-        result.BestKnownSolution = solution;
-      }
-
-      return result;
+      problem.ReadyTime = new DoubleArray(cvrptwData.ReadyTimes);
+      problem.ServiceTime = new DoubleArray(cvrptwData.ServiceTimes);
+      problem.DueTime = new DoubleArray(cvrptwData.DueTimes);
     }
   }
Index: trunk/sources/HeuristicLab.Problems.VehicleRouting/3.4/Interpreters/PDPTWInterpreter.cs
===================================================================
--- trunk/sources/HeuristicLab.Problems.VehicleRouting/3.4/Interpreters/PDPTWInterpreter.cs	(revision 8600)
+++ trunk/sources/HeuristicLab.Problems.VehicleRouting/3.4/Interpreters/PDPTWInterpreter.cs	(revision 8649)
@@ -24,50 +24,24 @@
 using HeuristicLab.Problems.VehicleRouting.Encodings.Potvin;
 using HeuristicLab.Problems.VehicleRouting.ProblemInstances;
+using HeuristicLab.Problems.VehicleRouting.Interfaces;
+using System;
 
 namespace HeuristicLab.Problems.VehicleRouting.Interpreters {
-  public class PDPTWInterpreter : IVRPDataInterpreter<PDPTWData> {
-    public VRPInstanceDescription Interpret(IVRPData data) {
-      PDPTWData cvrpData = data as PDPTWData;
+  public class PDPTWInterpreter : CVRPTWInterpreter, IVRPDataInterpreter<PDPTWData> {
+    public override Type GetDataType() {
+      return typeof(PDPTWData);
+    }
+    
+    protected override IVRPProblemInstance CreateProblemInstance() {
+      return new CVRPPDTWProblemInstance();
+    }
 
-      VRPInstanceDescription result = new VRPInstanceDescription();
-      result.Name = cvrpData.Name;
-      result.Description = cvrpData.Description;
+    protected override void Interpret(IVRPData data, IVRPProblemInstance problemInstance) {
+      base.Interpret(data, problemInstance);
 
-      CVRPPDTWProblemInstance problem = new CVRPPDTWProblemInstance();
-      if (cvrpData.Coordinates != null)
-        problem.Coordinates = new DoubleMatrix(cvrpData.Coordinates);
-      if (cvrpData.MaximumVehicles != null)
-        problem.Vehicles.Value = (int)cvrpData.MaximumVehicles;
-      else
-        problem.Vehicles.Value = cvrpData.Dimension - 1;
-      problem.Capacity.Value = cvrpData.Capacity;
-      problem.Demand = new DoubleArray(cvrpData.Demands);
-      if (cvrpData.DistanceMeasure != DistanceMeasure.Euclidean) {
-        problem.UseDistanceMatrix.Value = true;
-        problem.DistanceMatrix = new DoubleMatrix(cvrpData.GetDistanceMatrix());
-      }
-      problem.ReadyTime = new DoubleArray(cvrpData.ReadyTimes);
-      problem.ServiceTime = new DoubleArray(cvrpData.ServiceTimes);
-      problem.DueTime = new DoubleArray(cvrpData.DueTimes);
-      problem.PickupDeliveryLocation = new IntArray(cvrpData.PickupDeliveryLocations);
-      result.ProblemInstance = problem;
+      PDPTWData pdpData = data as PDPTWData;
+      CVRPPDTWProblemInstance problem = problemInstance as CVRPPDTWProblemInstance;
 
-      result.BestKnownQuality = cvrpData.BestKnownQuality;
-      if (cvrpData.BestKnownTour != null) {
-        PotvinEncoding solution = new PotvinEncoding(problem);
-
-        for (int i = 0; i < cvrpData.BestKnownTour.GetLength(0); i++) {
-          Tour tour = new Tour();
-          solution.Tours.Add(tour);
-
-          foreach (int stop in cvrpData.BestKnownTour[i]) {
-            tour.Stops.Add(stop + 1);
-          }
-        }
-
-        result.BestKnownSolution = solution;
-      }
-
-      return result;
+      problem.PickupDeliveryLocation = new IntArray(pdpData.PickupDeliveryLocations);
     }
   }
Index: trunk/sources/HeuristicLab.Problems.VehicleRouting/3.4/Interpreters/VRPInterpreter.cs
===================================================================
--- trunk/sources/HeuristicLab.Problems.VehicleRouting/3.4/Interpreters/VRPInterpreter.cs	(revision 8649)
+++ trunk/sources/HeuristicLab.Problems.VehicleRouting/3.4/Interpreters/VRPInterpreter.cs	(revision 8649)
@@ -0,0 +1,71 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2012 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.Data;
+using HeuristicLab.Problems.Instances;
+using HeuristicLab.Problems.VehicleRouting.Encodings.Potvin;
+using HeuristicLab.Problems.VehicleRouting.ProblemInstances;
+using HeuristicLab.Problems.VehicleRouting.Interfaces;
+using System;
+
+namespace HeuristicLab.Problems.VehicleRouting.Interpreters {
+  public abstract class VRPInterpreter : IVRPDataInterpreter<IVRPData> {
+    protected abstract void Interpret(IVRPData data, IVRPProblemInstance problemInstance);
+
+    protected virtual IVRPEncoding GetBestKnowTour(IVRPData data, IVRPProblemInstance problemInstance) {
+      if (data.BestKnownTour != null) {
+        PotvinEncoding solution = new PotvinEncoding(problemInstance);
+
+        for (int i = 0; i < data.BestKnownTour.GetLength(0); i++) {
+          Tour tour = new Tour();
+          solution.Tours.Add(tour);
+
+          foreach (int stop in data.BestKnownTour[i]) {
+            tour.Stops.Add(stop + 1);
+          }
+        }
+
+        return solution;
+      } else {
+        return null;
+      }
+    }
+
+    public abstract Type GetDataType();
+
+    protected abstract IVRPProblemInstance CreateProblemInstance();
+    
+    public VRPInstanceDescription Interpret(IVRPData data) {
+      VRPInstanceDescription result = new VRPInstanceDescription();
+      result.Name = data.Name;
+      result.Description = data.Description;
+
+      IVRPProblemInstance problem = CreateProblemInstance();
+      Interpret(data, problem);
+      result.ProblemInstance = problem;
+
+      result.BestKnownQuality = data.BestKnownQuality;
+      result.BestKnownSolution = GetBestKnowTour(data, problem);
+
+      return result;
+    }
+  }
+}
