Question: please show all work 7. Continuous vs. Discrete Knapsack Problem Given values v[1 ... 6] = (5,5,9, 4, 4, 12), weights w[1 ... 6) =
7. Continuous vs. Discrete Knapsack Problem Given values v[1 ... 6] = (5,5,9, 4, 4, 12), weights w[1 ... 6) = (1,4,3,4, 1,6) and capacity W = 9. a. Suppose these data constitute an instance of the discrete knapsack problem. (Determine x {0, 1} that maximizes 24 XiV subject to the constraint that XW SW.) Solve this problem using dynamic programming. b. Suppose these data constitute an instance of the continuous knapsack problem. (Determine x e [0, 1] that maximizes l_1 XV subject to the constraint that X/W SW.) Solve this problem using a greedy algorithm, using the selection function f(0) = vi/wi c. Regard these data as an instance of the discrete knapsack problem again. Attempt to solve it using a greedy algorithm, using the selection function f(1) = v/wi. If at some point in the greedy loop, you cannot include all of an object, skip it and go to the next "best" object, according to f. Does your answer have the same value that you found in part (a)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
