Skip to content

pixmusix/palletize

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Palletizebanner

Simple bruteforce framework for 3D bin packing problem.

  • Provides two types: Cartons to be packed, and Pallet which accepts cartons using a greedy, layer based algorithm.
  • Implementation can be handled by the user. Alternatively a helper function is provided in prelude which should cover typical use cases.

Quick and dirty appoximations fast enough for real world application.

Dependencies

  • Built on uom for type-safe lengths and masses.
  • Impls Error with thiserror

Quick Start

cargo add palletize
// Example, pack two items where the weights don't matter.
let mut things_to_pack = vec![
    Carton::new(cm(40.0), cm(30.0), cm(20.0), None),
    Carton::new(cm(25.0), cm(25.0), cm(25.0), None),
];

let dim_of_bin = Dims {
    length: cm(100.0),
    width: cm(100.0),
    height: cm(100.0),
};

let shipment: Vec<Pallet> = packit(&amp;mut items, dims, None);
// Example, catching an overweight pallet.
let mut pallet = Pallet::from_dims(Dims {
     length: cm(100.0), width: cm(100.0), height: cm(100.0),
});
pallet.max_weight = Some(kg(20.0));

let heavy_box = Carton::new(cm(40.0), cm(30.0), cm(20.0), Some(kg(15.0)));
assert!(pallet.add(heavy_box).is_ok());

let another_box = Carton::new(cm(30.0), cm(30.0), cm(30.0), Some(kg(10.0)));
let result = pallet.add(another_box);
assert!(matches!(result, Err(Mispack::Overweight)));

Further Reading

Alternatives

https://github.com/topics/bin-packing?o=desc&s=

About

A boring, brute force, but simple approach to the Bin Packing Problem

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages