Free cookie consent management tool by TermsFeed Policy Generator

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

#1966: renamed *PackingDimension -> PackingPosition

Location:
branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.2D/3.3
Files:
15 edited
1 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    }
Note: See TracChangeset for help on using the changeset viewer.