Description Usage Arguments Value
this function is guaranteed to give a correct answer in all situations. The function enumerates all different combinations by using a binary representation of the numbers 1 to 2n and include all elements of that is equal to 1 in the binary representation.
1 | brute_force_knapsack(x, W, parallel = FALSE)
|
x |
Data frame which consists the value and the weight for each object. |
W |
The knapsack size. |
parallel |
Gives the opportunity to use parallel programming,if parallel=TRUE. |
The functoin returns a list containing two named objects:
"value": maximum knapsack value;
"elements": a vector containing the indexes of the objects (rows of data.frame) used to obtain the final result.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.