greedy_knapsack: A Greedy Solution for the Knapsack Problem

Description Usage Arguments Value

View source: R/greedy_knapsack.r

Description

A Greedy Solution for the Knapsack Problem

Usage

1

Arguments

x

a data.frame with two columns, "w" and "v", indicating the weight and value of items respectively

W

the maximum weight that the knapsack can hold

Value

a list containing two elements: value and elements, representing the maximum value that can be realised with the given knapsack and the indices of the items to be packed in the knapsack for realising maximum value


rojanka/knapsack documentation built on Oct. 22, 2021, 4:11 p.m.