Changeset 13612 for branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.2D/3.3/BinPacking2D.cs
- Timestamp:
- 02/08/16 21:38:13 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.2D/3.3/BinPacking2D.cs
r13606 r13612 37 37 public BinPacking2D(RectangularPackingBin binMeasures) 38 38 : base(binMeasures) { 39 //ExtremePoints = new HashSet<TwoDimensionalPacking>();40 39 ExtremePoints = new SortedSet<TwoDimensionalPacking>(new EPComparer2D()); 41 40 ExtremePoints.Add(binMeasures.Origin); … … 50 49 return new BinPacking2D(this, cloner); 51 50 } 52 51 53 52 protected override void GenerateNewExtremePointsForNewItem(RectangularPackingItem newItem, TwoDimensionalPacking position) { 54 53 … … 73 72 if (sourcePointY.X < BinMeasures.Width && sourcePointY.Y < BinMeasures.Height) { 74 73 //Traversing down the x-axis 75 while (sourcePointY.X > 0 && !IsPointOccupied(new TwoDimensionalPacking (0,sourcePointY.X - 1, sourcePointY.Y))) {74 while (sourcePointY.X > 0 && !IsPointOccupied(new TwoDimensionalPacking(0, sourcePointY.X - 1, sourcePointY.Y))) { 76 75 sourcePointY.X--; 77 76 } … … 111 110 || IsPositionFeasible(measures, TwoDimensionalPacking.MoveDown(currentPosition))) { 112 111 //Slide the item as far as possible to the bottom 113 114 115 } 116 112 while (IsPositionFeasible(measures, TwoDimensionalPacking.MoveDown(currentPosition))) { 113 currentPosition = TwoDimensionalPacking.MoveDown(currentPosition); 114 } 115 if (IsPositionFeasible(measures, TwoDimensionalPacking.MoveLeft(currentPosition))) 117 116 currentPosition = TwoDimensionalPacking.MoveLeft(currentPosition); 118 117 } … … 120 119 return IsPositionFeasible(measures, currentPosition) ? currentPosition : null; 121 120 } 122 121 123 122 public override void SlidingBasedPacking(ref List<int> sequence, ItemList<RectangularPackingItem> itemMeasures) { 124 123 var temp = new List<int>(sequence); … … 193 192 194 193 protected override void InitializeOccupationLayers() { 195 for (int i = 0; i *10 <= BinMeasures.Width; i += 1) {194 for (int i = 0; i * 10 <= BinMeasures.Width; i += 1) { 196 195 OccupationLayers[i] = new List<int>(); 197 196 } … … 207 206 return OccupationLayers[position.X / 10]; 208 207 } 209 protected override List<int> GetLayerItemIDs(RectangularPackingItem measures, TwoDimensionalPacking position) { 210 List<int> result = new List<int> 208 protected override List<int> GetLayerItemIDs(RectangularPackingItem measures, TwoDimensionalPacking position) { 209 List<int> result = new List<int>(); 211 210 int x1 = position.X / 10; 212 211 int x2 = (position.X + (position.Rotated ? measures.Height : measures.Width)) / 10;
Note: See TracChangeset
for help on using the changeset viewer.