Description Usage Arguments Value References
The 'greedy_knapsack' function is a approach that use the a heuristic or approximation for knapsack package problem.
1 | greedy_knapsack(x, W)
|
x |
is a matrix containing the weights and values |
W |
a numeric string. |
A list cointaining a value and a element
https://en.wikipedia.org/wiki/Knapsack_problem#Greedy_approximation_algorithm 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:8,], W = 3500)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.