3D Bin Packing implementation based on this paper. The code is based on binpacking by bom-d-van but
modified to allow flexible bins and use float64
instead of int
.
go get github.com/gedex/bp3d
p := bp3d.NewPacker()
// Add bins.
p.AddBin(bp3d.NewBin("Small Bin", 10, 15, 20, 100))
p.AddBin(bp3d.NewBin("Medium Bin", 100, 150, 200, 1000))
// Add items.
p.AddItem(bp3d.NewItem("Item 1", 2, 2, 1, 2))
p.AddItem(bp3d.NewItem("Item 2", 3, 3, 2, 3))
// Pack items to bins.
if err := p.Pack(); err != nil {
log.Fatal(err)
}
// Each bin, b, in p.Bins might have packed items in b.Items