Description Usage Arguments Value Examples
Solve the knapsack problem using a brute force approach.
1 | brute_force_knapsack(x, W)
|
x |
A data frame object, containing two variables |
W |
An integer, representing the capacity of the knapsack. |
A list with two objects: $value
which is the value of the knapsack and an object $elements
which are the elements contained in the knapsack.
1 2 3 4 | \code{set.seed(42)}
\code{x <- data.frame(w=sample(1:4000, size = 10, replace = TRUE), v=runif(n = 10, 0, 10000))}
\code{W <- 3500}
\code{brute_force_knapsack(x, W)}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.