Description Usage Arguments Value Examples
View source: R/knapsack_brute.R
knapsack brute force, the function goes through all the possible answers.
1 | brute_force_knapsack(x, W, parallel = FALSE)
|
x |
An object with the class “data frame”, the weight of the data in the first column and price in the second column. |
W |
Maximal capacity of the knapsack. |
parallel |
Parallelize programming using mclapply and foreach, default is FALSE. |
A list of the greatest combined value and the elements.
1 2 3 | x<-knapsack_data(8)
brute_force_knapsack(x,3500)
system.time(brute_force_knapsack(x,3500))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.