Knapsack problem: equal profits
-
05-11-2019 - |
题
I am looking for references to efficient algorithms that solve knapsack problem where all profits are equal.
More formal definition of the problem from a Wikipedia article on KPs:
If all the profits are 1, we will try to maximize the number of items which would not exceed the knapsack capacity:
maximize $\sum_{j=0}^n x_j$
subject to $\sum_{j=0}^n w_jx_j \leq W$,
$x_j \in \{0, 1\}, \forall_j \in \{1, ..., n\}$
I skimmed through Knapsack Problems book (Kellerer et al', 2004) that is referenced by that Wikipedia article but couldn't find that particular problem.
I also saw some posts about this exact problem with no good answers:
The answer to the first post mentions Capital Budgeting problem, but the provided link doesn't discuss the case where all profits (values) are equal, which I believe can be better optimized due to its special case.
The answer to the second post mentions a naive solution in which a greedy algorithm picks minimum weight items at each step until no more items fit in the knapsack. This requires knowing the order of items by weight, which results in $O(n\log{n})$ solution.
Is there an algorithm with a better upper bound (e.g. linear time)?
没有正确的解决方案