Last change
on this file since 15454 was
15454,
checked in by rhanghof, 7 years ago
|
#2817
- Extreme point bin packing does not need the occupation layer anymore
- Changes at the fitting algorithm. Now they are packing the items as in the paper of S. Martello, D. Pisinger, D. Vigo described
|
File size:
1.5 KB
|
Line | |
---|
1 | using HeuristicLab.Core;
|
---|
2 | using HeuristicLab.Encodings.PermutationEncoding;
|
---|
3 | using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
|
---|
4 | using System;
|
---|
5 | using System.Collections.Generic;
|
---|
6 | using System.Linq;
|
---|
7 | using System.Text;
|
---|
8 | using System.Threading.Tasks;
|
---|
9 |
|
---|
10 | namespace HeuristicLab.Problems.BinPacking3D.Packer {
|
---|
11 |
|
---|
12 | [Item("BinPackerFirstFit", "A class for packing bins for the 3D bin-packer problem. It uses a first fit algorithm")]
|
---|
13 | [StorableClass]
|
---|
14 | public class BinPackerFirstFit : BinPacker {
|
---|
15 |
|
---|
16 | public BinPackerFirstFit(Permutation permutation, PackingShape binShape, IList<PackingItem> items, bool useStackingConstraints) {
|
---|
17 | _permutation = permutation;
|
---|
18 | _binShape = binShape;
|
---|
19 | _items = items;
|
---|
20 | _useStackingConstraints = useStackingConstraints;
|
---|
21 | }
|
---|
22 |
|
---|
23 |
|
---|
24 | /// <summary>
|
---|
25 | /// Packs the items of the object by using a first fit algorithm into an amount of bins and returns them
|
---|
26 | /// </summary>
|
---|
27 | /// <returns>Returns a collection of bin packing 3d objects. Each object represents a bin and the packed items</returns>
|
---|
28 | public override IList<BinPacking3D> PackItems() {
|
---|
29 | IList<BinPacking3D> packingList = new List<BinPacking3D>();
|
---|
30 | IList<int> remainingIds = new List<int>(_permutation);
|
---|
31 |
|
---|
32 | while (remainingIds.Count > 0) {
|
---|
33 | BinPacking3D packingBin = new BinPacking3D(_binShape);
|
---|
34 | PackRemainingItems(ref remainingIds, ref packingBin, _items, _useStackingConstraints, null);
|
---|
35 | packingList.Add(packingBin);
|
---|
36 | }
|
---|
37 |
|
---|
38 | return packingList;
|
---|
39 | }
|
---|
40 | }
|
---|
41 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.