Free cookie consent management tool by TermsFeed Policy Generator

Changeset 15652


Ignore:
Timestamp:
01/24/18 17:15:15 (7 years ago)
Author:
rhanghof
Message:

#2817:

  • Little changes on the packer
Location:
branches/2817-BinPackingSpeedup/HeuristicLab.Problems.BinPacking/3.3/3D
Files:
7 edited

Legend:

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

    r15617 r15652  
    102102      var pruningMethod = ExtremePointPruningMethod.None;
    103103      Solution solution = new Solution(binShape, useExtremePoints: true, stackingConstraints: useStackingConstraints);
    104       foreach (var packedBin in binPacker.PackItems(permutation, binShape, items, ExtremePointCreationMethod, pruningMethod, useStackingConstraints)) {
     104     
     105      IList<BinPacking3D> packingList = binPacker.PackItems(permutation, binShape, items, ExtremePointCreationMethod, pruningMethod, useStackingConstraints);
     106      foreach (var packedBin in packingList) {
    105107        solution.Bins.Add(packedBin);
    106108      }
    107109      return solution;
    108110    }
     111
     112    Permutation AddOffset(Permutation p, int offset) {
     113      var s = p.ToArray();
     114      for (int i = 0; i < s.Length; i++) {
     115        s[i] += offset;
     116      }
     117     
     118      return new Permutation(PermutationTypes.Absolute, s);
     119    }
    109120  }
    110121}
  • branches/2817-BinPackingSpeedup/HeuristicLab.Problems.BinPacking/3.3/3D/Packer/BinPacker.cs

    r15617 r15652  
    5959    /// <returns>Returns a collection of bin packing 3d objects. Each object represents a bin and the packed items</returns>
    6060    public abstract IList<BinPacking3D> PackItems(Permutation sortedItems, PackingShape binShape, IList<PackingItem> items, ExtremePointCreationMethod epCreationMethod, ExtremePointPruningMethod epPruningMethod, bool useStackingConstraints);
    61    
     61
     62
     63
     64    public abstract void PackItemsToPackingList(IList<BinPacking3D> packingList, Permutation sortedItems, PackingShape binShape, IList<PackingItem> items, ExtremePointCreationMethod epCreationMethod, ExtremePointPruningMethod epPruningMethod, bool useStackingConstraints);
     65
    6266    /// <summary>
    6367    /// Pack a given item into a given bin and updates the residual space and the extreme points
  • branches/2817-BinPackingSpeedup/HeuristicLab.Problems.BinPacking/3.3/3D/Packer/BinPackerFirstFit.cs

    r15617 r15652  
    8686      }
    8787    }
     88
     89    public override void PackItemsToPackingList(IList<BinPacking3D> packingList, Permutation sortedItems, PackingShape binShape, IList<PackingItem> items, ExtremePointCreationMethod epCreationMethod, ExtremePointPruningMethod epPruningMethod, bool useStackingConstraints) {
     90      throw new NotImplementedException();
     91    }
    8892  }
    8993}
  • branches/2817-BinPackingSpeedup/HeuristicLab.Problems.BinPacking/3.3/3D/Packer/BinPackerFreeVolumeBestFit.cs

    r15617 r15652  
    9898      return packingList.ToList();
    9999    }
     100
     101    public override void PackItemsToPackingList(IList<BinPacking3D> packingList, Permutation sortedItems, PackingShape binShape, IList<PackingItem> items, ExtremePointCreationMethod epCreationMethod, ExtremePointPruningMethod epPruningMethod, bool useStackingConstraints) {
     102      throw new NotImplementedException();
     103    }
    100104  }
    101105}
  • branches/2817-BinPackingSpeedup/HeuristicLab.Problems.BinPacking/3.3/3D/Packer/BinPackerMinRSLeft.cs

    r15646 r15652  
    7373    }
    7474
     75
     76    public override void PackItemsToPackingList(IList<BinPacking3D> packingList, Permutation sortedItems, PackingShape binShape, IList<PackingItem> items, ExtremePointCreationMethod epCreationMethod, ExtremePointPruningMethod epPruningMethod, bool useStackingConstraints) {
     77      var workingItems = CloneItems(items);
     78      IList<int> remainingIds = new List<int>(sortedItems);
     79
     80      try {
     81        if (packingList.Count > 0) {
     82          BinPacking3D packingBin = packingList.Last();
     83          PackRemainingItems(ref remainingIds, ref packingBin, workingItems, epCreationMethod, useStackingConstraints);
     84        }
     85
     86        while (remainingIds.Count > 0) {
     87          BinPacking3D packingBin = new BinPacking3D(binShape);
     88          PackRemainingItems(ref remainingIds, ref packingBin, workingItems, epCreationMethod, useStackingConstraints);
     89          packingList.Add(packingBin);
     90        }
     91      } catch (BinPacking3DException e) {
     92      }
     93
     94      ExtremePointPruningFactory.CreatePruning().PruneExtremePoints(epPruningMethod, packingList);
     95    }
     96
    7597    /// <summary>
    7698    /// Tries to pack the remainig items into a given BinPacking3D object. Each item could be packed into the BinPacking3D object will be removed from the list of remaining ids
     
    248270    }
    249271
     272   
    250273    protected class ResidualSpaceDifference : IComparable {
    251274      public static ResidualSpaceDifference Create(PackingPosition position, PackingItem item, ResidualSpace rs) {
  • branches/2817-BinPackingSpeedup/HeuristicLab.Problems.BinPacking/3.3/3D/Packer/BinPackerResidualSpaceBestFit.cs

    r15617 r15652  
    127127          (rs.Depth - item.Depth));
    128128    }
     129
     130    public override void PackItemsToPackingList(IList<BinPacking3D> packingList, Permutation sortedItems, PackingShape binShape, IList<PackingItem> items, ExtremePointCreationMethod epCreationMethod, ExtremePointPruningMethod epPruningMethod, bool useStackingConstraints) {
     131      throw new NotImplementedException();
     132    }
    129133  }
    130134}
  • branches/2817-BinPackingSpeedup/HeuristicLab.Problems.BinPacking/3.3/3D/Packer/IBinPacker.cs

    r15617 r15652  
    3939    IList<BinPacking3D> PackItems(Permutation sortedItems, PackingShape binShape, IList<PackingItem> items, ExtremePointCreationMethod epCreationMethod, ExtremePointPruningMethod epPruningMethod, bool useStackingConstraints);
    4040
     41
     42    /// <summary>
     43    /// Packs all items of the bin packer into a collection of BinPacking3D objects
     44    /// </summary>
     45    /// <param name="packingList">Packing list which will be filled by the packer.</param>
     46    /// <param name="sortedItems">Permutation of items sorted by a sorting method. The value of each permutation index references to the index of the items list</param>
     47    /// <param name="binShape">Bin for storing the items</param>
     48    /// <param name="items">A list of packing items which should be assigned to a bin</param>
     49    /// <param name="useStackingConstraints">Flag for using stacking constraints</param>
     50    /// <param name="epPruningMethod"></param>
     51    void PackItemsToPackingList(IList<BinPacking3D> packingList ,Permutation sortedItems, PackingShape binShape, IList<PackingItem> items, ExtremePointCreationMethod epCreationMethod, ExtremePointPruningMethod epPruningMethod, bool useStackingConstraints);
     52
     53
     54
    4155  }
    4256}
Note: See TracChangeset for help on using the changeset viewer.