Changeset 15652
- Timestamp:
- 01/24/18 17:15:15 (7 years ago)
- Location:
- branches/2817-BinPackingSpeedup/HeuristicLab.Problems.BinPacking/3.3/3D
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2817-BinPackingSpeedup/HeuristicLab.Problems.BinPacking/3.3/3D/Encoding/ExtremePointPermutationDecoder.cs
r15617 r15652 102 102 var pruningMethod = ExtremePointPruningMethod.None; 103 103 Solution solution = new Solution(binShape, useExtremePoints: true, stackingConstraints: useStackingConstraints); 104 foreach (var packedBin in binPacker.PackItems(permutation, binShape, items, ExtremePointCreationMethod, pruningMethod, useStackingConstraints)) { 104 105 IList<BinPacking3D> packingList = binPacker.PackItems(permutation, binShape, items, ExtremePointCreationMethod, pruningMethod, useStackingConstraints); 106 foreach (var packedBin in packingList) { 105 107 solution.Bins.Add(packedBin); 106 108 } 107 109 return solution; 108 110 } 111 112 Permutation AddOffset(Permutation p, int offset) { 113 var s = p.ToArray(); 114 for (int i = 0; i < s.Length; i++) { 115 s[i] += offset; 116 } 117 118 return new Permutation(PermutationTypes.Absolute, s); 119 } 109 120 } 110 121 } -
branches/2817-BinPackingSpeedup/HeuristicLab.Problems.BinPacking/3.3/3D/Packer/BinPacker.cs
r15617 r15652 59 59 /// <returns>Returns a collection of bin packing 3d objects. Each object represents a bin and the packed items</returns> 60 60 public abstract IList<BinPacking3D> PackItems(Permutation sortedItems, PackingShape binShape, IList<PackingItem> items, ExtremePointCreationMethod epCreationMethod, ExtremePointPruningMethod epPruningMethod, bool useStackingConstraints); 61 61 62 63 64 public abstract void PackItemsToPackingList(IList<BinPacking3D> packingList, Permutation sortedItems, PackingShape binShape, IList<PackingItem> items, ExtremePointCreationMethod epCreationMethod, ExtremePointPruningMethod epPruningMethod, bool useStackingConstraints); 65 62 66 /// <summary> 63 67 /// Pack a given item into a given bin and updates the residual space and the extreme points -
branches/2817-BinPackingSpeedup/HeuristicLab.Problems.BinPacking/3.3/3D/Packer/BinPackerFirstFit.cs
r15617 r15652 86 86 } 87 87 } 88 89 public override void PackItemsToPackingList(IList<BinPacking3D> packingList, Permutation sortedItems, PackingShape binShape, IList<PackingItem> items, ExtremePointCreationMethod epCreationMethod, ExtremePointPruningMethod epPruningMethod, bool useStackingConstraints) { 90 throw new NotImplementedException(); 91 } 88 92 } 89 93 } -
branches/2817-BinPackingSpeedup/HeuristicLab.Problems.BinPacking/3.3/3D/Packer/BinPackerFreeVolumeBestFit.cs
r15617 r15652 98 98 return packingList.ToList(); 99 99 } 100 101 public override void PackItemsToPackingList(IList<BinPacking3D> packingList, Permutation sortedItems, PackingShape binShape, IList<PackingItem> items, ExtremePointCreationMethod epCreationMethod, ExtremePointPruningMethod epPruningMethod, bool useStackingConstraints) { 102 throw new NotImplementedException(); 103 } 100 104 } 101 105 } -
branches/2817-BinPackingSpeedup/HeuristicLab.Problems.BinPacking/3.3/3D/Packer/BinPackerMinRSLeft.cs
r15646 r15652 73 73 } 74 74 75 76 public override void PackItemsToPackingList(IList<BinPacking3D> packingList, Permutation sortedItems, PackingShape binShape, IList<PackingItem> items, ExtremePointCreationMethod epCreationMethod, ExtremePointPruningMethod epPruningMethod, bool useStackingConstraints) { 77 var workingItems = CloneItems(items); 78 IList<int> remainingIds = new List<int>(sortedItems); 79 80 try { 81 if (packingList.Count > 0) { 82 BinPacking3D packingBin = packingList.Last(); 83 PackRemainingItems(ref remainingIds, ref packingBin, workingItems, epCreationMethod, useStackingConstraints); 84 } 85 86 while (remainingIds.Count > 0) { 87 BinPacking3D packingBin = new BinPacking3D(binShape); 88 PackRemainingItems(ref remainingIds, ref packingBin, workingItems, epCreationMethod, useStackingConstraints); 89 packingList.Add(packingBin); 90 } 91 } catch (BinPacking3DException e) { 92 } 93 94 ExtremePointPruningFactory.CreatePruning().PruneExtremePoints(epPruningMethod, packingList); 95 } 96 75 97 /// <summary> 76 98 /// Tries to pack the remainig items into a given BinPacking3D object. Each item could be packed into the BinPacking3D object will be removed from the list of remaining ids … … 248 270 } 249 271 272 250 273 protected class ResidualSpaceDifference : IComparable { 251 274 public static ResidualSpaceDifference Create(PackingPosition position, PackingItem item, ResidualSpace rs) { -
branches/2817-BinPackingSpeedup/HeuristicLab.Problems.BinPacking/3.3/3D/Packer/BinPackerResidualSpaceBestFit.cs
r15617 r15652 127 127 (rs.Depth - item.Depth)); 128 128 } 129 130 public override void PackItemsToPackingList(IList<BinPacking3D> packingList, Permutation sortedItems, PackingShape binShape, IList<PackingItem> items, ExtremePointCreationMethod epCreationMethod, ExtremePointPruningMethod epPruningMethod, bool useStackingConstraints) { 131 throw new NotImplementedException(); 132 } 129 133 } 130 134 } -
branches/2817-BinPackingSpeedup/HeuristicLab.Problems.BinPacking/3.3/3D/Packer/IBinPacker.cs
r15617 r15652 39 39 IList<BinPacking3D> PackItems(Permutation sortedItems, PackingShape binShape, IList<PackingItem> items, ExtremePointCreationMethod epCreationMethod, ExtremePointPruningMethod epPruningMethod, bool useStackingConstraints); 40 40 41 42 /// <summary> 43 /// Packs all items of the bin packer into a collection of BinPacking3D objects 44 /// </summary> 45 /// <param name="packingList">Packing list which will be filled by the packer.</param> 46 /// <param name="sortedItems">Permutation of items sorted by a sorting method. The value of each permutation index references to the index of the items list</param> 47 /// <param name="binShape">Bin for storing the items</param> 48 /// <param name="items">A list of packing items which should be assigned to a bin</param> 49 /// <param name="useStackingConstraints">Flag for using stacking constraints</param> 50 /// <param name="epPruningMethod"></param> 51 void PackItemsToPackingList(IList<BinPacking3D> packingList ,Permutation sortedItems, PackingShape binShape, IList<PackingItem> items, ExtremePointCreationMethod epCreationMethod, ExtremePointPruningMethod epPruningMethod, bool useStackingConstraints); 52 53 54 41 55 } 42 56 }
Note: See TracChangeset
for help on using the changeset viewer.