Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
02/28/18 15:33:30 (7 years ago)
Author:
rhanghof
Message:

#2817:

  • Added the property SequenceGroup to the PackingItem
  • Fixed a bug related to the sequence group
Location:
branches/2817-BinPackingSpeedup/HeuristicLab.Problems.BinPacking/3.3/3D
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • branches/2817-BinPackingSpeedup/HeuristicLab.Problems.BinPacking/3.3/3D/ExtremePointCreation/PointProjectionBasedEPCreator.cs

    r15820 r15822  
    5050      }
    5151     
    52       // generate all new extreme points parallel. This speeds up the creator.
    53       var items = binPacking.Items.OrderBy(x => x.Value.Layer);
    54       Parallel.ForEach(items.Where(x => x.Value.Layer < item.Layer), i => {
    55         PackingItem it = i.Value;
    56         PackingPosition pos = binPacking.Positions[i.Key];
    57         GenerateNewExtremePointsForItem(binPacking, it, pos);
    58       });
    59      
    60       Parallel.ForEach(items.Where(x => x.Value.Layer >= item.Layer), i => {
     52      // generate all new extreme points parallel. This speeds up the creator.     
     53      Parallel.ForEach(binPacking.Items, i => {
    6154        PackingItem it = i.Value;
    6255        PackingPosition pos = binPacking.Positions[i.Key];
  • branches/2817-BinPackingSpeedup/HeuristicLab.Problems.BinPacking/3.3/3D/ExtremePointPruning/ExtremePointPruning.cs

    r15820 r15822  
    4747    }
    4848
    49     public void PruneExtremePoints(BinPacking3D binPacking, int layer) {
     49    public void PruneExtremePoints(BinPacking3D binPacking, int sequenceNumber) {
    5050      var pruningPositions = new List<KeyValuePair<int, PackingPosition>>();
    5151      var pruning = new Dictionary<BinPacking3D, List<KeyValuePair<int, PackingPosition>>>();
    5252      pruning.Add(binPacking, pruningPositions);
    53       foreach (var item in binPacking.Items.Where(x => x.Value.Layer <= layer)) {
     53      foreach (var item in binPacking.Items.Where(x => x.Value.SequenceGroup <= sequenceNumber)) {
    5454        pruningPositions.Add(new KeyValuePair<int, PackingPosition>(item.Key, binPacking.Positions[item.Key]));
    5555      }
  • branches/2817-BinPackingSpeedup/HeuristicLab.Problems.BinPacking/3.3/3D/ExtremePointPruning/IExtremePointPruning.cs

    r15820 r15822  
    5050    /// <param name="binPacking"></param>
    5151    /// <param name="layer"
    52     void PruneExtremePoints(BinPacking3D binPacking, int layer);
     52    void PruneExtremePoints(BinPacking3D binPacking, int sequenceNumber);
    5353  }
    5454}
  • branches/2817-BinPackingSpeedup/HeuristicLab.Problems.BinPacking/3.3/3D/Instances/ThreeDInstanceParser.cs

    r15731 r15822  
    5656            var tilt = GetNextInteger(reader);
    5757            for (var i = 0; i < pieces; i++) {
    58               PackingItem item = new PackingItem(width, height, length, Bin, weight, material) {
     58              PackingItem item = new PackingItem(width, height, length, Bin, weight, 0, material) {
    5959                RotateEnabled = rotate == 0 ? false : true,
    6060                TiltEnabled = tilt == 0 ? false : true,
  • branches/2817-BinPackingSpeedup/HeuristicLab.Problems.BinPacking/3.3/3D/Packer/BinPacker.cs

    r15731 r15822  
    9494        packingItem.Height,
    9595        packingItem.Depth,
    96         packingItem.TargetBin, packingItem.Weight, packingItem.Layer);
     96        packingItem.TargetBin,
     97        packingItem.Weight,
     98        packingItem.SequenceGroup,
     99        packingItem.Layer);
    97100
    98101      // The extremepoints are sortet by Y / Z / X
  • branches/2817-BinPackingSpeedup/HeuristicLab.Problems.BinPacking/3.3/3D/Packer/BinPackerMinRSLeft.cs

    r15820 r15822  
    112112        var item = items[itemId];
    113113        var clonedPackingBin = packingBin.Clone() as BinPacking3D;
    114         ExtremePointPruningFactory.CreatePruning(ExtremePointPruningMethod.PruneBehind).PruneExtremePoints(clonedPackingBin, item.Layer - 1);
     114        ExtremePointPruningFactory.CreatePruning(ExtremePointPruningMethod.PruneBehind).PruneExtremePoints(clonedPackingBin, item.SequenceGroup - 1);
    115115
    116116        // If an item doesn't support any weight it should have a minimum waste of the residual space.
  • branches/2817-BinPackingSpeedup/HeuristicLab.Problems.BinPacking/3.3/3D/PackingItem.cs

    r15820 r15822  
    4545    }
    4646
     47    public IFixedValueParameter<IntValue> SequenceGroupParameter {
     48      get { return (IFixedValueParameter<IntValue>)Parameters["SequenceGroup"]; }
     49    }
     50
    4751    public IFixedValueParameter<IntValue> IdParameter {
    4852      get { return (IFixedValueParameter<IntValue>)Parameters["Id"]; }
     
    6468    }
    6569
     70    public int SequenceGroup {
     71      get { return SequenceGroupParameter.Value.Value; }
     72      set { SequenceGroupParameter.Value.Value = value; }
     73    }
     74   
    6675    public int Id {
    6776      get { return IdParameter.Value.Value; }
     
    324333      : base() {
    325334      Parameters.Add(new ValueParameter<PackingShape>("TargetBin"));
    326       Parameters.Add(new FixedValueParameter<DoubleValue>("Weight"));
     335      Parameters.Add(new FixedValueParameter<DoubleValue>("Weight"));     
    327336      Parameters.Add(new FixedValueParameter<IntValue>("Layer"));
     337      Parameters.Add(new FixedValueParameter<IntValue>("SequenceGroup"));
    328338      Parameters.Add(new FixedValueParameter<IntValue>("Id"));
    329339
     
    356366    }
    357367
    358     public PackingItem(int width, int height, int depth, PackingShape targetBin, double weight, int layer)
     368    public PackingItem(int width, int height, int depth, PackingShape targetBin, double weight, int sequenceNumber, int layer)
    359369      : this(width, height, depth, targetBin) {
    360370      this.Weight = weight;
    361371      this.Layer = layer;
    362     }
    363 
    364 
     372      this.SequenceGroup = sequenceNumber;
     373    }
    365374
    366375    public PackingItem(PackingItem packingItem) : this() {
     
    371380      Weight = packingItem.Weight;
    372381      Layer = packingItem.Layer;
     382      SequenceGroup = packingItem.SequenceGroup;
    373383      Id = packingItem.Id;
    374384      Rotated = packingItem.Rotated;
  • branches/2817-BinPackingSpeedup/HeuristicLab.Problems.BinPacking/3.3/3D/Sorting/PermutationPackingItemSorter.cs

    r15731 r15822  
    136136      return new Permutation(PermutationTypes.Absolute,
    137137                    items.Select((v, i) => new { Index = i, Item = v })
    138                          .OrderBy(x => x.Item.Layer)
     138                         .OrderBy(x => x.Item.SequenceGroup)
    139139                         .ThenByDescending(x => x.Item.Depth * x.Item.Width * x.Item.Height)
    140140                         .ThenByDescending(x => x.Item.Height)
     
    150150      return new Permutation(PermutationTypes.Absolute,
    151151                    items.Select((v, i) => new { Index = i, Item = v })
    152                          .OrderBy(x => x.Item.Layer)
     152                         .OrderBy(x => x.Item.SequenceGroup)
    153153                         .ThenByDescending(x => x.Item.Height)
    154154                         .ThenByDescending(x => x.Item.Depth * x.Item.Width * x.Item.Height)
     
    164164      return new Permutation(PermutationTypes.Absolute,
    165165                    items.Select((v, i) => new { Index = i, Item = v })
    166                          .OrderBy(x => x.Item.Layer)
     166                         .OrderBy(x => x.Item.SequenceGroup)
    167167                         .ThenByDescending(x => x.Item.Depth * x.Item.Width)
    168168                         .ThenByDescending(x => x.Item.Height)
     
    178178      return new Permutation(PermutationTypes.Absolute,
    179179                    items.Select((v, i) => new { Index = i, Item = v })
    180                          .OrderBy(x => x.Item.Layer)
     180                         .OrderBy(x => x.Item.SequenceGroup)
    181181                         .ThenByDescending(x => x.Item.Height)
    182182                         .ThenByDescending(x => x.Item.Depth * x.Item.Width)
     
    198198                items.Select((v, i) => new { Index = i, Item = v, ClusterId = (int)(Math.Ceiling(v.Width * v.Depth / clusterRange)) })
    199199                    .GroupBy(x => x.ClusterId)
    200                     .Select(x => new { Cluster = x.Key, Items = x.OrderBy(z => z.Item.Layer).ThenByDescending(y => y.Item.Height).ToList() })
     200                    .Select(x => new { Cluster = x.Key, Items = x.OrderBy(z => z.Item.SequenceGroup).ThenByDescending(y => y.Item.Height).ToList() })
    201201                    .OrderByDescending(x => x.Cluster)
    202202                    .SelectMany(x => x.Items)
     
    218218                items.Select((v, i) => new { Index = i, Item = v, ClusterId = (int)(Math.Ceiling(v.Height / clusterRange2)) })
    219219                    .GroupBy(x => x.ClusterId)
    220                     .Select(x => new { Cluster = x.Key, Items = x.OrderBy(z => z.Item.Layer).ThenByDescending(y => y.Item.Depth * y.Item.Width).ToList() })
     220                    .Select(x => new { Cluster = x.Key, Items = x.OrderBy(z => z.Item.SequenceGroup).ThenByDescending(y => y.Item.Depth * y.Item.Width).ToList() })
    221221                    .OrderByDescending(x => x.Cluster)
    222222                    .SelectMany(x => x.Items)
Note: See TracChangeset for help on using the changeset viewer.