Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

4. (10 pts.) Greedy choice Recall that in the 0-1 knapsack problem, you are given a backpack with capacity W. There are n items and

image text in transcribed
image text in transcribed
4. (10 pts.) Greedy choice Recall that in the 0-1 knapsack problem, you are given a backpack with capacity W. There are n items and the i-th item has weight w; and value vi. The goal is to pick some items with total weight at most W that maximize the total value. More formally, you need to find an assignment (*...) with x; (0.1) (ie.. .; is either 0 or 1), where x; = 1 means the i-th item is picked and x; = 0 otherwise. The goal is to maximize E%* subject to the constraint E. SW. As we have discussed in the class, this 0-1 knapsack problem does not have the greedy choice property. Now consider the fractional knapsack problem, where you can take a fraction of an item. More formally, you need to find an assignment (1...) with x 10,11(. can be any real number inclusively between 0 and 1). The goal is to maximize subject to the constraint EXW, SW. The greedy heuristic for each step is to find the item with the largest value per pound and take as much of it as possible. Suppose the j-th item has the largest value-per-pound. Prove that there exists an optimal solution that contains as much of the j-th item as possible. (This shows the greedy choice property.) 4. (10 pts.) Greedy choice Recall that in the 0-1 knapsack problem, you are given a backpack with capacity W. There are n items and the i-th item has weight w; and value v;. The goal is to pick some items with total weight at most W that maximize the total value. More formally, you need to find an assignment (X1,...,xn) with x; {0,1} (i.e., x; is either 0 or 1), where x; = 1 means the i-th item is picked and x; = 0 otherwise. The goal is to maximize 27-1X/v; subject to the constraint E-1X;w; SW. As we have discussed in the class, this 0-1 knapsack problem does not have the greedy choice property. Now consider the fractional knapsack problem, where you can take a fraction of an item. More formally, you need to find an assignment (x1, ... ,xn) with x; (0,1) (i.e., x; can be any real number inclusively between 0 and 1). The goal is to maximize ? : X;V; subject to the constraint ?-x;w;

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Administrator Limited Edition

Authors: Martif Way

1st Edition

B0CGG89N8Z

Students also viewed these Databases questions

Question

Describe the purpose of the most common change interventions.

Answered: 1 week ago