knapsack_dynamic: knapsack_dynamic

Description Usage Arguments Examples

Description

This function like two other functions brute_force_knapsack and greedy_knapsack is one of the aproaches for solving knapsack problem (https://en.wikipedia.org/wiki/Knapsack_problem). The pseudocode for this algorithm can be found here:https://en.wikipedia.org/wiki/Knapsack_problem#0.2F1_knapsack_problem

Usage

1

Arguments

x

data.frame A data.frame that contains the weight and value of each element.

W

integer An integer that shows the limit for the weight that can be carried by the knapsack.

Examples

1
2
3
4
5
knapsack_dynamic(x = knapsack_objects[1:8,], W = 3500)
# $value
# 16770
# $elements
# 5 8

Yusur/Rlab06 documentation built on May 13, 2019, 11:09 a.m.