Index: branches/2817-BinPackingSpeedup/HeuristicLab.Problems.BinPacking/3.3/3D/Packer/BinPacker.cs
===================================================================
--- branches/2817-BinPackingSpeedup/HeuristicLab.Problems.BinPacking/3.3/3D/Packer/BinPacker.cs	(revision 15454)
+++ branches/2817-BinPackingSpeedup/HeuristicLab.Problems.BinPacking/3.3/3D/Packer/BinPacker.cs	(revision 15462)
@@ -1,3 +1,24 @@
-﻿using HeuristicLab.Core;
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2016 Joseph Helm and 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.Persistence.Default.CompositeSerializers.Storable;
@@ -13,33 +34,18 @@
   [StorableClass]
   public abstract class BinPacker {
-    protected Permutation _permutation;
-    protected PackingShape _binShape;
-    protected IList<PackingItem> _items;
-    protected bool _useStackingConstraints;
+    
+    public BinPacker() { }
 
     /// <summary>
     /// Packs all items of the bin packer and returns a collection of BinPacking3D objects
     /// </summary>
+    /// <param name="sortedItems">Permutation of items sorted by a sorting method. The value of each permutation index references to the index of the items list</param>
+    /// <param name="binShape">Bin for storing the items</param>
+    /// <param name="items">A list of packing items which should be assigned to a bin</param>
+    /// <param name="useStackingConstraints">Flag for using stacking constraints</param>
     /// <returns></returns>
-    public abstract IList<BinPacking3D> PackItems();
+    public abstract IList<BinPacking3D> PackItems(Permutation sortedItems, PackingShape binShape, IList<PackingItem> items, bool useStackingConstraints);
 
-    /// <summary>
-    /// Tries to pack the remainig items into a given BinPacking3D object. Each item could be packed into the BinPacking3D object will be removed from the list of remaining ids
-    /// </summary>
-    /// <param name="remainingIds">List of remaining ids. After the method has been executed the list has to have less items</param>
-    /// <param name="items">List of packing items. Some of the items will be assigned to the BinPacking3D object</param>
-    /// <param name="packingBin">This object will be filled with some of the given items</param>
-    protected void PackRemainingItems(ref IList<int> remainingIds, ref BinPacking3D packingBin, IList<PackingItem> items, bool useStackingConstraints, Dictionary<int, bool> rotationArray) {
-
-      foreach (var itemId in new List<int>(remainingIds)) {
-        bool rotated = rotationArray == null ? false : rotationArray[itemId];
-        PackingPosition position = FindPackingPositionForItem(packingBin, items[itemId], useStackingConstraints, rotated);
-        // if a valid packing position could be found, the current item can be added to the given bin
-        if (position != null) {
-          PackItem(ref packingBin, itemId, items[itemId], position, useStackingConstraints);
-          remainingIds.Remove(itemId);
-        }
-      }
-    }
+    
 
     /// <summary>
@@ -52,5 +58,5 @@
     protected void PackItem(ref BinPacking3D packingBin, int itemId, PackingItem packingItem, PackingPosition position, bool useStackingConstraints) {
 
-      packingBin.AddItem(itemId, packingItem, position);
+      packingBin.PackItem(itemId, packingItem, position);
       packingBin.UpdateResidualSpace(packingItem, position);
       packingBin.UpdateExtremePoints(packingItem, position, useStackingConstraints);
Index: branches/2817-BinPackingSpeedup/HeuristicLab.Problems.BinPacking/3.3/3D/Packer/BinPackerFirstFit.cs
===================================================================
--- branches/2817-BinPackingSpeedup/HeuristicLab.Problems.BinPacking/3.3/3D/Packer/BinPackerFirstFit.cs	(revision 15454)
+++ branches/2817-BinPackingSpeedup/HeuristicLab.Problems.BinPacking/3.3/3D/Packer/BinPackerFirstFit.cs	(revision 15462)
@@ -1,3 +1,24 @@
-﻿using HeuristicLab.Core;
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2016 Joseph Helm and 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.Persistence.Default.CompositeSerializers.Storable;
@@ -14,11 +35,5 @@
   public class BinPackerFirstFit : BinPacker {
 
-    public BinPackerFirstFit(Permutation permutation, PackingShape binShape, IList<PackingItem> items, bool useStackingConstraints) {
-      _permutation = permutation;
-      _binShape = binShape;
-      _items = items;
-      _useStackingConstraints = useStackingConstraints;
-    }
-
+    public BinPackerFirstFit() : base() { }    
 
     /// <summary>
@@ -26,11 +41,11 @@
     /// </summary>
     /// <returns>Returns a collection of bin packing 3d objects. Each object represents a bin and the packed items</returns>
-    public override IList<BinPacking3D> PackItems() {
+    public override IList<BinPacking3D> PackItems(Permutation sortedItems, PackingShape binShape, IList<PackingItem> items, bool useStackingConstraints) {
       IList<BinPacking3D> packingList = new List<BinPacking3D>();
-      IList<int> remainingIds = new List<int>(_permutation);
+      IList<int> remainingIds = new List<int>(sortedItems);
 
       while (remainingIds.Count > 0) {
-        BinPacking3D packingBin = new BinPacking3D(_binShape);
-        PackRemainingItems(ref remainingIds, ref packingBin, _items, _useStackingConstraints, null);
+        BinPacking3D packingBin = new BinPacking3D(binShape);
+        PackRemainingItems(ref remainingIds, ref packingBin, items, useStackingConstraints, null);
         packingList.Add(packingBin);
       }
@@ -38,4 +53,23 @@
       return packingList;
     }
+
+    /// <summary>
+    /// Tries to pack the remainig items into a given BinPacking3D object. Each item could be packed into the BinPacking3D object will be removed from the list of remaining ids
+    /// </summary>
+    /// <param name="remainingIds">List of remaining ids. After the method has been executed the list has to have less items</param>
+    /// <param name="items">List of packing items. Some of the items will be assigned to the BinPacking3D object</param>
+    /// <param name="packingBin">This object will be filled with some of the given items</param>
+    protected void PackRemainingItems(ref IList<int> remainingIds, ref BinPacking3D packingBin, IList<PackingItem> items, bool useStackingConstraints, Dictionary<int, bool> rotationArray) {
+
+      foreach (var itemId in new List<int>(remainingIds)) {
+        bool rotated = rotationArray == null ? false : rotationArray[itemId];
+        PackingPosition position = FindPackingPositionForItem(packingBin, items[itemId], useStackingConstraints, rotated);
+        // if a valid packing position could be found, the current item can be added to the given bin
+        if (position != null) {
+          PackItem(ref packingBin, itemId, items[itemId], position, useStackingConstraints);
+          remainingIds.Remove(itemId);
+        }
+      }
+    }
   }
 }
Index: branches/2817-BinPackingSpeedup/HeuristicLab.Problems.BinPacking/3.3/3D/Packer/BinPackerFreeVolumeBestFit.cs
===================================================================
--- branches/2817-BinPackingSpeedup/HeuristicLab.Problems.BinPacking/3.3/3D/Packer/BinPackerFreeVolumeBestFit.cs	(revision 15454)
+++ branches/2817-BinPackingSpeedup/HeuristicLab.Problems.BinPacking/3.3/3D/Packer/BinPackerFreeVolumeBestFit.cs	(revision 15462)
@@ -1,3 +1,24 @@
-﻿using HeuristicLab.Core;
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2016 Joseph Helm and 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.Persistence.Default.CompositeSerializers.Storable;
@@ -12,34 +33,32 @@
   [StorableClass]
   public class BinPackerFreeVolumeBestFit : BinPacker {
-    public BinPackerFreeVolumeBestFit(Permutation permutation, PackingShape binShape, IList<PackingItem> items, bool useStackingConstraints) {
-      _permutation = permutation;
-      _binShape = binShape;
-      _items = items;
-      _useStackingConstraints = useStackingConstraints;
-    }
 
-    public override IList<BinPacking3D> PackItems() {
+    public BinPackerFreeVolumeBestFit() : base() { }
+
+    public override IList<BinPacking3D> PackItems(Permutation sortedItems, PackingShape binShape, IList<PackingItem> items, bool useStackingConstraints) {
       IList<BinPacking3D> packingList = new List<BinPacking3D>();
-      IList<int> remainingIds = new List<int>(_permutation);
-      
+      IList<int> remainingIds = new List<int>(sortedItems);
+
 
       foreach (int remainingId in remainingIds) {
         var sortedBins = packingList.OrderBy(x => x.FreeVolume);
-        PackingItem item = _items[remainingId];
+        var z = sortedBins.ToList();
+
+        PackingItem item = items[remainingId];
         bool positionFound = false;
 
         foreach (var packingBin in sortedBins) {
-          PackingPosition position = FindPackingPositionForItem(packingBin, item, _useStackingConstraints, false);
+          PackingPosition position = FindPackingPositionForItem(packingBin, item, useStackingConstraints, false);
           positionFound = position != null;
           var bin = packingBin;
           if (positionFound) {
-            PackItem(ref bin, remainingId, item, position, _useStackingConstraints);
+            PackItem(ref bin, remainingId, item, position, useStackingConstraints);
             break;
-          }            
+          }
         }
 
         if (!positionFound) {
-          BinPacking3D packingBin = new BinPacking3D(_binShape);
-          PackingPosition position = FindPackingPositionForItem(packingBin, item, _useStackingConstraints, false);
+          BinPacking3D packingBin = new BinPacking3D(binShape);
+          PackingPosition position = FindPackingPositionForItem(packingBin, item, useStackingConstraints, false);
 
           if (position == null) {
@@ -47,5 +66,5 @@
           }
 
-          PackItem(ref packingBin, remainingId, item, position, _useStackingConstraints);
+          PackItem(ref packingBin, remainingId, item, position, useStackingConstraints);
           packingList.Add(packingBin);
         }
Index: branches/2817-BinPackingSpeedup/HeuristicLab.Problems.BinPacking/3.3/3D/Packer/BinPackerResidualSpaceBestFit.cs
===================================================================
--- branches/2817-BinPackingSpeedup/HeuristicLab.Problems.BinPacking/3.3/3D/Packer/BinPackerResidualSpaceBestFit.cs	(revision 15454)
+++ branches/2817-BinPackingSpeedup/HeuristicLab.Problems.BinPacking/3.3/3D/Packer/BinPackerResidualSpaceBestFit.cs	(revision 15462)
@@ -1,3 +1,24 @@
-﻿using HeuristicLab.Core;
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2016 Joseph Helm and 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.Persistence.Default.CompositeSerializers.Storable;
@@ -12,11 +33,9 @@
   [StorableClass]
   public class BinPackerResidualSpaceBestFit : BinPacker {
-    public BinPackerResidualSpaceBestFit(Permutation permutation, PackingShape binShape, IList<PackingItem> items, bool useStackingConstraints) {
-      _permutation = permutation;
-      _binShape = binShape;
-      _items = items;
-      _useStackingConstraints = useStackingConstraints;
-    }
 
+    public BinPackerResidualSpaceBestFit() : base() { }/*
+    public BinPackerResidualSpaceBestFit(Permutation permutation, PackingShape binShape, IList<PackingItem> items, bool useStackingConstraints)
+      : base(permutation, binShape, items, useStackingConstraints) { }
+      */
     /// <summary>
     /// Packs the items into the bins by using a best fit residual space algorithm.
@@ -25,11 +44,11 @@
     /// </summary>
     /// <returns></returns>
-    public override IList<BinPacking3D> PackItems() {
+    public override IList<BinPacking3D> PackItems(Permutation sortedItems, PackingShape binShape, IList<PackingItem> items, bool useStackingConstraints) {
       IList<BinPacking3D> packingList = new List<BinPacking3D>();
-      IList<int> remainingIds = new List<int>(_permutation);
+      IList<int> remainingIds = new List<int>(sortedItems);
       bool rotated = false;
 
       foreach (var remainingId in remainingIds) {
-        PackingItem item = _items[remainingId];
+        PackingItem item = items[remainingId];
         var residualSpacePoints = GetResidualSpaceForAllPoints(packingList, item);
         var sortedPoints = residualSpacePoints.OrderBy(x => x.Item3);
@@ -37,7 +56,7 @@
 
         foreach (var point in sortedPoints) {
-          if (point.Item1.IsPositionFeasible(item, point.Item2, _useStackingConstraints)) {
+          if (point.Item1.IsPositionFeasible(item, point.Item2, useStackingConstraints)) {
             var binPacking = point.Item1;
-            PackItem(ref binPacking, remainingId, item, point.Item2, _useStackingConstraints);
+            PackItem(ref binPacking, remainingId, item, point.Item2, useStackingConstraints);
             packed = true;
             break;
@@ -46,8 +65,8 @@
 
         if (!packed) {
-          BinPacking3D binPacking = new BinPacking3D(_binShape);
-          var position = FindPackingPositionForItem(binPacking, item, _useStackingConstraints, rotated);
+          BinPacking3D binPacking = new BinPacking3D(binShape);
+          var position = FindPackingPositionForItem(binPacking, item, useStackingConstraints, rotated);
           if (position != null) {
-            PackItem(ref binPacking, remainingId, item, position, _useStackingConstraints);
+            PackItem(ref binPacking, remainingId, item, position, useStackingConstraints);
           } else {
             throw new InvalidOperationException("Item " + remainingId + " cannot be packed in an empty bin.");
