greedy_knapsack: Greedy Knapsack class

Description Usage Arguments

View source: R/greedy_knapsack.R

Description

Greedy Knapsack class

Usage

1

Arguments

x

an object of class data.frame with two variables v (values) and w (weights).

W

numeric scalar object that represents the knapsack size.

In greedy approach to knapsack problem.The unit value per weight is calculated for each item. After calculating unit per weight, the items with maximum values are selected in order. Selected items total must be below knapsack weight W. This approach suppose not to give an exact value but return at least 50% of the maximum value.


uzairjan/AdvR6 documentation built on Dec. 23, 2021, 2:06 p.m.