Description Usage Arguments Value Examples
View source: R/brute_force_knapsack.R
Calulate with the brute force method how to get the maximum value out of optimal weight. A choice of a paralell comutation is possible.
1 | brute_force_knapsack(x, W, parallel = FALSE)
|
x |
must be a data frame with variables v (value) and w (weight) |
W |
integer. Specify the maximum value for the knapsack. |
parallel |
logical. Default is TRUE |
Returns a list of the maximum value and which elemets used.
1 2 3 4 5 | knapsack_objects <-
data.frame(
w=sample(1:4000, size = 2000, replace = TRUE),
v=runif(n = 2000, 0, 10000))
brute_force_knapsack(x = knapsack_objects[1:8,], W = 3500,parallel = FALSE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.