Changeset 14048


Ignore:
Timestamp:
07/12/16 19:54:35 (8 months ago)
Author:
gkronber
Message:

#1966: renamed *PackingDimension -> PackingPosition

Location:
branches/HeuristicLab.BinPacking
Files:
49 edited
3 moved

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.2D/3.3/BinPacking2D.cs

    r14046 r14048  
    3131  [Item("BinPacking2D", "Represents a single-bin packing for a 2D bin-packing problem.")]
    3232  [StorableClass]
    33   public class BinPacking2D : BinPacking<TwoDimensionalPacking, RectangularPackingShape, RectangularPackingItem> {
     33  public class BinPacking2D : BinPacking<PackingPosition, RectangularPackingShape, RectangularPackingItem> {
    3434
    3535    public BinPacking2D(RectangularPackingShape binMeasures)
    3636      : base(binMeasures) {
    37       ExtremePoints = new SortedSet<TwoDimensionalPacking>(new EPComparer2D());
     37      ExtremePoints = new SortedSet<PackingPosition>(new EPComparer2D());
    3838      ExtremePoints.Add(binMeasures.Origin);
    3939    }
     
    4242    protected BinPacking2D(BinPacking2D original, Cloner cloner)
    4343      : base(original, cloner) {
    44       this.ExtremePoints = new SortedSet<TwoDimensionalPacking>(original.ExtremePoints, new EPComparer2D());
     44      this.ExtremePoints = new SortedSet<PackingPosition>(original.ExtremePoints, new EPComparer2D());
    4545    }
    4646    public override IDeepCloneable Clone(Cloner cloner) {
     
    4848    }
    4949
    50     protected override void GenerateNewExtremePointsForNewItem(RectangularPackingItem newItem, TwoDimensionalPacking position) {
     50    protected override void GenerateNewExtremePointsForNewItem(RectangularPackingItem newItem, PackingPosition position) {
    5151
    5252      int newWidth = position.Rotated ? newItem.Height : newItem.Width;
     
    5454
    5555      //Find ExtremePoints beginning from sourcepointX
    56       var sourcePointX = new TwoDimensionalPacking(0, position.X + newWidth, position.Y);
     56      var sourcePointX = new PackingPosition(0, position.X + newWidth, position.Y);
    5757      if (sourcePointX.X < BinMeasures.Width && sourcePointX.Y < BinMeasures.Height) {
    5858        //Traversing down the y-axis       
    59         var newPoint = new TwoDimensionalPacking(0, sourcePointX.X, sourcePointX.Y - 1);
     59        var newPoint = new PackingPosition(0, sourcePointX.X, sourcePointX.Y - 1);
    6060        while (sourcePointX.Y > 0 && !IsPointOccupied(newPoint)) {
    6161          sourcePointX = newPoint;
    62           newPoint = new TwoDimensionalPacking(0, sourcePointX.X, sourcePointX.Y - 1);
    63         }
    64         ExtremePoints.Add(new TwoDimensionalPacking(0, sourcePointX.X, sourcePointX.Y));
     62          newPoint = new PackingPosition(0, sourcePointX.X, sourcePointX.Y - 1);
     63        }
     64        ExtremePoints.Add(new PackingPosition(0, sourcePointX.X, sourcePointX.Y));
    6565      }
    6666
    6767      //Find ExtremePoints beginning from sourcepointY
    68       var sourcePointY = new TwoDimensionalPacking(0, position.X, position.Y + newItem.Height);
     68      var sourcePointY = new PackingPosition(0, position.X, position.Y + newItem.Height);
    6969      if (sourcePointY.X < BinMeasures.Width && sourcePointY.Y < BinMeasures.Height) {
    7070        //Traversing down the x-axis 
    71         var newPoint = new TwoDimensionalPacking(0, sourcePointY.X - 1, sourcePointY.Y);
     71        var newPoint = new PackingPosition(0, sourcePointY.X - 1, sourcePointY.Y);
    7272        while (sourcePointY.X > 0 && !IsPointOccupied(newPoint)) {
    7373          sourcePointY = newPoint;
    74           newPoint = new TwoDimensionalPacking(0, sourcePointY.X - 1, sourcePointY.Y);
    75         }
    76         ExtremePoints.Add(new TwoDimensionalPacking(0, sourcePointY.X, sourcePointY.Y));
     74          newPoint = new PackingPosition(0, sourcePointY.X - 1, sourcePointY.Y);
     75        }
     76        ExtremePoints.Add(new PackingPosition(0, sourcePointY.X, sourcePointY.Y));
    7777      }
    7878
     
    8585    }
    8686
    87     public override TwoDimensionalPacking FindExtremePointForItem(RectangularPackingItem measures, bool rotated, bool stackingConstraints) {
     87    public override PackingPosition FindExtremePointForItem(RectangularPackingItem measures, bool rotated, bool stackingConstraints) {
    8888      RectangularPackingItem item = new RectangularPackingItem(
    8989        rotated ? measures.Height : measures.Width,
     
    9797        var currentPoint = ExtremePoints.ElementAt(epIndex);
    9898
    99         var result = new TwoDimensionalPacking(currentPoint.AssignedBin, currentPoint.X, currentPoint.Y, rotated);
     99        var result = new PackingPosition(currentPoint.AssignedBin, currentPoint.X, currentPoint.Y, rotated);
    100100        return result;
    101101      }
    102102      return null;
    103103    }
    104     public override TwoDimensionalPacking FindPositionBySliding(RectangularPackingItem measures, bool rotated) {
    105       TwoDimensionalPacking currentPosition = new TwoDimensionalPacking(0,
     104    public override PackingPosition FindPositionBySliding(RectangularPackingItem measures, bool rotated) {
     105      PackingPosition currentPosition = new PackingPosition(0,
    106106        BinMeasures.Width - (rotated ? measures.Height : measures.Width),
    107107        BinMeasures.Height - (rotated ? measures.Width : measures.Height), rotated);
    108108      //Slide the item as far as possible to the left
    109       while (IsPositionFeasible(measures, TwoDimensionalPacking.MoveLeft(currentPosition))
    110         || IsPositionFeasible(measures, TwoDimensionalPacking.MoveDown(currentPosition))) {
     109      while (IsPositionFeasible(measures, PackingPosition.MoveLeft(currentPosition))
     110        || IsPositionFeasible(measures, PackingPosition.MoveDown(currentPosition))) {
    111111        //Slide the item as far as possible to the bottom
    112         while (IsPositionFeasible(measures, TwoDimensionalPacking.MoveDown(currentPosition))) {
    113           currentPosition = TwoDimensionalPacking.MoveDown(currentPosition);
    114         }
    115         if (IsPositionFeasible(measures, TwoDimensionalPacking.MoveLeft(currentPosition)))
    116           currentPosition = TwoDimensionalPacking.MoveLeft(currentPosition);
     112        while (IsPositionFeasible(measures, PackingPosition.MoveDown(currentPosition))) {
     113          currentPosition = PackingPosition.MoveDown(currentPosition);
     114        }
     115        if (IsPositionFeasible(measures, PackingPosition.MoveLeft(currentPosition)))
     116          currentPosition = PackingPosition.MoveLeft(currentPosition);
    117117      }
    118118
     
    165165    }
    166166
    167     public override int ShortestPossibleSideFromPoint(TwoDimensionalPacking position) {
     167    public override int ShortestPossibleSideFromPoint(PackingPosition position) {
    168168      int shortestSide = int.MaxValue;
    169169      int width = BinMeasures.Width;
     
    173173        return shortestSide;
    174174
    175       TwoDimensionalPacking current = new TwoDimensionalPacking(0, position.X, position.Y);
    176       while (current.X < width && IsPointOccupied(current)) { current = TwoDimensionalPacking.MoveRight(current); }
     175      PackingPosition current = new PackingPosition(0, position.X, position.Y);
     176      while (current.X < width && IsPointOccupied(current)) { current = PackingPosition.MoveRight(current); }
    177177      if (current.X - position.X < shortestSide)
    178178        shortestSide = current.X - position.X;
    179179
    180180
    181       current = new TwoDimensionalPacking(0, position.X, position.Y);
    182       while (current.Y < height && IsPointOccupied(current)) { current = TwoDimensionalPacking.MoveUp(current); }
     181      current = new PackingPosition(0, position.X, position.Y);
     182      while (current.Y < height && IsPointOccupied(current)) { current = PackingPosition.MoveUp(current); }
    183183      if (current.Y - position.Y < shortestSide)
    184184        shortestSide = current.Y - position.Y;
     
    186186      return shortestSide;
    187187    }
    188     public override bool IsStaticStable(RectangularPackingItem item, TwoDimensionalPacking position) {
     188    public override bool IsStaticStable(RectangularPackingItem item, PackingPosition position) {
    189189      throw new NotImplementedException();
    190190    }
     
    196196      }
    197197    }
    198     protected override void AddNewItemToOccupationLayers(int itemID, RectangularPackingItem measures, TwoDimensionalPacking position) {
     198    protected override void AddNewItemToOccupationLayers(int itemID, RectangularPackingItem measures, PackingPosition position) {
    199199      int x1 = position.X / 10;
    200200      int x2 = (position.X + (position.Rotated ? measures.Height : measures.Width)) / 10;
     
    203203        OccupationLayers[i].Add(itemID);
    204204    }
    205     protected override List<int> GetLayerItemIDs(TwoDimensionalPacking position) {
     205    protected override List<int> GetLayerItemIDs(PackingPosition position) {
    206206      return OccupationLayers[position.X / 10];
    207207    }
    208     protected override List<int> GetLayerItemIDs(RectangularPackingItem measures, TwoDimensionalPacking position) {
     208    protected override List<int> GetLayerItemIDs(RectangularPackingItem measures, PackingPosition position) {
    209209      List<int> result = new List<int>();
    210210      int x1 = position.X / 10;
     
    217217    }
    218218  }
    219   public class EPComparer2D : IComparer<TwoDimensionalPacking> {
    220     public int Compare(TwoDimensionalPacking a, TwoDimensionalPacking b) {
     219  public class EPComparer2D : IComparer<PackingPosition> {
     220    public int Compare(PackingPosition a, PackingPosition b) {
    221221      int result = a.X.CompareTo(b.X);
    222222      if (result == 0)
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.2D/3.3/Decoders/BL/BottomLeftGroupingVectorDecoder.cs

    r14047 r14048  
    3131  [Item("Identical bin two dimensional grouping vector decoder", "<Description missing...>")]
    3232  [StorableClass]
    33   public class BottomLeftGroupingVectorDecoder : PackingSolutionDecoder<TwoDimensionalPacking, RectangularPackingShape, RectangularPackingItem>, I2DGVDecoder {
     33  public class BottomLeftGroupingVectorDecoder : PackingSolutionDecoder<PackingPosition, RectangularPackingShape, RectangularPackingItem>, I2DGVDecoder {
    3434    public BottomLeftGroupingVectorDecoder() : base() {}
    3535    [StorableConstructor]
     
    4242    }
    4343
    44     public override PackingPlan<TwoDimensionalPacking, RectangularPackingShape, RectangularPackingItem> CreatePackingPlanFromEncoding(IItem encodedSolution, RectangularPackingShape binMeasures, ItemList<RectangularPackingItem> itemMeasures) {
     44    public override PackingPlan<PackingPosition, RectangularPackingShape, RectangularPackingItem> CreatePackingPlanFromEncoding(IItem encodedSolution, RectangularPackingShape binMeasures, ItemList<RectangularPackingItem> itemMeasures) {
    4545      var solution = encodedSolution as GroupingVectorEncoding;
    4646      if (solution == null) throw new InvalidOperationException("Encoding is not of type GroupingVector");
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.2D/3.3/Decoders/BL/BottomLeftMultiComponentVectorDecoder.cs

    r14047 r14048  
    3131  [Item("Identical bin two dimensional multi component vector decoder", "<Description missing...>")]
    3232  [StorableClass]
    33   public class BottomLeftMultiComponentVectorDecoder : PackingSolutionDecoder<TwoDimensionalPacking,RectangularPackingShape, RectangularPackingItem>, I2DMCVDecoder {
     33  public class BottomLeftMultiComponentVectorDecoder : PackingSolutionDecoder<PackingPosition,RectangularPackingShape, RectangularPackingItem>, I2DMCVDecoder {
    3434    public BottomLeftMultiComponentVectorDecoder() : base() {}
    3535    [StorableConstructor]
     
    4242    }
    4343
    44     public override PackingPlan<TwoDimensionalPacking, RectangularPackingShape, RectangularPackingItem> CreatePackingPlanFromEncoding(IItem encodedSolution, RectangularPackingShape binMeasures, ItemList<RectangularPackingItem> itemMeasures) {
     44    public override PackingPlan<PackingPosition, RectangularPackingShape, RectangularPackingItem> CreatePackingPlanFromEncoding(IItem encodedSolution, RectangularPackingShape binMeasures, ItemList<RectangularPackingItem> itemMeasures) {
    4545      var solution = encodedSolution as MultiComponentVectorEncoding;
    4646      if (solution == null) throw new InvalidOperationException("Encoding is not of type MultiComponent Vector");
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.2D/3.3/Decoders/BL/BottomLeftPackingSequenceDecoder.cs

    r14047 r14048  
    3232  [Item("Identical bin, two dimensional, direct permutation decoder", "<Description missing...>")]
    3333  [StorableClass]
    34   public class BottomLeftPackingSequenceDecoder : PackingSolutionDecoder<TwoDimensionalPacking, RectangularPackingShape, RectangularPackingItem>, I2DPSDecoder {
     34  public class BottomLeftPackingSequenceDecoder : PackingSolutionDecoder<PackingPosition, RectangularPackingShape, RectangularPackingItem>, I2DPSDecoder {
    3535
    3636    public BottomLeftPackingSequenceDecoder(): base() { }
     
    4444    }
    4545
    46     public override PackingPlan<TwoDimensionalPacking, RectangularPackingShape, RectangularPackingItem> CreatePackingPlanFromEncoding(IItem encodedSolution, RectangularPackingShape binMeasures, ItemList<RectangularPackingItem> itemMeasures) {
     46    public override PackingPlan<PackingPosition, RectangularPackingShape, RectangularPackingItem> CreatePackingPlanFromEncoding(IItem encodedSolution, RectangularPackingShape binMeasures, ItemList<RectangularPackingItem> itemMeasures) {
    4747      var solution = encodedSolution as PackingSequenceEncoding;
    4848      if (solution == null) throw new InvalidOperationException("Encoding is not of type PackingSequence");
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.2D/3.3/Decoders/EP/ExtremePointGroupingVectorDecoder2D.cs

    r14047 r14048  
    3232  [Item("Identical bin, two dimensional, extreme points based decoder for the GroupingVector encoding.", "<Description missing...>")]
    3333  [StorableClass]
    34   public class ExtremePointGroupingVectorDecoder2D : PackingSolutionDecoder<TwoDimensionalPacking, RectangularPackingShape, RectangularPackingItem>, I2DGVDecoder {
     34  public class ExtremePointGroupingVectorDecoder2D : PackingSolutionDecoder<PackingPosition, RectangularPackingShape, RectangularPackingItem>, I2DGVDecoder {
    3535    public ExtremePointGroupingVectorDecoder2D () : base() {}
    3636    [StorableConstructor]
     
    4343    }
    4444
    45     public static PackingPlan<TwoDimensionalPacking, RectangularPackingShape, RectangularPackingItem> Decode(GroupingVectorEncoding solution, RectangularPackingShape binMeasures, ItemList<RectangularPackingItem> itemMeasures) {
     45    public static PackingPlan<PackingPosition, RectangularPackingShape, RectangularPackingItem> Decode(GroupingVectorEncoding solution, RectangularPackingShape binMeasures, ItemList<RectangularPackingItem> itemMeasures) {
    4646      Solution result = new Solution(binMeasures, true, false);
    4747      result.Pack(solution, itemMeasures);
     
    4949    }
    5050
    51     public override PackingPlan<TwoDimensionalPacking, RectangularPackingShape, RectangularPackingItem> CreatePackingPlanFromEncoding(IItem encodedSolution, RectangularPackingShape binMeasures, ItemList<RectangularPackingItem> itemMeasures) {
     51    public override PackingPlan<PackingPosition, RectangularPackingShape, RectangularPackingItem> CreatePackingPlanFromEncoding(IItem encodedSolution, RectangularPackingShape binMeasures, ItemList<RectangularPackingItem> itemMeasures) {
    5252      var solution = encodedSolution as GroupingVectorEncoding;
    5353      if (solution == null) throw new InvalidOperationException("Encoding is not of type GroupingVector");
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.2D/3.3/Decoders/EP/ExtremePointMultiComponentVectorDecoder2D.cs

    r14047 r14048  
    3131  [Item("Identical bin, two dimensional, extreme points based decoder for the MultiComponentVector encoding.", "<Description missing...>")] // TODO
    3232  [StorableClass]
    33   public class ExtremePointMultiComponentVectorDecoder2D : PackingSolutionDecoder<TwoDimensionalPacking, RectangularPackingShape, RectangularPackingItem>, I2DMCVDecoder {
     33  public class ExtremePointMultiComponentVectorDecoder2D : PackingSolutionDecoder<PackingPosition, RectangularPackingShape, RectangularPackingItem>, I2DMCVDecoder {
    3434    public ExtremePointMultiComponentVectorDecoder2D () : base() {}
    3535    [StorableConstructor]
     
    4242    }
    4343
    44     public static PackingPlan<TwoDimensionalPacking, RectangularPackingShape, RectangularPackingItem> Decode(MultiComponentVectorEncoding solution, RectangularPackingShape binMeasures, ItemList<RectangularPackingItem> itemMeasures) {
     44    public static PackingPlan<PackingPosition, RectangularPackingShape, RectangularPackingItem> Decode(MultiComponentVectorEncoding solution, RectangularPackingShape binMeasures, ItemList<RectangularPackingItem> itemMeasures) {
    4545      Solution result = new Solution(binMeasures, true, false);
    4646      result.Pack(solution, itemMeasures);
     
    4848    }
    4949
    50     public override PackingPlan<TwoDimensionalPacking, RectangularPackingShape, RectangularPackingItem> CreatePackingPlanFromEncoding(IItem encodedSolution, RectangularPackingShape binMeasures, ItemList<RectangularPackingItem> itemMeasures) {
     50    public override PackingPlan<PackingPosition, RectangularPackingShape, RectangularPackingItem> CreatePackingPlanFromEncoding(IItem encodedSolution, RectangularPackingShape binMeasures, ItemList<RectangularPackingItem> itemMeasures) {
    5151      var solution = encodedSolution as MultiComponentVectorEncoding;
    5252      if (solution == null) throw new InvalidOperationException("Encoding is not of type MultiComponentVector");
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.2D/3.3/Decoders/EP/ExtremePointPackingSequenceDecoder2D.cs

    r14047 r14048  
    3232  [Item("Identical bin, two dimensional, extreme points based decoder for the PackingSequence encoding.", "<Description missing...>")] // TODO
    3333  [StorableClass]
    34   public class ExtremePointPackingSequenceDecoder2D : PackingSolutionDecoder<TwoDimensionalPacking, RectangularPackingShape, RectangularPackingItem>, I2DPSDecoder {
     34  public class ExtremePointPackingSequenceDecoder2D : PackingSolutionDecoder<PackingPosition, RectangularPackingShape, RectangularPackingItem>, I2DPSDecoder {
    3535    public ExtremePointPackingSequenceDecoder2D () : base() {}
    3636    [StorableConstructor]
     
    4444
    4545
    46     public override PackingPlan<TwoDimensionalPacking, RectangularPackingShape, RectangularPackingItem> CreatePackingPlanFromEncoding(IItem encodedSolution, RectangularPackingShape binMeasures, ItemList<RectangularPackingItem> itemMeasures) {
     46    public override PackingPlan<PackingPosition, RectangularPackingShape, RectangularPackingItem> CreatePackingPlanFromEncoding(IItem encodedSolution, RectangularPackingShape binMeasures, ItemList<RectangularPackingItem> itemMeasures) {
    4747      var solution = encodedSolution as PackingSequenceEncoding;
    4848      if (solution == null) throw new InvalidOperationException("Encoding is not of type PackingSequence");
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.2D/3.3/HeuristicLab.Problems.BinPacking2D-3.3.csproj

    r14047 r14048  
    172172    <Compile Include="MoveEvaluators\PackingMoveEvaluator2DMCV.cs" />
    173173    <Compile Include="MoveEvaluators\PackingMoveEvaluator2DPS.cs" />
     174    <Compile Include="PackingPosition.cs" />
    174175    <Compile Include="PackingRatioRectangularIdenticalBinEvaluator.cs" />
    175176    <Compile Include="Plugin.cs" />
     
    179180    <Compile Include="RectangularPackingShape.cs" />
    180181    <Compile Include="Solution.cs" />
    181     <Compile Include="TwoDimensionalPacking.cs" />
    182182  </ItemGroup>
    183183  <ItemGroup>
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.2D/3.3/MoveEvaluators/PackingMoveEvaluator2DGV.cs

    r14046 r14048  
    2929  [Item("GroupingVectorMoveEvaluator2D", "Class for evaluating packing moves for 2dimensional problems.")]
    3030  [StorableClass]
    31   public class PackingMoveEvaluator2DGV : PackingMoveEvaluator<TwoDimensionalPacking, RectangularPackingShape, RectangularPackingItem>, ISingleObjectiveMoveEvaluator, IGroupingVectorMoveOperator, I2DOperator {
     31  public class PackingMoveEvaluator2DGV : PackingMoveEvaluator<PackingPosition, RectangularPackingShape, RectangularPackingItem>, ISingleObjectiveMoveEvaluator, IGroupingVectorMoveOperator, I2DOperator {
    3232    [StorableConstructor]
    3333    protected PackingMoveEvaluator2DGV(bool deserializing) : base(deserializing) { }
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.2D/3.3/MoveEvaluators/PackingMoveEvaluator2DMCV.cs

    r14046 r14048  
    2929  [Item("MultiComponentVectorMoveEvaluator2D", "Class for evaluating packing moves for 2dimensional problems.")]
    3030  [StorableClass]
    31   public class PackingMoveEvaluator2DMCV : PackingMoveEvaluator<TwoDimensionalPacking, RectangularPackingShape, RectangularPackingItem>, ISingleObjectiveMoveEvaluator, IMultiComponentVectorMoveOperator, I2DOperator {
     31  public class PackingMoveEvaluator2DMCV : PackingMoveEvaluator<PackingPosition, RectangularPackingShape, RectangularPackingItem>, ISingleObjectiveMoveEvaluator, IMultiComponentVectorMoveOperator, I2DOperator {
    3232    [StorableConstructor]
    3333    protected PackingMoveEvaluator2DMCV(bool deserializing) : base(deserializing) { }
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.2D/3.3/MoveEvaluators/PackingMoveEvaluator2DPS.cs

    r14046 r14048  
    2929  [Item("PackingSequenceMoveEvaluator2D", "Class for evaluating packing moves for 2dimensional problems.")]
    3030  [StorableClass]
    31   public class PackingMoveEvaluator2DPS : PackingMoveEvaluator<TwoDimensionalPacking, RectangularPackingShape, RectangularPackingItem>, ISingleObjectiveMoveEvaluator, IPackingSequenceMoveOperator, I2DOperator {
     31  public class PackingMoveEvaluator2DPS : PackingMoveEvaluator<PackingPosition, RectangularPackingShape, RectangularPackingItem>, ISingleObjectiveMoveEvaluator, IPackingSequenceMoveOperator, I2DOperator {
    3232    [StorableConstructor]
    3333    protected PackingMoveEvaluator2DPS(bool deserializing) : base(deserializing) { }
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.2D/3.3/PackingPosition.cs

    r14047 r14048  
    2020#endregion
    2121
    22 using System.Text;
    2322using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2423using HeuristicLab.Core;
    2524using HeuristicLab.Common;
    26 using HeuristicLab.Problems.BinPacking;
    2725
    2826namespace HeuristicLab.Problems.BinPacking2D {
    29   [Item("Two Dimensional Packing", "Represents a packing-position associated with a two dimensional packing-problem.")]
     27  [Item("Packing Position (2d)", "Represents a packing-position associated with a two dimensional packing-problem.")]
    3028  [StorableClass]
    31   // TwoDimensionalPacking is an immutable class (and handled as value type concerning Equals and GetHashCode())
    32   public class TwoDimensionalPacking : PackingDimensions {
     29  // PackingPosition is an immutable class (and handled as value type concerning Equals and GetHashCode())
     30  public class PackingPosition : BinPacking.PackingPosition {
    3331    [Storable]
    3432    private readonly int x;
     
    4038
    4139    [StorableConstructor]
    42     protected TwoDimensionalPacking(bool deserializing) : base(deserializing) { }
    43     protected TwoDimensionalPacking(TwoDimensionalPacking original, Cloner cloner)
     40    protected PackingPosition(bool deserializing) : base(deserializing) { }
     41    protected PackingPosition(PackingPosition original, Cloner cloner)
    4442      : base(original, cloner) {
    4543      x = original.X;
     
    4745    }
    4846
    49     public TwoDimensionalPacking(int assignedBin, int x, int y, bool rotated = false)
     47    public PackingPosition(int assignedBin, int x, int y, bool rotated = false)
    5048      : base(assignedBin, rotated) {
    5149      this.x = x;
     
    5452
    5553    public override IDeepCloneable Clone(Cloner cloner) {
    56       return new TwoDimensionalPacking(this, cloner);
     54      return new PackingPosition(this, cloner);
    5755    }
    5856   
     
    6260
    6361    public override bool Equals(object obj) {
    64       var other = obj as TwoDimensionalPacking;
     62      var other = obj as PackingPosition;
    6563      if (other != null)
    6664        return (other.X == this.X && other.Y == this.Y && base.Equals(other));
     
    7270    }
    7371
    74     public static TwoDimensionalPacking MoveLeft(TwoDimensionalPacking original) {
    75       return new TwoDimensionalPacking(original.AssignedBin, original.X - 1, original.Y, original.Rotated);
     72    public static PackingPosition MoveLeft(PackingPosition original) {
     73      return new PackingPosition(original.AssignedBin, original.X - 1, original.Y, original.Rotated);
    7674    }
    77     public static TwoDimensionalPacking MoveDown(TwoDimensionalPacking original) {
    78       return new TwoDimensionalPacking(original.AssignedBin, original.X, original.Y - 1, original.Rotated);
     75    public static PackingPosition MoveDown(PackingPosition original) {
     76      return new PackingPosition(original.AssignedBin, original.X, original.Y - 1, original.Rotated);
    7977    }
    8078
    81     public static TwoDimensionalPacking MoveRight(TwoDimensionalPacking original) {
    82       return new TwoDimensionalPacking(original.AssignedBin, original.X + 1, original.Y, original.Rotated);
     79    public static PackingPosition MoveRight(PackingPosition original) {
     80      return new PackingPosition(original.AssignedBin, original.X + 1, original.Y, original.Rotated);
    8381    }
    84     public static TwoDimensionalPacking MoveUp(TwoDimensionalPacking original) {
    85       return new TwoDimensionalPacking(original.AssignedBin, original.X, original.Y + 1, original.Rotated);
     82    public static PackingPosition MoveUp(PackingPosition original) {
     83      return new PackingPosition(original.AssignedBin, original.X, original.Y + 1, original.Rotated);
    8684    }
    8785
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.2D/3.3/PackingRatioRectangularIdenticalBinEvaluator.cs

    r14046 r14048  
    2929  [Item("Packing-Ratio Rectangular Identical-Bin Evaluator", "Represents an evaluation-algorithm for rectangular-shaped bin-packing problems with identical bins which calculates the ratio between packed and unpacked space. Found in Falkenauer:1996")]
    3030  [StorableClass]
    31   public class PackingRatioRectangularIdenticalBinEvaluator : PackingRatioRegularIdenticalBinEvaluator<TwoDimensionalPacking, RectangularPackingShape, RectangularPackingItem> {
     31  public class PackingRatioRectangularIdenticalBinEvaluator : PackingRatioRegularIdenticalBinEvaluator<PackingPosition, RectangularPackingShape, RectangularPackingItem> {
    3232
    3333    [StorableConstructor]
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.2D/3.3/RectangularIdenticalBinPackingProblem.cs

    r14046 r14048  
    3838  [Creatable(CreatableAttribute.Categories.CombinatorialProblems, Priority = 300)]
    3939  // TODO: only support 2d BPPData
    40   public class RectangularIdenticalBinPackingProblem : BinPackingProblem<TwoDimensionalPacking, RectangularPackingShape, RectangularPackingItem>, IProblemInstanceConsumer<BPPData>, IProblemInstanceExporter<BPPData> {
     40  public class RectangularIdenticalBinPackingProblem : BinPackingProblem<PackingPosition, RectangularPackingShape, RectangularPackingItem>, IProblemInstanceConsumer<BPPData>, IProblemInstanceExporter<BPPData> {
    4141
    4242    #region Default Instance
     
    9797    }
    9898    public RectangularIdenticalBinPackingProblem() : base(
    99       new PackingPlanEvaluationAlgorithm<Permutation, TwoDimensionalPacking, RectangularPackingShape, RectangularPackingItem>()) {
     99      new PackingPlanEvaluationAlgorithm<Permutation, PackingPosition, RectangularPackingShape, RectangularPackingItem>()) {
    100100    }
    101101
     
    174174    protected override void RemoveTooBigItems() {
    175175      PackingItemMeasures.RemoveAll(pi =>
    176         !PackingBinMeasures.Encloses(new TwoDimensionalPacking(0, 0, 0, false), pi) &&
    177         !PackingBinMeasures.Encloses(new TwoDimensionalPacking(0, 0, 0, true), pi));
     176        !PackingBinMeasures.Encloses(new PackingPosition(0, 0, 0, false), pi) &&
     177        !PackingBinMeasures.Encloses(new PackingPosition(0, 0, 0, true), pi));
    178178    }
    179179    #endregion
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.2D/3.3/RectangularPackingShape.cs

    r14046 r14048  
    3232  [Item("RectangularPackingShape", "Represents the rectangular measures (width, height) of a two-dimensional bin-packing object.")]
    3333  [StorableClass]
    34   public class RectangularPackingShape : PackingShape<TwoDimensionalPacking>, IComparable<RectangularPackingShape> {
     34  public class RectangularPackingShape : PackingShape<PackingPosition>, IComparable<RectangularPackingShape> {
    3535    public int Height {
    3636      get { return ((IFixedValueParameter<IntValue>)Parameters["Height"]).Value.Value; }
     
    8686
    8787    #region Helpers
    88     public override TwoDimensionalPacking Origin { get { return new TwoDimensionalPacking(0, 0, 0); } }
     88    public override PackingPosition Origin { get { return new PackingPosition(0, 0, 0); } }
    8989    public override int Volume { get { return Height * Width; } }
    9090
    91     public override bool EnclosesPoint(TwoDimensionalPacking myPosition, TwoDimensionalPacking checkedPoint) {
     91    public override bool EnclosesPoint(PackingPosition myPosition, PackingPosition checkedPoint) {
    9292      return (myPosition.X <= checkedPoint.X &&
    9393                (myPosition.X + (myPosition.Rotated ? Height : Width) - 1) >= checkedPoint.X &&
     
    9595                (myPosition.Y + (myPosition.Rotated ? Width : Height) - 1) >= checkedPoint.Y);
    9696    }
    97     public override bool Encloses(TwoDimensionalPacking checkedPosition, PackingShape<TwoDimensionalPacking> checkedShape) {
     97    public override bool Encloses(PackingPosition checkedPosition, PackingShape<PackingPosition> checkedShape) {
    9898      return Encloses(checkedPosition, (RectangularPackingShape)checkedShape);
    9999    }
    100     private bool Encloses(TwoDimensionalPacking checkedPosition, RectangularPackingShape checkedShape) {
     100    private bool Encloses(PackingPosition checkedPosition, RectangularPackingShape checkedShape) {
    101101      return Encloses(new RectangleDiagonal(this), new RectangleDiagonal(checkedPosition, checkedShape));
    102102    }
     
    108108    }
    109109
    110     public override bool Overlaps(TwoDimensionalPacking myPosition, TwoDimensionalPacking checkedPosition, PackingShape<TwoDimensionalPacking> checkedShape) {
     110    public override bool Overlaps(PackingPosition myPosition, PackingPosition checkedPosition, PackingShape<PackingPosition> checkedShape) {
    111111      return Overlaps(myPosition, checkedPosition, (RectangularPackingShape)checkedShape);
    112112    }
    113     private bool Overlaps(TwoDimensionalPacking myPosition, TwoDimensionalPacking checkedPosition, RectangularPackingShape checkedShape) {
     113    private bool Overlaps(PackingPosition myPosition, PackingPosition checkedPosition, RectangularPackingShape checkedShape) {
    114114      return Overlaps(new RectangleDiagonal(myPosition, this), new RectangleDiagonal(checkedPosition, checkedShape));
    115115    }
     
    136136      public int x2;
    137137      public int y2;
    138       public RectangleDiagonal(RectangularPackingShape myShape) : this(new TwoDimensionalPacking(0, 0, 0), myShape) { }
    139       public RectangleDiagonal(TwoDimensionalPacking myPosition, RectangularPackingShape myShape) {
     138      public RectangleDiagonal(RectangularPackingShape myShape) : this(new PackingPosition(0, 0, 0), myShape) { }
     139      public RectangleDiagonal(PackingPosition myPosition, RectangularPackingShape myShape) {
    140140        x1 = myPosition.X;
    141141        y1 = myPosition.Y;
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.2D/3.3/Solution.cs

    r14047 r14048  
    2828  [Item("Bin Packing Solution (2d)", "Represents a solution for a 2D bin packing problem.")]
    2929  [StorableClass]
    30   public class Solution : PackingPlan<TwoDimensionalPacking, RectangularPackingShape, RectangularPackingItem> {
     30  public class Solution : PackingPlan<PackingPosition, RectangularPackingShape, RectangularPackingItem> {
    3131    public Solution(RectangularPackingShape binMeasures) : this(binMeasures, false, false) { }
    3232    public Solution(RectangularPackingShape binMeasures, bool useExtremePoints, bool stackingConstraints) : base(binMeasures, useExtremePoints, stackingConstraints) { }
     
    3939      return new Solution(this, cloner);
    4040    }
    41     public override BinPacking<TwoDimensionalPacking, RectangularPackingShape, RectangularPackingItem> NewBinPacking() {
     41    public override BinPacking<PackingPosition, RectangularPackingShape, RectangularPackingItem> NewBinPacking() {
    4242      return new BinPacking2D(BinMeasures);
    4343    }
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.3D/3.3/BinPacking3D.cs

    r14046 r14048  
    3030  [Item("BinPacking3D", "Represents a single-bin packing for a 3D bin-packing problem.")]
    3131  [StorableClass]
    32   public class BinPacking3D : BinPacking<ThreeDimensionalPacking, CuboidPackingShape, CuboidPackingItem> {
     32  public class BinPacking3D : BinPacking<PackingPosition, CuboidPackingShape, CuboidPackingItem> {
    3333
    3434    public BinPacking3D(CuboidPackingShape binMeasures)
    3535      : base(binMeasures) {
    36       ExtremePoints = new SortedSet<ThreeDimensionalPacking>(new EPComparer3D());
     36      ExtremePoints = new SortedSet<PackingPosition>(new EPComparer3D());
    3737      ExtremePoints.Add(binMeasures.Origin);
    3838    }
     
    4242      : base(original, cloner) {
    4343      this.depthWasDoubled = original.depthWasDoubled;
    44       this.ExtremePoints = new SortedSet<ThreeDimensionalPacking>(original.ExtremePoints, new EPComparer3D());
     44      this.ExtremePoints = new SortedSet<PackingPosition>(original.ExtremePoints, new EPComparer3D());
    4545    }
    4646    public override IDeepCloneable Clone(Cloner cloner) {
     
    4848    }
    4949
    50     protected override void GenerateNewExtremePointsForNewItem(CuboidPackingItem newItem, ThreeDimensionalPacking position) {
     50    protected override void GenerateNewExtremePointsForNewItem(CuboidPackingItem newItem, PackingPosition position) {
    5151      int newWidth = position.Rotated ? newItem.Depth : newItem.Width;
    5252      int newDepth = position.Rotated ? newItem.Width : newItem.Depth;
    5353
    5454      //Find ExtremePoints beginning from sourcepointX
    55       var sourcePointX = new ThreeDimensionalPacking(0, position.X + newWidth, position.Y, position.Z);
     55      var sourcePointX = new PackingPosition(0, position.X + newWidth, position.Y, position.Z);
    5656      if (sourcePointX.X < BinMeasures.Width && sourcePointX.Y < BinMeasures.Height && sourcePointX.Z < BinMeasures.Depth) {
    5757        //Traversing down the y-axis 
    58         ThreeDimensionalPacking current = new ThreeDimensionalPacking(0, sourcePointX.X, sourcePointX.Y, sourcePointX.Z);
    59         while (current.Y > 0 && !IsPointOccupied(ThreeDimensionalPacking.MoveDown(current))) {
    60           current = ThreeDimensionalPacking.MoveDown(current);
    61         }
    62         ExtremePoints.Add((ThreeDimensionalPacking)current.Clone());
    63         while (current.X > 0 && !IsPointOccupied(ThreeDimensionalPacking.MoveLeft(current))) {
    64           current = ThreeDimensionalPacking.MoveLeft(current);
     58        PackingPosition current = new PackingPosition(0, sourcePointX.X, sourcePointX.Y, sourcePointX.Z);
     59        while (current.Y > 0 && !IsPointOccupied(PackingPosition.MoveDown(current))) {
     60          current = PackingPosition.MoveDown(current);
     61        }
     62        ExtremePoints.Add((PackingPosition)current.Clone());
     63        while (current.X > 0 && !IsPointOccupied(PackingPosition.MoveLeft(current))) {
     64          current = PackingPosition.MoveLeft(current);
    6565        }
    6666        ExtremePoints.Add(current);
    6767
    6868        //Traversing down the z-axis
    69         current = new ThreeDimensionalPacking(0, sourcePointX.X, sourcePointX.Y, sourcePointX.Z);
    70         while (current.Z > 0 && !IsPointOccupied(ThreeDimensionalPacking.MoveBack(current))) {
    71           current = ThreeDimensionalPacking.MoveBack(current);
    72         }
    73         ExtremePoints.Add((ThreeDimensionalPacking)current.Clone());
    74         while (current.Y > 0 && !IsPointOccupied(ThreeDimensionalPacking.MoveDown(current))) {
    75           current = ThreeDimensionalPacking.MoveDown(current);
     69        current = new PackingPosition(0, sourcePointX.X, sourcePointX.Y, sourcePointX.Z);
     70        while (current.Z > 0 && !IsPointOccupied(PackingPosition.MoveBack(current))) {
     71          current = PackingPosition.MoveBack(current);
     72        }
     73        ExtremePoints.Add((PackingPosition)current.Clone());
     74        while (current.Y > 0 && !IsPointOccupied(PackingPosition.MoveDown(current))) {
     75          current = PackingPosition.MoveDown(current);
    7676        }
    7777        ExtremePoints.Add(current);
     
    8282
    8383      //Find ExtremePoints beginning from sourcepointY
    84       var sourcePointY = new ThreeDimensionalPacking(0, position.X, position.Y + newItem.Height, position.Z);
     84      var sourcePointY = new PackingPosition(0, position.X, position.Y + newItem.Height, position.Z);
    8585      if (sourcePointY.X < BinMeasures.Width && sourcePointY.Y < BinMeasures.Height && sourcePointY.Z < BinMeasures.Depth) {
    8686        //Traversing down the x-axis         
    87         ThreeDimensionalPacking current = new ThreeDimensionalPacking(0, sourcePointY.X, sourcePointY.Y, sourcePointY.Z);
    88         while (current.X > 0 && !IsPointOccupied(ThreeDimensionalPacking.MoveLeft(current))) {
    89           current = ThreeDimensionalPacking.MoveLeft(current);
    90         }
    91         ExtremePoints.Add((ThreeDimensionalPacking)current.Clone());
    92         while (current.Y > 0 && !IsPointOccupied(ThreeDimensionalPacking.MoveDown(current))) {
    93           current = ThreeDimensionalPacking.MoveDown(current);
     87        PackingPosition current = new PackingPosition(0, sourcePointY.X, sourcePointY.Y, sourcePointY.Z);
     88        while (current.X > 0 && !IsPointOccupied(PackingPosition.MoveLeft(current))) {
     89          current = PackingPosition.MoveLeft(current);
     90        }
     91        ExtremePoints.Add((PackingPosition)current.Clone());
     92        while (current.Y > 0 && !IsPointOccupied(PackingPosition.MoveDown(current))) {
     93          current = PackingPosition.MoveDown(current);
    9494        }
    9595        ExtremePoints.Add(current);
    9696
    9797        //Traversing down the z-axis                                                                   
    98         current = new ThreeDimensionalPacking(0, sourcePointY.X, sourcePointY.Y, sourcePointY.Z);
    99         while (current.Z > 0 && !IsPointOccupied(ThreeDimensionalPacking.MoveBack(current))) {
    100           current = ThreeDimensionalPacking.MoveBack(current);
    101         }
    102         ExtremePoints.Add((ThreeDimensionalPacking)current.Clone());
    103         while (current.Y > 0 && !IsPointOccupied(ThreeDimensionalPacking.MoveDown(current))) {
    104           current = ThreeDimensionalPacking.MoveDown(current);
     98        current = new PackingPosition(0, sourcePointY.X, sourcePointY.Y, sourcePointY.Z);
     99        while (current.Z > 0 && !IsPointOccupied(PackingPosition.MoveBack(current))) {
     100          current = PackingPosition.MoveBack(current);
     101        }
     102        ExtremePoints.Add((PackingPosition)current.Clone());
     103        while (current.Y > 0 && !IsPointOccupied(PackingPosition.MoveDown(current))) {
     104          current = PackingPosition.MoveDown(current);
    105105        }
    106106        ExtremePoints.Add(current);
     
    112112
    113113      //Find ExtremePoints beginning from sourcepointZ
    114       var sourcePointZ = new ThreeDimensionalPacking(0, position.X, position.Y, position.Z + newDepth);
     114      var sourcePointZ = new PackingPosition(0, position.X, position.Y, position.Z + newDepth);
    115115      if (sourcePointZ.X < BinMeasures.Width && sourcePointZ.Y < BinMeasures.Height && sourcePointZ.Z < BinMeasures.Depth) {
    116116        //Traversing down the x-axis                                                                             
    117         ThreeDimensionalPacking current = new ThreeDimensionalPacking(0, sourcePointZ.X, sourcePointZ.Y, sourcePointZ.Z);
    118         while (current.X > 0 && !IsPointOccupied(ThreeDimensionalPacking.MoveLeft(current))) {
    119           current = ThreeDimensionalPacking.MoveLeft(current);
    120         }
    121         ExtremePoints.Add((ThreeDimensionalPacking)current.Clone());
    122         while (current.Y > 0 && !IsPointOccupied(ThreeDimensionalPacking.MoveDown(current))) {
    123           current = ThreeDimensionalPacking.MoveDown(current);
     117        PackingPosition current = new PackingPosition(0, sourcePointZ.X, sourcePointZ.Y, sourcePointZ.Z);
     118        while (current.X > 0 && !IsPointOccupied(PackingPosition.MoveLeft(current))) {
     119          current = PackingPosition.MoveLeft(current);
     120        }
     121        ExtremePoints.Add((PackingPosition)current.Clone());
     122        while (current.Y > 0 && !IsPointOccupied(PackingPosition.MoveDown(current))) {
     123          current = PackingPosition.MoveDown(current);
    124124        }
    125125        ExtremePoints.Add(current);
    126126
    127127        //Traversing down the y-axis                                                                     
    128         current = new ThreeDimensionalPacking(0, sourcePointZ.X, sourcePointZ.Y, sourcePointZ.Z);
    129         while (current.Y > 0 && !IsPointOccupied(ThreeDimensionalPacking.MoveDown(current))) {
    130           current = ThreeDimensionalPacking.MoveDown(current);
    131         }
    132         ExtremePoints.Add((ThreeDimensionalPacking)current.Clone());
    133         while (current.X > 0 && !IsPointOccupied(ThreeDimensionalPacking.MoveLeft(current))) {
    134           current = ThreeDimensionalPacking.MoveLeft(current);
     128        current = new PackingPosition(0, sourcePointZ.X, sourcePointZ.Y, sourcePointZ.Z);
     129        while (current.Y > 0 && !IsPointOccupied(PackingPosition.MoveDown(current))) {
     130          current = PackingPosition.MoveDown(current);
     131        }
     132        ExtremePoints.Add((PackingPosition)current.Clone());
     133        while (current.X > 0 && !IsPointOccupied(PackingPosition.MoveLeft(current))) {
     134          current = PackingPosition.MoveLeft(current);
    135135        }
    136136        ExtremePoints.Add(current);
     
    146146    }
    147147
    148     public override ThreeDimensionalPacking FindExtremePointForItem(CuboidPackingItem measures, bool rotated, bool stackingConstraints) {
     148    public override PackingPosition FindExtremePointForItem(CuboidPackingItem measures, bool rotated, bool stackingConstraints) {
    149149
    150150      CuboidPackingItem item = new CuboidPackingItem(
     
    164164      if (epIndex < ExtremePoints.Count) {
    165165        var origPoint = ExtremePoints.ElementAt(epIndex);
    166         var result = new ThreeDimensionalPacking(origPoint.AssignedBin, origPoint.X, origPoint.Y, origPoint.Z, rotated);
     166        var result = new PackingPosition(origPoint.AssignedBin, origPoint.X, origPoint.Y, origPoint.Z, rotated);
    167167        return result;
    168168      }
     
    170170    }
    171171
    172     public override ThreeDimensionalPacking FindPositionBySliding(CuboidPackingItem measures, bool rotated) {
     172    public override PackingPosition FindPositionBySliding(CuboidPackingItem measures, bool rotated) {
    173173      //Starting-position at upper right corner (=left bottom point of item-rectangle is at position item.width,item.height)
    174       ThreeDimensionalPacking currentPosition = new ThreeDimensionalPacking(0,
     174      PackingPosition currentPosition = new PackingPosition(0,
    175175        BinMeasures.Width - (rotated ? measures.Depth : measures.Width),
    176176        BinMeasures.Height - measures.Height,
    177177        BinMeasures.Depth - (rotated ? measures.Width : measures.Depth), rotated);
    178178      //Slide the item as far as possible to the bottom
    179       while (IsPositionFeasible(measures, ThreeDimensionalPacking.MoveDown(currentPosition))
    180         || IsPositionFeasible(measures, ThreeDimensionalPacking.MoveLeft(currentPosition))
    181         || IsPositionFeasible(measures, ThreeDimensionalPacking.MoveBack(currentPosition))) {
     179      while (IsPositionFeasible(measures, PackingPosition.MoveDown(currentPosition))
     180        || IsPositionFeasible(measures, PackingPosition.MoveLeft(currentPosition))
     181        || IsPositionFeasible(measures, PackingPosition.MoveBack(currentPosition))) {
    182182        //Slide the item as far as possible to the left
    183         while (IsPositionFeasible(measures, ThreeDimensionalPacking.MoveLeft(currentPosition))
    184       || IsPositionFeasible(measures, ThreeDimensionalPacking.MoveBack(currentPosition))) {
     183        while (IsPositionFeasible(measures, PackingPosition.MoveLeft(currentPosition))
     184      || IsPositionFeasible(measures, PackingPosition.MoveBack(currentPosition))) {
    185185          //Slide the item as far as possible to the back
    186           while (IsPositionFeasible(measures, ThreeDimensionalPacking.MoveBack(currentPosition))) {
    187             currentPosition = ThreeDimensionalPacking.MoveBack(currentPosition);
     186          while (IsPositionFeasible(measures, PackingPosition.MoveBack(currentPosition))) {
     187            currentPosition = PackingPosition.MoveBack(currentPosition);
    188188          }
    189           if (IsPositionFeasible(measures, ThreeDimensionalPacking.MoveLeft(currentPosition)))
    190             currentPosition = ThreeDimensionalPacking.MoveLeft(currentPosition);
    191         }
    192         if (IsPositionFeasible(measures, ThreeDimensionalPacking.MoveDown(currentPosition)))
    193           currentPosition = ThreeDimensionalPacking.MoveDown(currentPosition);
     189          if (IsPositionFeasible(measures, PackingPosition.MoveLeft(currentPosition)))
     190            currentPosition = PackingPosition.MoveLeft(currentPosition);
     191        }
     192        if (IsPositionFeasible(measures, PackingPosition.MoveDown(currentPosition)))
     193          currentPosition = PackingPosition.MoveDown(currentPosition);
    194194      }
    195195
     
    242242    }
    243243
    244     public override int ShortestPossibleSideFromPoint(ThreeDimensionalPacking position) {
     244    public override int ShortestPossibleSideFromPoint(PackingPosition position) {
    245245
    246246      int shortestSide = int.MaxValue;
     
    252252        return shortestSide;
    253253
    254       ThreeDimensionalPacking current = new ThreeDimensionalPacking(0, position.X, position.Y, position.Z);
    255       while (current.X < width && IsPointOccupied(current)) { current = ThreeDimensionalPacking.MoveRight(current); }
     254      PackingPosition current = new PackingPosition(0, position.X, position.Y, position.Z);
     255      while (current.X < width && IsPointOccupied(current)) { current = PackingPosition.MoveRight(current); }
    256256      if (current.X - position.X < shortestSide)
    257257        shortestSide = current.X - position.X;
    258258
    259259
    260       current = new ThreeDimensionalPacking(0, position.X, position.Y, position.Z);
    261       while (current.Y < height && IsPointOccupied(current)) { current = ThreeDimensionalPacking.MoveUp(current); }
     260      current = new PackingPosition(0, position.X, position.Y, position.Z);
     261      while (current.Y < height && IsPointOccupied(current)) { current = PackingPosition.MoveUp(current); }
    262262      if (current.Y - position.Y < shortestSide)
    263263        shortestSide = current.Y - position.Y;
    264264
    265265
    266       current = new ThreeDimensionalPacking(0, position.X, position.Y, position.Z);
    267       while (current.Z < depth && IsPointOccupied(current)) { current = ThreeDimensionalPacking.MoveFront(current); }
     266      current = new PackingPosition(0, position.X, position.Y, position.Z);
     267      while (current.Z < depth && IsPointOccupied(current)) { current = PackingPosition.MoveFront(current); }
    268268      if (current.Z - position.Z < shortestSide)
    269269        shortestSide = current.Z - position.Z;
     
    271271      return shortestSide;
    272272    }
    273     public override bool IsStaticStable(CuboidPackingItem item, ThreeDimensionalPacking position) {
     273    public override bool IsStaticStable(CuboidPackingItem item, PackingPosition position) {
    274274      //Static stability is given, if item is placed on the ground
    275275      if (position.Y == 0)
    276276        return true;
    277277
    278       if (IsPointOccupied(new ThreeDimensionalPacking(0, position.X, position.Y - 1, position.Z))
    279         && IsPointOccupied(new ThreeDimensionalPacking(0, position.X + item.Width - 1, position.Y - 1, position.Z))
    280         && IsPointOccupied(new ThreeDimensionalPacking(0, position.X, position.Y - 1, position.Z + item.Depth - 1))
    281         && IsPointOccupied(new ThreeDimensionalPacking(0, position.X + item.Width - 1, position.Y - 1, position.Z + item.Depth - 1)))
     278      if (IsPointOccupied(new PackingPosition(0, position.X, position.Y - 1, position.Z))
     279        && IsPointOccupied(new PackingPosition(0, position.X + item.Width - 1, position.Y - 1, position.Z))
     280        && IsPointOccupied(new PackingPosition(0, position.X, position.Y - 1, position.Z + item.Depth - 1))
     281        && IsPointOccupied(new PackingPosition(0, position.X + item.Width - 1, position.Y - 1, position.Z + item.Depth - 1)))
    282282        return true;
    283283
     
    304304
    305305    [Storable]
    306     private bool depthWasDoubled = false;
     306    private bool depthWasDoubled = false; // TODO ???
    307307    public void DoubleDepth() {
    308308      if (!depthWasDoubled) {
     
    314314    }
    315315
    316     public bool IsSupportedByAtLeastOnePoint(CuboidPackingItem item, ThreeDimensionalPacking position) {
     316    public bool IsSupportedByAtLeastOnePoint(CuboidPackingItem item, PackingPosition position) {
    317317      if (position.Y == 0)
    318318        return true;
     
    321321      for (int x = position.X; x < position.X + item.Width; x++)
    322322        for (int z = position.Z; z < position.Z + item.Depth; z++)
    323           if (IsPointOccupied(new ThreeDimensionalPacking(0, x, y, z)))
     323          if (IsPointOccupied(new PackingPosition(0, x, y, z)))
    324324            return true;
    325325
    326326      return false;
    327327    }
    328     public bool IsWeightSupported(CuboidPackingItem item, ThreeDimensionalPacking ep) {
     328    public bool IsWeightSupported(CuboidPackingItem item, PackingPosition ep) {
    329329      if (ep.Y == 0)
    330330        return true;
    331331
    332       if (ItemMeasures[PointOccupation(new ThreeDimensionalPacking(0, ep.X, ep.Y - 1, ep.Z))].SupportsStacking(item)
    333         && ItemMeasures[PointOccupation(new ThreeDimensionalPacking(0, ep.X + item.Width - 1, ep.Y - 1, ep.Z))].SupportsStacking(item)
    334         && ItemMeasures[PointOccupation(new ThreeDimensionalPacking(0, ep.X, ep.Y - 1, ep.Z + item.Depth - 1))].SupportsStacking(item)
    335         && ItemMeasures[PointOccupation(new ThreeDimensionalPacking(0, ep.X + item.Width - 1, ep.Y - 1, ep.Z + item.Depth - 1))].SupportsStacking(item))
     332      if (ItemMeasures[PointOccupation(new PackingPosition(0, ep.X, ep.Y - 1, ep.Z))].SupportsStacking(item)
     333        && ItemMeasures[PointOccupation(new PackingPosition(0, ep.X + item.Width - 1, ep.Y - 1, ep.Z))].SupportsStacking(item)
     334        && ItemMeasures[PointOccupation(new PackingPosition(0, ep.X, ep.Y - 1, ep.Z + item.Depth - 1))].SupportsStacking(item)
     335        && ItemMeasures[PointOccupation(new PackingPosition(0, ep.X + item.Width - 1, ep.Y - 1, ep.Z + item.Depth - 1))].SupportsStacking(item))
    336336        return true;
    337337
     
    345345      }
    346346    }
    347     protected override void AddNewItemToOccupationLayers(int itemID, CuboidPackingItem measures, ThreeDimensionalPacking position) {
     347    protected override void AddNewItemToOccupationLayers(int itemID, CuboidPackingItem measures, PackingPosition position) {
    348348      int z1 = position.Z / 10;
    349349      int z2 = (position.Z + (position.Rotated ? measures.Width : measures.Depth)) / 10;
     
    352352        OccupationLayers[i].Add(itemID);
    353353    }
    354     protected override List<int> GetLayerItemIDs(ThreeDimensionalPacking position) {
     354    protected override List<int> GetLayerItemIDs(PackingPosition position) {
    355355      return OccupationLayers[position.Z / 10];
    356356    }
    357     protected override List<int> GetLayerItemIDs(CuboidPackingItem measures, ThreeDimensionalPacking position) {
     357    protected override List<int> GetLayerItemIDs(CuboidPackingItem measures, PackingPosition position) {
    358358      List<int> result = new List<int>();
    359359      int z1 = position.Z / 10;
     
    366366    }
    367367  }
    368   public class EPComparer3D : IComparer<ThreeDimensionalPacking> {
    369     public int Compare(ThreeDimensionalPacking a, ThreeDimensionalPacking b) {
     368  public class EPComparer3D : IComparer<PackingPosition> {
     369    public int Compare(PackingPosition a, PackingPosition b) {
    370370      int result = a.Z.CompareTo(b.Z);
    371371      if (result == 0)
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.3D/3.3/CuboidIdenticalBinPackingProblem.cs

    r14046 r14048  
    3838  [Creatable(CreatableAttribute.Categories.CombinatorialProblems, Priority = 310)]
    3939  // TODO don't support generic BPPData but only 3d BPPData
    40   public class CuboidIdenticalBinPackingProblem : BinPackingProblem<ThreeDimensionalPacking, CuboidPackingShape, CuboidPackingItem>, IProblemInstanceConsumer<BPPData>, IProblemInstanceExporter<BPPData> {
     40  public class CuboidIdenticalBinPackingProblem : BinPackingProblem<PackingPosition, CuboidPackingShape, CuboidPackingItem>, IProblemInstanceConsumer<BPPData>, IProblemInstanceExporter<BPPData> {
    4141
    4242
     
    102102    }
    103103    public CuboidIdenticalBinPackingProblem() : base(
    104       new PackingPlanEvaluationAlgorithm<Permutation, ThreeDimensionalPacking, CuboidPackingShape, CuboidPackingItem>()) {
     104      new PackingPlanEvaluationAlgorithm<Permutation, PackingPosition, CuboidPackingShape, CuboidPackingItem>()) {
    105105    }
    106106
     
    178178    protected override void RemoveTooBigItems() {
    179179      PackingItemMeasures.RemoveAll(pi =>
    180         !PackingBinMeasures.Encloses(new ThreeDimensionalPacking(0, 0, 0, 0, false), pi) &&
    181         !PackingBinMeasures.Encloses(new ThreeDimensionalPacking(0, 0, 0, 0, true), pi));
     180        !PackingBinMeasures.Encloses(new PackingPosition(0, 0, 0, 0, false), pi) &&
     181        !PackingBinMeasures.Encloses(new PackingPosition(0, 0, 0, 0, true), pi));
    182182    }
    183183    #endregion
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.3D/3.3/CuboidPackingShape.cs

    r14046 r14048  
    3131  [Item("CuboidPackingShape", "Represents the cuboid measures (width, height, depth) of a three-dimensional cuboidic bin-packing object.")]
    3232  [StorableClass]
    33   public class CuboidPackingShape : PackingShape<ThreeDimensionalPacking>, IComparable<CuboidPackingShape> {
     33  public class CuboidPackingShape : PackingShape<PackingPosition>, IComparable<CuboidPackingShape> {
    3434    public IFixedValueParameter<IntValue> HeightParameter {
    3535      get { return (IFixedValueParameter<IntValue>)Parameters["Height"]; }
     
    128128      public int y2;
    129129      public int z2;
    130       public CuboidDiagonal(CuboidPackingShape myShape) : this(new ThreeDimensionalPacking(0, 0, 0, 0), myShape) { }
    131       public CuboidDiagonal(ThreeDimensionalPacking myPosition, CuboidPackingShape myShape) {
     130      public CuboidDiagonal(CuboidPackingShape myShape) : this(new PackingPosition(0, 0, 0, 0), myShape) { }
     131      public CuboidDiagonal(PackingPosition myPosition, CuboidPackingShape myShape) {
    132132        x1 = myPosition.X;
    133133        y1 = myPosition.Y;
     
    141141
    142142    #region Helpers
    143     public override ThreeDimensionalPacking Origin { get { return new ThreeDimensionalPacking(0, 0, 0, 0); } }
     143    public override PackingPosition Origin { get { return new PackingPosition(0, 0, 0, 0); } }
    144144    public override int Volume { get { return Width * Height * Depth; } }
    145145
    146     public override bool EnclosesPoint(ThreeDimensionalPacking myPosition, ThreeDimensionalPacking checkedPoint) {
     146    public override bool EnclosesPoint(PackingPosition myPosition, PackingPosition checkedPoint) {
    147147      return (myPosition.X <= checkedPoint.X &&
    148148                (myPosition.X + (myPosition.Rotated ? Depth : Width) - 1) >= checkedPoint.X &&
     
    152152                (myPosition.Z + (myPosition.Rotated ? Width : Depth) - 1) >= checkedPoint.Z);
    153153    }
    154     public override bool Encloses(ThreeDimensionalPacking checkedPosition, PackingShape<ThreeDimensionalPacking> checkedShape) {
     154    public override bool Encloses(PackingPosition checkedPosition, PackingShape<PackingPosition> checkedShape) {
    155155      return Encloses(checkedPosition, (CuboidPackingShape)checkedShape);
    156156    }
    157     private bool Encloses(ThreeDimensionalPacking checkedPosition, CuboidPackingShape checkedShape) {
     157    private bool Encloses(PackingPosition checkedPosition, CuboidPackingShape checkedShape) {
    158158      return Encloses(new CuboidDiagonal(this), new CuboidDiagonal(checkedPosition, checkedShape));
    159159    }
     
    167167    }
    168168
    169     public override bool Overlaps(ThreeDimensionalPacking myPosition, ThreeDimensionalPacking checkedPosition, PackingShape<ThreeDimensionalPacking> checkedShape) {
     169    public override bool Overlaps(PackingPosition myPosition, PackingPosition checkedPosition, PackingShape<PackingPosition> checkedShape) {
    170170      return Overlaps(myPosition, checkedPosition, (CuboidPackingShape)checkedShape);
    171171    }
    172     private bool Overlaps(ThreeDimensionalPacking myPosition, ThreeDimensionalPacking checkedPosition, CuboidPackingShape checkedShape) {
     172    private bool Overlaps(PackingPosition myPosition, PackingPosition checkedPosition, CuboidPackingShape checkedShape) {
    173173      return Overlaps(new CuboidDiagonal(myPosition, this), new CuboidDiagonal(checkedPosition, checkedShape));
    174174    }
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.3D/3.3/Decoders/DBL/DeepestBottomLeftGroupingVectorDecoder.cs

    r14047 r14048  
    3131  [Item("Identical bin, three dimensional, GroupingVector-decoder", "<Description missing...>")]
    3232  [StorableClass]
    33   public class DeepestBottomLeftGroupingVectorDecoder : PackingSolutionDecoder<ThreeDimensionalPacking, CuboidPackingShape, CuboidPackingItem>, I3DGVDecoder {
     33  public class DeepestBottomLeftGroupingVectorDecoder : PackingSolutionDecoder<PackingPosition, CuboidPackingShape, CuboidPackingItem>, I3DGVDecoder {
    3434    public DeepestBottomLeftGroupingVectorDecoder() : base() {}
    3535    [StorableConstructor]
     
    4242    }
    4343
    44     public override PackingPlan<ThreeDimensionalPacking, CuboidPackingShape, CuboidPackingItem> CreatePackingPlanFromEncoding(IItem encodedSolution, CuboidPackingShape binMeasures, ItemList<CuboidPackingItem> itemMeasures) {
     44    public override PackingPlan<PackingPosition, CuboidPackingShape, CuboidPackingItem> CreatePackingPlanFromEncoding(IItem encodedSolution, CuboidPackingShape binMeasures, ItemList<CuboidPackingItem> itemMeasures) {
    4545      var solution = encodedSolution as GroupingVectorEncoding;
    4646      if (solution == null) throw new InvalidOperationException("Encoding is not of type GroupingVector");
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.3D/3.3/Decoders/DBL/DeepestBottomLeftMultiComponentVectorDecoder.cs

    r14047 r14048  
    3131  [Item("Identical bin, three dimensional, MultiComponentVector-decoder", "<Description missing...>")]
    3232  [StorableClass]
    33   public class DeepestBottomLeftMultiComponentVectorDecoder : PackingSolutionDecoder<ThreeDimensionalPacking, CuboidPackingShape, CuboidPackingItem>, I3DMCVDecoder {
     33  public class DeepestBottomLeftMultiComponentVectorDecoder : PackingSolutionDecoder<PackingPosition, CuboidPackingShape, CuboidPackingItem>, I3DMCVDecoder {
    3434    public DeepestBottomLeftMultiComponentVectorDecoder() : base() { }
    3535    [StorableConstructor]
     
    4242    }
    4343
    44     public override PackingPlan<ThreeDimensionalPacking, CuboidPackingShape, CuboidPackingItem> CreatePackingPlanFromEncoding(IItem encodedSolution, CuboidPackingShape binMeasures, ItemList<CuboidPackingItem> itemMeasures) {
     44    public override PackingPlan<PackingPosition, CuboidPackingShape, CuboidPackingItem> CreatePackingPlanFromEncoding(IItem encodedSolution, CuboidPackingShape binMeasures, ItemList<CuboidPackingItem> itemMeasures) {
    4545      var solution = encodedSolution as MultiComponentVectorEncoding;
    4646      if (solution == null) throw new InvalidOperationException("Encoding is not of type MultiComponent Vector");
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.3D/3.3/Decoders/DBL/DeepestBottomLeftPackingSequenceDecoder.cs

    r14047 r14048  
    3131  [Item("Identical bin, three dimensional, PackingSequence-decoder", "<Description missing...>")]
    3232  [StorableClass]
    33   public class DeepestBottomLeftPackingSequenceDecoder : PackingSolutionDecoder<ThreeDimensionalPacking, CuboidPackingShape, CuboidPackingItem>, I3DPSDecoder {
     33  public class DeepestBottomLeftPackingSequenceDecoder : PackingSolutionDecoder<PackingPosition, CuboidPackingShape, CuboidPackingItem>, I3DPSDecoder {
    3434    public DeepestBottomLeftPackingSequenceDecoder(): base() {}
    3535    [StorableConstructor]
     
    4242    }
    4343
    44     public override PackingPlan<ThreeDimensionalPacking, CuboidPackingShape, CuboidPackingItem> CreatePackingPlanFromEncoding(IItem encodedSolution, CuboidPackingShape binMeasures, ItemList<CuboidPackingItem> itemMeasures) {
     44    public override PackingPlan<PackingPosition, CuboidPackingShape, CuboidPackingItem> CreatePackingPlanFromEncoding(IItem encodedSolution, CuboidPackingShape binMeasures, ItemList<CuboidPackingItem> itemMeasures) {
    4545      var solution = encodedSolution as PackingSequenceEncoding;
    4646      if (solution == null) throw new InvalidOperationException("Encoding is not of type PackingSequence");
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.3D/3.3/Decoders/EP/ExtremePointGroupingVectorDecoder3D.cs

    r14047 r14048  
    3131  [Item("Identical bin, three dimensional, extreme points based decoder for the GroupingVector encoding.", "<Description missing...>")]
    3232  [StorableClass]
    33   public class ExtremePointGroupingVectorDecoder3D : PackingSolutionDecoder<ThreeDimensionalPacking, CuboidPackingShape, CuboidPackingItem>, I3DGVDecoder {
     33  public class ExtremePointGroupingVectorDecoder3D : PackingSolutionDecoder<PackingPosition, CuboidPackingShape, CuboidPackingItem>, I3DGVDecoder {
    3434    public ExtremePointGroupingVectorDecoder3D() : base() { }
    3535    [StorableConstructor]
     
    4242    }
    4343
    44     public static PackingPlan<ThreeDimensionalPacking, CuboidPackingShape, CuboidPackingItem> Decode(GroupingVectorEncoding solution, CuboidPackingShape binMeasures, ItemList<CuboidPackingItem> itemMeasures, bool stackingConstraints) {
     44    public static PackingPlan<PackingPosition, CuboidPackingShape, CuboidPackingItem> Decode(GroupingVectorEncoding solution, CuboidPackingShape binMeasures, ItemList<CuboidPackingItem> itemMeasures, bool stackingConstraints) {
    4545      Solution result = new Solution(binMeasures, true, stackingConstraints);
    4646      result.Pack(solution, itemMeasures);
     
    4848    }
    4949
    50     public override PackingPlan<ThreeDimensionalPacking, CuboidPackingShape, CuboidPackingItem> CreatePackingPlanFromEncoding(IItem encodedSolution, CuboidPackingShape binMeasures, ItemList<CuboidPackingItem> itemMeasures) {
     50    public override PackingPlan<PackingPosition, CuboidPackingShape, CuboidPackingItem> CreatePackingPlanFromEncoding(IItem encodedSolution, CuboidPackingShape binMeasures, ItemList<CuboidPackingItem> itemMeasures) {
    5151      var solution = encodedSolution as GroupingVectorEncoding;
    5252      if (solution == null) throw new InvalidOperationException("Encoding is not of type GroupingVector");
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.3D/3.3/Decoders/EP/ExtremePointMultiComponentVectorDecoder3D.cs

    r14047 r14048  
    3131  [Item("Identical bin, three dimensional, extreme points based decoder for the MultiComponentVector encoding.", "<Description missing...>")]
    3232  [StorableClass]
    33   public class ExtremePointMultiComponentVectorDecoder3D : PackingSolutionDecoder<ThreeDimensionalPacking, CuboidPackingShape, CuboidPackingItem>, I3DMCVDecoder {
     33  public class ExtremePointMultiComponentVectorDecoder3D : PackingSolutionDecoder<PackingPosition, CuboidPackingShape, CuboidPackingItem>, I3DMCVDecoder {
    3434    public ExtremePointMultiComponentVectorDecoder3D () : base() { }
    3535    [StorableConstructor]
     
    4242    }
    4343
    44     public static PackingPlan<ThreeDimensionalPacking, CuboidPackingShape, CuboidPackingItem> Decode(MultiComponentVectorEncoding solution, CuboidPackingShape binMeasures, ItemList<CuboidPackingItem> itemMeasures, bool stackingConstraints) {
     44    public static PackingPlan<PackingPosition, CuboidPackingShape, CuboidPackingItem> Decode(MultiComponentVectorEncoding solution, CuboidPackingShape binMeasures, ItemList<CuboidPackingItem> itemMeasures, bool stackingConstraints) {
    4545      Solution result = new Solution(binMeasures, true, stackingConstraints);
    4646      result.Pack(solution, itemMeasures);
     
    4848    }
    4949
    50     public override PackingPlan<ThreeDimensionalPacking, CuboidPackingShape, CuboidPackingItem> CreatePackingPlanFromEncoding(IItem encodedSolution, CuboidPackingShape binMeasures, ItemList<CuboidPackingItem> itemMeasures) {
     50    public override PackingPlan<PackingPosition, CuboidPackingShape, CuboidPackingItem> CreatePackingPlanFromEncoding(IItem encodedSolution, CuboidPackingShape binMeasures, ItemList<CuboidPackingItem> itemMeasures) {
    5151      var solution = encodedSolution as MultiComponentVectorEncoding;
    5252      if (solution == null) throw new InvalidOperationException("Encoding is not of type MultiComponentVector");
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.3D/3.3/Decoders/EP/ExtremePointPackingSequenceDecoder3D.cs

    r14047 r14048  
    3232  [Item("Identical bin, three dimensional, extreme points based decoder for the PackingSequence encoding.", "<Description missing...>")]
    3333  [StorableClass]
    34   public class ExtremePointPackingSequenceDecoder3D : PackingSolutionDecoder<ThreeDimensionalPacking, CuboidPackingShape, CuboidPackingItem>, I3DPSDecoder {
     34  public class ExtremePointPackingSequenceDecoder3D : PackingSolutionDecoder<PackingPosition, CuboidPackingShape, CuboidPackingItem>, I3DPSDecoder {
    3535    public ExtremePointPackingSequenceDecoder3D () : base() {}
    3636    [StorableConstructor]
     
    4444
    4545
    46     public override PackingPlan<ThreeDimensionalPacking, CuboidPackingShape, CuboidPackingItem> CreatePackingPlanFromEncoding(IItem encodedSolution, CuboidPackingShape binMeasures, ItemList<CuboidPackingItem> itemMeasures) {
     46    public override PackingPlan<PackingPosition, CuboidPackingShape, CuboidPackingItem> CreatePackingPlanFromEncoding(IItem encodedSolution, CuboidPackingShape binMeasures, ItemList<CuboidPackingItem> itemMeasures) {
    4747      var solution = encodedSolution as PackingSequenceEncoding;
    4848      if (solution == null) throw new InvalidOperationException("Encoding is not of type PackingSequence");
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.3D/3.3/HeuristicLab.Problems.BinPacking3D-3.3.csproj

    r14047 r14048  
    175175    <Compile Include="MoveEvaluators\PackingMoveEvaluator3DMCV.cs" />
    176176    <Compile Include="MoveEvaluators\PackingMoveEvaluator3DPS.cs" />
     177    <Compile Include="PackingPosition.cs" />
    177178    <Compile Include="PackingRatioCuboidIdenticalBinEvaluator.cs" />
    178179    <Compile Include="Plugin.cs" />
    179180    <Compile Include="Properties\AssemblyInfo.cs" />
    180181    <Compile Include="Solution.cs" />
    181     <Compile Include="ThreeDimensionalPacking.cs" />
    182182  </ItemGroup>
    183183  <ItemGroup>
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.3D/3.3/MoveEvaluators/PackingMoveEvaluator3DGV.cs

    r14046 r14048  
    3030  [Item("GroupingVectorMoveEvaluator3D", "Class for evaluating packing moves for 3dimensional problems.")]
    3131  [StorableClass]
    32   public class PackingMoveEvaluator3DGV : PackingMoveEvaluator<ThreeDimensionalPacking, CuboidPackingShape, CuboidPackingItem>, ISingleObjectiveMoveEvaluator, IGroupingVectorMoveOperator, I3DOperator {
     32  public class PackingMoveEvaluator3DGV : PackingMoveEvaluator<PackingPosition, CuboidPackingShape, CuboidPackingItem>, ISingleObjectiveMoveEvaluator, IGroupingVectorMoveOperator, I3DOperator {
    3333    [StorableConstructor]
    3434    protected PackingMoveEvaluator3DGV(bool deserializing) : base(deserializing) { }
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.3D/3.3/MoveEvaluators/PackingMoveEvaluator3DMCV.cs

    r14046 r14048  
    3030  [Item("MultiComponentVectorMoveEvaluator3D", "Class for evaluating packing moves for 3dimensional problems.")]
    3131  [StorableClass]
    32   public class PackingMoveEvaluator3DMCV : PackingMoveEvaluator<ThreeDimensionalPacking, CuboidPackingShape, CuboidPackingItem>, ISingleObjectiveMoveEvaluator, IMultiComponentVectorMoveOperator, I3DOperator {
     32  public class PackingMoveEvaluator3DMCV : PackingMoveEvaluator<PackingPosition, CuboidPackingShape, CuboidPackingItem>, ISingleObjectiveMoveEvaluator, IMultiComponentVectorMoveOperator, I3DOperator {
    3333    [StorableConstructor]
    3434    protected PackingMoveEvaluator3DMCV(bool deserializing) : base(deserializing) { }
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.3D/3.3/MoveEvaluators/PackingMoveEvaluator3DPS.cs

    r14046 r14048  
    3030  [Item("PackingSequenceMoveEvaluator3D", "Class for evaluating packing moves for 3dimensional problems.")]
    3131  [StorableClass]
    32   public class PackingMoveEvaluator3DPS : PackingMoveEvaluator<ThreeDimensionalPacking, CuboidPackingShape, CuboidPackingItem>, ISingleObjectiveMoveEvaluator, IPackingSequenceMoveOperator, I3DOperator {
     32  public class PackingMoveEvaluator3DPS : PackingMoveEvaluator<PackingPosition, CuboidPackingShape, CuboidPackingItem>, ISingleObjectiveMoveEvaluator, IPackingSequenceMoveOperator, I3DOperator {
    3333    [StorableConstructor]
    3434    protected PackingMoveEvaluator3DPS(bool deserializing) : base(deserializing) { }
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.3D/3.3/PackingPosition.cs

    r14047 r14048  
    2424using HeuristicLab.Core;
    2525using HeuristicLab.Common;
    26 using HeuristicLab.Problems.BinPacking;
    2726
    2827namespace HeuristicLab.Problems.BinPacking3D {
    29   [Item("Three Dimensional Packing", "Represents a packing-position associated with a three dimensional packing-problem.")]
     28  [Item("Packing Position (3d)", "Represents a packing-position associated with a three dimensional packing-problem.")]
    3029  [StorableClass]
    31   // ThreeDimensionalPacking is immutable (and handled as value type concerning Equals and GetHashCode)
    32   public class ThreeDimensionalPacking : PackingDimensions {
     30  // PackingPosition is immutable (and handled as value type concerning Equals and GetHashCode)
     31  public class PackingPosition : BinPacking.PackingPosition {
    3332    [Storable]
    3433    private readonly int x;
     
    4342
    4443    [StorableConstructor]
    45     protected ThreeDimensionalPacking(bool deserializing) : base(deserializing) { }
    46     protected ThreeDimensionalPacking(ThreeDimensionalPacking original, Cloner cloner)
     44    protected PackingPosition(bool deserializing) : base(deserializing) { }
     45    protected PackingPosition(PackingPosition original, Cloner cloner)
    4746      : base(original, cloner) {
    4847      x = original.X;
     
    5150    }
    5251    public override IDeepCloneable Clone(Cloner cloner) {
    53       return new ThreeDimensionalPacking(this, cloner);
     52      return new PackingPosition(this, cloner);
    5453    }
    5554
    56     public ThreeDimensionalPacking(int assignedBin, int x, int y, int z, bool rotated = false)
     55    public PackingPosition(int assignedBin, int x, int y, int z, bool rotated = false)
    5756      : base(assignedBin, rotated) {
    5857      this.x = x;
     
    6766
    6867    public override bool Equals(object obj) {
    69       var tdp = obj as ThreeDimensionalPacking;
     68      var tdp = obj as PackingPosition;
    7069      if (tdp != null)
    7170        return (tdp.X == this.X && tdp.Y == this.Y && tdp.Z == this.Z);
     
    7776    }
    7877
    79     public static ThreeDimensionalPacking MoveLeft(ThreeDimensionalPacking original) {
    80       return new ThreeDimensionalPacking(original.AssignedBin, original.X - 1, original.Y, original.Z, original.Rotated);
     78    public static PackingPosition MoveLeft(PackingPosition original) {
     79      return new PackingPosition(original.AssignedBin, original.X - 1, original.Y, original.Z, original.Rotated);
    8180    }
    82     public static ThreeDimensionalPacking MoveDown(ThreeDimensionalPacking original) {
    83       return new ThreeDimensionalPacking(original.AssignedBin, original.X, original.Y - 1, original.Z, original.Rotated);
     81    public static PackingPosition MoveDown(PackingPosition original) {
     82      return new PackingPosition(original.AssignedBin, original.X, original.Y - 1, original.Z, original.Rotated);
    8483    }
    85     public static ThreeDimensionalPacking MoveBack(ThreeDimensionalPacking original) {
    86       return new ThreeDimensionalPacking(original.AssignedBin, original.X, original.Y, original.Z - 1, original.Rotated);
     84    public static PackingPosition MoveBack(PackingPosition original) {
     85      return new PackingPosition(original.AssignedBin, original.X, original.Y, original.Z - 1, original.Rotated);
    8786    }
    8887
    89     public static ThreeDimensionalPacking MoveRight(ThreeDimensionalPacking original) {
    90       return new ThreeDimensionalPacking(original.AssignedBin, original.X + 1, original.Y, original.Z, original.Rotated);
     88    public static PackingPosition MoveRight(PackingPosition original) {
     89      return new PackingPosition(original.AssignedBin, original.X + 1, original.Y, original.Z, original.Rotated);
    9190    }
    92     public static ThreeDimensionalPacking MoveUp(ThreeDimensionalPacking original) {
    93       return new ThreeDimensionalPacking(original.AssignedBin, original.X, original.Y + 1, original.Z, original.Rotated);
     91    public static PackingPosition MoveUp(PackingPosition original) {
     92      return new PackingPosition(original.AssignedBin, original.X, original.Y + 1, original.Z, original.Rotated);
    9493    }
    95     public static ThreeDimensionalPacking MoveFront(ThreeDimensionalPacking original) {
    96       return new ThreeDimensionalPacking(original.AssignedBin, original.X, original.Y, original.Z + 1, original.Rotated);
     94    public static PackingPosition MoveFront(PackingPosition original) {
     95      return new PackingPosition(original.AssignedBin, original.X, original.Y, original.Z + 1, original.Rotated);
    9796    }
    9897  }
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.3D/3.3/PackingRatioCuboidIdenticalBinEvaluator.cs

    r14046 r14048  
    2828  [Item("Packing-Ratio Cuboid Identical-Bin Evaluator", "Represents an evaluation-algorithm for cuboid-shaped bin-packing problems with identical bins which calculates the ratio between packed and unpacked space. Found in Falkenauer:1996")]
    2929  [StorableClass]
    30   public class PackingRatioCuboidIdenticalBinEvaluator : PackingRatioRegularIdenticalBinEvaluator<ThreeDimensionalPacking, CuboidPackingShape, CuboidPackingItem> {
     30  public class PackingRatioCuboidIdenticalBinEvaluator : PackingRatioRegularIdenticalBinEvaluator<PackingPosition, CuboidPackingShape, CuboidPackingItem> {
    3131
    3232    [StorableConstructor]
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.3D/3.3/Solution.cs

    r14047 r14048  
    77  [Item("Bin Packing Solution (3d)", "Represents a solution for a 3D bin packing problem.")]
    88  [StorableClass]
    9   public class Solution : PackingPlan<ThreeDimensionalPacking, CuboidPackingShape, CuboidPackingItem> {
     9  public class Solution : PackingPlan<PackingPosition, CuboidPackingShape, CuboidPackingItem> {
    1010    public Solution(CuboidPackingShape binMeasures) : this(binMeasures, false, false) { }
    1111    public Solution(CuboidPackingShape binMeasures, bool useExtremePoints, bool stackingConstraints) : base(binMeasures, useExtremePoints, stackingConstraints) { }
     
    1818      return new Solution(this, cloner);
    1919    }
    20     public override BinPacking<ThreeDimensionalPacking, CuboidPackingShape, CuboidPackingItem> NewBinPacking() {
     20    public override BinPacking<PackingPosition, CuboidPackingShape, CuboidPackingItem> NewBinPacking() {
    2121      return new BinPacking3D(BinMeasures);
    2222    }
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.Views/3.3/Container2DView.xaml.cs

    r14046 r14048  
    3333    private int selectedItemKey;
    3434    private Size renderSize;
    35     private BinPacking<TwoDimensionalPacking, RectangularPackingShape, RectangularPackingItem> packing;
    36     public BinPacking<TwoDimensionalPacking, RectangularPackingShape, RectangularPackingItem> Packing {
     35    private BinPacking<BinPacking2D.PackingPosition, RectangularPackingShape, RectangularPackingItem> packing;
     36    public BinPacking<BinPacking2D.PackingPosition, RectangularPackingShape, RectangularPackingItem> Packing {
    3737      get { return packing; }
    3838      set {
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.Views/3.3/Container3DView.xaml.cs

    r14046 r14048  
    3535    private int selectedItemKey;
    3636
    37     private BinPacking<ThreeDimensionalPacking, CuboidPackingShape, CuboidPackingItem> packing;
    38     public BinPacking<ThreeDimensionalPacking, CuboidPackingShape, CuboidPackingItem> Packing {
     37    private BinPacking<BinPacking3D.PackingPosition, CuboidPackingShape, CuboidPackingItem> packing;
     38    public BinPacking<BinPacking3D.PackingPosition, CuboidPackingShape, CuboidPackingItem> Packing {
    3939      get { return packing; }
    4040      set {
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.Views/3.3/PackingPlan2DView.cs

    r14046 r14048  
    2828namespace HeuristicLab.Problems.BinPacking.Views {
    2929  [View("2-dimensional packing plan view")]
    30   [Content(typeof(PackingPlan<TwoDimensionalPacking, RectangularPackingShape, RectangularPackingItem>), true)]
     30  [Content(typeof(PackingPlan<BinPacking2D.PackingPosition, RectangularPackingShape, RectangularPackingItem>), true)]
    3131  public partial class PackingPlan2DView : ItemView {
    3232
     
    3535    }
    3636
    37     public new PackingPlan<TwoDimensionalPacking, RectangularPackingShape, RectangularPackingItem> Content {
    38       get { return (PackingPlan<TwoDimensionalPacking, RectangularPackingShape, RectangularPackingItem>)base.Content; }
     37    public new PackingPlan<BinPacking2D.PackingPosition, RectangularPackingShape, RectangularPackingItem> Content {
     38      get { return (PackingPlan<BinPacking2D.PackingPosition, RectangularPackingShape, RectangularPackingItem>)base.Content; }
    3939      set { base.Content = value; }
    4040    }
     
    5656    }
    5757
    58     private void UpdateState(PackingPlan<TwoDimensionalPacking, RectangularPackingShape, RectangularPackingItem> plan) {
     58    private void UpdateState(PackingPlan<BinPacking2D.PackingPosition, RectangularPackingShape, RectangularPackingItem> plan) {
    5959      int currentBin = (binSelection != null && binSelection.SelectedItem != null) ? (int)(binSelection.SelectedItem) : 0;
    6060      container2DView.Packing = plan.BinPackings[currentBin];
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.Views/3.3/PackingPlan3DView.cs

    r14046 r14048  
    2828namespace HeuristicLab.Problems.BinPacking.Views {
    2929  [View("3-dimensional packing plan View")]
    30   [Content(typeof(PackingPlan<ThreeDimensionalPacking, CuboidPackingShape, CuboidPackingItem>), true)]
     30  [Content(typeof(PackingPlan<BinPacking3D.PackingPosition, CuboidPackingShape, CuboidPackingItem>), true)]
    3131  public partial class PackingPlan3DView : ItemView {
    3232
     
    3535    }
    3636
    37     public new PackingPlan<ThreeDimensionalPacking, CuboidPackingShape, CuboidPackingItem> Content {
    38       get { return (PackingPlan<ThreeDimensionalPacking, CuboidPackingShape, CuboidPackingItem>)base.Content; }
     37    public new PackingPlan<BinPacking3D.PackingPosition, CuboidPackingShape, CuboidPackingItem> Content {
     38      get { return (PackingPlan<BinPacking3D.PackingPosition, CuboidPackingShape, CuboidPackingItem>)base.Content; }
    3939      set { base.Content = value; }
    4040    }
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Analyzers/BestBinPackingSolutionAnalyzer.cs

    r14046 r14048  
    3434  [StorableClass]
    3535  public class BestBinPackingSolutionAnalyzer<D, B, I> : BinPackingAnalyzer<D, B, I>, IStochasticOperator
    36     where D : class, IPackingDimensions
     36    where D : class, IPackingPosition
    3737    where B : PackingShape<D>
    3838    where I : PackingShape<D>, IPackingItem {
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Analyzers/BinPackingAnalyzer.cs

    r14046 r14048  
    3333  [StorableClass]
    3434  public abstract class BinPackingAnalyzer<D, B, I> : SingleSuccessorOperator, IAnalyzer
    35     where D : class, IPackingDimensions
     35    where D : class, IPackingPosition
    3636    where B : PackingShape<D>
    3737    where I : PackingShape<D>, IPackingItem {
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/BinPackingProblem.cs

    r14046 r14048  
    3838  [StorableClass]
    3939  public abstract class BinPackingProblem<D, B, I> : SingleObjectiveHeuristicOptimizationProblem<IPackingPlanEvaluationAlgorithm, IPackingSolutionCreator>
    40     where D : class, IPackingDimensions
     40    where D : class, IPackingPosition
    4141    where B : PackingShape<D>, new()
    4242    where I : PackingShape<D>, IPackingItem, new () {
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Encodings/PackingPlans/BinPacking.cs

    r14046 r14048  
    3232  [StorableClass]
    3333  public abstract class BinPacking<D,B,I>  : Item
    34     where D : class, IPackingDimensions
     34    where D : class, IPackingPosition
    3535    where B : PackingShape<D>
    3636    where I : PackingShape<D>, IPackingItem {
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Encodings/PackingPlans/PackingPlan.cs

    r14046 r14048  
    3838  [StorableClass]
    3939  public abstract class PackingPlan<D, B, I> :Item, IPackingPlan
    40     where D : class, IPackingDimensions
     40    where D : class, IPackingPosition
    4141    where B : PackingShape<D>
    4242    where I : PackingShape<D>, IPackingItem {
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Evaluators/BinUtilizationRegularIdenticalBinEvaluator.cs

    r14046 r14048  
    3131  [StorableClass]
    3232  public abstract class BinUtilizationRegularIdenticalBinEvaluator<D, B, I> : RegularSimpleRotationIdenticalBinPackingPlanEvaluator<D, B, I>
    33     where D : class, IPackingDimensions
     33    where D : class, IPackingPosition
    3434    where B : PackingShape<D>
    3535    where I : PackingShape<D>, IPackingItem {
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Evaluators/PackingPlanEvaluationAlgorithm.cs

    r14046 r14048  
    3434  public class PackingPlanEvaluationAlgorithm<E, D, B, I> : SingleSuccessorOperator, IPackingPlanEvaluationAlgorithm
    3535    where E : Item //E defines the used Encoding
    36     where D : class, IPackingDimensions
     36    where D : class, IPackingPosition
    3737    where B : PackingShape<D>
    3838    where I : PackingShape<D>, IPackingItem {
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Evaluators/PackingPlanEvaluator.cs

    r14046 r14048  
    3333  [StorableClass]
    3434  public abstract class PackingPlanEvaluator<D,B,I> : SingleSuccessorOperator, IPackingPlanEvaluator
    35     where D : class, IPackingDimensions
     35    where D : class, IPackingPosition
    3636    where B : PackingShape<D>
    3737    where I : PackingShape<D>, IPackingItem {
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Evaluators/PackingRatioRegularIdenticalBinEvaluator.cs

    r14046 r14048  
    3131  [StorableClass]
    3232  public abstract class PackingRatioRegularIdenticalBinEvaluator<D, B, I> : RegularSimpleRotationIdenticalBinPackingPlanEvaluator<D, B, I>
    33     where D : class, IPackingDimensions
     33    where D : class, IPackingPosition
    3434    where B : PackingShape<D>
    3535    where I : PackingShape<D>, IPackingItem {
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Evaluators/RegularSimpleRotationIdenticalBinPackingPlanEvaluator.cs

    r14046 r14048  
    3030  [StorableClass]
    3131  public abstract class RegularSimpleRotationIdenticalBinPackingPlanEvaluator<D, B, I> : PackingPlanEvaluator<D, B, I>
    32     where D : class, IPackingDimensions
     32    where D : class, IPackingPosition
    3333    where B : PackingShape<D>
    3434    where I : PackingShape<D>, IPackingItem {
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/HeuristicLab.Problems.BinPacking-3.3.csproj

    r14045 r14048  
    262262    <Compile Include="Instances\BPPORLIBDataDescriptor.cs" />
    263263    <Compile Include="Instances\RealBPPData.cs" />
     264    <Compile Include="Interfaces\IPackingPosition.cs" />
    264265    <Compile Include="Interfaces\IPackingSequenceMoveOperator.cs" />
    265266    <Compile Include="Interfaces\IPackingMove.cs" />
     
    279280    <Compile Include="Interfaces\IPackingPlanEvaluator.cs" />
    280281    <Compile Include="Interfaces\IPackingShape.cs" />
    281     <Compile Include="Interfaces\IPackingDimensions.cs" />
    282282    <Compile Include="PackingDimensions.cs" />
    283283    <Compile Include="PackingMoveEvaluator.cs" />
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Interfaces/IPackingPosition.cs

    r14047 r14048  
    2323
    2424namespace HeuristicLab.Problems.BinPacking {
    25   // TODO: this interface should contain positions
    26   public interface IPackingDimensions : IItem {
     25 
     26  public interface IPackingPosition : IItem {
    2727    int AssignedBin { get; }
    2828    bool Rotated { get; }
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/PackingDimensions.cs

    r14046 r14048  
    2929  [StorableClass]
    3030  // PackingDimensions is immutable (and handled as value types concerning Equals and GetHashCode)
    31   public abstract class PackingDimensions : Item, IPackingDimensions {
     31  public abstract class PackingPosition : Item, IPackingPosition {
    3232    /// <summary>
    3333    /// The number of the bin to which the current item is assigned is stored in this variable. Counting starts at 0 !!!
     
    4949
    5050    [StorableConstructor]
    51     protected PackingDimensions(bool deserializing) : base(deserializing) { }
    52     protected PackingDimensions(PackingDimensions original, Cloner cloner)
     51    protected PackingPosition(bool deserializing) : base(deserializing) { }
     52    protected PackingPosition(PackingPosition original, Cloner cloner)
    5353      : base(original, cloner) {
    5454      assignedBin = original.AssignedBin;
     
    5656    }
    5757
    58     protected PackingDimensions(int assignedBin, bool rotated) {
     58    protected PackingPosition(int assignedBin, bool rotated) {
    5959      this.assignedBin = assignedBin;
    6060      this.rotated = rotated;
     
    6666
    6767    public override bool Equals(object obj) {
    68       var other = obj as PackingDimensions;
     68      var other = obj as PackingPosition;
    6969      if (other != null)
    7070        return (other.AssignedBin == this.AssignedBin && other.Rotated == this.Rotated);
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/PackingMoveEvaluator.cs

    r14046 r14048  
    3333  [StorableClass]
    3434  public abstract class PackingMoveEvaluator<D, B, I> : SingleSuccessorOperator, IPackingMoveEvaluator, IMoveOperator
    35     where D : class, IPackingDimensions
     35    where D : class, IPackingPosition
    3636    where B : PackingShape<D>
    3737    where I : PackingShape<D>, IPackingItem {     
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/PackingShape.cs

    r14046 r14048  
    3232  [StorableClass]
    3333  public abstract class PackingShape<T> : Item, IPackingShape, IParameterizedItem
    34     where T : class, IPackingDimensions {
     34    where T : class, IPackingPosition {
    3535    public static Type PositionType {
    3636      get { return typeof(T); }
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/PackingSolutionDecoder.cs

    r14046 r14048  
    3434  [StorableClass]
    3535  public abstract class PackingSolutionDecoder<D, B, I> : SingleSuccessorOperator, IPackingSolutionDecoder
    36     where D : class, IPackingDimensions
     36    where D : class, IPackingPosition
    3737    where B : PackingShape<D>
    3838    where I : PackingShape<D>, IPackingItem {
Note: See TracChangeset for help on using the changeset viewer.