Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
11/28/17 16:10:31 (7 years ago)
Author:
rhanghof
Message:

#2817:

  • Added line projection based bin packing
  • Added residual spaces to the view
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  
    3030using HeuristicLab.Common;
    3131using HeuristicLab.Problems.BinPacking3D.Packer;
     32using HeuristicLab.Parameters;
     33using HeuristicLab.Data;
    3234
    3335namespace HeuristicLab.Problems.BinPacking3D.Encoding {
     
    3840  [Item("Extreme-point Permutation Decoder (3d) Base", "Base class for 3d decoders")]
    3941  [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    }
    4365
    4466    [StorableConstructor]
     
    4668    protected ExtremePointPermutationDecoder(ExtremePointPermutationDecoder original, Cloner cloner)
    4769      : base(original, cloner) {
     70      fittingMethodParameter = cloner.Clone(original.fittingMethodParameter);
     71      //_binPacker = cloner.Clone(original._binPacker);
    4872    }
     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)));
    4978
    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)));
    5683    }
    5784
     
    6087    }
    6188
     89    /*[Storable]
    6290    BinPacker _binPacker;
    63 
     91    */
    6492    /// <summary>
    6593    /// Creates a solution for displaying it on the HEAL gui
     
    7098    /// <param name="useStackingConstraints"></param>
    7199    /// <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);
    73102      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)) {
    75104        solution.Bins.Add(packedBin);
    76105      }
  • branches/2817-BinPackingSpeedup/HeuristicLab.Problems.BinPacking/3.3/3D/Encoding/PermutationProblem.cs

    r15473 r15488  
    5050    public PermutationProblem()
    5151      : base() {
    52       Decoder = new ExtremePointPermutationDecoder(new BinPackerFirstFit()); // default decoder
     52      Decoder = new ExtremePointPermutationDecoder(); // default decoder
    5353
    5454      Encoding = new Encodings.PermutationEncoding.PermutationEncoding(EncodedSolutionName, Items.Count, PermutationTypes.Absolute);
Note: See TracChangeset for help on using the changeset viewer.