Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
02/28/18 14:05:31 (7 years ago)
Author:
rhanghof
Message:

#2817:

  • Fixes for pruning
File:
1 edited

Legend:

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

    r15731 r15820  
    2828namespace HeuristicLab.Problems.BinPacking3D.ExtremePointPruning {
    2929  internal class ExtremePointPruning : IExtremePointPruning {
    30     public void PruneExtremePoints(ExtremePointPruningMethod pruningMethod, PackingShape bin, Dictionary<BinPacking3D, List<KeyValuePair<int, PackingPosition>>> positions) {
    31       if (pruningMethod == ExtremePointPruningMethod.PruneBehind) {
    32         PruneExtremePointsBehind(bin, positions);
    33       }
     30    public void PruneExtremePoints(PackingShape bin, Dictionary<BinPacking3D, List<KeyValuePair<int, PackingPosition>>> positions) {
     31      PruneExtremePointsBehind(bin, positions);
    3432    }
    3533
    36     public void PruneExtremePoints(ExtremePointPruningMethod pruningMethod, IList<BinPacking3D> binPackings) {
     34    public void PruneExtremePoints(IList<BinPacking3D> binPackings) {
    3735      if (binPackings.Count <= 0) {
    3836        return;
     
    4745      }
    4846      PruneExtremePointsBehind(binPackings[0].BinShape, fixedPositions);
     47    }
     48
     49    public void PruneExtremePoints(BinPacking3D binPacking, int layer) {
     50      var pruningPositions = new List<KeyValuePair<int, PackingPosition>>();
     51      var pruning = new Dictionary<BinPacking3D, List<KeyValuePair<int, PackingPosition>>>();
     52      pruning.Add(binPacking, pruningPositions);
     53      foreach (var item in binPacking.Items.Where(x => x.Value.Layer <= layer)) {
     54        pruningPositions.Add(new KeyValuePair<int, PackingPosition>(item.Key, binPacking.Positions[item.Key]));
     55      }
     56
     57      PruneExtremePointsBehind(binPacking.BinShape, pruning);
    4958    }
    5059
Note: See TracChangeset for help on using the changeset viewer.