# mknapsack: Optimal packing into multiple containers In mknapsack: Multiple Knapsack Problem Solver

## Description

Gets containers based on the utility of individual items, their volume and container size

## Usage

 ```1 2``` ```mknapsack(profit, volume, moq = rep(0, length(profit)), cap = 65, sold = rep(0, length(profit))) ```

## Arguments

 `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

## Value

vector with container numbers keeping the permutation of the original data

## Examples

 ``` 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] ```

mknapsack documentation built on May 2, 2019, 8:23 a.m.