Question: Consider the following instance of the knapsack problem: number of jobs n = 4; Capacity of the knapsack M= 9, profits (p1, P2, P3,

Consider the following instance of the knapsack problem: number of jobs n

Consider the following instance of the knapsack problem: number of jobs n = 4; Capacity of the knapsack M= 9, profits (p1, P2, P3, P4) = (2, 4, 6, 8) and weights (W, W2, W3, W4) =(4, 3, 2, 1). (a) (3 points) First explain basic idea of the following dynamic programming formulation: fi(y) = max {fi-1(y), fi-1(y wi) + Pi} (b) (10 points) Then develop the set solution by developing all sets, show purging as you develop sets. Discuss all your work, specially explaining the idea of purging. (c) (2 points) Finally use the above sets to find the optimal solution when capacity of knapsack is 9. Show all your work.

Step by Step Solution

3.54 Rating (157 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

a Dynamic Programming Formulation The dynamic programming formulation for the knapsack problem involves defining a recursive function fiy that represe... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!