Description Usage Arguments Value Examples
Gets containers based on the utility of individual items, their volume and container size
1 2 |
profit |
vector with profit for item |
volume |
vector of item sizes in cubic meters |
moq |
vector of flags where 1 means that row contans mininum order quantity (MOQ). Defaults to zero vector matching profit in length. |
cap |
size of the container in cubic meters |
sold |
vector with a number of items that were sold on demand |
vector with container numbers keeping the permutation of the original data
1 2 3 4 5 6 7 8 9 10 11 12 | # Calculate the optimal containers summary for a sample dataset
data(unitsbro)
library(data.table)
units.combined <- data.table(unitsbro)
moq <- units.combined$moq
profit <- units.combined$utility
volume <- units.combined$volume
res <- mknapsack(profit, volume, moq, 65)
units.combined$container <- as.factor(res)
#Aggregate solution to container
containers <- units.combined[order(container), .(volume = sum(volume),
profit = sum(profit)), by = container]
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.