The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.

binpackr

R-CMD-check Codecov test coverage Lifecycle: experimental CRAN status

This package implements the First Fit Decreasing algorithm to achieve one dimensional heuristic bin packing. Its run time is of order \(\mathcal{O}(n\,log(n))\) where \(n\) is the number of items to pack.

Installation

You can install the latest CRAN release of binpackr with:

install.packages("binpackr")

Alternatively, you can install the development version of binpackr from GitHub with:

# install.packages("devtools")
devtools::install_github("lschneiderbauer/binpackr")

Example

This is a basic example which shows to retrieve the solution for the bin packing problem.

library(binpackr)

# Generate a vector of item sizes
set.seed(42)
x <- sample(100, 1000, replace = TRUE)

# Pack those items into bins of capacity 130
bins <- bin_pack_ffd(x, cap = 130)

# Number of bins needed to pack the items
print(length(unique(bins)))
#> [1] 389

Benchmarks

The implementation in this package is compared to an implementation of the same algorithm in the BBmisc package. The authors made it clear that speed was none of their concern. BBmisc’s implementation is written in R while this package uses a C++ implementation.

Run time

Memory allocation

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.