Documente Academic
Documente Profesional
Documente Cultură
Contents
[hide]
1 Definition
2 Computational complexity
6 See also
7 References
8 Further reading
9 External links
[edit] Definition
In the following, we have n kinds of items, 1 through n. Each kind of item i has a value vi and
a weight wi. We usually assume that all values and weights are nonnegative. The maximum
weight that we can carry in the bag is W.
The most common formulation of the problem is the 0-1 knapsack problem, which restricts
the number xi of copies of each kind of item to zero or one. Mathematically the 0-1-knapsack
problem can be formulated as:
maximize
subject to
The bounded knapsack problem restricts the number xi of copies of each kind of item to a
maximum integer value ci. Mathematically the bounded knapsack problem can be formulated
as:
maximize
subject to
The unbounded knapsack problem places no upper bound on the number of copies of each
kind of item.
Of particular interest is the special case of the problem with these properties:
it is a decision problem,
it is a 0-1 problem,
for each kind of item, the weight equals the value: wi = vi.
Notice that in this special case, the problem is equivalent to this: given a set of nonnegative
integers, does any subset of it add up to exactly W? Or, if negative weights are allowed and W
is chosen to be zero, the problem is: given a set of integers, does any subset add up to exactly
0? This special case is called the subset sum problem. In the field of cryptography the term
knapsack problem is often used to refer specifically to the subset sum problem.
If multiple knapsacks are allowed, the problem is better thought of as the bin packing
problem.
there is a fully polynomial-time approximation scheme, which uses the pseudopolynomial time algorithm as a subroutine
the problem is NP-complete to solve exactly, thus it is expected that no algorithm can
be both correct and fast (polynomial-time) on all cases
many cases that arise in practice, and "random instances" from some distributions, can
nonetheless be solved exactly.
The subset sum version of the knapsack problem is commonly known as one of Karp's 21
NP-complete problems.
There have been attempts to use subset sum as the basis for public key cryptography systems,
such as the Merkle-Hellman knapsack cryptosystem. These attempts typically used some
group other than the integers. Merkle-Hellman and several similar algorithms were later
broken, because the particular subset sum problems they produced were in fact solvable by
polynomial-time algorithms.
One theme in research literature is to identify what the "hard" instances of the knapsack
problem look like[1][2], or viewed another way, to identify what properties of instances in
practice might make them more amenable than their worst-case NP-complete behaviour
suggests.
Several algorithms are freely available to solve knapsack problems, based on dynamic
programming approach[3], branch and bound approach[4] or hybridations of both approaches[5]
[6][7][8]
m[0] = 0 (the sum of zero items, i.e., the summation of the empty set)
length of the input to the problem is proportional to the number, logW, of bits in W, not to W
itself.
m[0,w] = 0
m[i,0] = 0
; if
.
The solution can then be found by calculating m[n,W]. To do this efficiently we can use a
table to store previous computations. This solution will therefore run in O(nW) time and
O(nW) space.
, and
for some
where
iff
and
for some
i.e. = 1. The verification of this dominance is
computationally hard, so it can be used in a dynamic programming approach only.
, iff
, and
for some
i.e.
. This dominance
could be efficiently used in a preprocessing because it can be detected relatively easily.
Packing problem
[edit] References
1. ^ Pisinger, D. 2003. Where are the hard knapsack problems? Technical Report
2003/08, Department of Computer Science, University of Copenhagen, Copenhagen,
Denmark.
2. ^ L. Caccetta, A. Kulanoot, Computational Aspects of Hard Knapsack Problems,
Nonlinear Analysis 47 (2001) 55475558.
3. ^ Rumen Andonov, Vincent Poirriez, Sanjay Rajopadhye (2000) Unbounded
Knapsack Problem : dynamic programming revisited European Journal of Operational
Research 123: 2. 168-181 http://dx.doi.org/10.1016/S0377-2217(99)00265-9
4. ^ S. Martello, P. Toth, Knapsack Problems: Algorithms and Computer Implementation
, John Wiley and Sons, 1990
5. ^ S. Martello, D. Pisinger, P. Toth, Dynamic programming and strong bounds for the
0-1 knapsack problem , Manag. Sci., 45:414-424, 1999.
6. ^ Vincent Poirriez, Nicola Yanev, Rumen Andonov (2009) A Hybrid Algorithm for the
Unbounded Knapsack Problem Discrete Optimization
http://dx.doi.org/10.1016/j.disopt.2008.09.004
7. ^ G. Plateau, M. Elkihel, A hybrid algorithm for the 0-1 knapsack problem, Methods
of Oper. Res., 49:277-293, 1985.
8. ^ S. Martello, P. Toth, A mixture of dynamic programming and branch-and-bound for
the subset-sum problem, Manag. Sci., 30:765-771
Garey, Michael R.; David S. Johnson (1979). Computers and Intractability: A Guide
to the Theory of NP-Completeness. W.H. Freeman. ISBN 0-7167-1045-5. A6: MP9,
pg.247.
Martello, Silvano; Paolo Toth (1990). Knapsack Problems: Algorithms and Computer
Implementations. John Wiley & Sons. ISBN 0-471-92420-2.
PYAsUKP: Yet Another solver for the Unbounded Knapsack Problem, with code,
benchmarks and downloadable copies of some papers.
Home page of David Pisinger with downloadable copies of some papers on the
publication list (including "Where are the hard knapsack problems?")
Article
Discussion
History
Personal tools
Try Beta
Navigation
Main page
Contents
Featured content
Current events
Random article
Search
Special:Search
Go
Interaction
About Wikipedia
Community portal
Recent changes
Contact Wikipedia
Donate to Wikipedia
Help
Toolbox
Related changes
Upload file
Special pages
Printable version
Permanent link
Languages
Catal
esky
Deutsch
Espaol
Franais
Search
Italiano
Nederlands
Polski
Portugus
Svenska
Ting Vit
Trke
Contact us
Privacy policy
About Wikipedia
Disclaimers