knapsack_dynamic: A dynamic knapsack problem algorithm

Description Usage Arguments Value Examples

View source: R/knapsack.R

Description

A dynamic knapsack problem algorithm

Usage

1

Arguments

x

A data frame with two variables, v and w, only containing positive values.

W

Knapsack size.

Value

A list containing the value of the knapsack and it's corresponding elements.

Examples

1
2
3
4
5
6
7
set.seed(42)
n <- 2000
knapsack_objects <- data.frame(
   w = sample(1:4000, size = n, replace = TRUE),
   v = runif(n = n, 0, 10000)
   )
knapsack_dynamic(x = knapsack_objects[1:8,], W = 3500)

Safvenberger/Lab6RT documentation built on Oct. 16, 2020, 1:56 a.m.