greedy_knapsack: Knapsack greedy

Description Usage Arguments Value Examples

View source: R/knapsack_greedy.R

Description

Greedy approximation algorithm for the knapsak problem.

Usage

1
greedy_knapsack(x, W, show_elements = TRUE, old = FALSE)

Arguments

x

An object with the class “data frame”, the weight of the data in the first column and price in the second column.

W

Maximal capacity of the knapsack.

show_elements

Do you want the function to display the elements, default value is to show the eletmes

old

Old calculations vs new ones.

Value

A list of the greatest combined value and the elements.

Examples

1
2
3

harjew/lab6G3 documentation built on Nov. 4, 2019, 1:28 p.m.