greedy_knapsack: Solving the knapsack problem through heuristic approach

Description Usage Arguments Value

View source: R/greedy_knapsack.R

Description

Solving the knapsack problem through heuristic approach

Usage

1
greedy_knapsack(x, W, opt = TRUE)

Arguments

x

is a data.frame containing knapsack data. It has two columns: v with values and w with weights.

W

is a numeric scalar which defined the maximum possible weight knapsack can handle before breaking.

opt

indicates whether or not the better version should be used (for tests it is set to FALSE)

Value

a list object containing the best bag value given the weight and the elements that make up the best bag.


TheodorEmanuelsson/knapsack documentation built on Dec. 18, 2021, 4:11 p.m.