Description Usage Arguments Value Examples
Solve knapsack problem by Greedy heuristic. This approach is of complexity O(nlog(n))
1 | greedy_knapsack(x, W)
|
x |
data.frame, first column x:weight of object, second column v:value of object |
W |
numeric, weight limit of knapsack |
list, value: total value of objects, elements: the rows of objects
1 2 3 | data(knapsack_objects)
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.