Changeset 15230 for trunk/sources/HeuristicLab.Problems.BinPacking
- Timestamp:
- 07/13/17 15:25:11 (7 years ago)
- Location:
- trunk/sources/HeuristicLab.Problems.BinPacking
- Files:
-
- 11 edited
- 8 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.BinPacking
-
Property
svn:mergeinfo
set to
/branches/BinPackingExtension/HeuristicLab.Problems.BinPacking merged eligible
-
Property
svn:mergeinfo
set to
-
trunk/sources/HeuristicLab.Problems.BinPacking/3.3/2D/BinPacking2D.cs
r14916 r15230 88 88 }; 89 89 90 int epIndex = 0; 91 while (epIndex < ExtremePoints.Count && (!IsPositionFeasible(rotatedItem, ExtremePoints.ElementAt(epIndex)))) { epIndex++; } 92 93 if (epIndex < ExtremePoints.Count) { 94 var currentPoint = ExtremePoints.ElementAt(epIndex); 95 96 var result = new PackingPosition(currentPoint.AssignedBin, currentPoint.X, currentPoint.Y, rotated); 90 var ep = ExtremePoints.Where(x => IsPositionFeasible(rotatedItem, x, stackingConstraints)).FirstOrDefault(); 91 if (ep != null) { 92 var result = new PackingPosition(ep.AssignedBin, ep.X, ep.Y, rotated); 97 93 return result; 98 94 } 99 95 return null; 100 96 } 101 public override PackingPosition FindPositionBySliding(PackingItem item, bool rotated ) {97 public override PackingPosition FindPositionBySliding(PackingItem item, bool rotated, bool stackingConstraints) { 102 98 PackingPosition currentPosition = new PackingPosition(0, 103 99 BinShape.Width - (rotated ? item.Height : item.Width), 104 100 BinShape.Height - (rotated ? item.Width : item.Height), rotated); 105 101 //Slide the item as far as possible to the left 106 while (IsPositionFeasible(item, PackingPosition.MoveLeft(currentPosition) )107 || IsPositionFeasible(item, PackingPosition.MoveDown(currentPosition) )) {102 while (IsPositionFeasible(item, PackingPosition.MoveLeft(currentPosition), stackingConstraints) 103 || IsPositionFeasible(item, PackingPosition.MoveDown(currentPosition), stackingConstraints)) { 108 104 //Slide the item as far as possible to the bottom 109 while (IsPositionFeasible(item, PackingPosition.MoveDown(currentPosition) )) {105 while (IsPositionFeasible(item, PackingPosition.MoveDown(currentPosition), stackingConstraints)) { 110 106 currentPosition = PackingPosition.MoveDown(currentPosition); 111 107 } 112 if (IsPositionFeasible(item, PackingPosition.MoveLeft(currentPosition) ))108 if (IsPositionFeasible(item, PackingPosition.MoveLeft(currentPosition), stackingConstraints)) 113 109 currentPosition = PackingPosition.MoveLeft(currentPosition); 114 110 } 115 111 116 return IsPositionFeasible(item, currentPosition ) ? currentPosition : null;117 } 118 119 public override void SlidingBasedPacking(ref IList<int> sequence, IList<PackingItem> items ) {112 return IsPositionFeasible(item, currentPosition, stackingConstraints) ? currentPosition : null; 113 } 114 115 public override void SlidingBasedPacking(ref IList<int> sequence, IList<PackingItem> items, bool stackingConstraints) { 120 116 var temp = new List<int>(sequence); 121 117 for (int i = 0; i < temp.Count; i++) { 122 118 var item = items[temp[i]]; 123 var position = FindPositionBySliding(item, false );119 var position = FindPositionBySliding(item, false, stackingConstraints); 124 120 if (position != null) { 125 121 PackItem(temp[i], item, position); … … 128 124 } 129 125 } 130 public override void SlidingBasedPacking(ref IList<int> sequence, IList<PackingItem> items, Dictionary<int, bool> rotationArray ) {126 public override void SlidingBasedPacking(ref IList<int> sequence, IList<PackingItem> items, Dictionary<int, bool> rotationArray, bool stackingConstraints) { 131 127 var temp = new List<int>(sequence); 132 128 for (int i = 0; i < temp.Count; i++) { 133 129 var item = items[temp[i]]; 134 var position = FindPositionBySliding(item, rotationArray[temp[i]] );130 var position = FindPositionBySliding(item, rotationArray[temp[i]], stackingConstraints); 135 131 if (position != null) { 136 132 PackItem(temp[i], item, position); … … 150 146 } 151 147 } 148 152 149 public override void ExtremePointBasedPacking(ref IList<int> sequence, IList<PackingItem> items, bool stackingConstraints, Dictionary<int, bool> rotationArray) { 153 150 var temp = new List<int>(sequence); … … 186 183 throw new NotSupportedException(); 187 184 } 188 189 185 protected override void InitializeOccupationLayers() { 190 186 for (int i = 0; i * 10 <= BinShape.Width; i += 1) { -
trunk/sources/HeuristicLab.Problems.BinPacking/3.3/2D/IntegerVectorEncoding/BottomLeftIntegerVectorDecoder.cs
r14167 r15230 47 47 48 48 protected override PackingPosition FindPositionForItem(BinPacking2D bp, PackingItem item) { 49 return bp.FindPositionBySliding(item, rotated: false );49 return bp.FindPositionBySliding(item, rotated: false, stackingConstraints: false); 50 50 } 51 51 … … 54 54 ref IList<int> remainingIDs, IList<PackingItem> items) { 55 55 var bp = new BinPacking2D(partialSolution.BinShape); 56 bp.SlidingBasedPacking(ref remainingIDs, items );56 bp.SlidingBasedPacking(ref remainingIDs, items, stackingConstraints: false); 57 57 return bp; 58 58 } -
trunk/sources/HeuristicLab.Problems.BinPacking/3.3/2D/PermutationEncoding/BottomLeftPermutationDecoder.cs
r14167 r15230 46 46 while (remainingIDs.Count > 0) { 47 47 var bp = new BinPacking2D(binShape); 48 bp.SlidingBasedPacking(ref remainingIDs, items );48 bp.SlidingBasedPacking(ref remainingIDs, items, stackingConstraints: false); 49 49 result.Bins.Add(bp); 50 50 } -
trunk/sources/HeuristicLab.Problems.BinPacking/3.3/3D/BinPacking3D.cs
r14916 r15230 20 20 #endregion 21 21 22 using System; 22 23 using System.Collections.Generic; 23 24 using System.Linq; … … 35 36 : base(binShape) { 36 37 ExtremePoints = new SortedSet<PackingPosition>(); 37 ExtremePoints.Add(binShape.Origin); 38 ResidualSpace = new Dictionary<PackingPosition, Tuple<int,int,int>>(); 39 AddExtremePoint(binShape.Origin); 38 40 InitializeOccupationLayers(); 39 41 } … … 43 45 : base(original, cloner) { 44 46 this.ExtremePoints = new SortedSet<PackingPosition>(original.ExtremePoints.Select(p => cloner.Clone(p))); 47 this.ResidualSpace = new Dictionary<PackingPosition, Tuple<int, int, int>>(); 48 foreach (var o in original.ResidualSpace) 49 this.ResidualSpace.Add(cloner.Clone(o.Key), Tuple.Create(o.Value.Item1, o.Value.Item2, o.Value.Item3)); 45 50 } 46 51 public override IDeepCloneable Clone(Cloner cloner) { … … 60 65 current = PackingPosition.MoveDown(current); 61 66 } 62 ExtremePoints.Add((PackingPosition)current.Clone());67 AddExtremePoint((PackingPosition)current.Clone()); 63 68 while (current.X > 0 && !IsPointOccupied(PackingPosition.MoveLeft(current))) { 64 69 current = PackingPosition.MoveLeft(current); 65 70 } 66 ExtremePoints.Add(current);71 AddExtremePoint(current); 67 72 68 73 //Traversing down the z-axis … … 71 76 current = PackingPosition.MoveBack(current); 72 77 } 73 ExtremePoints.Add((PackingPosition)current.Clone());74 while (current.Y > 0 && !IsPointOccupied(PackingPosition.MoveDown(current))) { 75 current = PackingPosition.MoveDown(current); 76 } 77 ExtremePoints.Add(current);78 AddExtremePoint((PackingPosition)current.Clone()); 79 while (current.Y > 0 && !IsPointOccupied(PackingPosition.MoveDown(current))) { 80 current = PackingPosition.MoveDown(current); 81 } 82 AddExtremePoint(current); 78 83 } 79 84 … … 86 91 current = PackingPosition.MoveLeft(current); 87 92 } 88 ExtremePoints.Add((PackingPosition)current.Clone());89 while (current.Y > 0 && !IsPointOccupied(PackingPosition.MoveDown(current))) { 90 current = PackingPosition.MoveDown(current); 91 } 92 ExtremePoints.Add(current);93 AddExtremePoint((PackingPosition)current.Clone()); 94 while (current.Y > 0 && !IsPointOccupied(PackingPosition.MoveDown(current))) { 95 current = PackingPosition.MoveDown(current); 96 } 97 AddExtremePoint(current); 93 98 94 99 //Traversing down the z-axis … … 97 102 current = PackingPosition.MoveBack(current); 98 103 } 99 ExtremePoints.Add((PackingPosition)current.Clone());100 while (current.Y > 0 && !IsPointOccupied(PackingPosition.MoveDown(current))) { 101 current = PackingPosition.MoveDown(current); 102 } 103 ExtremePoints.Add(current);104 AddExtremePoint((PackingPosition)current.Clone()); 105 while (current.Y > 0 && !IsPointOccupied(PackingPosition.MoveDown(current))) { 106 current = PackingPosition.MoveDown(current); 107 } 108 AddExtremePoint(current); 104 109 } 105 110 … … 112 117 current = PackingPosition.MoveLeft(current); 113 118 } 114 ExtremePoints.Add((PackingPosition)current.Clone());115 while (current.Y > 0 && !IsPointOccupied(PackingPosition.MoveDown(current))) { 116 current = PackingPosition.MoveDown(current); 117 } 118 ExtremePoints.Add(current);119 AddExtremePoint((PackingPosition)current.Clone()); 120 while (current.Y > 0 && !IsPointOccupied(PackingPosition.MoveDown(current))) { 121 current = PackingPosition.MoveDown(current); 122 } 123 AddExtremePoint(current); 119 124 120 125 //Traversing down the y-axis … … 123 128 current = PackingPosition.MoveDown(current); 124 129 } 125 ExtremePoints.Add((PackingPosition)current.Clone());130 AddExtremePoint((PackingPosition)current.Clone()); 126 131 while (current.X > 0 && !IsPointOccupied(PackingPosition.MoveLeft(current))) { 127 132 current = PackingPosition.MoveLeft(current); 128 133 } 129 ExtremePoints.Add(current); 134 AddExtremePoint(current); 135 } 136 } 137 138 private void AddExtremePoint(PackingPosition current) { 139 if (ExtremePoints.Add(current)) { 140 var tuple = Tuple.Create(BinShape.Width - current.X, BinShape.Height - current.Y, BinShape.Depth - current.Z); 141 ResidualSpace.Add(current, tuple); 130 142 } 131 143 } 132 144 133 145 public override PackingPosition FindExtremePointForItem(PackingItem item, bool rotated, bool stackingConstraints) { 134 135 146 PackingItem newItem = new PackingItem( 136 147 rotated ? item.Depth : item.Width, … … 139 150 item.TargetBin, item.Weight, item.Material); 140 151 141 int epIndex = 0; 142 while (epIndex < ExtremePoints.Count && ( 143 !IsPositionFeasible(newItem, ExtremePoints.ElementAt(epIndex)) 144 || !IsSupportedByAtLeastOnePoint(newItem, ExtremePoints.ElementAt(epIndex)) 145 || (stackingConstraints && !IsStaticStable(newItem, ExtremePoints.ElementAt(epIndex))) 146 || (stackingConstraints && !IsWeightSupported(newItem, ExtremePoints.ElementAt(epIndex))) 147 )) { epIndex++; } 148 149 if (epIndex < ExtremePoints.Count) { 150 var origPoint = ExtremePoints.ElementAt(epIndex); 151 var result = new PackingPosition(origPoint.AssignedBin, origPoint.X, origPoint.Y, origPoint.Z, rotated); 152 var ep = ExtremePoints.Where(x => IsPositionFeasible(newItem, x, stackingConstraints)).FirstOrDefault(); 153 if (ep != null) { 154 var result = new PackingPosition(ep.AssignedBin, ep.X, ep.Y, ep.Z, rotated); 152 155 return result; 153 156 } … … 155 158 } 156 159 157 public override PackingPosition FindPositionBySliding(PackingItem item, bool rotated) { 158 //TODO: does not support stacking constraints yet 160 public override bool IsPositionFeasible(PackingItem item, PackingPosition position, bool stackingConstraints) { 161 var feasible = base.IsPositionFeasible(item, position, stackingConstraints); 162 return feasible 163 && IsSupportedByAtLeastOnePoint(item, position) 164 && (!stackingConstraints || (IsStaticStable(item, position) && IsWeightSupported(item, position))); 165 } 166 167 public override PackingPosition FindPositionBySliding(PackingItem item, bool rotated, bool stackingConstraints) { 159 168 //Starting-position at upper right corner (=left bottom point of item-rectangle is at position item.width,item.height) 160 169 PackingPosition currentPosition = new PackingPosition(0, … … 163 172 BinShape.Depth - (rotated ? item.Width : item.Depth), rotated); 164 173 //Slide the item as far as possible to the bottom 165 while (IsPositionFeasible(item, PackingPosition.MoveDown(currentPosition) )166 || IsPositionFeasible(item, PackingPosition.MoveLeft(currentPosition) )167 || IsPositionFeasible(item, PackingPosition.MoveBack(currentPosition) )) {174 while (IsPositionFeasible(item, PackingPosition.MoveDown(currentPosition), stackingConstraints) 175 || IsPositionFeasible(item, PackingPosition.MoveLeft(currentPosition), stackingConstraints) 176 || IsPositionFeasible(item, PackingPosition.MoveBack(currentPosition), stackingConstraints)) { 168 177 //Slide the item as far as possible to the left 169 while (IsPositionFeasible(item, PackingPosition.MoveLeft(currentPosition) )170 || IsPositionFeasible(item, PackingPosition.MoveBack(currentPosition) )) {178 while (IsPositionFeasible(item, PackingPosition.MoveLeft(currentPosition), stackingConstraints) 179 || IsPositionFeasible(item, PackingPosition.MoveBack(currentPosition), stackingConstraints)) { 171 180 //Slide the item as far as possible to the back 172 while (IsPositionFeasible(item, PackingPosition.MoveBack(currentPosition) )) {181 while (IsPositionFeasible(item, PackingPosition.MoveBack(currentPosition), stackingConstraints)) { 173 182 currentPosition = PackingPosition.MoveBack(currentPosition); 174 183 } 175 if (IsPositionFeasible(item, PackingPosition.MoveLeft(currentPosition) ))184 if (IsPositionFeasible(item, PackingPosition.MoveLeft(currentPosition), stackingConstraints)) 176 185 currentPosition = PackingPosition.MoveLeft(currentPosition); 177 186 } 178 if (IsPositionFeasible(item, PackingPosition.MoveDown(currentPosition) ))187 if (IsPositionFeasible(item, PackingPosition.MoveDown(currentPosition), stackingConstraints)) 179 188 currentPosition = PackingPosition.MoveDown(currentPosition); 180 189 } 181 190 182 return IsPositionFeasible(item, currentPosition ) ? currentPosition : null;183 } 184 185 public override void SlidingBasedPacking(ref IList<int> sequence, IList<PackingItem> items ) {191 return IsPositionFeasible(item, currentPosition, stackingConstraints) ? currentPosition : null; 192 } 193 194 public override void SlidingBasedPacking(ref IList<int> sequence, IList<PackingItem> items, bool stackingConstraints) { 186 195 var temp = new List<int>(sequence); 187 196 for (int i = 0; i < temp.Count; i++) { 188 197 var item = items[temp[i]]; 189 var position = FindPositionBySliding(item, false );198 var position = FindPositionBySliding(item, false, stackingConstraints); 190 199 if (position != null) { 191 200 PackItem(temp[i], item, position); … … 194 203 } 195 204 } 196 public override void SlidingBasedPacking(ref IList<int> sequence, IList<PackingItem> items, Dictionary<int, bool> rotationArray ) {205 public override void SlidingBasedPacking(ref IList<int> sequence, IList<PackingItem> items, Dictionary<int, bool> rotationArray, bool stackingConstraints) { 197 206 var temp = new List<int>(sequence); 198 207 for (int i = 0; i < temp.Count; i++) { 199 208 var item = items[temp[i]]; 200 var position = FindPositionBySliding(item, rotationArray[i] );209 var position = FindPositionBySliding(item, rotationArray[i], stackingConstraints); 201 210 if (position != null) { 202 211 PackItem(temp[i], item, position); … … 212 221 if (positionFound != null) { 213 222 PackItem(itemID, item, positionFound); 223 if (!(positionFound.X == 0 && positionFound.Y == 0 && positionFound.Z == 0)) { 224 UpdateResidualSpace(item, positionFound); 225 } 214 226 sequence.Remove(itemID); 215 227 } … … 227 239 } 228 240 } 229 230 241 public override int ShortestPossibleSideFromPoint(PackingPosition position) { 231 242 … … 297 308 } 298 309 299 300 310 protected override void InitializeOccupationLayers() { 301 311 for (int i = 0; i * 10 <= BinShape.Depth; i += 1) { … … 320 330 for (int i = z1; i <= z2; i++) 321 331 result.AddRange(OccupationLayers[i]); 322 323 332 return result; 324 333 } 334 335 public void UpdateResidualSpace(PackingItem item, PackingPosition pos) { 336 foreach (var ep in ExtremePoints) { 337 if (ep.Z >= pos.Z && ep.Z <= pos.Z + item.Depth) { 338 if (ep.X <= pos.X && ep.Y > pos.Y && ep.Y < pos.Y + item.Height) { 339 var diff = pos.X - ep.X; 340 var newRSX = ResidualSpace[ep].Item1 < diff ? ResidualSpace[ep].Item1 : diff; 341 ResidualSpace[ep] = Tuple.Create(newRSX, ResidualSpace[ep].Item2, ResidualSpace[ep].Item3); 342 } 343 if (ep.Y <= pos.Y && ep.X > pos.X && ep.X < pos.X + item.Width) { 344 var diff = pos.Y - ep.Y; 345 var newRSY = ResidualSpace[ep].Item2 < diff ? ResidualSpace[ep].Item2 : diff; 346 ResidualSpace[ep] = Tuple.Create(ResidualSpace[ep].Item1, newRSY, ResidualSpace[ep].Item3); 347 } 348 } 349 if (ep.Z <= pos.Z && 350 ep.Y > pos.Y && ep.Y < pos.Y + item.Height && 351 ep.X > pos.X && ep.X < pos.X + item.Width) { 352 var diff = pos.Z - ep.Z; 353 var newRSZ = ResidualSpace[ep].Item3 < diff ? ResidualSpace[ep].Item3 : diff; 354 ResidualSpace[ep] = Tuple.Create(ResidualSpace[ep].Item1, ResidualSpace[ep].Item2, newRSZ); 355 } 356 } 357 return; 358 } 325 359 } 326 327 360 } -
trunk/sources/HeuristicLab.Problems.BinPacking/3.3/3D/IntegerVectorEncoding/BottomLeftIntegerVectorDecoder.cs
r14167 r15230 54 54 55 55 protected override PackingPosition FindPositionForItem(BinPacking3D bp, PackingItem item, bool useStackingConstraints) { 56 return bp.FindPositionBySliding(item, rotated: false );56 return bp.FindPositionBySliding(item, rotated: false, stackingConstraints: useStackingConstraints); 57 57 } 58 58 … … 61 61 ref IList<int> remainingIDs, IList<PackingItem> items, bool useStackingConstraints) { 62 62 var bp = new BinPacking3D(partialSolution.BinShape); 63 bp.SlidingBasedPacking(ref remainingIDs, items );63 bp.SlidingBasedPacking(ref remainingIDs, items, useStackingConstraints); 64 64 return bp; 65 65 } -
trunk/sources/HeuristicLab.Problems.BinPacking/3.3/3D/PermutationEncoding/BottomLeftPermutationDecoder.cs
r14167 r15230 46 46 while (remainingIDs.Count > 0) { 47 47 var bp = new BinPacking3D(binShape); 48 bp.SlidingBasedPacking(ref remainingIDs, items );48 bp.SlidingBasedPacking(ref remainingIDs, items, useStackingConstraints); 49 49 result.Bins.Add(bp); 50 50 } -
trunk/sources/HeuristicLab.Problems.BinPacking/3.3/3D/PermutationEncoding/ExtremePointPermutationDecoder.cs
r14167 r15230 20 20 #endregion 21 21 22 using System; 22 23 using HeuristicLab.Core; 23 24 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; … … 25 26 using System.Collections.Generic; 26 27 using HeuristicLab.Encodings.PermutationEncoding; 28 using System.Linq; 29 27 30 28 31 namespace HeuristicLab.Problems.BinPacking3D { 29 32 [Item("Extreme-point Permutation Decoder (3d)", "Decodes the permutation and creates a packing solution candidate")] 30 33 [StorableClass] 31 public class ExtremePointPermutationDecoder : Item, IDecoder<Permutation>{34 public class ExtremePointPermutationDecoder : ExtremePointPermutationDecoderBase { 32 35 33 36 [StorableConstructor] … … 41 44 } 42 45 43 public Solution Decode(Permutation permutation, PackingShape binShape, IList<PackingItem> items, bool useStackingConstraints) { 46 public override Solution Decode(Permutation permutation, PackingShape binShape, IList<PackingItem> items, bool useStackingConstraints) { 47 return Apply(permutation, binShape, items, useStackingConstraints); 48 } 49 50 public static Solution Apply(Permutation permutation, PackingShape binShape, IList<PackingItem> items, bool useStackingConstraints) { 44 51 Solution result = new Solution(binShape, useExtremePoints: true, stackingConstraints: useStackingConstraints); 45 52 IList<int> remainingIDs = new List<int>(permutation); -
trunk/sources/HeuristicLab.Problems.BinPacking/3.3/3D/ProblemBase.cs
r14162 r15230 175 175 public override bool Maximization { get { return true; } } 176 176 177 178 177 public override double Evaluate(Individual individual, IRandom random) { 179 178 var encodedSolutionCand = (TSol)individual[EncodedSolutionName]; … … 237 236 BinShape = data.BinShape; 238 237 var items = new ItemList<PackingItem>(data.Items); 239 items.Sort((x, y) => y.CompareTo(x));240 238 Items = items.AsReadOnly(); 241 239 -
trunk/sources/HeuristicLab.Problems.BinPacking/3.3/BinPacking.cs
r14162 r15230 51 51 protected Dictionary<int, List<int>> OccupationLayers { get; set; } 52 52 53 [Storable] 54 public Dictionary<TPos, Tuple<int,int,int>> ResidualSpace { get; protected set; } 55 53 56 #endregion Properties 57 58 public int FreeVolume { 59 get { return BinShape.Volume - Items.Sum(x => x.Value.Volume); } 60 } 54 61 55 62 protected BinPacking(TBin binShape) … … 60 67 OccupationLayers = new Dictionary<int, List<int>>(); 61 68 } 62 63 69 64 70 [StorableConstructor] … … 84 90 85 91 public abstract TPos FindExtremePointForItem(TItem item, bool rotated, bool stackingConstraints); 86 public abstract TPos FindPositionBySliding(TItem item, bool rotated );92 public abstract TPos FindPositionBySliding(TItem item, bool rotated, bool stackingConstraints); 87 93 88 public abstract void SlidingBasedPacking(ref IList<int> sequence, IList<TItem> items );89 public abstract void SlidingBasedPacking(ref IList<int> sequence, IList<TItem> items, Dictionary<int, bool> rotationArray );94 public abstract void SlidingBasedPacking(ref IList<int> sequence, IList<TItem> items, bool stackingConstraints); 95 public abstract void SlidingBasedPacking(ref IList<int> sequence, IList<TItem> items, Dictionary<int, bool> rotationArray, bool stackingConstraints); 90 96 public abstract void ExtremePointBasedPacking(ref IList<int> sequence, IList<TItem> items, bool stackingConstraints); 91 97 public abstract void ExtremePointBasedPacking(ref IList<int> sequence, IList<TItem> items, bool stackingConstraints, Dictionary<int, bool> rotationArray); 92 98 93 public v oid PackItem(int itemID, TItem item, TPos position) {99 public virtual void PackItem(int itemID, TItem item, TPos position) { 94 100 Items[itemID] = item; 95 101 Positions[itemID] = position; 96 102 ExtremePoints.Remove(position); 103 if (ResidualSpace != null) ResidualSpace.Remove(position); 97 104 foreach (int id in Items.Select(x => x.Key)) 98 105 GenerateNewExtremePointsForNewItem(Items[id], Positions[id]); 99 106 100 107 AddNewItemToOccupationLayers(itemID, item, position); 108 } 109 public virtual bool PackItemIfFeasible(int itemID, TItem item, TPos position, bool stackingConstraints) { 110 if (IsPositionFeasible(item, position, stackingConstraints)) { 111 PackItem(itemID, item, position); 112 return true; 113 } 114 return false; 101 115 } 102 116 … … 127 141 return false; 128 142 } 129 public bool IsPositionFeasible(TItem item, TPos position) {143 public virtual bool IsPositionFeasible(TItem item, TPos position, bool stackingConstraints) { 130 144 //In this case feasability is defined as following: 1. the item fits into the bin-borders; 2. the point is supported by something; 3. the item does not collide with another already packed item 131 145 if (!BinShape.Encloses(position, item)) … … 139 153 return true; 140 154 } 155 141 156 public abstract int ShortestPossibleSideFromPoint(TPos position); 142 157 public abstract bool IsStaticStable(TItem measures, TPos position); 143 144 158 145 159 protected abstract void InitializeOccupationLayers(); -
trunk/sources/HeuristicLab.Problems.BinPacking/3.3/HeuristicLab.Problems.BinPacking-3.3.csproj
r15069 r15230 19 19 <DebugType>full</DebugType> 20 20 <Optimize>false</Optimize> 21 <OutputPath>..\..\ bin\</OutputPath>21 <OutputPath>..\..\..\..\trunk\sources\bin\</OutputPath> 22 22 <DefineConstants>DEBUG;TRACE</DefineConstants> 23 23 <ErrorReport>prompt</ErrorReport> … … 27 27 <DebugType>pdbonly</DebugType> 28 28 <Optimize>true</Optimize> 29 <OutputPath>..\..\ bin\</OutputPath>29 <OutputPath>..\..\..\..\trunk\sources\bin\</OutputPath> 30 30 <DefineConstants>TRACE</DefineConstants> 31 31 <ErrorReport>prompt</ErrorReport> … … 34 34 <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'"> 35 35 <DebugSymbols>true</DebugSymbols> 36 <OutputPath>..\..\ bin\</OutputPath>36 <OutputPath>..\..\..\..\trunk\sources\bin\</OutputPath> 37 37 <DefineConstants>DEBUG;TRACE</DefineConstants> 38 38 <DebugType>full</DebugType> … … 41 41 </PropertyGroup> 42 42 <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'"> 43 <OutputPath>..\..\ bin\</OutputPath>43 <OutputPath>..\..\..\..\trunk\sources\bin\</OutputPath> 44 44 <DefineConstants>TRACE</DefineConstants> 45 45 <Optimize>true</Optimize> … … 51 51 <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'"> 52 52 <DebugSymbols>true</DebugSymbols> 53 <OutputPath>..\..\ bin\</OutputPath>53 <OutputPath>..\..\..\..\trunk\sources\bin\</OutputPath> 54 54 <DefineConstants>DEBUG;TRACE</DefineConstants> 55 55 <DebugType>full</DebugType> … … 58 58 </PropertyGroup> 59 59 <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'"> 60 <OutputPath>..\..\ bin\</OutputPath>60 <OutputPath>..\..\..\..\trunk\sources\bin\</OutputPath> 61 61 <DefineConstants>TRACE</DefineConstants> 62 62 <Optimize>true</Optimize> … … 72 72 </PropertyGroup> 73 73 <ItemGroup> 74 <Reference Include="HeuristicLab.Analysis-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL"> 75 <SpecificVersion>False</SpecificVersion> 76 <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Analysis-3.3.dll</HintPath> 77 <Private>False</Private> 78 </Reference> 79 <Reference Include="HeuristicLab.Collections-3.3"> 80 <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Collections-3.3.dll</HintPath> 81 <Private>False</Private> 82 </Reference> 83 <Reference Include="HeuristicLab.Common-3.3"> 84 <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Common-3.3.dll</HintPath> 85 <Private>False</Private> 86 </Reference> 87 <Reference Include="HeuristicLab.Core-3.3"> 88 <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Core-3.3.dll</HintPath> 89 <Private>False</Private> 90 </Reference> 91 <Reference Include="HeuristicLab.Data-3.3"> 92 <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Data-3.3.dll</HintPath> 93 <Private>False</Private> 94 </Reference> 95 <Reference Include="HeuristicLab.Encodings.IntegerVectorEncoding-3.3"> 96 <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Encodings.IntegerVectorEncoding-3.3.dll</HintPath> 97 <Private>False</Private> 98 </Reference> 99 <Reference Include="HeuristicLab.Encodings.PermutationEncoding-3.3"> 100 <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Encodings.PermutationEncoding-3.3.dll</HintPath> 101 <Private>False</Private> 102 </Reference> 103 <Reference Include="HeuristicLab.Operators-3.3"> 104 <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Operators-3.3.dll</HintPath> 105 <Private>False</Private> 106 </Reference> 107 <Reference Include="HeuristicLab.Optimization-3.3"> 108 <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Optimization-3.3.dll</HintPath> 109 <Private>False</Private> 110 </Reference> 111 <Reference Include="HeuristicLab.Optimization.Operators-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL"> 112 <SpecificVersion>False</SpecificVersion> 113 <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Optimization.Operators-3.3.dll</HintPath> 114 <Private>False</Private> 115 </Reference> 116 <Reference Include="HeuristicLab.Parameters-3.3"> 117 <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Parameters-3.3.dll</HintPath> 118 <Private>False</Private> 119 </Reference> 120 <Reference Include="HeuristicLab.Persistence-3.3"> 121 <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Persistence-3.3.dll</HintPath> 122 <Private>False</Private> 123 </Reference> 124 <Reference Include="HeuristicLab.PluginInfrastructure-3.3"> 125 <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.PluginInfrastructure-3.3.dll</HintPath> 126 <Private>False</Private> 127 </Reference> 128 <Reference Include="HeuristicLab.Problems.Instances-3.3"> 129 <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Problems.Instances-3.3.dll</HintPath> 130 <Private>False</Private> 131 </Reference> 132 <Reference Include="HeuristicLab.Random-3.3"> 133 <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Random-3.3.dll</HintPath> 134 <Private>False</Private> 135 </Reference> 74 136 <Reference Include="System" /> 75 137 <Reference Include="System.Core" /> … … 106 168 <Compile Include="3D\Evaluators\BinUtilizationEvaluator.cs" /> 107 169 <Compile Include="3D\Evaluators\PackingRatioEvaluator.cs" /> 170 <Compile Include="Algorithms\3D\ExtremePointAlgorithm.cs" /> 171 <Compile Include="3D\Instances\ThreeDInstanceDescriptor.cs" /> 108 172 <Compile Include="3D\Instances\BPPData.cs" /> 109 173 <Compile Include="3D\Instances\RandomDataDescriptor.cs" /> 174 <Compile Include="3D\Instances\RealWorldContainerPackingInstanceProvider.cs" /> 110 175 <Compile Include="3D\Instances\RandomInstanceProvider.cs" /> 176 <Compile Include="3D\Instances\ThreeDInstanceParser.cs" /> 111 177 <Compile Include="3D\IntegerVectorEncoding\BottomLeftIntegerVectorDecoder.cs" /> 112 178 <Compile Include="3D\IntegerVectorEncoding\ExtremePointIntegerVectorDecoder.cs" /> … … 121 187 <Compile Include="3D\PackingShape.cs" /> 122 188 <Compile Include="3D\PermutationEncoding\BottomLeftPermutationDecoder.cs" /> 189 <Compile Include="3D\PermutationEncoding\ResidualSpaceBestFitExtremePointPermutationDecoder.cs" /> 190 <Compile Include="3D\PermutationEncoding\FreeVolumeBestFitExtremePointPermutationDecoder.cs" /> 191 <Compile Include="3D\PermutationEncoding\ExtremePointPermutationDecoderBase.cs" /> 123 192 <Compile Include="3D\PermutationEncoding\ExtremePointPermutationDecoder.cs" /> 124 193 <Compile Include="3D\PermutationEncoding\PermutationProblem.cs" /> … … 144 213 </ItemGroup> 145 214 <ItemGroup> 215 <EmbeddedResource Include="3D\Instances\ContainerPackingInstances.zip" /> 146 216 <None Include="HeuristicLab.snk" /> 147 217 <None Include="Properties\AssemblyInfo.cs.frame" /> … … 149 219 </ItemGroup> 150 220 <ItemGroup /> 151 <ItemGroup>152 <ProjectReference Include="..\..\HeuristicLab.Analysis\3.3\HeuristicLab.Analysis-3.3.csproj">153 <Project>{887425B4-4348-49ED-A457-B7D2C26DDBF9}</Project>154 <Name>HeuristicLab.Analysis-3.3</Name>155 <Private>False</Private>156 </ProjectReference>157 <ProjectReference Include="..\..\HeuristicLab.Collections\3.3\HeuristicLab.Collections-3.3.csproj">158 <Project>{958B43BC-CC5C-4FA2-8628-2B3B01D890B6}</Project>159 <Name>HeuristicLab.Collections-3.3</Name>160 <Private>False</Private>161 </ProjectReference>162 <ProjectReference Include="..\..\HeuristicLab.Common\3.3\HeuristicLab.Common-3.3.csproj">163 <Project>{a9ad58b9-3ef9-4cc1-97e5-8d909039ff5c}</Project>164 <Name>HeuristicLab.Common-3.3</Name>165 <Private>False</Private>166 </ProjectReference>167 <ProjectReference Include="..\..\HeuristicLab.Core\3.3\HeuristicLab.Core-3.3.csproj">168 <Project>{c36bd924-a541-4a00-afa8-41701378ddc5}</Project>169 <Name>HeuristicLab.Core-3.3</Name>170 <Private>False</Private>171 </ProjectReference>172 <ProjectReference Include="..\..\HeuristicLab.Data\3.3\HeuristicLab.Data-3.3.csproj">173 <Project>{bbab9df5-5ef3-4ba8-ade9-b36e82114937}</Project>174 <Name>HeuristicLab.Data-3.3</Name>175 <Private>False</Private>176 </ProjectReference>177 <ProjectReference Include="..\..\HeuristicLab.Encodings.IntegerVectorEncoding\3.3\HeuristicLab.Encodings.IntegerVectorEncoding-3.3.csproj">178 <Project>{ddfb14dd-2a85-493c-a52d-e69729bbaeb0}</Project>179 <Name>HeuristicLab.Encodings.IntegerVectorEncoding-3.3</Name>180 <Private>False</Private>181 </ProjectReference>182 <ProjectReference Include="..\..\HeuristicLab.Encodings.PermutationEncoding\3.3\HeuristicLab.Encodings.PermutationEncoding-3.3.csproj">183 <Project>{dbecb8b0-b166-4133-baf1-ed67c3fd7fca}</Project>184 <Name>HeuristicLab.Encodings.PermutationEncoding-3.3</Name>185 <Private>False</Private>186 </ProjectReference>187 <ProjectReference Include="..\..\HeuristicLab.Operators\3.3\HeuristicLab.Operators-3.3.csproj">188 <Project>{23DA7FF4-D5B8-41B6-AA96-F0561D24F3EE}</Project>189 <Name>HeuristicLab.Operators-3.3</Name>190 <Private>False</Private>191 </ProjectReference>192 <ProjectReference Include="..\..\HeuristicLab.Optimization.Operators\3.3\HeuristicLab.Optimization.Operators-3.3.csproj">193 <Project>{25087811-F74C-4128-BC86-8324271DA13E}</Project>194 <Name>HeuristicLab.Optimization.Operators-3.3</Name>195 <Private>False</Private>196 </ProjectReference>197 <ProjectReference Include="..\..\HeuristicLab.Optimization\3.3\HeuristicLab.Optimization-3.3.csproj">198 <Project>{14ab8d24-25bc-400c-a846-4627aa945192}</Project>199 <Name>HeuristicLab.Optimization-3.3</Name>200 <Private>False</Private>201 </ProjectReference>202 <ProjectReference Include="..\..\HeuristicLab.Parameters\3.3\HeuristicLab.Parameters-3.3.csproj">203 <Project>{56F9106A-079F-4C61-92F6-86A84C2D84B7}</Project>204 <Name>HeuristicLab.Parameters-3.3</Name>205 <Private>False</Private>206 </ProjectReference>207 <ProjectReference Include="..\..\HeuristicLab.Persistence\3.3\HeuristicLab.Persistence-3.3.csproj">208 <Project>{102bc7d3-0ef9-439c-8f6d-96ff0fdb8e1b}</Project>209 <Name>HeuristicLab.Persistence-3.3</Name>210 <Private>False</Private>211 </ProjectReference>212 <ProjectReference Include="..\..\HeuristicLab.PluginInfrastructure\3.3\HeuristicLab.PluginInfrastructure-3.3.csproj">213 <Project>{94186A6A-5176-4402-AE83-886557B53CCA}</Project>214 <Name>HeuristicLab.PluginInfrastructure-3.3</Name>215 <Private>False</Private>216 </ProjectReference>217 <ProjectReference Include="..\..\HeuristicLab.Problems.Instances\3.3\HeuristicLab.Problems.Instances-3.3.csproj">218 <Project>{3540E29E-4793-49E7-8EE2-FEA7F61C3994}</Project>219 <Name>HeuristicLab.Problems.Instances-3.3</Name>220 <Private>False</Private>221 </ProjectReference>222 <ProjectReference Include="..\..\HeuristicLab.Random\3.3\HeuristicLab.Random-3.3.csproj">223 <Project>{F4539FB6-4708-40C9-BE64-0A1390AEA197}</Project>224 <Name>HeuristicLab.Random-3.3</Name>225 <Private>False</Private>226 </ProjectReference>227 </ItemGroup>228 221 <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> 229 222 <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Note: See TracChangeset
for help on using the changeset viewer.