Description Usage Arguments Examples
This function like two other functions
brute_force_knapsack
and greedy_knapsack
is one
of the aproaches for solving knapsack problem
(https://en.wikipedia.org/wiki/Knapsack_problem). The pseudocode for
this algorithm can be found
here:https://en.wikipedia.org/wiki/Knapsack_problem#0.2F1_knapsack_problem
1 | knapsack_dynamic(x, W)
|
x |
data.frame A data.frame that contains the weight and value of each element. |
W |
integer An integer that shows the limit for the weight that can be carried by the knapsack. |
1 2 3 4 5 | knapsack_dynamic(x = knapsack_objects[1:8,], W = 3500)
# $value
# 16770
# $elements
# 5 8
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.