bruteForceKnapsackSolver: Solves a knapsack problem by using a brute force strategy.

Description Usage Arguments Value See Also Examples

View source: R/bruteForceKnapsackSolver.R

Description

This function takes a data frame with items and a knapsack capacity and returns the solution that maximises the total value.

Usage

1

Arguments

x

A data frame containing items

W

The weight capacity of the knapsack

Value

A list describing the solution

See Also

https://en.wikipedia.org/wiki/Knapsack_problem

Examples

1
2
3
4
5
6
## Not run: 
if(interactive()){
 bruteForceKnapsackSolver(data.frame(w = c(1,2,3), v = c(1,9,4)), W=5)
 }

## End(Not run)

paerx/knapsackph documentation built on Dec. 31, 2020, 1:11 a.m.