Index: branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Alba/AlbaEncoding.cs
===================================================================
--- branches/VRP/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Alba/AlbaEncoding.cs	(revision 6838)
+++ 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 6838)
+++ 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 6838)
+++ 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 6838)
+++ 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 6838)
+++ 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();
