Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/stevenferrer/packme
A 3D bin packing library in Go
https://github.com/stevenferrer/packme
3d-bin-packing 3d-bin-packing-problem go golang
Last synced: 7 days ago
JSON representation
A 3D bin packing library in Go
- Host: GitHub
- URL: https://github.com/stevenferrer/packme
- Owner: stevenferrer
- License: mit
- Created: 2021-07-13T04:18:26.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2021-11-04T01:10:10.000Z (about 3 years ago)
- Last Synced: 2024-06-20T00:33:33.419Z (5 months ago)
- Topics: 3d-bin-packing, 3d-bin-packing-problem, go, golang
- Language: Go
- Homepage:
- Size: 18.6 KB
- Stars: 6
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[![GoDoc Reference](https://pkg.go.dev/badge/github.com/stevenferrer/packme)](https://pkg.go.dev/github.com/stevenferrer/packme)
![Github Actions](https://github.com/stevenferrer/packme/workflows/test/badge.svg)
[![Coverage Status](https://coveralls.io/repos/github/stevenferrer/packme/badge.svg?branch=main)](https://coveralls.io/github/stevenferrer/packme?branch=main)
[![Go Report Card](https://goreportcard.com/badge/github.com/stevenferrer/packme)](https://goreportcard.com/report/github.com/stevenferrer/packme)# PackMe
A 3D bin packing library in Go.
## Packing implementations
All packing implementations comply to [Packer](packer.go) interface.
- [Best-fit packer](best_fit_packer.go) - A 3D bin packing implementation based on a paper by Dube, E., & Kanavathy L. (2006) titled *Optimizing Three-Dimensional Bin Packing Through Simulation*
## Example
```go
// Define box specifications
boxSpecs := []packme.BoxSpec{
packme.NewBoxSpec("Box A", 1, packme.NewDimensions(30, 30, 30)),
packme.NewBoxSpec("Box B", 1, packme.NewDimensions(5, 5, 40)),
packme.NewBoxSpec("Box C", 1, packme.NewDimensions(20, 20, 30)),
}// Define item specifications
itemSpecs := []packme.ItemSpec{
packme.NewItemSpec("Item A1", 17, packme.NewDimensions(10, 10, 30)),
packme.NewItemSpec("Item A2", 1, packme.NewDimensions(10, 10, 30)),
packme.NewItemSpec("Tall Item", 1, packme.NewDimensions(5, 39.5, 5)),
packme.NewItemSpec("Large Item", 1, packme.NewDimensions(50, 50, 100)),
}// Create new instance of best-fit packer
packer := packme.NewBestFitPacker()// Start packing!
packingScheme := packer.Pack(boxes, items)// Print packing scheme
fmt.Println(packingScheme)// Output:
// Box B items(1) dims(5x5x40) vol(1000)
// Tall Item dims(5x5x39.5) vol(987.5) pos(0,0,0) rot(h,l,w)
//
// Box C items(4) dims(20x20x30) vol(12000)
// Item A1 dims(10x10x30) vol(3000) pos(0,0,0) rot(l,w,h)
// Item A1 dims(10x10x30) vol(3000) pos(10,0,0) rot(l,w,h)
// Item A1 dims(10x10x30) vol(3000) pos(0,10,0) rot(l,w,h)
// Item A1 dims(10x10x30) vol(3000) pos(10,10,0) rot(l,w,h)
//
// Box A items(9) dims(30x30x30) vol(27000)
// Item A1 dims(10x10x30) vol(3000) pos(0,0,0) rot(l,w,h)
// Item A1 dims(10x10x30) vol(3000) pos(10,0,0) rot(l,w,h)
// Item A1 dims(10x10x30) vol(3000) pos(20,0,0) rot(l,w,h)
// Item A1 dims(10x10x30) vol(3000) pos(0,10,0) rot(l,w,h)
// Item A1 dims(10x10x30) vol(3000) pos(10,10,0) rot(l,w,h)
// Item A1 dims(10x10x30) vol(3000) pos(20,10,0) rot(l,w,h)
// Item A1 dims(10x10x30) vol(3000) pos(0,20,0) rot(l,w,h)
// Item A1 dims(10x10x30) vol(3000) pos(10,20,0) rot(l,w,h)
// Item A1 dims(10x10x30) vol(3000) pos(20,20,0) rot(l,w,h)
//
// Not packed (6)
// Item A1 dims(10x30x10) vol(3000) pos(0,0,0) rot(l,h,w)
// Item A1 dims(10x30x10) vol(3000) pos(0,0,0) rot(l,h,w)
// Item A1 dims(10x30x10) vol(3000) pos(0,0,0) rot(l,h,w)
// Item A1 dims(10x30x10) vol(3000) pos(0,0,0) rot(l,h,w)
// Item A2 dims(10x30x10) vol(3000) pos(0,0,0) rot(l,h,w)
// Large Item dims(50x100x50) vol(250000) pos(0,0,0) rot(l,h,w)
```## Credits
- [Dube, E., & Kanavathy L. (2006). *Optimizing Three-Dimensional Bin Packing Through Simulation.*](https://www.researchgate.net/publication/228974015_Optimizing_Three-Dimensional_Bin_Packing_Through_Simulation)
- [3D Bin Packing by Enzo Ruiz](https://github.com/enzoruiz/3dbinpacking)## Licence
[MIT](LICENSE)