greedy_knapsack: greedy_knapsack

Description Usage Arguments Value References

View source: R/greedy.R

Description

The 'greedy_knapsack' function is a approach that use the a heuristic or approximation for knapsack package problem.

Usage

1

Arguments

x

is a matrix containing the weights and values

W

a numeric string.

Value

A list cointaining a value and a element

References

https://en.wikipedia.org/wiki/Knapsack_problem#Greedy_approximation_algorithm set.seed(42) n <- 2000 knapsack_objects <- data.frame( w=sample(1:4000, size = n, replace = TRUE), v=runif(n = n, 0, 10000) ) greedy_knapsack(x = knapsack_objects[1:8,], W = 3500)


boxizhang/boxknapsack documentation built on May 24, 2019, 7:25 p.m.