- Timestamp:
- 06/07/13 01:20:12 (12 years ago)
- Location:
- branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Decoders
- Files:
-
- 9 deleted
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Decoders/2D/BL/BottomLeftGroupingVectorDecoder.cs
r9593 r9596 41 41 [Item("Identical bin two dimensional grouping vector decoder", "<Description missing...>")] 42 42 [StorableClass] 43 public class BottomLeftGroupingVectorDecoder : PackingSolutionDecoder< 44 TwoDimensionalPacking, 45 RectangularPackingBin, 46 RectangularPackingItem>, I2DGVDecoder { 47 48 public BottomLeftGroupingVectorDecoder() 49 : base() { 50 //EncodedSolutionParameter.ActualName = "EncodedSolution"; 51 } 43 public class BottomLeftGroupingVectorDecoder : PackingSolutionDecoder<TwoDimensionalPacking, RectangularPackingBin,RectangularPackingItem>, I2DGVDecoder { 44 public BottomLeftGroupingVectorDecoder() : base() {} 52 45 [StorableConstructor] 53 46 protected BottomLeftGroupingVectorDecoder(bool deserializing) : base(deserializing) { } … … 59 52 } 60 53 61 62 54 public override PackingPlan<TwoDimensionalPacking, RectangularPackingBin, RectangularPackingItem> CreatePackingPlanFromEncoding(IItem encodedSolution, RectangularPackingBin binMeasures, ItemList<RectangularPackingItem> itemMeasures) { 63 64 55 var solution = encodedSolution as GroupingVectorEncoding; 65 56 if (solution == null) throw new InvalidOperationException("Encoding is not of type GroupingVector"); 66 67 PackingPlan<TwoDimensionalPacking, RectangularPackingBin, RectangularPackingItem> result = 68 new PackingPlan<TwoDimensionalPacking, RectangularPackingBin, RectangularPackingItem>(binMeasures); 69 70 result.BinPackings = TwoDimensionalPackingFunctions.BottomLeftPacking(solution, binMeasures, itemMeasures); //BottomLeftFunctions.BottomLeftPacking(solution, binMeasures, itemMeasures); 57 PackingPlan2D result = new PackingPlan2D(binMeasures); 58 result.Pack(solution, itemMeasures); 71 59 return result; 72 60 } -
branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Decoders/2D/BL/BottomLeftMultiComponentVectorDecoder.cs
r9593 r9596 41 41 [Item("Identical bin two dimensional multi component vector decoder", "<Description missing...>")] 42 42 [StorableClass] 43 public class BottomLeftMultiComponentVectorDecoder : PackingSolutionDecoder< 44 TwoDimensionalPacking, 45 RectangularPackingBin, 46 RectangularPackingItem>, I2DMCVDecoder { 47 48 public BottomLeftMultiComponentVectorDecoder() 49 : base() { 50 //EncodedSolutionParameter.ActualName = "EncodedSolution"; 51 } 43 public class BottomLeftMultiComponentVectorDecoder : PackingSolutionDecoder<TwoDimensionalPacking,RectangularPackingBin, RectangularPackingItem>, I2DMCVDecoder { 44 public BottomLeftMultiComponentVectorDecoder() : base() {} 52 45 [StorableConstructor] 53 46 protected BottomLeftMultiComponentVectorDecoder(bool deserializing) : base(deserializing) { } … … 59 52 } 60 53 61 62 54 public override PackingPlan<TwoDimensionalPacking, RectangularPackingBin, RectangularPackingItem> CreatePackingPlanFromEncoding(IItem encodedSolution, RectangularPackingBin binMeasures, ItemList<RectangularPackingItem> itemMeasures) { 63 64 55 var solution = encodedSolution as MultiComponentVectorEncoding; 65 56 if (solution == null) throw new InvalidOperationException("Encoding is not of type MultiComponent Vector"); 66 67 PackingPlan<TwoDimensionalPacking, RectangularPackingBin, RectangularPackingItem> result = 68 new PackingPlan<TwoDimensionalPacking, RectangularPackingBin, RectangularPackingItem>(binMeasures); 69 70 result.BinPackings = TwoDimensionalPackingFunctions.BottomLeftPacking(solution, binMeasures, itemMeasures); //BottomLeftFunctions.BottomLeftPacking(solution, binMeasures, itemMeasures); 71 57 PackingPlan2D result = new PackingPlan2D(binMeasures); 58 result.Pack(solution, itemMeasures); 72 59 return result; 73 60 } -
branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Decoders/2D/BL/BottomLeftPackingSequenceDecoder.cs
r9593 r9596 40 40 [Item("Identical bin, two dimensional, direct permutation decoder", "<Description missing...>")] 41 41 [StorableClass] 42 public class BottomLeftPackingSequenceDecoder : PackingSolutionDecoder< 43 TwoDimensionalPacking, 44 RectangularPackingBin, 45 RectangularPackingItem>, I2DPSDecoder { 42 public class BottomLeftPackingSequenceDecoder : PackingSolutionDecoder<TwoDimensionalPacking, RectangularPackingBin, RectangularPackingItem>, I2DPSDecoder { 46 43 47 public BottomLeftPackingSequenceDecoder() 48 : base() { 49 //EncodedSolutionParameter.ActualName = "EncodedSolution"; 50 } 44 public BottomLeftPackingSequenceDecoder(): base() { } 51 45 [StorableConstructor] 52 46 protected BottomLeftPackingSequenceDecoder(bool deserializing) : base(deserializing) { } … … 58 52 } 59 53 60 61 54 public override PackingPlan<TwoDimensionalPacking, RectangularPackingBin, RectangularPackingItem> CreatePackingPlanFromEncoding(IItem encodedSolution, RectangularPackingBin binMeasures, ItemList<RectangularPackingItem> itemMeasures) { 62 63 55 var solution = encodedSolution as PackingSequenceEncoding; 64 56 if (solution == null) throw new InvalidOperationException("Encoding is not of type PackingSequence"); 65 66 PackingPlan<TwoDimensionalPacking, RectangularPackingBin, RectangularPackingItem> result = 67 new PackingPlan<TwoDimensionalPacking, RectangularPackingBin, RectangularPackingItem>(binMeasures); 68 69 result.BinPackings = TwoDimensionalPackingFunctions.BottomLeftPacking(solution, binMeasures, itemMeasures); //BottomLeftFunctions.BottomLeftPacking(solution, binMeasures, itemMeasures); 70 57 PackingPlan2D result = new PackingPlan2D(binMeasures); 58 result.Pack(solution, itemMeasures); 71 59 return result; 72 60 } -
branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Decoders/2D/EP/ExtremePointGroupingVectorDecoder2D.cs
r9593 r9596 41 41 [Item("Identical bin, two dimensional, extreme points based decoder for the GroupingVector encoding.", "<Description missing...>")] 42 42 [StorableClass] 43 public class ExtremePointGroupingVectorDecoder2D : PackingSolutionDecoder< 44 TwoDimensionalPacking, 45 RectangularPackingBin, 46 RectangularPackingItem>, I2DGVDecoder { 47 48 public ExtremePointGroupingVectorDecoder2D () 49 : base() { 50 } 43 public class ExtremePointGroupingVectorDecoder2D : PackingSolutionDecoder<TwoDimensionalPacking, RectangularPackingBin, RectangularPackingItem>, I2DGVDecoder { 44 public ExtremePointGroupingVectorDecoder2D () : base() {} 51 45 [StorableConstructor] 52 46 protected ExtremePointGroupingVectorDecoder2D (bool deserializing) : base(deserializing) { } … … 59 53 60 54 public static PackingPlan<TwoDimensionalPacking, RectangularPackingBin, RectangularPackingItem> Decode(GroupingVectorEncoding solution, RectangularPackingBin binMeasures, ItemList<RectangularPackingItem> itemMeasures) { 61 PackingPlan<TwoDimensionalPacking, RectangularPackingBin, RectangularPackingItem> result = 62 new PackingPlan<TwoDimensionalPacking, RectangularPackingBin, RectangularPackingItem>(binMeasures); 63 64 result.BinPackings = TwoDimensionalPackingFunctions.ExtremePointBasedPacking(solution, itemMeasures, binMeasures);//ExtremPointsFunctions2D.ExtremePointBasedPacking(solution, itemMeasures, binMeasures); 65 55 PackingPlan2D result = new PackingPlan2D(binMeasures, true, false); 56 result.Pack(solution, itemMeasures); 66 57 return result; 67 58 } 68 59 69 60 public override PackingPlan<TwoDimensionalPacking, RectangularPackingBin, RectangularPackingItem> CreatePackingPlanFromEncoding(IItem encodedSolution, RectangularPackingBin binMeasures, ItemList<RectangularPackingItem> itemMeasures) { 70 71 61 var solution = encodedSolution as GroupingVectorEncoding; 72 62 if (solution == null) throw new InvalidOperationException("Encoding is not of type GroupingVector"); 73 74 63 return Decode(solution, binMeasures, itemMeasures); 75 64 } -
branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Decoders/2D/EP/ExtremePointMultiComponentVectorDecoder2D.cs
r9593 r9596 42 42 [Item("Identical bin, two dimensional, extreme points based decoder for the MultiComponentVector encoding.", "<Description missing...>")] 43 43 [StorableClass] 44 public class ExtremePointMultiComponentVectorDecoder2D : PackingSolutionDecoder< 45 TwoDimensionalPacking, 46 RectangularPackingBin, 47 RectangularPackingItem>, I2DMCVDecoder { 48 49 public ExtremePointMultiComponentVectorDecoder2D () 50 : base() { 51 } 44 public class ExtremePointMultiComponentVectorDecoder2D : PackingSolutionDecoder<TwoDimensionalPacking,RectangularPackingBin, RectangularPackingItem>, I2DMCVDecoder { 45 public ExtremePointMultiComponentVectorDecoder2D () : base() {} 52 46 [StorableConstructor] 53 47 protected ExtremePointMultiComponentVectorDecoder2D (bool deserializing) : base(deserializing) { } … … 60 54 61 55 public static PackingPlan<TwoDimensionalPacking, RectangularPackingBin, RectangularPackingItem> Decode(MultiComponentVectorEncoding solution, RectangularPackingBin binMeasures, ItemList<RectangularPackingItem> itemMeasures) { 62 PackingPlan<TwoDimensionalPacking, RectangularPackingBin, RectangularPackingItem> result = 63 new PackingPlan<TwoDimensionalPacking, RectangularPackingBin, RectangularPackingItem>(binMeasures); 64 65 result.BinPackings = TwoDimensionalPackingFunctions.ExtremePointBasedPacking(solution, itemMeasures, binMeasures);//ExtremPointsFunctions2D.ExtremePointBasedPacking(solution, itemMeasures, binMeasures); 66 56 PackingPlan2D result = new PackingPlan2D(binMeasures, true, false); 57 result.Pack(solution, itemMeasures); 67 58 return result; 68 59 } 69 60 70 61 public override PackingPlan<TwoDimensionalPacking, RectangularPackingBin, RectangularPackingItem> CreatePackingPlanFromEncoding(IItem encodedSolution, RectangularPackingBin binMeasures, ItemList<RectangularPackingItem> itemMeasures) { 71 72 62 var solution = encodedSolution as MultiComponentVectorEncoding; 73 63 if (solution == null) throw new InvalidOperationException("Encoding is not of type MultiComponentVector"); 74 75 64 return Decode(solution, binMeasures, itemMeasures); 76 65 } -
branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Decoders/2D/EP/ExtremePointPackingSequenceDecoder2D.cs
r9593 r9596 40 40 [Item("Identical bin, two dimensional, extreme points based decoder for the PackingSequence encoding.", "<Description missing...>")] 41 41 [StorableClass] 42 public class ExtremePointPackingSequenceDecoder2D : PackingSolutionDecoder< 43 TwoDimensionalPacking, 44 RectangularPackingBin, 45 RectangularPackingItem>, I2DPSDecoder { 46 47 public ExtremePointPackingSequenceDecoder2D () 48 : base() { 49 } 42 public class ExtremePointPackingSequenceDecoder2D : PackingSolutionDecoder<TwoDimensionalPacking, RectangularPackingBin, RectangularPackingItem>, I2DPSDecoder { 43 public ExtremePointPackingSequenceDecoder2D () : base() {} 50 44 [StorableConstructor] 51 45 protected ExtremePointPackingSequenceDecoder2D (bool deserializing) : base(deserializing) { } … … 59 53 60 54 public override PackingPlan<TwoDimensionalPacking, RectangularPackingBin, RectangularPackingItem> CreatePackingPlanFromEncoding(IItem encodedSolution, RectangularPackingBin binMeasures, ItemList<RectangularPackingItem> itemMeasures) { 61 62 55 var solution = encodedSolution as PackingSequenceEncoding; 63 56 if (solution == null) throw new InvalidOperationException("Encoding is not of type PackingSequence"); 64 65 PackingPlan<TwoDimensionalPacking, RectangularPackingBin, RectangularPackingItem> result = 66 new PackingPlan<TwoDimensionalPacking, RectangularPackingBin, RectangularPackingItem>(binMeasures); 67 68 result.BinPackings = TwoDimensionalPackingFunctions.ExtremePointBasedPacking(solution, itemMeasures, binMeasures);//ExtremPointsFunctions2D.ExtremePointBasedPacking(solution, itemMeasures, binMeasures); 69 57 PackingPlan2D result = new PackingPlan2D(binMeasures, true, false); 58 result.Pack(solution, itemMeasures); 70 59 return result; 71 60 } -
branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Decoders/3D/DBL/DeepestBottomLeftGroupingVectorDecoder.cs
r9593 r9596 38 38 39 39 namespace HeuristicLab.Problems.BinPacking.Decoders { 40 [Item("Identical bin three dimensional direct grouping vectordecoder", "<Description missing...>")]40 [Item("Identical bin, three dimensional, GroupingVector-decoder", "<Description missing...>")] 41 41 [StorableClass] 42 public class DeepestBottomLeftGroupingVectorDecoder : PackingSolutionDecoder< 43 ThreeDimensionalPacking, 44 CuboidPackingBin, 45 CuboidPackingItem>, I3DGVDecoder { 46 47 public DeepestBottomLeftGroupingVectorDecoder() 48 : base() { 49 //EncodedSolutionParameter.ActualName = "EncodedSolution"; 50 } 42 public class DeepestBottomLeftGroupingVectorDecoder : PackingSolutionDecoder<ThreeDimensionalPacking, CuboidPackingBin, CuboidPackingItem>, I3DGVDecoder { 43 public DeepestBottomLeftGroupingVectorDecoder() : base() {} 51 44 [StorableConstructor] 52 45 protected DeepestBottomLeftGroupingVectorDecoder(bool deserializing) : base(deserializing) { } … … 58 51 } 59 52 60 61 53 public override PackingPlan<ThreeDimensionalPacking, CuboidPackingBin, CuboidPackingItem> CreatePackingPlanFromEncoding(IItem encodedSolution, CuboidPackingBin binMeasures, ItemList<CuboidPackingItem> itemMeasures) { 62 63 54 var solution = encodedSolution as GroupingVectorEncoding; 64 55 if (solution == null) throw new InvalidOperationException("Encoding is not of type GroupingVector"); 65 66 PackingPlan<ThreeDimensionalPacking, CuboidPackingBin, CuboidPackingItem> result = new PackingPlan<ThreeDimensionalPacking, CuboidPackingBin, CuboidPackingItem>(binMeasures); 67 68 result.BinPackings = ThreeDimensionalPackingFunctions.DeepestLeftBottomPacking(solution, binMeasures, itemMeasures); 69 56 PackingPlan3D result = new PackingPlan3D(binMeasures); 57 result.Pack(solution, itemMeasures); 70 58 return result; 71 59 } -
branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Decoders/3D/DBL/DeepestBottomLeftMultiComponentVectorDecoder.cs
r9593 r9596 39 39 40 40 namespace HeuristicLab.Problems.BinPacking.Decoders { 41 [Item("Identical bin three dimensional multi component vectordecoder", "<Description missing...>")]41 [Item("Identical bin, three dimensional, MultiComponentVector-decoder", "<Description missing...>")] 42 42 [StorableClass] 43 public class DeepestBottomLeftMultiComponentVectorDecoder : PackingSolutionDecoder< 44 ThreeDimensionalPacking, 45 CuboidPackingBin, 46 CuboidPackingItem>, I3DMCVDecoder { 47 48 public DeepestBottomLeftMultiComponentVectorDecoder() 49 : base() { 50 //EncodedSolutionParameter.ActualName = "EncodedSolution"; 51 } 43 public class DeepestBottomLeftMultiComponentVectorDecoder : PackingSolutionDecoder<ThreeDimensionalPacking, CuboidPackingBin, CuboidPackingItem>, I3DMCVDecoder { 44 public DeepestBottomLeftMultiComponentVectorDecoder() : base() { } 52 45 [StorableConstructor] 53 46 protected DeepestBottomLeftMultiComponentVectorDecoder(bool deserializing) : base(deserializing) { } … … 59 52 } 60 53 61 62 54 public override PackingPlan<ThreeDimensionalPacking, CuboidPackingBin, CuboidPackingItem> CreatePackingPlanFromEncoding(IItem encodedSolution, CuboidPackingBin binMeasures, ItemList<CuboidPackingItem> itemMeasures) { 63 64 55 var solution = encodedSolution as MultiComponentVectorEncoding; 65 56 if (solution == null) throw new InvalidOperationException("Encoding is not of type MultiComponent Vector"); 66 67 PackingPlan<ThreeDimensionalPacking, CuboidPackingBin, CuboidPackingItem> result = 68 new PackingPlan<ThreeDimensionalPacking, CuboidPackingBin, CuboidPackingItem>(binMeasures); 69 70 result.BinPackings = ThreeDimensionalPackingFunctions.DeepestLeftBottomPacking(solution, binMeasures, itemMeasures); 71 57 PackingPlan3D result = new PackingPlan3D(binMeasures); 58 result.Pack(solution, itemMeasures); 72 59 return result; 73 60 } -
branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Decoders/3D/DBL/DeepestBottomLeftPackingSequenceDecoder.cs
r9593 r9596 38 38 39 39 namespace HeuristicLab.Problems.BinPacking.Decoders { 40 [Item("Identical bin, three dimensional, direct permutationdecoder", "<Description missing...>")]40 [Item("Identical bin, three dimensional, PackingSequence-decoder", "<Description missing...>")] 41 41 [StorableClass] 42 public class DeepestBottomLeftPackingSequenceDecoder : PackingSolutionDecoder< 43 ThreeDimensionalPacking, 44 CuboidPackingBin, 45 CuboidPackingItem>, I3DPSDecoder { 46 47 public DeepestBottomLeftPackingSequenceDecoder() 48 : base() { 49 //EncodedSolutionParameter.ActualName = "EncodedSolution"; 50 } 42 public class DeepestBottomLeftPackingSequenceDecoder : PackingSolutionDecoder<ThreeDimensionalPacking, CuboidPackingBin, CuboidPackingItem>, I3DPSDecoder { 43 public DeepestBottomLeftPackingSequenceDecoder(): base() {} 51 44 [StorableConstructor] 52 45 protected DeepestBottomLeftPackingSequenceDecoder(bool deserializing) : base(deserializing) { } … … 58 51 } 59 52 60 61 53 public override PackingPlan<ThreeDimensionalPacking, CuboidPackingBin, CuboidPackingItem> CreatePackingPlanFromEncoding(IItem encodedSolution, CuboidPackingBin binMeasures, ItemList<CuboidPackingItem> itemMeasures) { 62 63 54 var solution = encodedSolution as PackingSequenceEncoding; 64 55 if (solution == null) throw new InvalidOperationException("Encoding is not of type PackingSequence"); 65 66 PackingPlan<ThreeDimensionalPacking, CuboidPackingBin, CuboidPackingItem> result = 67 new PackingPlan<ThreeDimensionalPacking, CuboidPackingBin, CuboidPackingItem>(binMeasures); 68 69 result.BinPackings = ThreeDimensionalPackingFunctions.DeepestLeftBottomPacking(solution, binMeasures, itemMeasures); 70 56 PackingPlan3D result = new PackingPlan3D(binMeasures); 57 result.Pack(solution, itemMeasures); 71 58 return result; 72 59 } -
branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Decoders/3D/EP/ExtremePointGroupingVectorDecoder3D.cs
r9593 r9596 42 42 [Item("Identical bin, three dimensional, extreme points based decoder for the GroupingVector encoding.", "<Description missing...>")] 43 43 [StorableClass] 44 public class ExtremePointGroupingVectorDecoder3D : PackingSolutionDecoder< 45 ThreeDimensionalPacking, 46 CuboidPackingBin, 47 CuboidPackingItem>, I3DGVDecoder { 48 49 public ValueParameter<BoolValue> StackingConstraintsParameter { 50 get { return (ValueParameter<BoolValue>)Parameters["StackingConstraint"]; } 51 } 52 53 public ExtremePointGroupingVectorDecoder3D () 54 : base() { 55 Parameters.Add(new ValueParameter<BoolValue>("StackingConstraint", "A flag determining whether stackingconstraints should be enforced or not.")); 56 } 44 public class ExtremePointGroupingVectorDecoder3D : PackingSolutionDecoder< ThreeDimensionalPacking, CuboidPackingBin, CuboidPackingItem>, I3DGVDecoder { 45 public ExtremePointGroupingVectorDecoder3D () : base() { } 57 46 [StorableConstructor] 58 47 protected ExtremePointGroupingVectorDecoder3D (bool deserializing) : base(deserializing) { } … … 65 54 66 55 public static PackingPlan<ThreeDimensionalPacking, CuboidPackingBin, CuboidPackingItem> Decode(GroupingVectorEncoding solution, CuboidPackingBin binMeasures, ItemList<CuboidPackingItem> itemMeasures, bool stackingConstraints) { 67 PackingPlan<ThreeDimensionalPacking, CuboidPackingBin, CuboidPackingItem> result = 68 new PackingPlan<ThreeDimensionalPacking, CuboidPackingBin, CuboidPackingItem>(binMeasures); 69 70 result.BinPackings = ThreeDimensionalPackingFunctions.ExtremePointBasedPacking(solution, itemMeasures, binMeasures, stackingConstraints); 71 56 PackingPlan3D result = new PackingPlan3D(binMeasures, true, stackingConstraints); 57 result.Pack(solution, itemMeasures); 72 58 return result; 73 59 } 74 60 75 61 public override PackingPlan<ThreeDimensionalPacking, CuboidPackingBin, CuboidPackingItem> CreatePackingPlanFromEncoding(IItem encodedSolution, CuboidPackingBin binMeasures, ItemList<CuboidPackingItem> itemMeasures) { 76 77 62 var solution = encodedSolution as GroupingVectorEncoding; 78 63 if (solution == null) throw new InvalidOperationException("Encoding is not of type GroupingVector"); 79 80 64 return Decode(solution, binMeasures, itemMeasures, StackingConstraintsParameter.Value.Value); 81 65 } -
branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Decoders/3D/EP/ExtremePointMultiComponentVectorDecoder3D.cs
r9593 r9596 43 43 [Item("Identical bin, three dimensional, extreme points based decoder for the MultiComponentVector encoding.", "<Description missing...>")] 44 44 [StorableClass] 45 public class ExtremePointMultiComponentVectorDecoder3D : PackingSolutionDecoder< 46 ThreeDimensionalPacking, 47 CuboidPackingBin, 48 CuboidPackingItem>, I3DMCVDecoder { 49 50 public ValueParameter<BoolValue> StackingConstraintsParameter { 51 get { return (ValueParameter<BoolValue>)Parameters["StackingConstraint"]; } 52 } 53 54 public ExtremePointMultiComponentVectorDecoder3D () 55 : base() { 56 Parameters.Add(new ValueParameter<BoolValue>("StackingConstraint", "A flag determining whether stackingconstraints should be enforced or not.")); 57 } 45 public class ExtremePointMultiComponentVectorDecoder3D : PackingSolutionDecoder<ThreeDimensionalPacking, CuboidPackingBin, CuboidPackingItem>, I3DMCVDecoder { 46 public ExtremePointMultiComponentVectorDecoder3D () : base() { } 58 47 [StorableConstructor] 59 48 protected ExtremePointMultiComponentVectorDecoder3D (bool deserializing) : base(deserializing) { } … … 66 55 67 56 public static PackingPlan<ThreeDimensionalPacking, CuboidPackingBin, CuboidPackingItem> Decode(MultiComponentVectorEncoding solution, CuboidPackingBin binMeasures, ItemList<CuboidPackingItem> itemMeasures, bool stackingConstraints) { 68 PackingPlan<ThreeDimensionalPacking, CuboidPackingBin, CuboidPackingItem> result = 69 new PackingPlan<ThreeDimensionalPacking, CuboidPackingBin, CuboidPackingItem>(binMeasures); 70 71 result.BinPackings = ThreeDimensionalPackingFunctions.ExtremePointBasedPacking(solution, itemMeasures, binMeasures, stackingConstraints); 72 57 PackingPlan3D result = new PackingPlan3D(binMeasures, true, stackingConstraints); 58 result.Pack(solution, itemMeasures); 73 59 return result; 74 60 } 75 61 76 62 public override PackingPlan<ThreeDimensionalPacking, CuboidPackingBin, CuboidPackingItem> CreatePackingPlanFromEncoding(IItem encodedSolution, CuboidPackingBin binMeasures, ItemList<CuboidPackingItem> itemMeasures) { 77 78 63 var solution = encodedSolution as MultiComponentVectorEncoding; 79 64 if (solution == null) throw new InvalidOperationException("Encoding is not of type MultiComponentVector"); 80 81 65 return Decode(solution, binMeasures, itemMeasures, StackingConstraintsParameter.Value.Value); 82 66 } -
branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Decoders/3D/EP/ExtremePointPackingSequenceDecoder3D.cs
r9593 r9596 41 41 [Item("Identical bin, three dimensional, extreme points based decoder for the PackingSequence encoding.", "<Description missing...>")] 42 42 [StorableClass] 43 public class ExtremePointPackingSequenceDecoder3D : PackingSolutionDecoder< 44 ThreeDimensionalPacking, 45 CuboidPackingBin, 46 CuboidPackingItem>, I3DPSDecoder { 47 48 public ValueParameter<BoolValue> StackingConstraintsParameter { 49 get { return (ValueParameter<BoolValue>)Parameters["StackingConstraint"]; } 50 } 51 52 public ExtremePointPackingSequenceDecoder3D () 53 : base() { 54 Parameters.Add(new ValueParameter<BoolValue>("StackingConstraint", "A flag determining whether stackingconstraints should be enforced or not.")); 55 } 43 public class ExtremePointPackingSequenceDecoder3D : PackingSolutionDecoder<ThreeDimensionalPacking, CuboidPackingBin, CuboidPackingItem>, I3DPSDecoder { 44 public ExtremePointPackingSequenceDecoder3D () : base() {} 56 45 [StorableConstructor] 57 46 protected ExtremePointPackingSequenceDecoder3D (bool deserializing) : base(deserializing) { } … … 65 54 66 55 public override PackingPlan<ThreeDimensionalPacking, CuboidPackingBin, CuboidPackingItem> CreatePackingPlanFromEncoding(IItem encodedSolution, CuboidPackingBin binMeasures, ItemList<CuboidPackingItem> itemMeasures) { 67 68 56 var solution = encodedSolution as PackingSequenceEncoding; 69 57 if (solution == null) throw new InvalidOperationException("Encoding is not of type PackingSequence"); 70 71 PackingPlan<ThreeDimensionalPacking, CuboidPackingBin, CuboidPackingItem> result = 72 new PackingPlan<ThreeDimensionalPacking, CuboidPackingBin, CuboidPackingItem>(binMeasures); 73 74 result.BinPackings = ThreeDimensionalPackingFunctions.ExtremePointBasedPacking(solution, itemMeasures, binMeasures, StackingConstraintsParameter.Value.Value); 75 58 PackingPlan3D result = new PackingPlan3D(binMeasures, true, StackingConstraintsParameter.Value.Value); 59 result.Pack(solution, itemMeasures); 76 60 return result; 77 61 } -
branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Decoders/3D/EP/ISOContainerMultiComponentVectorDecoder3D.cs
r9593 r9596 60 60 61 61 public static PackingPlan<ThreeDimensionalPacking, CuboidPackingBin, CuboidPackingItem> Decode(MultiComponentVectorEncoding solution, CuboidPackingBin binMeasures, ItemList<CuboidPackingItem> itemMeasures) { 62 63 PackingPlan<ThreeDimensionalPacking, CuboidPackingBin, CuboidPackingItem> result = 64 new PackingPlan<ThreeDimensionalPacking, CuboidPackingBin, CuboidPackingItem>(); 65 /* 66 #region Preperations 67 int nrOfBins = solution.NrOfBins; 68 69 Dictionary<int, List<PackingInformation>> unpackedItemIndexesPerBin = new Dictionary<int, List<PackingInformation>>(); 70 Dictionary<int, HashSet<ThreeDimensionalPacking>> extremePointsForBin = new Dictionary<int, HashSet<ThreeDimensionalPacking>>(); 71 ObservableDictionary<int, CuboidPackingBin> resultingBinMeasures = new ObservableDictionary<int, CuboidPackingBin>(); 72 var occupiedPoints = new List<int[, ,]>(); 62 PackingPlan<ThreeDimensionalPacking, CuboidPackingBin, CuboidPackingItem> resultPlan = new PackingPlan3D(binMeasures); 63 ObservableList<BinPacking3D> result = new ObservableList<BinPacking3D>(); 73 64 74 for (int i = 0; i < nrOfBins; i++) {75 unpackedItemIndexesPerBin[i] = new List<PackingInformation>(solution.PackingInformations[i]);65 var sequenceMatrix = solution.GenerateSequenceMatrix(); 66 Dictionary<int, bool> rotated = solution.GenerateRotationArray(); 76 67 77 extremePointsForBin[i] = new HashSet<ThreeDimensionalPacking>(); 78 extremePointsForBin[i].Add(new ThreeDimensionalPacking(i, 0, 0, 0, false)); 79 occupiedPoints = ExtremePointsFunctions3D.IncreaseBinCountForOccupiedPoints(occupiedPoints, binMeasures); 80 resultingBinMeasures[i] = new CuboidPackingBin(binMeasures.Width, binMeasures.Height, binMeasures.Depth); 68 //Fill bins according to grouping vector 69 List<int> remainingIDs = new List<int>(); 70 foreach (var sequence in sequenceMatrix) { 71 remainingIDs = remainingIDs.Concat(sequence).ToList(); 72 var bp = new BinPacking3D(binMeasures); 73 bp.ExtremePointBasedPacking(ref remainingIDs, itemMeasures, true, rotated); 74 if (remainingIDs.Count > 0) { 75 bp.DoubleDepth(); 76 bp.ExtremePointBasedPacking(ref remainingIDs, itemMeasures, true, rotated); 77 } 78 result.Add(bp); 81 79 } 80 result.RemoveAll(x => x.ItemPositions.Count == 0); 81 result = new ObservableList<BinPacking3D>(result.OrderByDescending(bp => bp.PackingDensity)); 82 82 83 ObservableDictionary<int, ThreeDimensionalPacking> itemPositions = new ObservableDictionary<int, ThreeDimensionalPacking>(); 84 var remainingItems = new List<PackingInformation>(); 85 86 #endregion Preperations 87 88 89 //Iterate over all bin-lists 90 for (int binNr = 0; binNr < nrOfBins; binNr++) { 91 //Iterate over the current bin-item-list and find feasible positions in the current bin for each item 92 var unpackedItems = unpackedItemIndexesPerBin[binNr]; 93 for (int i = 0; i < unpackedItems.Count; i++) { 94 var itemIndex = unpackedItems[i].ItemID; 95 var item = itemMeasures[itemIndex]; 96 97 extremePointsForBin[binNr] = ExtremePointsFunctions3D.OrderExtremePoints(extremePointsForBin[binNr], occupiedPoints, resultingBinMeasures[binNr]); 98 var positionFound = ExtremePointsFunctions3D.FindExtremePointForItemUsingMaterialAndWeightConstraint(itemIndex, itemMeasures, resultingBinMeasures[binNr], extremePointsForBin[binNr], occupiedPoints, itemPositions, unpackedItems[i].Rotated); 99 100 if (positionFound == null && resultingBinMeasures[binNr].Depth.Equals(binMeasures.Depth)) { 101 occupiedPoints = DoubleDepthForBinNr(occupiedPoints, ref resultingBinMeasures, binNr); 102 positionFound = ExtremePointsFunctions3D.FindExtremePointForItemUsingMaterialAndWeightConstraint(itemIndex, itemMeasures, resultingBinMeasures[binNr], extremePointsForBin[binNr], occupiedPoints, itemPositions, unpackedItems[i].Rotated); 103 } 104 105 if (positionFound != null) { 106 extremePointsForBin[binNr].Remove(positionFound); 107 itemPositions[itemIndex] = positionFound; 108 occupiedPoints = ExtremePointsFunctions3D.OccupyPointsForNewItem(occupiedPoints, item, positionFound, itemIndex); 109 extremePointsForBin[binNr] = ExtremePointsFunctions3D.GenerateNewExtremePointsForNewItem(extremePointsForBin[binNr], occupiedPoints, item, positionFound, resultingBinMeasures[binNr]); 110 } else { 111 remainingItems.Add(unpackedItems[i]); 112 solution.PackingInformations[binNr].Remove(unpackedItems[i]); 83 //Try to put remaining items in existing bins 84 var temp = new List<int>(remainingIDs); 85 foreach (int id in temp) { 86 foreach (var bp in result) { 87 var position = bp.FindExtremePointForItem(itemMeasures[id], rotated[id], true); 88 if (remainingIDs.Count > 0) { 89 bp.DoubleDepth(); 90 position = bp.FindExtremePointForItem(itemMeasures[id], rotated[id], true); 91 } 92 if (position != null) { 93 bp.PackItem(id, itemMeasures[id], position); 94 remainingIDs.Remove(id); 113 95 } 114 96 } 115 97 } 116 98 117 118 //Packing of remaining items 119 //Iterate over all bin-lists 120 for (int binNr = 0; binNr < nrOfBins && remainingItems.Count > 0; binNr++) { 121 var unpackedItems = new List<PackingInformation>(remainingItems); 122 //Iterate over all the remaining items 123 for (int i = 0; i < unpackedItems.Count; i++) { 124 var itemIndex = unpackedItems[i].ItemID; 125 var item = itemMeasures[itemIndex]; 126 127 extremePointsForBin[binNr] = ExtremePointsFunctions3D.OrderExtremePoints(extremePointsForBin[binNr], occupiedPoints, resultingBinMeasures[binNr]); 128 var positionFound = ExtremePointsFunctions3D.FindExtremePointForItemUsingMaterialAndWeightConstraint(itemIndex, itemMeasures, resultingBinMeasures[binNr], extremePointsForBin[binNr], occupiedPoints, itemPositions, unpackedItems[i].Rotated); 129 130 131 if (positionFound == null && resultingBinMeasures[binNr].Depth.Equals(binMeasures.Depth)) { 132 occupiedPoints = DoubleDepthForBinNr(occupiedPoints, ref resultingBinMeasures, binNr); 133 positionFound = ExtremePointsFunctions3D.FindExtremePointForItemUsingMaterialAndWeightConstraint(itemIndex, itemMeasures, resultingBinMeasures[binNr], extremePointsForBin[binNr], occupiedPoints, itemPositions, unpackedItems[i].Rotated); 134 } 135 136 if (positionFound != null) { 137 extremePointsForBin[binNr].Remove(positionFound); 138 itemPositions[itemIndex] = positionFound; 139 occupiedPoints = ExtremePointsFunctions3D.OccupyPointsForNewItem(occupiedPoints, item, positionFound, itemIndex); 140 extremePointsForBin[binNr] = ExtremePointsFunctions3D.GenerateNewExtremePointsForNewItem(extremePointsForBin[binNr], occupiedPoints, item, positionFound, resultingBinMeasures[binNr]); 141 remainingItems.Remove(unpackedItems[i]); 142 solution.PackingInformations[binNr].Add(unpackedItems[i]); 143 } 99 //Put still remaining items in new bins 100 while (remainingIDs.Count > 0) { 101 var bp = new BinPacking3D(binMeasures); 102 bp.ExtremePointBasedPacking(ref remainingIDs, itemMeasures, true, rotated); 103 if (remainingIDs.Count > 0) { 104 bp.DoubleDepth(); 105 bp.ExtremePointBasedPacking(ref remainingIDs, itemMeasures, true, rotated); 144 106 } 145 if (remainingItems.Count > 0 && binNr + 1 >= nrOfBins) { 146 extremePointsForBin[nrOfBins] = new HashSet<ThreeDimensionalPacking>(); 147 extremePointsForBin[nrOfBins].Add(new ThreeDimensionalPacking(nrOfBins, 0, 0, 0, false)); 148 occupiedPoints = ExtremePointsFunctions3D.IncreaseBinCountForOccupiedPoints(occupiedPoints, binMeasures); 149 resultingBinMeasures[nrOfBins] = new CuboidPackingBin(binMeasures.Width, binMeasures.Height, binMeasures.Depth); 150 solution.PackingInformations[nrOfBins] = new ItemList<PackingInformation>(); 151 nrOfBins++; 152 } 107 result.Add(bp); 153 108 } 154 155 result.BinPackings = BinPacking<ThreeDimensionalPacking, CuboidPackingBin, CuboidPackingItem>.GetBinPackings(itemPositions, resultingBinMeasures, itemMeasures, nrOfBins); */ 156 return result; 157 } 158 159 private static List<int[, ,]> DoubleDepthForBinNr(List<int[, ,]> occupiedPoints, ref ObservableDictionary<int, CuboidPackingBin> binMeasures, int binNr) { 160 var oldDepth = binMeasures[binNr].Depth; 161 binMeasures[binNr].Depth = binMeasures[binNr].Depth * 2; 162 var newBinOccupation = new int[binMeasures[binNr].Width, binMeasures[binNr].Height, binMeasures[binNr].Depth]; 163 for (int w = 0; w < binMeasures[binNr].Width; w++) { 164 for (int h = 0; h < binMeasures[binNr].Height; h++) { 165 for (int d = 0; d < binMeasures[binNr].Depth; d++) { 166 if (d < oldDepth) 167 newBinOccupation[w, h, d] = occupiedPoints[binNr][w, h, d]; 168 else 169 newBinOccupation[w, h, d] = -1; 170 } 171 } 172 } 173 174 occupiedPoints[binNr] = newBinOccupation; 175 return occupiedPoints; 109 result.RemoveAll(x => x.ItemPositions.Count == 0); 110 resultPlan.BinPackings = new ObservableList<BinPacking<ThreeDimensionalPacking, CuboidPackingBin, CuboidPackingItem>>(result.OrderByDescending(bp => bp.PackingDensity)); 111 return resultPlan; 176 112 } 177 113 178 114 179 180 181 115 public override PackingPlan<ThreeDimensionalPacking, CuboidPackingBin, CuboidPackingItem> CreatePackingPlanFromEncoding(IItem encodedSolution, CuboidPackingBin binMeasures, ItemList<CuboidPackingItem> itemMeasures) { 182 183 116 var solution = encodedSolution as MultiComponentVectorEncoding; 184 117 if (solution == null) throw new InvalidOperationException("Encoding is not of type MultiComponentVector"); 185 186 118 return Decode(solution, binMeasures, itemMeasures); 187 119 } -
branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Decoders/PackingSolutionDecoder.cs
r9563 r9596 59 59 get { return (ILookupParameter<PackingPlan<D, B, I>>)Parameters["PackingPlan"]; } 60 60 } 61 public ValueParameter<BoolValue> StackingConstraintsParameter { 62 get { return (ValueParameter<BoolValue>)Parameters["StackingConstraint"]; } 63 } 61 64 62 65 … … 67 70 Parameters.Add(new LookupParameter<ItemList<I>>("PackingItemMeasures", "Packing-item data taken from the bin-packing problem-instance.")); 68 71 Parameters.Add(new LookupParameter<B>("PackingBinMeasures", "Packing-bin data taken from the bin-packing problem-instance.")); 72 Parameters.Add(new ValueParameter<BoolValue>("StackingConstraint", "A flag determining whether stackingconstraints should be enforced or not.")); 69 73 } 70 74
Note: See TracChangeset
for help on using the changeset viewer.