Description Details Author(s) References Examples
The knapsack packages provides three different functions for solving the well-known discrete optimization problem called the knapsack problem. The three functions are brute force search, dynamic programming and greedy heuristics, which can be used to add objects (where each object has a weight w
and value v
) to the knapsack and maximize the value without exceeding the limited weight W
of the knapsack. Also, the knapsack package contains a data set with 2000 knapsack objects, to be optimized by one of the three functions.
The DESCRIPTION file:
This package was not yet installed at build time.
Index: This package was not yet installed at build time.
SHOW SOME FUNCTIONS
Sofie Jörgensen, Henrik Olofsson
Maintainer: Sofie Jörgensen <sofjo281@student.liu.se>, Henrik Olofsson <henol528@student.liu.se>
https://en.wikipedia.org/wiki/Knapsack_problem
1 2 3 4 5 | data(knapsack_objects)
brute_force_knapsack(x = knapsack_objects[1:8,], W = 3500)
knapsack_dynamic(x = knapsack_objects[1:8,], W = 3500)
greedy_knapsack(x = knapsack_objects[1:8,], W = 3500)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.