Changeset 14049
- Timestamp:
- 07/12/16 20:03:45 (8 years ago)
- Location:
- branches/HeuristicLab.BinPacking
- Files:
-
- 32 edited
- 7 moved
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.2D/3.3/BinPacking2D.cs
r14048 r14049 31 31 [Item("BinPacking2D", "Represents a single-bin packing for a 2D bin-packing problem.")] 32 32 [StorableClass] 33 public class BinPacking2D : BinPacking<PackingPosition, RectangularPackingShape, RectangularPackingItem> {34 35 public BinPacking2D( RectangularPackingShape binMeasures)33 public class BinPacking2D : BinPacking<PackingPosition, PackingShape, PackingItem> { 34 35 public BinPacking2D(PackingShape binMeasures) 36 36 : base(binMeasures) { 37 37 ExtremePoints = new SortedSet<PackingPosition>(new EPComparer2D()); … … 48 48 } 49 49 50 protected override void GenerateNewExtremePointsForNewItem( RectangularPackingItem newItem, PackingPosition position) {50 protected override void GenerateNewExtremePointsForNewItem(PackingItem newItem, PackingPosition position) { 51 51 52 52 int newWidth = position.Rotated ? newItem.Height : newItem.Width; … … 85 85 } 86 86 87 public override PackingPosition FindExtremePointForItem( RectangularPackingItem measures, bool rotated, bool stackingConstraints) {88 RectangularPackingItem item = new RectangularPackingItem(87 public override PackingPosition FindExtremePointForItem(PackingItem measures, bool rotated, bool stackingConstraints) { 88 PackingItem item = new PackingItem( 89 89 rotated ? measures.Height : measures.Width, 90 90 rotated ? measures.Width : measures.Height, … … 102 102 return null; 103 103 } 104 public override PackingPosition FindPositionBySliding( RectangularPackingItem measures, bool rotated) {104 public override PackingPosition FindPositionBySliding(PackingItem measures, bool rotated) { 105 105 PackingPosition currentPosition = new PackingPosition(0, 106 106 BinMeasures.Width - (rotated ? measures.Height : measures.Width), … … 120 120 } 121 121 122 public override void SlidingBasedPacking(ref List<int> sequence, ItemList< RectangularPackingItem> itemMeasures) {122 public override void SlidingBasedPacking(ref List<int> sequence, ItemList<PackingItem> itemMeasures) { 123 123 var temp = new List<int>(sequence); 124 124 for (int i = 0; i < temp.Count; i++) { … … 131 131 } 132 132 } 133 public override void SlidingBasedPacking(ref List<int> sequence, ItemList< RectangularPackingItem> itemMeasures, Dictionary<int, bool> rotationArray) {133 public override void SlidingBasedPacking(ref List<int> sequence, ItemList<PackingItem> itemMeasures, Dictionary<int, bool> rotationArray) { 134 134 var temp = new List<int>(sequence); 135 135 for (int i = 0; i < temp.Count; i++) { … … 142 142 } 143 143 } 144 public override void ExtremePointBasedPacking(ref List<int> sequence, ItemList< RectangularPackingItem> itemMeasures, bool stackingConstraints) {144 public override void ExtremePointBasedPacking(ref List<int> sequence, ItemList<PackingItem> itemMeasures, bool stackingConstraints) { 145 145 var temp = new List<int>(sequence); 146 146 foreach (int itemID in temp) { … … 153 153 } 154 154 } 155 public override void ExtremePointBasedPacking(ref List<int> sequence, ItemList< RectangularPackingItem> itemMeasures, bool stackingConstraints, Dictionary<int, bool> rotationArray) {155 public override void ExtremePointBasedPacking(ref List<int> sequence, ItemList<PackingItem> itemMeasures, bool stackingConstraints, Dictionary<int, bool> rotationArray) { 156 156 var temp = new List<int>(sequence); 157 157 foreach (int itemID in temp) { … … 186 186 return shortestSide; 187 187 } 188 public override bool IsStaticStable( RectangularPackingItem item, PackingPosition position) {188 public override bool IsStaticStable(PackingItem item, PackingPosition position) { 189 189 throw new NotImplementedException(); 190 190 } … … 196 196 } 197 197 } 198 protected override void AddNewItemToOccupationLayers(int itemID, RectangularPackingItem measures, PackingPosition position) {198 protected override void AddNewItemToOccupationLayers(int itemID, PackingItem measures, PackingPosition position) { 199 199 int x1 = position.X / 10; 200 200 int x2 = (position.X + (position.Rotated ? measures.Height : measures.Width)) / 10; … … 206 206 return OccupationLayers[position.X / 10]; 207 207 } 208 protected override List<int> GetLayerItemIDs( RectangularPackingItem measures, PackingPosition position) {208 protected override List<int> GetLayerItemIDs(PackingItem measures, PackingPosition position) { 209 209 List<int> result = new List<int>(); 210 210 int x1 = position.X / 10; -
branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.2D/3.3/Decoders/BL/BottomLeftGroupingVectorDecoder.cs
r14048 r14049 31 31 [Item("Identical bin two dimensional grouping vector decoder", "<Description missing...>")] 32 32 [StorableClass] 33 public class BottomLeftGroupingVectorDecoder : PackingSolutionDecoder<PackingPosition, RectangularPackingShape, RectangularPackingItem>, I2DGVDecoder {33 public class BottomLeftGroupingVectorDecoder : PackingSolutionDecoder<PackingPosition, PackingShape, PackingItem>, I2DGVDecoder { 34 34 public BottomLeftGroupingVectorDecoder() : base() {} 35 35 [StorableConstructor] … … 42 42 } 43 43 44 public override PackingPlan<PackingPosition, RectangularPackingShape, RectangularPackingItem> CreatePackingPlanFromEncoding(IItem encodedSolution, RectangularPackingShape binMeasures, ItemList<RectangularPackingItem> itemMeasures) {44 public override PackingPlan<PackingPosition, PackingShape, PackingItem> CreatePackingPlanFromEncoding(IItem encodedSolution, PackingShape binMeasures, ItemList<PackingItem> itemMeasures) { 45 45 var solution = encodedSolution as GroupingVectorEncoding; 46 46 if (solution == null) throw new InvalidOperationException("Encoding is not of type GroupingVector"); -
branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.2D/3.3/Decoders/BL/BottomLeftMultiComponentVectorDecoder.cs
r14048 r14049 31 31 [Item("Identical bin two dimensional multi component vector decoder", "<Description missing...>")] 32 32 [StorableClass] 33 public class BottomLeftMultiComponentVectorDecoder : PackingSolutionDecoder<PackingPosition, RectangularPackingShape, RectangularPackingItem>, I2DMCVDecoder {33 public class BottomLeftMultiComponentVectorDecoder : PackingSolutionDecoder<PackingPosition,PackingShape, PackingItem>, I2DMCVDecoder { 34 34 public BottomLeftMultiComponentVectorDecoder() : base() {} 35 35 [StorableConstructor] … … 42 42 } 43 43 44 public override PackingPlan<PackingPosition, RectangularPackingShape, RectangularPackingItem> CreatePackingPlanFromEncoding(IItem encodedSolution, RectangularPackingShape binMeasures, ItemList<RectangularPackingItem> itemMeasures) {44 public override PackingPlan<PackingPosition, PackingShape, PackingItem> CreatePackingPlanFromEncoding(IItem encodedSolution, PackingShape binMeasures, ItemList<PackingItem> itemMeasures) { 45 45 var solution = encodedSolution as MultiComponentVectorEncoding; 46 46 if (solution == null) throw new InvalidOperationException("Encoding is not of type MultiComponent Vector"); -
branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.2D/3.3/Decoders/BL/BottomLeftPackingSequenceDecoder.cs
r14048 r14049 32 32 [Item("Identical bin, two dimensional, direct permutation decoder", "<Description missing...>")] 33 33 [StorableClass] 34 public class BottomLeftPackingSequenceDecoder : PackingSolutionDecoder<PackingPosition, RectangularPackingShape, RectangularPackingItem>, I2DPSDecoder {34 public class BottomLeftPackingSequenceDecoder : PackingSolutionDecoder<PackingPosition, PackingShape, PackingItem>, I2DPSDecoder { 35 35 36 36 public BottomLeftPackingSequenceDecoder(): base() { } … … 44 44 } 45 45 46 public override PackingPlan<PackingPosition, RectangularPackingShape, RectangularPackingItem> CreatePackingPlanFromEncoding(IItem encodedSolution, RectangularPackingShape binMeasures, ItemList<RectangularPackingItem> itemMeasures) {46 public override PackingPlan<PackingPosition, PackingShape, PackingItem> CreatePackingPlanFromEncoding(IItem encodedSolution, PackingShape binMeasures, ItemList<PackingItem> itemMeasures) { 47 47 var solution = encodedSolution as PackingSequenceEncoding; 48 48 if (solution == null) throw new InvalidOperationException("Encoding is not of type PackingSequence"); -
branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.2D/3.3/Decoders/EP/ExtremePointGroupingVectorDecoder2D.cs
r14048 r14049 32 32 [Item("Identical bin, two dimensional, extreme points based decoder for the GroupingVector encoding.", "<Description missing...>")] 33 33 [StorableClass] 34 public class ExtremePointGroupingVectorDecoder2D : PackingSolutionDecoder<PackingPosition, RectangularPackingShape, RectangularPackingItem>, I2DGVDecoder {34 public class ExtremePointGroupingVectorDecoder2D : PackingSolutionDecoder<PackingPosition, PackingShape, PackingItem>, I2DGVDecoder { 35 35 public ExtremePointGroupingVectorDecoder2D () : base() {} 36 36 [StorableConstructor] … … 43 43 } 44 44 45 public static PackingPlan<PackingPosition, RectangularPackingShape, RectangularPackingItem> Decode(GroupingVectorEncoding solution, RectangularPackingShape binMeasures, ItemList<RectangularPackingItem> itemMeasures) {45 public static PackingPlan<PackingPosition, PackingShape, PackingItem> Decode(GroupingVectorEncoding solution, PackingShape binMeasures, ItemList<PackingItem> itemMeasures) { 46 46 Solution result = new Solution(binMeasures, true, false); 47 47 result.Pack(solution, itemMeasures); … … 49 49 } 50 50 51 public override PackingPlan<PackingPosition, RectangularPackingShape, RectangularPackingItem> CreatePackingPlanFromEncoding(IItem encodedSolution, RectangularPackingShape binMeasures, ItemList<RectangularPackingItem> itemMeasures) {51 public override PackingPlan<PackingPosition, PackingShape, PackingItem> CreatePackingPlanFromEncoding(IItem encodedSolution, PackingShape binMeasures, ItemList<PackingItem> itemMeasures) { 52 52 var solution = encodedSolution as GroupingVectorEncoding; 53 53 if (solution == null) throw new InvalidOperationException("Encoding is not of type GroupingVector"); -
branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.2D/3.3/Decoders/EP/ExtremePointMultiComponentVectorDecoder2D.cs
r14048 r14049 31 31 [Item("Identical bin, two dimensional, extreme points based decoder for the MultiComponentVector encoding.", "<Description missing...>")] // TODO 32 32 [StorableClass] 33 public class ExtremePointMultiComponentVectorDecoder2D : PackingSolutionDecoder<PackingPosition, RectangularPackingShape, RectangularPackingItem>, I2DMCVDecoder {33 public class ExtremePointMultiComponentVectorDecoder2D : PackingSolutionDecoder<PackingPosition, PackingShape, PackingItem>, I2DMCVDecoder { 34 34 public ExtremePointMultiComponentVectorDecoder2D () : base() {} 35 35 [StorableConstructor] … … 42 42 } 43 43 44 public static PackingPlan<PackingPosition, RectangularPackingShape, RectangularPackingItem> Decode(MultiComponentVectorEncoding solution, RectangularPackingShape binMeasures, ItemList<RectangularPackingItem> itemMeasures) {44 public static PackingPlan<PackingPosition, PackingShape, PackingItem> Decode(MultiComponentVectorEncoding solution, PackingShape binMeasures, ItemList<PackingItem> itemMeasures) { 45 45 Solution result = new Solution(binMeasures, true, false); 46 46 result.Pack(solution, itemMeasures); … … 48 48 } 49 49 50 public override PackingPlan<PackingPosition, RectangularPackingShape, RectangularPackingItem> CreatePackingPlanFromEncoding(IItem encodedSolution, RectangularPackingShape binMeasures, ItemList<RectangularPackingItem> itemMeasures) {50 public override PackingPlan<PackingPosition, PackingShape, PackingItem> CreatePackingPlanFromEncoding(IItem encodedSolution, PackingShape binMeasures, ItemList<PackingItem> itemMeasures) { 51 51 var solution = encodedSolution as MultiComponentVectorEncoding; 52 52 if (solution == null) throw new InvalidOperationException("Encoding is not of type MultiComponentVector"); -
branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.2D/3.3/Decoders/EP/ExtremePointPackingSequenceDecoder2D.cs
r14048 r14049 32 32 [Item("Identical bin, two dimensional, extreme points based decoder for the PackingSequence encoding.", "<Description missing...>")] // TODO 33 33 [StorableClass] 34 public class ExtremePointPackingSequenceDecoder2D : PackingSolutionDecoder<PackingPosition, RectangularPackingShape, RectangularPackingItem>, I2DPSDecoder {34 public class ExtremePointPackingSequenceDecoder2D : PackingSolutionDecoder<PackingPosition, PackingShape, PackingItem>, I2DPSDecoder { 35 35 public ExtremePointPackingSequenceDecoder2D () : base() {} 36 36 [StorableConstructor] … … 44 44 45 45 46 public override PackingPlan<PackingPosition, RectangularPackingShape, RectangularPackingItem> CreatePackingPlanFromEncoding(IItem encodedSolution, RectangularPackingShape binMeasures, ItemList<RectangularPackingItem> itemMeasures) {46 public override PackingPlan<PackingPosition, PackingShape, PackingItem> CreatePackingPlanFromEncoding(IItem encodedSolution, PackingShape binMeasures, ItemList<PackingItem> itemMeasures) { 47 47 var solution = encodedSolution as PackingSequenceEncoding; 48 48 if (solution == null) throw new InvalidOperationException("Encoding is not of type PackingSequence"); -
branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.2D/3.3/HeuristicLab.Problems.BinPacking2D-3.3.csproj
r14048 r14049 172 172 <Compile Include="MoveEvaluators\PackingMoveEvaluator2DMCV.cs" /> 173 173 <Compile Include="MoveEvaluators\PackingMoveEvaluator2DPS.cs" /> 174 <Compile Include="PackingItem.cs" /> 174 175 <Compile Include="PackingPosition.cs" /> 175 176 <Compile Include="PackingRatioRectangularIdenticalBinEvaluator.cs" /> 177 <Compile Include="PackingShape.cs" /> 176 178 <Compile Include="Plugin.cs" /> 179 <Compile Include="Problem.cs" /> 177 180 <Compile Include="Properties\AssemblyInfo.cs" /> 178 <Compile Include="RectangularIdenticalBinPackingProblem.cs" />179 <Compile Include="RectangularPackingItem.cs" />180 <Compile Include="RectangularPackingShape.cs" />181 181 <Compile Include="Solution.cs" /> 182 182 </ItemGroup> -
branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.2D/3.3/MoveEvaluators/PackingMoveEvaluator2DGV.cs
r14048 r14049 29 29 [Item("GroupingVectorMoveEvaluator2D", "Class for evaluating packing moves for 2dimensional problems.")] 30 30 [StorableClass] 31 public class PackingMoveEvaluator2DGV : PackingMoveEvaluator<PackingPosition, RectangularPackingShape, RectangularPackingItem>, ISingleObjectiveMoveEvaluator, IGroupingVectorMoveOperator, I2DOperator {31 public class PackingMoveEvaluator2DGV : PackingMoveEvaluator<PackingPosition, PackingShape, PackingItem>, ISingleObjectiveMoveEvaluator, IGroupingVectorMoveOperator, I2DOperator { 32 32 [StorableConstructor] 33 33 protected PackingMoveEvaluator2DGV(bool deserializing) : base(deserializing) { } -
branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.2D/3.3/MoveEvaluators/PackingMoveEvaluator2DMCV.cs
r14048 r14049 29 29 [Item("MultiComponentVectorMoveEvaluator2D", "Class for evaluating packing moves for 2dimensional problems.")] 30 30 [StorableClass] 31 public class PackingMoveEvaluator2DMCV : PackingMoveEvaluator<PackingPosition, RectangularPackingShape, RectangularPackingItem>, ISingleObjectiveMoveEvaluator, IMultiComponentVectorMoveOperator, I2DOperator {31 public class PackingMoveEvaluator2DMCV : PackingMoveEvaluator<PackingPosition, PackingShape, PackingItem>, ISingleObjectiveMoveEvaluator, IMultiComponentVectorMoveOperator, I2DOperator { 32 32 [StorableConstructor] 33 33 protected PackingMoveEvaluator2DMCV(bool deserializing) : base(deserializing) { } -
branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.2D/3.3/MoveEvaluators/PackingMoveEvaluator2DPS.cs
r14048 r14049 29 29 [Item("PackingSequenceMoveEvaluator2D", "Class for evaluating packing moves for 2dimensional problems.")] 30 30 [StorableClass] 31 public class PackingMoveEvaluator2DPS : PackingMoveEvaluator<PackingPosition, RectangularPackingShape, RectangularPackingItem>, ISingleObjectiveMoveEvaluator, IPackingSequenceMoveOperator, I2DOperator {31 public class PackingMoveEvaluator2DPS : PackingMoveEvaluator<PackingPosition, PackingShape, PackingItem>, ISingleObjectiveMoveEvaluator, IPackingSequenceMoveOperator, I2DOperator { 32 32 [StorableConstructor] 33 33 protected PackingMoveEvaluator2DPS(bool deserializing) : base(deserializing) { } -
branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.2D/3.3/PackingItem.cs
r14048 r14049 29 29 30 30 namespace HeuristicLab.Problems.BinPacking2D { 31 [Item(" RectangularPackingItem", "Represents a rectangular packing-item for bin-packing problems.")]31 [Item("PackingItem (2d)", "Represents a rectangular packing-item for bin-packing problems.")] 32 32 [StorableClass] 33 public class RectangularPackingItem : RectangularPackingShape, IPackingItem {33 public class PackingItem : PackingShape, IPackingItem { 34 34 35 public RectangularPackingShape TargetBin {36 get { return ((IValueParameter< RectangularPackingShape>)Parameters["TargetBin"]).Value; }37 set { ((IValueParameter< RectangularPackingShape>)Parameters["TargetBin"]).Value = value; }35 public PackingShape TargetBin { 36 get { return ((IValueParameter<PackingShape>)Parameters["TargetBin"]).Value; } 37 set { ((IValueParameter<PackingShape>)Parameters["TargetBin"]).Value = value; } 38 38 } 39 39 … … 49 49 50 50 [StorableConstructor] 51 protected RectangularPackingItem(bool deserializing) : base(deserializing) { }52 protected RectangularPackingItem(RectangularPackingItem original, Cloner cloner)51 protected PackingItem(bool deserializing) : base(deserializing) { } 52 protected PackingItem(PackingItem original, Cloner cloner) 53 53 : base(original, cloner) { 54 54 } 55 55 56 56 public override IDeepCloneable Clone(Cloner cloner) { 57 return new RectangularPackingItem(this, cloner);57 return new PackingItem(this, cloner); 58 58 } 59 59 60 public RectangularPackingItem()60 public PackingItem() 61 61 : base() { 62 Parameters.Add(new ValueParameter< RectangularPackingShape>("TargetBin"));62 Parameters.Add(new ValueParameter<PackingShape>("TargetBin")); 63 63 Parameters.Add(new FixedValueParameter<DoubleValue>("Weight")); 64 64 Parameters.Add(new FixedValueParameter<IntValue>("Material")); 65 65 } 66 66 67 public RectangularPackingItem(int width, int height, RectangularPackingShape targetBin)67 public PackingItem(int width, int height, PackingShape targetBin) 68 68 : this() { 69 69 this.Width = width; 70 70 this.Height = height; 71 this.TargetBin = ( RectangularPackingShape)targetBin.Clone();71 this.TargetBin = (PackingShape)targetBin.Clone(); 72 72 } 73 73 -
branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.2D/3.3/PackingRatioRectangularIdenticalBinEvaluator.cs
r14048 r14049 29 29 [Item("Packing-Ratio Rectangular Identical-Bin Evaluator", "Represents an evaluation-algorithm for rectangular-shaped bin-packing problems with identical bins which calculates the ratio between packed and unpacked space. Found in Falkenauer:1996")] 30 30 [StorableClass] 31 public class PackingRatioRectangularIdenticalBinEvaluator : PackingRatioRegularIdenticalBinEvaluator<PackingPosition, RectangularPackingShape, RectangularPackingItem> {31 public class PackingRatioRectangularIdenticalBinEvaluator : PackingRatioRegularIdenticalBinEvaluator<PackingPosition, PackingShape, PackingItem> { 32 32 33 33 [StorableConstructor] -
branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.2D/3.3/PackingShape.cs
r14048 r14049 30 30 31 31 namespace HeuristicLab.Problems.BinPacking2D { 32 [Item(" RectangularPackingShape", "Represents the rectangular measures (width, height) of a two-dimensional bin-packing object.")]32 [Item("PackingShape (2d)", "Represents the rectangular measures (width, height) of a two-dimensional bin-packing object.")] 33 33 [StorableClass] 34 public class RectangularPackingShape : PackingShape<PackingPosition>, IComparable<RectangularPackingShape> {34 public class PackingShape : PackingShape<PackingPosition>, IComparable<PackingShape> { 35 35 public int Height { 36 36 get { return ((IFixedValueParameter<IntValue>)Parameters["Height"]).Value.Value; } … … 44 44 45 45 [StorableConstructor] 46 protected RectangularPackingShape(bool deserializing) : base(deserializing) { }47 protected RectangularPackingShape(RectangularPackingShape original, Cloner cloner)46 protected PackingShape(bool deserializing) : base(deserializing) { } 47 protected PackingShape(PackingShape original, Cloner cloner) 48 48 : base(original, cloner) { 49 49 } 50 public RectangularPackingShape()50 public PackingShape() 51 51 : base() { 52 52 Parameters.Add(new FixedValueParameter<IntValue>("Width")); 53 53 Parameters.Add(new FixedValueParameter<IntValue>("Height")); 54 54 } 55 public RectangularPackingShape(int width, int height)55 public PackingShape(int width, int height) 56 56 : this() { 57 57 this.Height = height; … … 60 60 61 61 public override IDeepCloneable Clone(Cloner cloner) { 62 return new RectangularPackingShape(this, cloner);62 return new PackingShape(this, cloner); 63 63 } 64 64 … … 69 69 #region IComparable<RectangularPackingShape> Members 70 70 71 public int CompareTo( RectangularPackingShape other) {71 public int CompareTo(PackingShape other) { 72 72 int result = this.Width.CompareTo(other.Width); 73 73 if (result == 0) … … 77 77 78 78 public override int CompareTo(object obj) { 79 var other = obj as RectangularPackingShape;79 var other = obj as PackingShape; 80 80 if (other != null) return CompareTo(other); 81 81 else throw new ArgumentException(string.Format("Cannot compare to object {0}", obj), "obj"); … … 96 96 } 97 97 public override bool Encloses(PackingPosition checkedPosition, PackingShape<PackingPosition> checkedShape) { 98 return Encloses(checkedPosition, ( RectangularPackingShape)checkedShape);98 return Encloses(checkedPosition, (PackingShape)checkedShape); 99 99 } 100 private bool Encloses(PackingPosition checkedPosition, RectangularPackingShape checkedShape) {100 private bool Encloses(PackingPosition checkedPosition, PackingShape checkedShape) { 101 101 return Encloses(new RectangleDiagonal(this), new RectangleDiagonal(checkedPosition, checkedShape)); 102 102 } … … 109 109 110 110 public override bool Overlaps(PackingPosition myPosition, PackingPosition checkedPosition, PackingShape<PackingPosition> checkedShape) { 111 return Overlaps(myPosition, checkedPosition, ( RectangularPackingShape)checkedShape);111 return Overlaps(myPosition, checkedPosition, (PackingShape)checkedShape); 112 112 } 113 private bool Overlaps(PackingPosition myPosition, PackingPosition checkedPosition, RectangularPackingShape checkedShape) {113 private bool Overlaps(PackingPosition myPosition, PackingPosition checkedPosition, PackingShape checkedShape) { 114 114 return Overlaps(new RectangleDiagonal(myPosition, this), new RectangleDiagonal(checkedPosition, checkedShape)); 115 115 } … … 136 136 public int x2; 137 137 public int y2; 138 public RectangleDiagonal( RectangularPackingShape myShape) : this(new PackingPosition(0, 0, 0), myShape) { }139 public RectangleDiagonal(PackingPosition myPosition, RectangularPackingShape myShape) {138 public RectangleDiagonal(PackingShape myShape) : this(new PackingPosition(0, 0, 0), myShape) { } 139 public RectangleDiagonal(PackingPosition myPosition, PackingShape myShape) { 140 140 x1 = myPosition.X; 141 141 y1 = myPosition.Y; -
branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.2D/3.3/Problem.cs
r14048 r14049 38 38 [Creatable(CreatableAttribute.Categories.CombinatorialProblems, Priority = 300)] 39 39 // TODO: only support 2d BPPData 40 public class RectangularIdenticalBinPackingProblem : BinPackingProblem<PackingPosition, RectangularPackingShape, RectangularPackingItem>, IProblemInstanceConsumer<BPPData>, IProblemInstanceExporter<BPPData> {40 public class Problem : Problem<PackingPosition, PackingShape, PackingItem>, IProblemInstanceConsumer<BPPData>, IProblemInstanceExporter<BPPData> { 41 41 42 42 #region Default Instance … … 89 89 90 90 [StorableConstructor] 91 protected RectangularIdenticalBinPackingProblem(bool deserializing) : base(deserializing) { }92 protected RectangularIdenticalBinPackingProblem(RectangularIdenticalBinPackingProblem original, Cloner cloner)91 protected Problem(bool deserializing) : base(deserializing) { } 92 protected Problem(Problem original, Cloner cloner) 93 93 : base(original, cloner) { 94 94 } 95 95 public override IDeepCloneable Clone(Cloner cloner) { 96 return new RectangularIdenticalBinPackingProblem(this, cloner);96 return new Problem(this, cloner); 97 97 } 98 public RectangularIdenticalBinPackingProblem() : base(99 new PackingPlanEvaluationAlgorithm<Permutation, PackingPosition, RectangularPackingShape, RectangularPackingItem>()) {98 public Problem() : base( 99 new PackingPlanEvaluationAlgorithm<Permutation, PackingPosition, PackingShape, PackingItem>()) { 100 100 } 101 101 … … 103 103 public void Load(BPPData data) { 104 104 var realData = data as RealBPPData; 105 var binData = new RectangularPackingShape(data.BinMeasures[0], data.BinMeasures[1]);105 var binData = new PackingShape(data.BinMeasures[0], data.BinMeasures[1]); 106 106 107 var itemData = new ItemList< RectangularPackingItem>(data.Items);107 var itemData = new ItemList<PackingItem>(data.Items); 108 108 for (int j = 0; j < data.Items; j++) { 109 var bin = new RectangularPackingShape(data.BinMeasures[0], data.BinMeasures[1]);110 var item = new RectangularPackingItem(data.ItemMeasures[j][0], data.ItemMeasures[j][1], bin);109 var bin = new PackingShape(data.BinMeasures[0], data.BinMeasures[1]); 110 var item = new PackingItem(data.ItemMeasures[j][0], data.ItemMeasures[j][1], bin); 111 111 if (realData != null) { 112 112 item.Weight = realData.ItemWeights[j]; -
branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.2D/3.3/Solution.cs
r14048 r14049 28 28 [Item("Bin Packing Solution (2d)", "Represents a solution for a 2D bin packing problem.")] 29 29 [StorableClass] 30 public class Solution : PackingPlan<PackingPosition, RectangularPackingShape, RectangularPackingItem> {31 public Solution( RectangularPackingShape binMeasures) : this(binMeasures, false, false) { }32 public Solution( RectangularPackingShape binMeasures, bool useExtremePoints, bool stackingConstraints) : base(binMeasures, useExtremePoints, stackingConstraints) { }30 public class Solution : PackingPlan<PackingPosition, PackingShape, PackingItem> { 31 public Solution(PackingShape binMeasures) : this(binMeasures, false, false) { } 32 public Solution(PackingShape binMeasures, bool useExtremePoints, bool stackingConstraints) : base(binMeasures, useExtremePoints, stackingConstraints) { } 33 33 [StorableConstructor] 34 34 protected Solution(bool deserializing) : base(deserializing) { } … … 39 39 return new Solution(this, cloner); 40 40 } 41 public override BinPacking<PackingPosition, RectangularPackingShape, RectangularPackingItem> NewBinPacking() {41 public override BinPacking<PackingPosition, PackingShape, PackingItem> NewBinPacking() { 42 42 return new BinPacking2D(BinMeasures); 43 43 } -
branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.3D/3.3/BinPacking3D.cs
r14048 r14049 30 30 [Item("BinPacking3D", "Represents a single-bin packing for a 3D bin-packing problem.")] 31 31 [StorableClass] 32 public class BinPacking3D : BinPacking<PackingPosition, CuboidPackingShape, CuboidPackingItem> {33 34 public BinPacking3D( CuboidPackingShape binMeasures)32 public class BinPacking3D : BinPacking<PackingPosition, PackingShape, PackingItem> { 33 34 public BinPacking3D(PackingShape binMeasures) 35 35 : base(binMeasures) { 36 36 ExtremePoints = new SortedSet<PackingPosition>(new EPComparer3D()); … … 48 48 } 49 49 50 protected override void GenerateNewExtremePointsForNewItem( CuboidPackingItem newItem, PackingPosition position) {50 protected override void GenerateNewExtremePointsForNewItem(PackingItem newItem, PackingPosition position) { 51 51 int newWidth = position.Rotated ? newItem.Depth : newItem.Width; 52 52 int newDepth = position.Rotated ? newItem.Width : newItem.Depth; … … 146 146 } 147 147 148 public override PackingPosition FindExtremePointForItem( CuboidPackingItem measures, bool rotated, bool stackingConstraints) {149 150 CuboidPackingItem item = new CuboidPackingItem(148 public override PackingPosition FindExtremePointForItem(PackingItem measures, bool rotated, bool stackingConstraints) { 149 150 PackingItem item = new PackingItem( 151 151 rotated ? measures.Depth : measures.Width, 152 152 measures.Height, … … 170 170 } 171 171 172 public override PackingPosition FindPositionBySliding( CuboidPackingItem measures, bool rotated) {172 public override PackingPosition FindPositionBySliding(PackingItem measures, bool rotated) { 173 173 //Starting-position at upper right corner (=left bottom point of item-rectangle is at position item.width,item.height) 174 174 PackingPosition currentPosition = new PackingPosition(0, … … 197 197 } 198 198 199 public override void SlidingBasedPacking(ref List<int> sequence, ItemList< CuboidPackingItem> itemMeasures) {199 public override void SlidingBasedPacking(ref List<int> sequence, ItemList<PackingItem> itemMeasures) { 200 200 var temp = new List<int>(sequence); 201 201 for (int i = 0; i < temp.Count; i++) { … … 208 208 } 209 209 } 210 public override void SlidingBasedPacking(ref List<int> sequence, ItemList< CuboidPackingItem> itemMeasures, Dictionary<int, bool> rotationArray) {210 public override void SlidingBasedPacking(ref List<int> sequence, ItemList<PackingItem> itemMeasures, Dictionary<int, bool> rotationArray) { 211 211 var temp = new List<int>(sequence); 212 212 for (int i = 0; i < temp.Count; i++) { … … 219 219 } 220 220 } 221 public override void ExtremePointBasedPacking(ref List<int> sequence, ItemList< CuboidPackingItem> itemMeasures, bool stackingConstraints) {221 public override void ExtremePointBasedPacking(ref List<int> sequence, ItemList<PackingItem> itemMeasures, bool stackingConstraints) { 222 222 var temp = new List<int>(sequence); 223 223 foreach (int itemID in temp) { … … 230 230 } 231 231 } 232 public override void ExtremePointBasedPacking(ref List<int> sequence, ItemList< CuboidPackingItem> itemMeasures, bool stackingConstraints, Dictionary<int, bool> rotationArray) {232 public override void ExtremePointBasedPacking(ref List<int> sequence, ItemList<PackingItem> itemMeasures, bool stackingConstraints, Dictionary<int, bool> rotationArray) { 233 233 var temp = new List<int>(sequence); 234 234 foreach (int itemID in temp) { … … 271 271 return shortestSide; 272 272 } 273 public override bool IsStaticStable( CuboidPackingItem item, PackingPosition position) {273 public override bool IsStaticStable(PackingItem item, PackingPosition position) { 274 274 //Static stability is given, if item is placed on the ground 275 275 if (position.Y == 0) … … 314 314 } 315 315 316 public bool IsSupportedByAtLeastOnePoint( CuboidPackingItem item, PackingPosition position) {316 public bool IsSupportedByAtLeastOnePoint(PackingItem item, PackingPosition position) { 317 317 if (position.Y == 0) 318 318 return true; … … 326 326 return false; 327 327 } 328 public bool IsWeightSupported( CuboidPackingItem item, PackingPosition ep) {328 public bool IsWeightSupported(PackingItem item, PackingPosition ep) { 329 329 if (ep.Y == 0) 330 330 return true; … … 345 345 } 346 346 } 347 protected override void AddNewItemToOccupationLayers(int itemID, CuboidPackingItem measures, PackingPosition position) {347 protected override void AddNewItemToOccupationLayers(int itemID, PackingItem measures, PackingPosition position) { 348 348 int z1 = position.Z / 10; 349 349 int z2 = (position.Z + (position.Rotated ? measures.Width : measures.Depth)) / 10; … … 355 355 return OccupationLayers[position.Z / 10]; 356 356 } 357 protected override List<int> GetLayerItemIDs( CuboidPackingItem measures, PackingPosition position) {357 protected override List<int> GetLayerItemIDs(PackingItem measures, PackingPosition position) { 358 358 List<int> result = new List<int>(); 359 359 int z1 = position.Z / 10; -
branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.3D/3.3/Decoders/DBL/DeepestBottomLeftGroupingVectorDecoder.cs
r14048 r14049 31 31 [Item("Identical bin, three dimensional, GroupingVector-decoder", "<Description missing...>")] 32 32 [StorableClass] 33 public class DeepestBottomLeftGroupingVectorDecoder : PackingSolutionDecoder<PackingPosition, CuboidPackingShape, CuboidPackingItem>, I3DGVDecoder {33 public class DeepestBottomLeftGroupingVectorDecoder : PackingSolutionDecoder<PackingPosition, PackingShape, PackingItem>, I3DGVDecoder { 34 34 public DeepestBottomLeftGroupingVectorDecoder() : base() {} 35 35 [StorableConstructor] … … 42 42 } 43 43 44 public override PackingPlan<PackingPosition, CuboidPackingShape, CuboidPackingItem> CreatePackingPlanFromEncoding(IItem encodedSolution, CuboidPackingShape binMeasures, ItemList<CuboidPackingItem> itemMeasures) {44 public override PackingPlan<PackingPosition, PackingShape, PackingItem> CreatePackingPlanFromEncoding(IItem encodedSolution, PackingShape binMeasures, ItemList<PackingItem> itemMeasures) { 45 45 var solution = encodedSolution as GroupingVectorEncoding; 46 46 if (solution == null) throw new InvalidOperationException("Encoding is not of type GroupingVector"); -
branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.3D/3.3/Decoders/DBL/DeepestBottomLeftMultiComponentVectorDecoder.cs
r14048 r14049 31 31 [Item("Identical bin, three dimensional, MultiComponentVector-decoder", "<Description missing...>")] 32 32 [StorableClass] 33 public class DeepestBottomLeftMultiComponentVectorDecoder : PackingSolutionDecoder<PackingPosition, CuboidPackingShape, CuboidPackingItem>, I3DMCVDecoder {33 public class DeepestBottomLeftMultiComponentVectorDecoder : PackingSolutionDecoder<PackingPosition, PackingShape, PackingItem>, I3DMCVDecoder { 34 34 public DeepestBottomLeftMultiComponentVectorDecoder() : base() { } 35 35 [StorableConstructor] … … 42 42 } 43 43 44 public override PackingPlan<PackingPosition, CuboidPackingShape, CuboidPackingItem> CreatePackingPlanFromEncoding(IItem encodedSolution, CuboidPackingShape binMeasures, ItemList<CuboidPackingItem> itemMeasures) {44 public override PackingPlan<PackingPosition, PackingShape, PackingItem> CreatePackingPlanFromEncoding(IItem encodedSolution, PackingShape binMeasures, ItemList<PackingItem> itemMeasures) { 45 45 var solution = encodedSolution as MultiComponentVectorEncoding; 46 46 if (solution == null) throw new InvalidOperationException("Encoding is not of type MultiComponent Vector"); -
branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.3D/3.3/Decoders/DBL/DeepestBottomLeftPackingSequenceDecoder.cs
r14048 r14049 31 31 [Item("Identical bin, three dimensional, PackingSequence-decoder", "<Description missing...>")] 32 32 [StorableClass] 33 public class DeepestBottomLeftPackingSequenceDecoder : PackingSolutionDecoder<PackingPosition, CuboidPackingShape, CuboidPackingItem>, I3DPSDecoder {33 public class DeepestBottomLeftPackingSequenceDecoder : PackingSolutionDecoder<PackingPosition, PackingShape, PackingItem>, I3DPSDecoder { 34 34 public DeepestBottomLeftPackingSequenceDecoder(): base() {} 35 35 [StorableConstructor] … … 42 42 } 43 43 44 public override PackingPlan<PackingPosition, CuboidPackingShape, CuboidPackingItem> CreatePackingPlanFromEncoding(IItem encodedSolution, CuboidPackingShape binMeasures, ItemList<CuboidPackingItem> itemMeasures) {44 public override PackingPlan<PackingPosition, PackingShape, PackingItem> CreatePackingPlanFromEncoding(IItem encodedSolution, PackingShape binMeasures, ItemList<PackingItem> itemMeasures) { 45 45 var solution = encodedSolution as PackingSequenceEncoding; 46 46 if (solution == null) throw new InvalidOperationException("Encoding is not of type PackingSequence"); -
branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.3D/3.3/Decoders/EP/ExtremePointGroupingVectorDecoder3D.cs
r14048 r14049 31 31 [Item("Identical bin, three dimensional, extreme points based decoder for the GroupingVector encoding.", "<Description missing...>")] 32 32 [StorableClass] 33 public class ExtremePointGroupingVectorDecoder3D : PackingSolutionDecoder<PackingPosition, CuboidPackingShape, CuboidPackingItem>, I3DGVDecoder {33 public class ExtremePointGroupingVectorDecoder3D : PackingSolutionDecoder<PackingPosition, PackingShape, PackingItem>, I3DGVDecoder { 34 34 public ExtremePointGroupingVectorDecoder3D() : base() { } 35 35 [StorableConstructor] … … 42 42 } 43 43 44 public static PackingPlan<PackingPosition, CuboidPackingShape, CuboidPackingItem> Decode(GroupingVectorEncoding solution, CuboidPackingShape binMeasures, ItemList<CuboidPackingItem> itemMeasures, bool stackingConstraints) {44 public static PackingPlan<PackingPosition, PackingShape, PackingItem> Decode(GroupingVectorEncoding solution, PackingShape binMeasures, ItemList<PackingItem> itemMeasures, bool stackingConstraints) { 45 45 Solution result = new Solution(binMeasures, true, stackingConstraints); 46 46 result.Pack(solution, itemMeasures); … … 48 48 } 49 49 50 public override PackingPlan<PackingPosition, CuboidPackingShape, CuboidPackingItem> CreatePackingPlanFromEncoding(IItem encodedSolution, CuboidPackingShape binMeasures, ItemList<CuboidPackingItem> itemMeasures) {50 public override PackingPlan<PackingPosition, PackingShape, PackingItem> CreatePackingPlanFromEncoding(IItem encodedSolution, PackingShape binMeasures, ItemList<PackingItem> itemMeasures) { 51 51 var solution = encodedSolution as GroupingVectorEncoding; 52 52 if (solution == null) throw new InvalidOperationException("Encoding is not of type GroupingVector"); -
branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.3D/3.3/Decoders/EP/ExtremePointMultiComponentVectorDecoder3D.cs
r14048 r14049 31 31 [Item("Identical bin, three dimensional, extreme points based decoder for the MultiComponentVector encoding.", "<Description missing...>")] 32 32 [StorableClass] 33 public class ExtremePointMultiComponentVectorDecoder3D : PackingSolutionDecoder<PackingPosition, CuboidPackingShape, CuboidPackingItem>, I3DMCVDecoder {33 public class ExtremePointMultiComponentVectorDecoder3D : PackingSolutionDecoder<PackingPosition, PackingShape, PackingItem>, I3DMCVDecoder { 34 34 public ExtremePointMultiComponentVectorDecoder3D () : base() { } 35 35 [StorableConstructor] … … 42 42 } 43 43 44 public static PackingPlan<PackingPosition, CuboidPackingShape, CuboidPackingItem> Decode(MultiComponentVectorEncoding solution, CuboidPackingShape binMeasures, ItemList<CuboidPackingItem> itemMeasures, bool stackingConstraints) {44 public static PackingPlan<PackingPosition, PackingShape, PackingItem> Decode(MultiComponentVectorEncoding solution, PackingShape binMeasures, ItemList<PackingItem> itemMeasures, bool stackingConstraints) { 45 45 Solution result = new Solution(binMeasures, true, stackingConstraints); 46 46 result.Pack(solution, itemMeasures); … … 48 48 } 49 49 50 public override PackingPlan<PackingPosition, CuboidPackingShape, CuboidPackingItem> CreatePackingPlanFromEncoding(IItem encodedSolution, CuboidPackingShape binMeasures, ItemList<CuboidPackingItem> itemMeasures) {50 public override PackingPlan<PackingPosition, PackingShape, PackingItem> CreatePackingPlanFromEncoding(IItem encodedSolution, PackingShape binMeasures, ItemList<PackingItem> itemMeasures) { 51 51 var solution = encodedSolution as MultiComponentVectorEncoding; 52 52 if (solution == null) throw new InvalidOperationException("Encoding is not of type MultiComponentVector"); -
branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.3D/3.3/Decoders/EP/ExtremePointPackingSequenceDecoder3D.cs
r14048 r14049 32 32 [Item("Identical bin, three dimensional, extreme points based decoder for the PackingSequence encoding.", "<Description missing...>")] 33 33 [StorableClass] 34 public class ExtremePointPackingSequenceDecoder3D : PackingSolutionDecoder<PackingPosition, CuboidPackingShape, CuboidPackingItem>, I3DPSDecoder {34 public class ExtremePointPackingSequenceDecoder3D : PackingSolutionDecoder<PackingPosition, PackingShape, PackingItem>, I3DPSDecoder { 35 35 public ExtremePointPackingSequenceDecoder3D () : base() {} 36 36 [StorableConstructor] … … 44 44 45 45 46 public override PackingPlan<PackingPosition, CuboidPackingShape, CuboidPackingItem> CreatePackingPlanFromEncoding(IItem encodedSolution, CuboidPackingShape binMeasures, ItemList<CuboidPackingItem> itemMeasures) {46 public override PackingPlan<PackingPosition, PackingShape, PackingItem> CreatePackingPlanFromEncoding(IItem encodedSolution, PackingShape binMeasures, ItemList<PackingItem> itemMeasures) { 47 47 var solution = encodedSolution as PackingSequenceEncoding; 48 48 if (solution == null) throw new InvalidOperationException("Encoding is not of type PackingSequence"); -
branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.3D/3.3/HeuristicLab.Problems.BinPacking3D-3.3.csproj
r14048 r14049 159 159 <ItemGroup> 160 160 <Compile Include="BinPacking3D.cs" /> 161 <Compile Include="CuboidIdenticalBinPackingProblem.cs" />162 <Compile Include="CuboidPackingItem.cs" />163 <Compile Include="CuboidPackingShape.cs" />164 161 <Compile Include="DecoderInterfaces\I3DGVDecoder.cs" /> 165 162 <Compile Include="DecoderInterfaces\I3DMCVDecoder.cs" /> … … 175 172 <Compile Include="MoveEvaluators\PackingMoveEvaluator3DMCV.cs" /> 176 173 <Compile Include="MoveEvaluators\PackingMoveEvaluator3DPS.cs" /> 174 <Compile Include="PackingItem.cs" /> 177 175 <Compile Include="PackingPosition.cs" /> 178 176 <Compile Include="PackingRatioCuboidIdenticalBinEvaluator.cs" /> 177 <Compile Include="PackingShape.cs" /> 179 178 <Compile Include="Plugin.cs" /> 179 <Compile Include="Problem.cs" /> 180 180 <Compile Include="Properties\AssemblyInfo.cs" /> 181 181 <Compile Include="Solution.cs" /> -
branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.3D/3.3/MoveEvaluators/PackingMoveEvaluator3DGV.cs
r14048 r14049 30 30 [Item("GroupingVectorMoveEvaluator3D", "Class for evaluating packing moves for 3dimensional problems.")] 31 31 [StorableClass] 32 public class PackingMoveEvaluator3DGV : PackingMoveEvaluator<PackingPosition, CuboidPackingShape, CuboidPackingItem>, ISingleObjectiveMoveEvaluator, IGroupingVectorMoveOperator, I3DOperator {32 public class PackingMoveEvaluator3DGV : PackingMoveEvaluator<PackingPosition, PackingShape, PackingItem>, ISingleObjectiveMoveEvaluator, IGroupingVectorMoveOperator, I3DOperator { 33 33 [StorableConstructor] 34 34 protected PackingMoveEvaluator3DGV(bool deserializing) : base(deserializing) { } -
branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.3D/3.3/MoveEvaluators/PackingMoveEvaluator3DMCV.cs
r14048 r14049 30 30 [Item("MultiComponentVectorMoveEvaluator3D", "Class for evaluating packing moves for 3dimensional problems.")] 31 31 [StorableClass] 32 public class PackingMoveEvaluator3DMCV : PackingMoveEvaluator<PackingPosition, CuboidPackingShape, CuboidPackingItem>, ISingleObjectiveMoveEvaluator, IMultiComponentVectorMoveOperator, I3DOperator {32 public class PackingMoveEvaluator3DMCV : PackingMoveEvaluator<PackingPosition, PackingShape, PackingItem>, ISingleObjectiveMoveEvaluator, IMultiComponentVectorMoveOperator, I3DOperator { 33 33 [StorableConstructor] 34 34 protected PackingMoveEvaluator3DMCV(bool deserializing) : base(deserializing) { } -
branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.3D/3.3/MoveEvaluators/PackingMoveEvaluator3DPS.cs
r14048 r14049 30 30 [Item("PackingSequenceMoveEvaluator3D", "Class for evaluating packing moves for 3dimensional problems.")] 31 31 [StorableClass] 32 public class PackingMoveEvaluator3DPS : PackingMoveEvaluator<PackingPosition, CuboidPackingShape, CuboidPackingItem>, ISingleObjectiveMoveEvaluator, IPackingSequenceMoveOperator, I3DOperator {32 public class PackingMoveEvaluator3DPS : PackingMoveEvaluator<PackingPosition, PackingShape, PackingItem>, ISingleObjectiveMoveEvaluator, IPackingSequenceMoveOperator, I3DOperator { 33 33 [StorableConstructor] 34 34 protected PackingMoveEvaluator3DPS(bool deserializing) : base(deserializing) { } -
branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.3D/3.3/PackingItem.cs
r14048 r14049 28 28 29 29 namespace HeuristicLab.Problems.BinPacking3D { 30 [Item(" CuboidPackingItem", "Represents a cuboidic packing-item for bin-packing problems.")]30 [Item("PackingItem (3d)", "Represents a cuboidic packing-item for bin-packing problems.")] 31 31 [StorableClass] 32 public class CuboidPackingItem : CuboidPackingShape, IPackingItem {33 public IValueParameter< CuboidPackingShape> TargetBinParameter {34 get { return (IValueParameter< CuboidPackingShape>)Parameters["TargetBin"]; }32 public class PackingItem : PackingShape, IPackingItem { 33 public IValueParameter<PackingShape> TargetBinParameter { 34 get { return (IValueParameter<PackingShape>)Parameters["TargetBin"]; } 35 35 } 36 36 public IFixedValueParameter<DoubleValue> WeightParameter { … … 41 41 } 42 42 43 public CuboidPackingShape TargetBin {43 public PackingShape TargetBin { 44 44 get { return TargetBinParameter.Value; } 45 45 set { TargetBinParameter.Value = value; } … … 61 61 62 62 [StorableConstructor] 63 protected CuboidPackingItem(bool deserializing) : base(deserializing) { }64 protected CuboidPackingItem(CuboidPackingItem original, Cloner cloner)63 protected PackingItem(bool deserializing) : base(deserializing) { } 64 protected PackingItem(PackingItem original, Cloner cloner) 65 65 : base(original, cloner) { 66 66 RegisterEvents(); 67 67 } 68 public CuboidPackingItem()68 public PackingItem() 69 69 : base() { 70 Parameters.Add(new ValueParameter< CuboidPackingShape>("TargetBin"));70 Parameters.Add(new ValueParameter<PackingShape>("TargetBin")); 71 71 Parameters.Add(new FixedValueParameter<DoubleValue>("Weight")); 72 72 Parameters.Add(new FixedValueParameter<IntValue>("Material")); … … 75 75 } 76 76 77 public CuboidPackingItem(int width, int height, int depth, CuboidPackingShape targetBin, double weight, int material)77 public PackingItem(int width, int height, int depth, PackingShape targetBin, double weight, int material) 78 78 : this() { 79 79 this.Width = width; … … 82 82 this.Weight = weight; 83 83 this.Material = material; 84 this.TargetBin = ( CuboidPackingShape)targetBin.Clone();84 this.TargetBin = (PackingShape)targetBin.Clone(); 85 85 } 86 86 87 public CuboidPackingItem(int width, int height, int depth, CuboidPackingShape targetBin)87 public PackingItem(int width, int height, int depth, PackingShape targetBin) 88 88 : this() { 89 89 this.Width = width; 90 90 this.Height = height; 91 91 this.Depth = depth; 92 this.TargetBin = ( CuboidPackingShape)targetBin.Clone();92 this.TargetBin = (PackingShape)targetBin.Clone(); 93 93 } 94 94 … … 99 99 100 100 public override IDeepCloneable Clone(Cloner cloner) { 101 return new CuboidPackingItem(this, cloner);101 return new PackingItem(this, cloner); 102 102 } 103 103 -
branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.3D/3.3/PackingRatioCuboidIdenticalBinEvaluator.cs
r14048 r14049 28 28 [Item("Packing-Ratio Cuboid Identical-Bin Evaluator", "Represents an evaluation-algorithm for cuboid-shaped bin-packing problems with identical bins which calculates the ratio between packed and unpacked space. Found in Falkenauer:1996")] 29 29 [StorableClass] 30 public class PackingRatioCuboidIdenticalBinEvaluator : PackingRatioRegularIdenticalBinEvaluator<PackingPosition, CuboidPackingShape, CuboidPackingItem> {30 public class PackingRatioCuboidIdenticalBinEvaluator : PackingRatioRegularIdenticalBinEvaluator<PackingPosition, PackingShape, PackingItem> { 31 31 32 32 [StorableConstructor] -
branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.3D/3.3/PackingShape.cs
r14048 r14049 29 29 30 30 namespace HeuristicLab.Problems.BinPacking3D { 31 [Item(" CuboidPackingShape", "Represents the cuboid measures (width, height, depth) of a three-dimensional cuboidic bin-packing object.")]31 [Item("PackingShape (3d)", "Represents the cuboid measures (width, height, depth) of a three-dimensional cuboidic bin-packing object.")] 32 32 [StorableClass] 33 public class CuboidPackingShape : PackingShape<PackingPosition>, IComparable<CuboidPackingShape> {33 public class PackingShape : PackingShape<PackingPosition>, IComparable<PackingShape> { 34 34 public IFixedValueParameter<IntValue> HeightParameter { 35 35 get { return (IFixedValueParameter<IntValue>)Parameters["Height"]; } … … 58 58 59 59 [StorableConstructor] 60 protected CuboidPackingShape(bool deserializing) : base(deserializing) { }61 protected CuboidPackingShape(CuboidPackingShape original, Cloner cloner)60 protected PackingShape(bool deserializing) : base(deserializing) { } 61 protected PackingShape(PackingShape original, Cloner cloner) 62 62 : base(original, cloner) { 63 63 RegisterEvents(); 64 64 } 65 public CuboidPackingShape()65 public PackingShape() 66 66 : base() { 67 67 Parameters.Add(new FixedValueParameter<IntValue>("Width")); … … 72 72 } 73 73 74 public CuboidPackingShape(int width, int height, int depth)74 public PackingShape(int width, int height, int depth) 75 75 : this() { 76 76 this.Width = width; … … 80 80 81 81 public override IDeepCloneable Clone(Cloner cloner) { 82 return new CuboidPackingShape(this, cloner);82 return new PackingShape(this, cloner); 83 83 } 84 84 … … 101 101 #region IComparable Members 102 102 103 public int CompareTo( CuboidPackingShape other) {103 public int CompareTo(PackingShape other) { 104 104 //Using "Clustered-Area-Height"-comparison as descr 105 105 … … 114 114 115 115 public override int CompareTo(object obj) { 116 var other = ( CuboidPackingShape)obj;116 var other = (PackingShape)obj; 117 117 if (other != null) return CompareTo(other); 118 118 else throw new ArgumentException(string.Format("Cannot compare with object {0}", obj), "obj"); … … 128 128 public int y2; 129 129 public int z2; 130 public CuboidDiagonal( CuboidPackingShape myShape) : this(new PackingPosition(0, 0, 0, 0), myShape) { }131 public CuboidDiagonal(PackingPosition myPosition, CuboidPackingShape myShape) {130 public CuboidDiagonal(PackingShape myShape) : this(new PackingPosition(0, 0, 0, 0), myShape) { } 131 public CuboidDiagonal(PackingPosition myPosition, PackingShape myShape) { 132 132 x1 = myPosition.X; 133 133 y1 = myPosition.Y; … … 153 153 } 154 154 public override bool Encloses(PackingPosition checkedPosition, PackingShape<PackingPosition> checkedShape) { 155 return Encloses(checkedPosition, ( CuboidPackingShape)checkedShape);155 return Encloses(checkedPosition, (PackingShape)checkedShape); 156 156 } 157 private bool Encloses(PackingPosition checkedPosition, CuboidPackingShape checkedShape) {157 private bool Encloses(PackingPosition checkedPosition, PackingShape checkedShape) { 158 158 return Encloses(new CuboidDiagonal(this), new CuboidDiagonal(checkedPosition, checkedShape)); 159 159 } … … 168 168 169 169 public override bool Overlaps(PackingPosition myPosition, PackingPosition checkedPosition, PackingShape<PackingPosition> checkedShape) { 170 return Overlaps(myPosition, checkedPosition, ( CuboidPackingShape)checkedShape);170 return Overlaps(myPosition, checkedPosition, (PackingShape)checkedShape); 171 171 } 172 private bool Overlaps(PackingPosition myPosition, PackingPosition checkedPosition, CuboidPackingShape checkedShape) {172 private bool Overlaps(PackingPosition myPosition, PackingPosition checkedPosition, PackingShape checkedShape) { 173 173 return Overlaps(new CuboidDiagonal(myPosition, this), new CuboidDiagonal(checkedPosition, checkedShape)); 174 174 } -
branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.3D/3.3/Problem.cs
r14048 r14049 38 38 [Creatable(CreatableAttribute.Categories.CombinatorialProblems, Priority = 310)] 39 39 // TODO don't support generic BPPData but only 3d BPPData 40 public class CuboidIdenticalBinPackingProblem : BinPackingProblem<PackingPosition, CuboidPackingShape, CuboidPackingItem>, IProblemInstanceConsumer<BPPData>, IProblemInstanceExporter<BPPData> {40 public class Problem : Problem<PackingPosition, PackingShape, PackingItem>, IProblemInstanceConsumer<BPPData>, IProblemInstanceExporter<BPPData> { 41 41 42 42 … … 94 94 95 95 [StorableConstructor] 96 protected CuboidIdenticalBinPackingProblem(bool deserializing) : base(deserializing) { }97 protected CuboidIdenticalBinPackingProblem(CuboidIdenticalBinPackingProblem original, Cloner cloner)96 protected Problem(bool deserializing) : base(deserializing) { } 97 protected Problem(Problem original, Cloner cloner) 98 98 : base(original, cloner) { 99 99 } 100 100 public override IDeepCloneable Clone(Cloner cloner) { 101 return new CuboidIdenticalBinPackingProblem(this, cloner);101 return new Problem(this, cloner); 102 102 } 103 public CuboidIdenticalBinPackingProblem() : base(104 new PackingPlanEvaluationAlgorithm<Permutation, PackingPosition, CuboidPackingShape, CuboidPackingItem>()) {103 public Problem() : base( 104 new PackingPlanEvaluationAlgorithm<Permutation, PackingPosition, PackingShape, PackingItem>()) { 105 105 } 106 106 … … 109 109 public void Load(BPPData data) { 110 110 var realData = data as RealBPPData; 111 var binData = new CuboidPackingShape(data.BinMeasures[0], data.BinMeasures[1], data.BinMeasures[2]);111 var binData = new PackingShape(data.BinMeasures[0], data.BinMeasures[1], data.BinMeasures[2]); 112 112 113 var itemData = new ItemList< CuboidPackingItem>(data.Items);113 var itemData = new ItemList<PackingItem>(data.Items); 114 114 for (int j = 0; j < data.Items; j++) { 115 var bin = new CuboidPackingShape(data.BinMeasures[0], data.BinMeasures[1], data.BinMeasures[2]);116 var item = new CuboidPackingItem(data.ItemMeasures[j][0], data.ItemMeasures[j][1], data.ItemMeasures[j][2], bin);115 var bin = new PackingShape(data.BinMeasures[0], data.BinMeasures[1], data.BinMeasures[2]); 116 var item = new PackingItem(data.ItemMeasures[j][0], data.ItemMeasures[j][1], data.ItemMeasures[j][2], bin); 117 117 if (realData != null) { 118 118 item.Weight = realData.ItemWeights[j]; -
branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.3D/3.3/Solution.cs
r14048 r14049 7 7 [Item("Bin Packing Solution (3d)", "Represents a solution for a 3D bin packing problem.")] 8 8 [StorableClass] 9 public class Solution : PackingPlan<PackingPosition, CuboidPackingShape, CuboidPackingItem> {10 public Solution( CuboidPackingShape binMeasures) : this(binMeasures, false, false) { }11 public Solution( CuboidPackingShape binMeasures, bool useExtremePoints, bool stackingConstraints) : base(binMeasures, useExtremePoints, stackingConstraints) { }9 public class Solution : PackingPlan<PackingPosition, PackingShape, PackingItem> { 10 public Solution(PackingShape binMeasures) : this(binMeasures, false, false) { } 11 public Solution(PackingShape binMeasures, bool useExtremePoints, bool stackingConstraints) : base(binMeasures, useExtremePoints, stackingConstraints) { } 12 12 [StorableConstructor] 13 13 protected Solution(bool deserializing) : base(deserializing) { } … … 18 18 return new Solution(this, cloner); 19 19 } 20 public override BinPacking<PackingPosition, CuboidPackingShape, CuboidPackingItem> NewBinPacking() {20 public override BinPacking<PackingPosition, PackingShape, PackingItem> NewBinPacking() { 21 21 return new BinPacking3D(BinMeasures); 22 22 } -
branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.Views/3.3/Container2DView.xaml.cs
r14048 r14049 33 33 private int selectedItemKey; 34 34 private Size renderSize; 35 private BinPacking<BinPacking2D.PackingPosition, RectangularPackingShape, RectangularPackingItem> packing;36 public BinPacking<BinPacking2D.PackingPosition, RectangularPackingShape, RectangularPackingItem> Packing {35 private BinPacking<BinPacking2D.PackingPosition, PackingShape, PackingItem> packing; 36 public BinPacking<BinPacking2D.PackingPosition, PackingShape, PackingItem> Packing { 37 37 get { return packing; } 38 38 set { -
branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.Views/3.3/Container3DView.xaml.cs
r14048 r14049 35 35 private int selectedItemKey; 36 36 37 private BinPacking<BinPacking3D.PackingPosition, CuboidPackingShape, CuboidPackingItem> packing;38 public BinPacking<BinPacking3D.PackingPosition, CuboidPackingShape, CuboidPackingItem> Packing {37 private BinPacking<BinPacking3D.PackingPosition, PackingShape, PackingItem> packing; 38 public BinPacking<BinPacking3D.PackingPosition, PackingShape, PackingItem> Packing { 39 39 get { return packing; } 40 40 set { -
branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.Views/3.3/PackingPlan2DView.cs
r14048 r14049 28 28 namespace HeuristicLab.Problems.BinPacking.Views { 29 29 [View("2-dimensional packing plan view")] 30 [Content(typeof(PackingPlan<BinPacking2D.PackingPosition, RectangularPackingShape, RectangularPackingItem>), true)]30 [Content(typeof(PackingPlan<BinPacking2D.PackingPosition, PackingShape, PackingItem>), true)] 31 31 public partial class PackingPlan2DView : ItemView { 32 32 … … 35 35 } 36 36 37 public new PackingPlan<BinPacking2D.PackingPosition, RectangularPackingShape, RectangularPackingItem> Content {38 get { return (PackingPlan<BinPacking2D.PackingPosition, RectangularPackingShape, RectangularPackingItem>)base.Content; }37 public new PackingPlan<BinPacking2D.PackingPosition, PackingShape, PackingItem> Content { 38 get { return (PackingPlan<BinPacking2D.PackingPosition, PackingShape, PackingItem>)base.Content; } 39 39 set { base.Content = value; } 40 40 } … … 56 56 } 57 57 58 private void UpdateState(PackingPlan<BinPacking2D.PackingPosition, RectangularPackingShape, RectangularPackingItem> plan) {58 private void UpdateState(PackingPlan<BinPacking2D.PackingPosition, PackingShape, PackingItem> plan) { 59 59 int currentBin = (binSelection != null && binSelection.SelectedItem != null) ? (int)(binSelection.SelectedItem) : 0; 60 60 container2DView.Packing = plan.BinPackings[currentBin]; -
branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.Views/3.3/PackingPlan3DView.cs
r14048 r14049 28 28 namespace HeuristicLab.Problems.BinPacking.Views { 29 29 [View("3-dimensional packing plan View")] 30 [Content(typeof(PackingPlan<BinPacking3D.PackingPosition, CuboidPackingShape, CuboidPackingItem>), true)]30 [Content(typeof(PackingPlan<BinPacking3D.PackingPosition, PackingShape, PackingItem>), true)] 31 31 public partial class PackingPlan3DView : ItemView { 32 32 … … 35 35 } 36 36 37 public new PackingPlan<BinPacking3D.PackingPosition, CuboidPackingShape, CuboidPackingItem> Content {38 get { return (PackingPlan<BinPacking3D.PackingPosition, CuboidPackingShape, CuboidPackingItem>)base.Content; }37 public new PackingPlan<BinPacking3D.PackingPosition, PackingShape, PackingItem> Content { 38 get { return (PackingPlan<BinPacking3D.PackingPosition, PackingShape, PackingItem>)base.Content; } 39 39 set { base.Content = value; } 40 40 } -
branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/HeuristicLab.Problems.BinPacking-3.3.csproj
r14048 r14049 160 160 <Compile Include="Analyzers\BestBinPackingSolutionAnalyzer.cs" /> 161 161 <Compile Include="Analyzers\BinPackingAnalyzer.cs" /> 162 <Compile Include="BinPackingProblem.cs" />163 162 <Compile Include="Encodings\GroupingVector\GroupingVectorSwap2Manipulator.cs" /> 164 163 <Compile Include="Encodings\GroupingVector\GroupingVectorSinglePointCrossover.cs" /> … … 287 286 <Compile Include="PackingSolutionDecoder.cs" /> 288 287 <Compile Include="Plugin.cs" /> 288 <Compile Include="Problem.cs" /> 289 289 <Compile Include="Properties\AssemblyInfo.cs" /> 290 290 </ItemGroup> -
branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/PackingShape.cs
r14048 r14049 29 29 30 30 namespace HeuristicLab.Problems.BinPacking { 31 [Item("PackingShape", "Represents an abstract shape to describe the measures and the positioning of objects related to bin-packing problems.")]32 31 [StorableClass] 33 32 public abstract class PackingShape<T> : Item, IPackingShape, IParameterizedItem -
branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Problem.cs
r14048 r14049 35 35 36 36 namespace HeuristicLab.Problems.BinPacking { 37 [Item("BinPackingProblem", "Abstract class that represents a BinPacking Problem")]38 37 [StorableClass] 39 public abstract class BinPackingProblem<D, B, I> : SingleObjectiveHeuristicOptimizationProblem<IPackingPlanEvaluationAlgorithm, IPackingSolutionCreator>38 public abstract class Problem<D, B, I> : SingleObjectiveHeuristicOptimizationProblem<IPackingPlanEvaluationAlgorithm, IPackingSolutionCreator> 40 39 where D : class, IPackingPosition 41 40 where B : PackingShape<D>, new() … … 92 91 93 92 [StorableConstructor] 94 protected BinPackingProblem(bool deserializing) : base(deserializing) { }95 protected BinPackingProblem(BinPackingProblem<D,B,I> original, Cloner cloner)93 protected Problem(bool deserializing) : base(deserializing) { } 94 protected Problem(Problem<D,B,I> original, Cloner cloner) 96 95 : base(original, cloner) { 97 96 InitializeEventHandlers(); 98 97 } 99 98 100 protected BinPackingProblem(IPackingPlanEvaluationAlgorithm e) : this(e, new MultiComponentVectorRandomCreator()) { }101 102 protected BinPackingProblem(IPackingPlanEvaluationAlgorithm e, IPackingSolutionCreator c) : base (e, c){99 protected Problem(IPackingPlanEvaluationAlgorithm e) : this(e, new MultiComponentVectorRandomCreator()) { } 100 101 protected Problem(IPackingPlanEvaluationAlgorithm e, IPackingSolutionCreator c) : base (e, c){ 103 102 Parameters.Add(new OptionalValueParameter<PackingPlan<D, B, I>>("BestKnownSolution", "The best known solution of this bin-packing instance.")); 104 103 Parameters.Add(new ValueParameter<ItemList<I>>("PackingItemMeasures", "Packing-item data defining the measures of the different items that need to be packed.", new ItemList<I>()));
Note: See TracChangeset
for help on using the changeset viewer.