3d-bin-container-packing icon indicating copy to clipboard operation
3d-bin-container-packing copied to clipboard

Containers only used once

Open Macrox14 opened this issue 3 years ago • 5 comments

Hi, I am working with 2 containers, is there a way to force to only use a container once? Here my example:

List<Container> containers = new ArrayList<Container>();
containers.add(new Container("c1",100, 100, 100, 0));
containers.add(new Container("c2",120, 120, 120, 0));

Packager packager =  LargestAreaFitFirstPackager.newBuilder().withContainers(containers).build();

List<BoxItem> products = new ArrayList<BoxItem>();
products.add(new BoxItem(new Box("b1", 90, 90, 90, 0), 1));
products.add(new BoxItem(new Box("b2", 80, 80, 80, 0), 1));

List<Container> fits =  packager.packList(products, containers.size(), System.currentTimeMillis() + 5000); 

The result is c1 twice. Is there a way to get c1 and c2?

Macrox14 avatar Oct 11 '20 04:10 Macrox14

Hi, no, this is currently not supported.

skjolber avatar Dec 06 '20 19:12 skjolber

@Macrox14 care to describe your use-case in more detail?

skjolber avatar Dec 09 '20 18:12 skjolber

@skjolber Hi! I think this is the case.

I have N containers. They may be different or the same. I have K boxes that need to be distributed among N containers in order to spend as few containers as possible, and not to find the most suitable container to fit all the boxes at once.

Here is an example of a Python library that allows you to set the [distribute_items=True] parameter: https://github.com/enzoruiz/3dbinpacking.

Do I understand correctly that now your library can not distribute boxes between containers?

4ybakut2004 avatar Feb 17 '22 05:02 4ybakut2004

Hmm I understand having a fixed set of containers (i.e. a fixed quantity of each container).

I have K boxes that need to be distributed among N containers in order to spend as few containers as possible, and not to find the most suitable container to fit all the boxes at once.

But is not "one" a special case of "as few as possible"?

skjolber avatar Feb 21 '22 21:02 skjolber

But is not "one" a special case of "as few as possible"?

For example there are 10 containers with a total volume of 10 cubic meters and many boxes with a total volume of 5 cubic meters. "As little as possible" means that the algorithm ideally will fill 5 containers to 100% and 5 containers will remain empty, rather than distribute boxes between containers to 50% of each container.

4ybakut2004 avatar Feb 24 '22 06:02 4ybakut2004

Fixed in 3.x branch.

skjolber avatar Mar 23 '23 23:03 skjolber