Changeset 15278 for stable/HeuristicLab.Problems.BinPacking/3.3/2D
- Timestamp:
- 07/21/17 11:29:08 (7 years ago)
- Location:
- stable
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
stable
- Property svn:mergeinfo changed
/trunk/sources merged: 14708-14709,14971,14978-14979,15167,15230,15233,15240-15241,15276
- Property svn:mergeinfo changed
-
stable/HeuristicLab.Problems.BinPacking
-
Property
svn:mergeinfo
set to
(toggle deleted branches)
/trunk/sources/HeuristicLab.Problems.BinPacking merged eligible /branches/1721-RandomForestPersistence/HeuristicLab.Problems.BinPacking 10321-10322 /branches/Algorithms.GradientDescent/HeuristicLab.Problems.BinPacking 5516-5520 /branches/Benchmarking/sources/HeuristicLab.Problems.BinPacking 6917-7005 /branches/BinPackingExtension/HeuristicLab.Problems.BinPacking 14835-15229 /branches/CloningRefactoring/HeuristicLab.Problems.BinPacking 4656-4721 /branches/CodeEditor/HeuristicLab.Problems.BinPacking 11700-11806 /branches/DataAnalysis Refactoring/HeuristicLab.Problems.BinPacking 5471-5808 /branches/DataAnalysis SolutionEnsembles/HeuristicLab.Problems.BinPacking 5815-6180 /branches/DataAnalysis/HeuristicLab.Problems.BinPacking 4458-4459,4462,4464 /branches/DataPreprocessing/HeuristicLab.Problems.BinPacking 10085-11101 /branches/GP.Grammar.Editor/HeuristicLab.Problems.BinPacking 6284-6795 /branches/GP.Symbols (TimeLag, Diff, Integral)/HeuristicLab.Problems.BinPacking 5060 /branches/HLScript/HeuristicLab.Problems.BinPacking 10331-10358 /branches/HeuristicLab.DatasetRefactor/sources/HeuristicLab.Problems.BinPacking 11570-12508 /branches/HeuristicLab.Problems.DataAnalysis.Trading/HeuristicLab.Problems.BinPacking 6123-9799 /branches/HeuristicLab.Problems.Orienteering/HeuristicLab.Problems.BinPacking 11130-12721 /branches/HiveStatistics/sources/HeuristicLab.Problems.BinPacking 12440-12877 /branches/LogResidualEvaluator/HeuristicLab.Problems.BinPacking 10202-10483 /branches/NET40/sources/HeuristicLab.Problems.BinPacking 5138-5162 /branches/NSGA-II Changes/HeuristicLab.Problems.BinPacking 12033-12122 /branches/ParallelEngine/HeuristicLab.Problems.BinPacking 5175-5192 /branches/ProblemInstancesRegressionAndClassification/HeuristicLab.Problems.BinPacking 7568-7810 /branches/QAPAlgorithms/HeuristicLab.Problems.BinPacking 6350-6627 /branches/Restructure trunk solution/HeuristicLab.Problems.BinPacking 6828 /branches/RuntimeOptimizer/HeuristicLab.Problems.BinPacking 8943-9078 /branches/ScatterSearch (trunk integration)/HeuristicLab.Problems.BinPacking 7787-8333 /branches/SlaveShutdown/HeuristicLab.Problems.BinPacking 8944-8956 /branches/SpectralKernelForGaussianProcesses/HeuristicLab.Problems.BinPacking 10204-10479 /branches/SuccessProgressAnalysis/HeuristicLab.Problems.BinPacking 5370-5682 /branches/Trunk/HeuristicLab.Problems.BinPacking 6829-6865 /branches/UnloadJobs/HeuristicLab.Problems.BinPacking 9168-9215 /branches/VNS/HeuristicLab.Problems.BinPacking 5594-5752 /branches/crossvalidation-2434/HeuristicLab.Problems.BinPacking 12948-12950 /branches/histogram/HeuristicLab.Problems.BinPacking 5959-6341 /branches/symbreg-factors-2650/HeuristicLab.Problems.BinPacking 14232-14825 /trunk/sources/HeuristicLab.Problems.TestFunctions.MultiObjective/HeuristicLab.Problems.BinPacking 14175
-
Property
svn:mergeinfo
set to
(toggle deleted branches)
-
stable/HeuristicLab.Problems.BinPacking/3.3/2D/BinPacking2D.cs
r14966 r15278 34 34 public BinPacking2D(PackingShape binShape) 35 35 : base(binShape) { 36 ExtremePoints = new SortedSet<PackingPosition>();37 36 ExtremePoints.Add(binShape.Origin); 38 37 InitializeOccupationLayers(); … … 41 40 [StorableConstructor] 42 41 protected BinPacking2D(bool deserializing) : base(deserializing) { } 43 protected BinPacking2D(BinPacking2D original, Cloner cloner) 44 : base(original, cloner) { 45 this.ExtremePoints = new SortedSet<PackingPosition>(original.ExtremePoints.Select(p => cloner.Clone(p))); 46 } 42 protected BinPacking2D(BinPacking2D original, Cloner cloner) : base(original, cloner) { } 47 43 public override IDeepCloneable Clone(Cloner cloner) { 48 44 return new BinPacking2D(this, cloner); … … 88 84 }; 89 85 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); 86 var ep = ExtremePoints.Where(x => IsPositionFeasible(rotatedItem, x, stackingConstraints)).FirstOrDefault(); 87 if (ep != null) { 88 var result = new PackingPosition(ep.AssignedBin, ep.X, ep.Y, rotated); 97 89 return result; 98 90 } 99 91 return null; 100 92 } 101 public override PackingPosition FindPositionBySliding(PackingItem item, bool rotated ) {93 public override PackingPosition FindPositionBySliding(PackingItem item, bool rotated, bool stackingConstraints) { 102 94 PackingPosition currentPosition = new PackingPosition(0, 103 95 BinShape.Width - (rotated ? item.Height : item.Width), 104 96 BinShape.Height - (rotated ? item.Width : item.Height), rotated); 105 97 //Slide the item as far as possible to the left 106 while (IsPositionFeasible(item, PackingPosition.MoveLeft(currentPosition) )107 || IsPositionFeasible(item, PackingPosition.MoveDown(currentPosition) )) {98 while (IsPositionFeasible(item, PackingPosition.MoveLeft(currentPosition), stackingConstraints) 99 || IsPositionFeasible(item, PackingPosition.MoveDown(currentPosition), stackingConstraints)) { 108 100 //Slide the item as far as possible to the bottom 109 while (IsPositionFeasible(item, PackingPosition.MoveDown(currentPosition) )) {101 while (IsPositionFeasible(item, PackingPosition.MoveDown(currentPosition), stackingConstraints)) { 110 102 currentPosition = PackingPosition.MoveDown(currentPosition); 111 103 } 112 if (IsPositionFeasible(item, PackingPosition.MoveLeft(currentPosition) ))104 if (IsPositionFeasible(item, PackingPosition.MoveLeft(currentPosition), stackingConstraints)) 113 105 currentPosition = PackingPosition.MoveLeft(currentPosition); 114 106 } 115 107 116 return IsPositionFeasible(item, currentPosition ) ? currentPosition : null;117 } 118 119 public override void SlidingBasedPacking(ref IList<int> sequence, IList<PackingItem> items ) {108 return IsPositionFeasible(item, currentPosition, stackingConstraints) ? currentPosition : null; 109 } 110 111 public override void SlidingBasedPacking(ref IList<int> sequence, IList<PackingItem> items, bool stackingConstraints) { 120 112 var temp = new List<int>(sequence); 121 113 for (int i = 0; i < temp.Count; i++) { 122 114 var item = items[temp[i]]; 123 var position = FindPositionBySliding(item, false );115 var position = FindPositionBySliding(item, false, stackingConstraints); 124 116 if (position != null) { 125 117 PackItem(temp[i], item, position); … … 128 120 } 129 121 } 130 public override void SlidingBasedPacking(ref IList<int> sequence, IList<PackingItem> items, Dictionary<int, bool> rotationArray ) {122 public override void SlidingBasedPacking(ref IList<int> sequence, IList<PackingItem> items, Dictionary<int, bool> rotationArray, bool stackingConstraints) { 131 123 var temp = new List<int>(sequence); 132 124 for (int i = 0; i < temp.Count; i++) { 133 125 var item = items[temp[i]]; 134 var position = FindPositionBySliding(item, rotationArray[temp[i]] );126 var position = FindPositionBySliding(item, rotationArray[temp[i]], stackingConstraints); 135 127 if (position != null) { 136 128 PackItem(temp[i], item, position); … … 150 142 } 151 143 } 144 152 145 public override void ExtremePointBasedPacking(ref IList<int> sequence, IList<PackingItem> items, bool stackingConstraints, Dictionary<int, bool> rotationArray) { 153 146 var temp = new List<int>(sequence); … … 186 179 throw new NotSupportedException(); 187 180 } 188 189 181 protected override void InitializeOccupationLayers() { 190 182 for (int i = 0; i * 10 <= BinShape.Width; i += 1) { -
stable/HeuristicLab.Problems.BinPacking/3.3/2D/IntegerVectorEncoding/BottomLeftIntegerVectorDecoder.cs
r14170 r15278 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 } -
stable/HeuristicLab.Problems.BinPacking/3.3/2D/PermutationEncoding/BottomLeftPermutationDecoder.cs
r14170 r15278 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 }
Note: See TracChangeset
for help on using the changeset viewer.