View source: R/brute_force_knapsack.R
An implementation of the brute force solution to the knapsack problem Where we list all possible combinations of a vector with size {0,1}\*n and then make it into a matrix and check each row for best possible value. The matrix has the size 2^n rows and n columns.
1 | brute_force_knapsack(x, W, parallel = FALSE)
|
x |
data.frame with two vectors of the same size, v with values and w with weights |
W |
an integer as the total weight of the knapsack |
parallel |
boolean deciding if computation should be done in parallel or concurrent |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.