Description Usage Arguments Examples
Greedy heuristic
1 | greedy_knapsack(x, W)
|
x |
knapsack objects - data frame |
W |
capacity of knapsack - integer |
1 2 3 4 5 6 7 8 9 | set.seed(42)
n <- 2000
knapsack_objects <- data.frame(
w=sample(1:4000, size = n, replace = TRUE),
v=runif(n = n, 0, 10000)
)
greedy_knapsack(x = knapsack_objects[1:800,], W = 3500)
greedy_knapsack(x = knapsack_objects[1:1200,], W = 2000)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.