https://github.com/gedex/bp3d
Golang package for 3d bin packing problem
https://github.com/gedex/bp3d
bin-packing golang golang-library
Last synced: 8 months ago
JSON representation
Golang package for 3d bin packing problem
- Host: GitHub
- URL: https://github.com/gedex/bp3d
- Owner: gedex
- License: mit
- Created: 2016-05-09T01:21:45.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2024-08-13T07:24:45.000Z (about 1 year ago)
- Last Synced: 2025-02-04T21:15:04.887Z (8 months ago)
- Topics: bin-packing, golang, golang-library
- Language: Go
- Size: 5.86 KB
- Stars: 89
- Watchers: 6
- Forks: 24
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
bp3d
====3D Bin Packing implementation based on [this paper](http://www.cs.ukzn.ac.za/publications/erick_dube_507-034.pdf). The code is based on [binpacking by bom-d-van](https://github.com/bom-d-van/binpacking) but
modified to allow flexible bins and use `float64` instead of `int`.## Install
```
go get github.com/gedex/bp3d
```## Usage
```
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
```See [`example/example.go`](./example/example.go)
## Credit
* http://www.cs.ukzn.ac.za/publications/erick_dube_507-034.pdf
* https://github.com/bom-d-van/binpacking## License
[MIT](./LICENSE)