Answer to Question #187150 in Algorithms for tejaswini

Question #187150

The general greedy method for the Knapsack problem first sorts the objects by some rule, and then puts the items into the knapsack according to this order subject to the capacity constraint. Consider the following three ordering rules: (a) Sort by size in increasing order. (b) Sort by profit in decreasing order. (c) Sort by profit/size in decreasing order. For each of the three above rules, give an instance to show that the approximation ratio of the greedy method using such rule can be arbitrarily large. 


1
Expert's answer
2021-04-30T00:14:58-0400

As per the required condition in the question,

a) Sort by size in the increasing order -

Given,

N=3, objective 1 objective 2 objective 3

Weight 18 15 10

Profit 25 24 15

Capacity of the knapsack = 20



N=3, objective 1 objective 2 objective 3

Weight 18 15 10

Profit 25 24 15

Select the object which have the minimum weight

Objective Profit Free space in knapsack

3 15 10

2 10*24/15 0

Total profit = 31


Sort by profit in decreasing order -

M = 20, objective 1 objective 2 objective 3

Weight 18 15 10

Profit 25 24 15

Objects are already sorted in decreasing order of profit.


Objective Profit Free space in knapsack

3 15 10

2 2*24/15 0

Total profit = 28.2









Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS