greedy_knapsack: Greedy Knapsack

Description Usage Arguments Value References

View source: R/greedy_knapsack.R

Description

Returns the maximum value given the capacity of knapsack by sorting the items in decreasing order of value per unit of weight.

Usage

1

Arguments

x

A data.frame consisting of two variables. w represents the object's weight and v is the value.

W

the maximum capacity of the knapsack.

Value

A list containing the maximum value and the elements.

References

en.wikipedia.org/wiki/Knapsack_problem


Jorisvdoorn/lab6group8 documentation built on Oct. 30, 2019, 8:02 p.m.