Changeset 15488 for branches/2817-BinPackingSpeedup/HeuristicLab.Problems.BinPacking/3.3/3D/Encoding
- Timestamp:
- 11/28/17 16:10:31 (7 years ago)
- Location:
- branches/2817-BinPackingSpeedup/HeuristicLab.Problems.BinPacking/3.3/3D/Encoding
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2817-BinPackingSpeedup/HeuristicLab.Problems.BinPacking/3.3/3D/Encoding/ExtremePointPermutationDecoder.cs
r15473 r15488 30 30 using HeuristicLab.Common; 31 31 using HeuristicLab.Problems.BinPacking3D.Packer; 32 using HeuristicLab.Parameters; 33 using HeuristicLab.Data; 32 34 33 35 namespace HeuristicLab.Problems.BinPacking3D.Encoding { … … 38 40 [Item("Extreme-point Permutation Decoder (3d) Base", "Base class for 3d decoders")] 39 41 [StorableClass] 40 public class ExtremePointPermutationDecoder : Item, IDecoder<Permutation> 41 //where TBinPacker : BinPacker, new () 42 { 42 public class ExtremePointPermutationDecoder : ParameterizedNamedItem, IDecoder<Permutation> { 43 44 [Storable] 45 private IValueParameter<EnumValue<FittingMethod>> fittingMethodParameter; 46 public IValueParameter<EnumValue<FittingMethod>> FittingMethodParameter { 47 get { return fittingMethodParameter; } 48 } 49 50 public FittingMethod FittingMethod { 51 get { return fittingMethodParameter.Value.Value; } 52 set { fittingMethodParameter.Value.Value = value; } 53 } 54 55 [Storable] 56 private readonly IValueParameter<EnumValue<ExtremePointCreationMethod>> extremePointCreationMethodParameter; 57 public IValueParameter<EnumValue<ExtremePointCreationMethod>> ExtremePointCreationMethodParameter { 58 get { return extremePointCreationMethodParameter; } 59 } 60 61 public ExtremePointCreationMethod ExtremePointCreationMethod { 62 get { return extremePointCreationMethodParameter.Value.Value; } 63 set { extremePointCreationMethodParameter.Value.Value = value; } 64 } 43 65 44 66 [StorableConstructor] … … 46 68 protected ExtremePointPermutationDecoder(ExtremePointPermutationDecoder original, Cloner cloner) 47 69 : base(original, cloner) { 70 fittingMethodParameter = cloner.Clone(original.fittingMethodParameter); 71 //_binPacker = cloner.Clone(original._binPacker); 48 72 } 73 public ExtremePointPermutationDecoder() { 74 Parameters.Add(fittingMethodParameter = 75 new ValueParameter<EnumValue<FittingMethod>>("Fitting Method", 76 "The fitting method that the decoder uses.", 77 new EnumValue<FittingMethod>(FittingMethod.FirstFit))); 49 78 50 /// <summary> 51 /// Creates an extrem point based permutation decoder 52 /// </summary> 53 /// <param name="binPacker">Contains the packing algorithm for packing the items</param> 54 public ExtremePointPermutationDecoder(BinPacker binPacker) : base() { 55 _binPacker = binPacker; 79 Parameters.Add(extremePointCreationMethodParameter = 80 new ValueParameter<EnumValue<ExtremePointCreationMethod>>("Extreme Point Generation Method", 81 "The Extreme point generation method that the decoder uses.", 82 new EnumValue<ExtremePointCreationMethod>(ExtremePointCreationMethod.PointProjection))); 56 83 } 57 84 … … 60 87 } 61 88 89 /*[Storable] 62 90 BinPacker _binPacker; 63 91 */ 64 92 /// <summary> 65 93 /// Creates a solution for displaying it on the HEAL gui … … 70 98 /// <param name="useStackingConstraints"></param> 71 99 /// <returns></returns> 72 public Solution Decode(Permutation permutation, PackingShape binShape, IList<PackingItem> items, bool useStackingConstraints) { 100 public Solution Decode(Permutation permutation, PackingShape binShape, IList<PackingItem> items,bool useStackingConstraints) { 101 var binPacker = BinPackerFactory.CreateBinPacker(FittingMethod); 73 102 Solution solution = new Solution(binShape, useExtremePoints: true, stackingConstraints: useStackingConstraints); 74 foreach (var packedBin in _binPacker.PackItems(permutation, binShape, items, useStackingConstraints)) {103 foreach (var packedBin in binPacker.PackItems(permutation, binShape, items, ExtremePointCreationMethod, useStackingConstraints)) { 75 104 solution.Bins.Add(packedBin); 76 105 } -
branches/2817-BinPackingSpeedup/HeuristicLab.Problems.BinPacking/3.3/3D/Encoding/PermutationProblem.cs
r15473 r15488 50 50 public PermutationProblem() 51 51 : base() { 52 Decoder = new ExtremePointPermutationDecoder( new BinPackerFirstFit()); // default decoder52 Decoder = new ExtremePointPermutationDecoder(); // default decoder 53 53 54 54 Encoding = new Encodings.PermutationEncoding.PermutationEncoding(EncodedSolutionName, Items.Count, PermutationTypes.Absolute);
Note: See TracChangeset
for help on using the changeset viewer.