HOME

TheInfoList



OR:

The
knapsack problem The knapsack problem is a problem in combinatorial optimization: Given a set of items, each with a weight and a value, determine the number of each item to include in a collection so that the total weight is less than or equal to a given limit an ...
is one of the most studied problems in
combinatorial optimization Combinatorial optimization is a subfield of mathematical optimization that consists of finding an optimal object from a finite set of objects, where the set of feasible solutions is discrete or can be reduced to a discrete set. Typical combi ...
, with many real-life applications. For this reason, many special cases and generalizations have been examined. Common to all versions are a set of ''n'' items, with each item 1 \leq j \leq n having an associated profit ''pj'' and weight ''wj''. The binary decision variable ''xj'' is used to select the item. The objective is to pick some of the items, with maximal total profit, while obeying that the maximum total weight of the chosen items must not exceed ''W''. Generally, these coefficients are scaled to become integers, and they are almost always assumed to be positive. The knapsack problem in its most basic form: __TOC__


Direct generalizations

One common variant is that each item can be chosen multiple times. The bounded knapsack problem specifies, for each item ''j'', an upper bound ''uj'' (which may be a positive integer, or infinity) on the number of times item ''j'' can be selected: The unbounded knapsack problem (sometimes called the integer knapsack problem) does not put any upper bounds on the number of times an item may be selected: The unbounded variant was shown to be
NP-complete In computational complexity theory, a problem is NP-complete when: # it is a problem for which the correctness of each solution can be verified quickly (namely, in polynomial time) and a brute-force search algorithm can find a solution by tryi ...
in 1975 by Lueker. Both the bounded and unbounded variants admit an
FPTAS A fully polynomial-time approximation scheme (FPTAS) is an algorithm for finding approximate solutions to function problems, especially optimization problems. An FPTAS takes as input an instance of the problem and a parameter ε > 0. It r ...
(essentially the same as the one used in the 0-1 knapsack problem). If the items are subdivided into ''k'' classes denoted N_i, and exactly one item must be taken from each class, we get the multiple-choice knapsack problem: If for each item the profit and weight are equal, we get the
subset sum problem The subset sum problem (SSP) is a decision problem in computer science. In its most general formulation, there is a multiset S of integers and a target-sum T, and the question is to decide whether any subset of the integers sum to precisely T''.'' T ...
(often the corresponding
decision problem In computability theory and computational complexity theory, a decision problem is a computational problem that can be posed as a yes–no question of the input values. An example of a decision problem is deciding by means of an algorithm whethe ...
is given instead): If we have ''n'' items and ''m'' knapsacks with capacities W_i, we get the multiple knapsack problem: As a special case of the multiple knapsack problem, when the profits are equal to weights and all bins have the same capacity, we can have multiple subset sum problem.
Quadratic knapsack problem The quadratic knapsack problem (QKP), first introduced in 19th century, is an extension of knapsack problem that allows for quadratic terms in the objective function: Given a set of items, each with a weight, a value, and an extra profit that can be ...
: Set-Union Knapsack Problem: SUKP is defined by Kellerer et al (on page 423) as follows:
Given a set of n items N = \ and a set of m so-called elements P = \, each item j corresponds to a subset P_j of the element set P. The items j have non-negative profits p_j, j = 1, \ldots, n, and the elements i have non-negative weights w_i, i = 1, \ldots, m. The total weight of a set of items is given by the total weight of the elements of the union of the corresponding element sets. The objective is to find a subset of the items with total weight not exceeding the knapsack capacity and maximal profit.


Multiple constraints

If there is more than one constraint (for example, both a volume limit and a weight limit, where the volume and weight of each item are not related), we get the multiple-constrained knapsack problem, multidimensional knapsack problem, or ''m''-dimensional knapsack problem. (Note, "dimension" here does not refer to the shape of any items.) This has 0-1, bounded, and unbounded variants; the unbounded one is shown below. The 0-1 variant (for any fixed m \ge 2) was shown to be
NP-complete In computational complexity theory, a problem is NP-complete when: # it is a problem for which the correctness of each solution can be verified quickly (namely, in polynomial time) and a brute-force search algorithm can find a solution by tryi ...
around 1980 and more strongly, has no FPTAS unless P=NP. The bounded and unbounded variants (for any fixed m \ge 2) also exhibit the same hardness. For any fixed m \ge 2, these problems do admit a
pseudo-polynomial time In computational complexity theory, a numeric algorithm runs in pseudo-polynomial time if its running time is a polynomial in the ''numeric value'' of the input (the largest integer present in the input)—but not necessarily in the ''length'' of th ...
algorithm (similar to the one for basic knapsack) and a PTAS.


Knapsack-like problems

If all the profits are 1, we will try to maximize the number of items which would not exceed the knapsack capacity: If we have a number of containers (of the same size), and we wish to pack all ''n'' items in as few containers as possible, we get the
bin packing problem The bin packing problem is an optimization problem, in which items of different sizes must be packed into a finite number of bins or containers, each of a fixed given capacity, in a way that minimizes the number of bins used. The problem has ma ...
, which is modelled by having indicator variables y_i=1 \Leftrightarrow container ''i'' is being used: The
cutting stock problem In operations research, the cutting-stock problem is the problem of cutting standard-sized pieces of stock material, such as paper rolls or sheet metal, into pieces of specified sizes while minimizing material wasted. It is an optimization problem ...
is identical to the
bin packing problem The bin packing problem is an optimization problem, in which items of different sizes must be packed into a finite number of bins or containers, each of a fixed given capacity, in a way that minimizes the number of bins used. The problem has ma ...
, but since practical instances usually have far fewer types of items, another formulation is often used. Item ''j'' is needed ''Bj'' times, each "pattern" of items which fit into a single knapsack have a variable, ''xi'' (there are ''m'' patterns), and pattern ''i'' uses item ''j'' ''bij'' times: If, to the multiple choice knapsack problem, we add the constraint that each subset is of size ''n'' and remove the restriction on total weight, we get the
assignment problem The assignment problem is a fundamental combinatorial optimization problem. In its most general form, the problem is as follows: :The problem instance has a number of ''agents'' and a number of ''tasks''. Any agent can be assigned to perform any ta ...
, which is also the problem of finding a maximal
bipartite matching In the mathematical discipline of graph theory, a matching or independent edge set in an undirected graph is a set of edges without common vertices. Finding a matching in a bipartite graph can be treated as a network flow problem. Definit ...
: In the Maximum Density Knapsack variant there is an initial weight w_0, and we maximize the density of selected of items which do not violate the capacity constraint: {, , colspan="2", maximize \frac{\sum_{j=1}^n x_j p_j}{w_0 +\sum_{j=1}^n x_j w_j} , , - , subject to , \sum_{j=1}^n w_j x_j \leq W, , , - , , x_j \in \{0,1\}, , \forall j \in \{1,\ldots,n\} Although less common than those above, several other knapsack-like problems exist, including: * Nested knapsack problem * Collapsing knapsack problem * Nonlinear knapsack problem * Inverse-parametric knapsack problem The last three of these are discussed in Kellerer et al's reference work, ''Knapsack Problems''.


References


"Algorithms for Knapsack Problems"
D. Pisinger. Ph.D. thesis, DIKU, University of Copenhagen, Report 95/1 (1995). Combinatorial optimization