View source: R/greedy_knapsack.R
Greedy Knapsack class
1 | greedy_knapsack(x, W)
|
x |
an object of class data.frame with two variables v (values) and w (weights). |
W |
numeric scalar object that represents the knapsack size. In greedy approach to knapsack problem.The unit value per weight is calculated for each item.
After calculating unit per weight, the items with maximum values are selected in order.
Selected items total must be below knapsack weight |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.