Changeset 14153
- Timestamp:
- 07/21/16 14:33:53 (8 years ago)
- Location:
- branches/HeuristicLab.BinPacking
- Files:
-
- 19 added
- 19 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.BinPacking/HeuristicLab.BinPacking.sln
r14038 r14153 1 1 2 2 Microsoft Visual Studio Solution File, Format Version 12.00 3 # Visual Studio 14 4 VisualStudioVersion = 14.0.25123.0 5 MinimumVisualStudioVersion = 10.0.40219.1 3 # Visual Studio 2012 6 4 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.Problems.BinPacking-3.3", "HeuristicLab.Problems.BinPacking\3.3\HeuristicLab.Problems.BinPacking-3.3.csproj", "{F8A55094-3CD5-4034-B0CA-5BD7FFB016D4}" 7 5 EndProject … … 9 7 ProjectSection(SolutionItems) = preProject 10 8 ..\Build.cmd = ..\Build.cmd 11 Performance1.psess = Performance1.psess12 9 ..\PreBuildEvent.cmd = ..\PreBuildEvent.cmd 13 10 EndProjectSection -
branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.2D/3.3/IntegerVectorEncoding/BottomLeftIntegerVectorDecoder.cs
r14151 r14153 46 46 } 47 47 48 protected override PackingPosition FindPositionForItem(BinPacking .BinPacking<PackingPosition, PackingShape, PackingItem>bp, PackingItem item) {48 protected override PackingPosition FindPositionForItem(BinPacking2D bp, PackingItem item) { 49 49 return bp.FindPositionBySliding(item, rotated: false); 50 50 } 51 51 52 protected override BinPacking .BinPacking<PackingPosition, PackingShape, PackingItem>CreatePacking(52 protected override BinPacking2D CreatePacking( 53 53 Solution partialSolution, 54 54 ref IList<int> remainingIDs, IList<PackingItem> items) { 55 var bp = partialSolution.NewBinPacking();55 var bp = new BinPacking2D(partialSolution.BinMeasures); 56 56 bp.SlidingBasedPacking(ref remainingIDs, items); 57 57 return bp; -
branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.2D/3.3/IntegerVectorEncoding/ExtremePointIntegerVectorDecoder.cs
r14151 r14153 46 46 } 47 47 48 protected override PackingPosition FindPositionForItem(BinPacking .BinPacking<PackingPosition, PackingShape, PackingItem>bp, PackingItem item) {48 protected override PackingPosition FindPositionForItem(BinPacking2D bp, PackingItem item) { 49 49 return bp.FindExtremePointForItem(item, false, stackingConstraints: false); 50 50 } 51 51 52 protected override BinPacking .BinPacking<PackingPosition, PackingShape, PackingItem>CreatePacking(52 protected override BinPacking2D CreatePacking( 53 53 Solution partialSolution, 54 54 ref IList<int> remainingIDs, IList<PackingItem> items) { 55 var bp = partialSolution.NewBinPacking();55 var bp = new BinPacking2D(partialSolution.BinMeasures); 56 56 bp.ExtremePointBasedPacking(ref remainingIDs, items, stackingConstraints: false); 57 57 return bp; -
branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.2D/3.3/IntegerVectorEncoding/IntegerVectorDecoderBase.cs
r14151 r14153 39 39 40 40 41 public Solution Decode(IntegerVector intVec, PackingShape binShape, IList<PackingItem> items) {41 public virtual Solution Decode(IntegerVector intVec, PackingShape binShape, IList<PackingItem> items) { 42 42 var sequenceMatrix = IntegerVectorProblem.GenerateSequenceMatrix(intVec); 43 43 Solution result = CreateSolution(binShape); … … 54 54 var temp = new List<int>(remainingIDs); 55 55 foreach (int id in temp) { 56 foreach ( varbp in result.BinPackings) {56 foreach (BinPacking2D bp in result.BinPackings) { 57 57 var position = FindPositionForItem(bp, items[id]); 58 58 if (position != null) { … … 70 70 result.UpdateBinPackings(); 71 71 72 // gkronber: original implementation also updates the encoded solution72 // gkronber: original implementation by Helm also updates the encoded solution (TODO) 73 73 // var newSolution = new int[intVec.Length]; 74 74 // int binIndex = 0; … … 84 84 85 85 protected abstract Solution CreateSolution(PackingShape binShape); 86 protected abstract PackingPosition FindPositionForItem(BinPacking .BinPacking<PackingPosition, PackingShape, PackingItem>bp, PackingItem item);87 protected abstract BinPacking .BinPacking<PackingPosition, PackingShape, PackingItem>CreatePacking(Solution partialSolution, ref IList<int> remainingIDs, IList<PackingItem> items);86 protected abstract PackingPosition FindPositionForItem(BinPacking2D bp, PackingItem item); 87 protected abstract BinPacking2D CreatePacking(Solution partialSolution, ref IList<int> remainingIDs, IList<PackingItem> items); 88 88 } 89 89 } -
branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.2D/3.3/IntegerVectorEncoding/IntegerVectorProblem.cs
r14151 r14153 66 66 private void AddOperators() { 67 67 68 // move operators are not yet supported 68 // move operators are not yet supported (TODO) 69 69 Operators.RemoveAll(x => x is SingleObjectiveMoveGenerator); 70 70 Operators.RemoveAll(x => x is SingleObjectiveMoveMaker); 71 71 Operators.RemoveAll(x => x is SingleObjectiveMoveEvaluator); 72 72 73 Encoding.ConfigureOperators(Operators.OfType<IOperator>()); 73 Encoding.ConfigureOperators(Operators.OfType<IOperator>()); // gkronber: not strictly necessary (only when customer ops are added) 74 74 } 75 75 -
branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.2D/3.3/Interfaces/IDecoder.cs
r14149 r14153 20 20 #endregion 21 21 22 using System.Collections;23 22 using System.Collections.Generic; 24 23 using HeuristicLab.Core; 25 using HeuristicLab.Encodings.PermutationEncoding;26 using HeuristicLab.Problems.BinPacking;27 24 28 25 namespace HeuristicLab.Problems.BinPacking2D { -
branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.2D/3.3/MoveEvaluatorBase.cs
r14149 r14153 23 23 using HeuristicLab.Core; 24 24 using HeuristicLab.Data; 25 using HeuristicLab.Encodings.PermutationEncoding;26 25 using HeuristicLab.Operators; 27 26 using HeuristicLab.Optimization; -
branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.2D/3.3/PermutationEncoding/BottomLeftPermutationDecoder.cs
r14149 r14153 45 45 IList<int> remainingIDs = new List<int>(permutation); 46 46 while (remainingIDs.Count > 0) { 47 var bp = result.NewBinPacking();47 var bp = new BinPacking2D(binShape); 48 48 bp.SlidingBasedPacking(ref remainingIDs, items); 49 49 result.BinPackings.Add(bp); -
branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.2D/3.3/PermutationEncoding/ExtremePointPermutationDecoder.cs
r14149 r14153 45 45 IList<int> remainingIDs = new List<int>(permutation); 46 46 while (remainingIDs.Count > 0) { 47 var bp = result.NewBinPacking();47 var bp = new BinPacking2D(binShape); 48 48 bp.ExtremePointBasedPacking(ref remainingIDs, items, stackingConstraints: false); 49 49 result.BinPackings.Add(bp); -
branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.2D/3.3/PermutationEncoding/PermutationProblem.cs
r14151 r14153 71 71 72 72 Encoding.ConfigureOperators(Operators.OfType<IOperator>()); 73 74 // TODO: configure the move evaluators (add interface for my move evaluators) 73 75 } 74 76 -
branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.2D/3.3/ProblemBase.cs
r14149 r14153 37 37 where TEnc : class, IEncoding 38 38 where TSol : class, IItem { 39 pr ivatereadonly string SolutionEvaluatorParameterName = "SolutionEvaluator";39 protected readonly string SolutionEvaluatorParameterName = "SolutionEvaluator"; 40 40 public readonly string EncodedSolutionName = "EncodedSolution"; 41 41 #region Default Instance 42 private static readonly BPPData DefaultInstance = new BPPData() {42 private readonly BPPData defaultInstance = new BPPData() { 43 43 Name = "2D BPP Default Instance", 44 44 Description = "The default instance for 2D Bin Packing.", … … 155 155 Parameters.Add(new FixedValueParameter<IntValue>("LowerBound", "A lower bound for the number of bins that is necessary to pack all items")); 156 156 157 Load( DefaultInstance);157 Load(defaultInstance); 158 158 } 159 159 -
branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.2D/3.3/Solution.cs
r14151 r14153 39 39 return new Solution(this, cloner); 40 40 } 41 public override BinPacking<PackingPosition, PackingShape, PackingItem> NewBinPacking() {42 return new BinPacking2D(BinMeasures);43 }44 41 } 45 42 } -
branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.3D/3.3/BinPacking3D.cs
r14151 r14153 41 41 protected BinPacking3D(BinPacking3D original, Cloner cloner) 42 42 : base(original, cloner) { 43 this.depthWasDoubled = original.depthWasDoubled;44 43 this.ExtremePoints = new SortedSet<PackingPosition>(original.ExtremePoints, new EPComparer3D()); 45 44 } … … 77 76 ExtremePoints.Add(current); 78 77 } 79 80 81 82 78 83 79 //Find ExtremePoints beginning from sourcepointY … … 95 91 ExtremePoints.Add(current); 96 92 97 //Traversing down the z-axis 93 //Traversing down the z-axis 98 94 current = new PackingPosition(0, sourcePointY.X, sourcePointY.Y, sourcePointY.Z); 99 95 while (current.Z > 0 && !IsPointOccupied(PackingPosition.MoveBack(current))) { … … 107 103 } 108 104 109 110 111 112 113 105 //Find ExtremePoints beginning from sourcepointZ 114 106 var sourcePointZ = new PackingPosition(0, position.X, position.Y, position.Z + newDepth); 115 107 if (sourcePointZ.X < BinMeasures.Width && sourcePointZ.Y < BinMeasures.Height && sourcePointZ.Z < BinMeasures.Depth) { 116 //Traversing down the x-axis 108 //Traversing down the x-axis 117 109 PackingPosition current = new PackingPosition(0, sourcePointZ.X, sourcePointZ.Y, sourcePointZ.Z); 118 110 while (current.X > 0 && !IsPointOccupied(PackingPosition.MoveLeft(current))) { … … 125 117 ExtremePoints.Add(current); 126 118 127 //Traversing down the y-axis 119 //Traversing down the y-axis 128 120 current = new PackingPosition(0, sourcePointZ.X, sourcePointZ.Y, sourcePointZ.Z); 129 121 while (current.Y > 0 && !IsPointOccupied(PackingPosition.MoveDown(current))) { … … 136 128 ExtremePoints.Add(current); 137 129 } 138 139 //ExtremePoints.RemoveWhere(ep => IsPointOccupied (ep));140 141 //ExtremePoints = new HashSet<ThreeDimensionalPacking>(ExtremePoints.142 // OrderBy(ep => ep.Z).143 // ThenBy(ep => ep.X).144 // ThenBy(ep => ep.Y)//.ThenBy(ep => ShortestPossibleSideFromPoint(ep))145 // );146 130 } 147 131 … … 171 155 172 156 public override PackingPosition FindPositionBySliding(PackingItem measures, bool rotated) { 157 //TODO: does not support stacking constraints yet 173 158 //Starting-position at upper right corner (=left bottom point of item-rectangle is at position item.width,item.height) 174 159 PackingPosition currentPosition = new PackingPosition(0, … … 282 267 return true; 283 268 284 285 //if (occupiedPoints[position.X, position.Y - 1, position.Z] != -1286 // && occupiedPoints[position.X + item.Width - 1, position.Y - 1, position.Z] != -1287 // && occupiedPoints[position.X, position.Y - 1, position.Z + item.Depth - 1] != -1288 // && occupiedPoints[position.X + item.Width - 1, position.Y - 1, position.Z + item.Depth - 1] != -1)289 // return true;290 291 //int groundCount = 0;292 //for (int x = ep.X; x < ep.X + item.Width - 1; x++) {293 // for (int z = ep.Z; z < ep.Z + item.Depth - 1; z++) {294 // if (occupiedPoints[x,ep.Y-1, z] != -1)295 // groundCount++;296 // }297 //}298 //double stableGround = (double)(groundCount) / (double)(item.Width * item.Depth);299 //if (stableGround > 0.75)300 // return true;301 302 269 return false; 303 270 } 304 271 305 [Storable]306 private bool depthWasDoubled = false; // TODO ???307 public void DoubleDepth() {308 if (!depthWasDoubled) {309 var oldDepth = BinMeasures.Depth;310 BinMeasures.Depth = BinMeasures.Depth * 2;311 //OccupiedPoints.ChangeBinMeasures(BinMeasures);312 depthWasDoubled = true;313 }314 }315 272 316 273 public bool IsSupportedByAtLeastOnePoint(PackingItem item, PackingPosition position) { -
branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.3D/3.3/HeuristicLab.Problems.BinPacking3D-3.3.csproj
r14146 r14153 163 163 <ItemGroup> 164 164 <Compile Include="BinPacking3D.cs" /> 165 <Compile Include="I3DOperator.cs" /> 165 <Compile Include="Evaluators\BinUtilizationEvaluator.cs" /> 166 <Compile Include="Evaluators\PackingRatioEvaluator.cs" /> 166 167 <Compile Include="Instances\BPPData.cs" /> 167 168 <Compile Include="Instances\RandomDataDescriptor.cs" /> 168 169 <Compile Include="Instances\RandomInstanceProvider.cs" /> 170 <Compile Include="IntegerVectorEncoding\BottomLeftIntegerVectorDecoder.cs" /> 171 <Compile Include="IntegerVectorEncoding\ExtremePointIntegerVectorDecoder.cs" /> 172 <Compile Include="IntegerVectorEncoding\IntegerVectorDecoderBase.cs" /> 173 <Compile Include="IntegerVectorEncoding\IntegerVectorProblem.cs" /> 174 <Compile Include="Interfaces\IDecoder.cs" /> 175 <Compile Include="Interfaces\IEvaluator.cs" /> 176 <Compile Include="MoveEvaluatorBase.cs" /> 169 177 <Compile Include="PackingItem.cs" /> 170 178 <Compile Include="PackingPosition.cs" /> 171 179 <Compile Include="PackingShape.cs" /> 180 <Compile Include="PermutationEncoding\BottomLeftPermutationDecoder.cs" /> 181 <Compile Include="PermutationEncoding\ExtremePointPermutationDecoder.cs" /> 182 <Compile Include="PermutationEncoding\PermutationProblem.cs" /> 183 <Compile Include="PermutationEncoding\Swap2MoveEvaluator.cs" /> 184 <Compile Include="PermutationEncoding\TranslocationMoveEvaluator.cs" /> 172 185 <Compile Include="Plugin.cs" /> 186 <Compile Include="ProblemBase.cs" /> 173 187 <Compile Include="Properties\AssemblyInfo.cs" /> 174 188 <Compile Include="Solution.cs" /> -
branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.3D/3.3/PackingItem.cs
r14049 r14153 103 103 104 104 private void RegisterEvents() { 105 // only because of ToString override105 // NOTE: only because of ToString override 106 106 WeightParameter.Value.ValueChanged += (sender, args) => OnToStringChanged(); 107 107 MaterialParameter.Value.ValueChanged += (sender, args) => OnToStringChanged(); -
branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.3D/3.3/Solution.cs
r14151 r14153 18 18 return new Solution(this, cloner); 19 19 } 20 public override BinPacking<PackingPosition, PackingShape, PackingItem> NewBinPacking() {21 return new BinPacking3D(BinMeasures);22 }23 20 } 24 21 } -
branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.Views/3.3/Container3DView.xaml
r13605 r14153 35 35 <Viewport3D Name="viewport3D1" > 36 36 <Viewport3D.Camera> 37 <PerspectiveCamera x:Name="camMain" Position="0.5 5 5" LookDirection="0 -1 -1"> <!-- camera position for design time-->37 <PerspectiveCamera x:Name="camMain" Position="0.5 8 8" LookDirection="0 -1 -1"> <!-- camera position for design time--> 38 38 </PerspectiveCamera> 39 39 </Viewport3D.Camera> … … 128 128 </RotateTransform3D> 129 129 <TranslateTransform3D OffsetX="0.5" OffsetY="0.5" OffsetZ="0.5" /> 130 <ScaleTransform3D x:Name="scaleZoom" CenterX="0.5" CenterY="0.5" CenterZ="0.5" ScaleX=" 1" ScaleY="1" ScaleZ="1"/>130 <ScaleTransform3D x:Name="scaleZoom" CenterX="0.5" CenterY="0.5" CenterZ="0.5" ScaleX="0.6" ScaleY="0.6" ScaleZ="0.6"/> 131 131 </Transform3DGroup> 132 132 </ModelVisual3D.Transform> -
branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Encodings/PackingPlans/PackingPlan.cs
r14151 r14153 29 29 30 30 namespace HeuristicLab.Problems.BinPacking { 31 [Item("PackingPlan", "Represents a concrete solution for a bin-packing problem.")]32 31 [StorableClass] 33 public abstract class PackingPlan<D, B, I> : Item , IPackingPlan32 public abstract class PackingPlan<D, B, I> : Item 34 33 where D : class, IPackingPosition 35 34 where B : PackingShape<D> … … 86 85 87 86 88 public abstract BinPacking<D, B, I> NewBinPacking();89 87 public void UpdateBinPackings() { 90 88 BinPackings.RemoveAll(x => x.ItemPositions.Count == 0); -
branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/HeuristicLab.Problems.BinPacking-3.3.csproj
r14151 r14153 179 179 <Compile Include="PackingDimensions.cs" /> 180 180 <Compile Include="Interfaces\IPackingItem.cs" /> 181 <Compile Include="Interfaces\IPackingPlan.cs" />182 181 <Compile Include="PackingShape.cs" /> 183 182 <Compile Include="PackingSolutionDecoder.cs" />
Note: See TracChangeset
for help on using the changeset viewer.