Changeset 15844 for branches/2817-BinPackingSpeedup
- Timestamp:
- 03/16/18 13:09:14 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2817-BinPackingSpeedup/HeuristicLab.Problems.BinPacking/3.3/3D/Packer/BinPackerMinRSLeft.cs
r15838 r15844 95 95 } 96 96 97 97 98 98 99 99 /// <summary> … … 107 107 protected virtual void PackRemainingItems(ref IList<int> remainingIds, ref BinPacking3D packingBin, IList<PackingItem> items, ExtremePointCreationMethod epCreationMethod, bool useStackingConstraints) { 108 108 IExtremePointCreator extremePointCreator = ExtremePointCreatorFactory.CreateExtremePointCreator(epCreationMethod, useStackingConstraints); 109 109 110 110 var remainingNotWeightSupportedItems = new List<int>(); 111 111 foreach (var itemId in new List<int>(remainingIds)) { … … 118 118 // and try to find positions where they don't waste too much space. 119 119 // If there are no weight supporting items left the non supporting ones have to be treated as a supporting one. 120 if (item. SupportedWeight <= 0 && useStackingConstraints && remainingIds.Any(x => items[x].SupportedWeight > 0)) {120 if (item.IsStackabel && item.SupportedWeight <= 0 && useStackingConstraints && remainingIds.Any(x => items[x].SupportedWeight > 0)) { 121 121 remainingNotWeightSupportedItems.Add(itemId); 122 122 } else if (!item.IsStackabel) { … … 127 127 remainingIds.Remove(itemId); 128 128 } 129 } else 129 } else { 130 130 PackingPosition position = FindPackingPositionForItem(clonedPackingBin, item, useStackingConstraints); 131 131 // if a valid packing position could be found, the current item can be added to the given bin … … 203 203 } 204 204 } 205 var d = rsds.Where(x => packingBin.IsPositionFeasible(x.Item, x.Position, useStackingConstraints)).FirstOrDefault();205 var d = rsds.FirstOrDefault(x => packingBin.IsPositionFeasible(x.Item, x.Position, useStackingConstraints)); 206 206 207 207 if (d == null) { 208 208 return null; 209 209 } 210 210 211 211 packingItem.Rotated = orientation.Item2; 212 212 packingItem.Tilted = orientation.Item3; … … 255 255 $"Item: ({packingItem.Width} {packingItem.Depth} {packingItem.Height})"); 256 256 } 257 257 258 258 var rsds = CalculateResidalSpaceDifferences(packingBin, packingItem, useStackingConstraints).Where(x => x != null); 259 259 var rsd = rsds.FirstOrDefault(); … … 266 266 packingItem.Rotated = rsd.Item.Rotated; 267 267 packingItem.Tilted = rsd.Item.Tilted; 268 268 269 269 return rsd.Position; 270 270 } … … 319 319 } 320 320 } 321 return rsds.Where(rsd => packingBin.IsPositionFeasible(rsd.Item, rsd.Position, useStackingConstraints)).FirstOrDefault(); 321 322 // If the packer uses line projection it migth happen, that an extreme point right of the disired on will be chosen. 323 // To avoid this, if there is an extreme point on the rigth side available this point will be returned. 324 var possible = rsds.Where(rsd => packingBin.IsPositionFeasible(rsd.Item, rsd.Position, useStackingConstraints)); 325 var prevered = possible.FirstOrDefault(); 326 327 return possible.Where(x => x.Position.Z == prevered.Position.Z && x.Position.Y == prevered.Position.Y).OrderBy(x => x.Position.X).FirstOrDefault(); 322 328 } 323 329 … … 401 407 return 0; 402 408 } 409 410 public override string ToString() { 411 return string.Format("({1},{2},{3})", X, Y, Z); 412 } 403 413 } 404 414
Note: See TracChangeset
for help on using the changeset viewer.