let TOT = w1 + w2 + ... + wn
.
In this answer I will describe the second bag. I will designate the original as βbagβ and optional as βbackpackβ
Fill the bag with all the elements and start to exclude elements from it, "filling out" a new <early backpack with a size of no more than TOT-W
with the highest possible value! You have a problem with a regular backpack, with the same elements and size of a TOT-W
bag.
Evidence:
Suppose you have a better solution with k elements: e_i1,e_i2,...,e_ik
, then the size of the bag is not less than the size W
, which makes the excluded items a satchel no more than the size of TOT-W
. In addition, since the knapsack value is minimized for the size W
, the value of the excluded elements is maximized for the TOT-W
size, since if it were not the maximum, there would be a better bag of at least W
size, with a smaller value.
Another way [assuming you have the maximum excluded bag] is almost identical.
source share