Abstract
The change-making problem is the problem of representing a given amount of money with the fewest number of coins possible from a given set of coin denominations. In the general version of the problem, an upper bound for the availability of every coin value is given. Even the special case, where for each value an unlimited number of coins is available, is NP-hard. Since in the original problem some amounts can not be represented, especially if no coin of value one exists, we introduce generalized problems that look for approximations of the given amount such that a cost function is minimized. We recall algorithms for the change-making problem and present new algorithms for the generalized version of the problem. Motivated by the NP-hardness we study fixed-parameter tractability of all these problems. We show that some of these problems are fixed-parameter tractable and that some are \(\hbox {W}[1]\)-hard. In order to show the existence of polynomial and constant-size kernels we prove some general results and apply them to several parameterizations of the change-making problems.
Similar content being viewed by others
Notes
The case of a maximization problem can be handled in a similar way
For example, if \(b_i=13\) we obtain the following values for the new coin list \(c_{i,0}=1\cdot c_i\), \(c_{i,1}=2\cdot c_i\), \(c_{i,2}=4\cdot c_i\), and \(c_{i,3}=6\cdot c_i\)
The weights \(w_{i,\ell }\) are necessary in order to consider the new coin values. If new coin value \(4\cdot c_i\) is chosen, we have to count 4 coins of our original instance. For example, \(b_2=7\), \(c_2=5\), \(b_3=3\), \(c_3=10\) defines the following values for the new coin list \(c_{2,0}=1\cdot 5=5\), \(c_{2,1}=2\cdot 5=10\), \(c_{2,2}=4\cdot 5=20\), and \(c_{3,0}=1\cdot 10=10\), \(c_{3,1}=2\cdot 10=20\). In order to deal with these not necessarily different coin values, the weights \(w_{i,\ell }\) are important
For example, \({\text {LCM}}(9,12)=36=4\cdot 9 = 3\cdot 12\). Thus no optimal solution can use four or more coins of value 9, since four coins of value 9 could be substituted by three coins of value 12
In the standard definition of Downey and Fellows (see Downey and Fellows 1999, 2013, p. 15), the parameter \(\kappa \) is considered as part of the instance. It is not computed from the instance. However, we discuss parameters that can be derived directly from the instance so that Flum and Grohe’s notation seems to be straightforward. Flum and Grohe require that \(\kappa \) is polynomial time computable which is actually the case for all our parameters but not required in our considerations
Please note that each parameterized problem of change-making, for which \(n\le d\kappa (I)\), d being a constant, lies in the class \(\hbox {FPT}\). That is, e.g., the case for \(\kappa (I):=\sum _{i=1}^{n}b_{i}\)
We use the notations of change-making problems when stating the result of Frank and Tardos (1987)
Please note that in Theorem 7 for some number x, the notation |x| gives its absolute value
References
Adamaszek A, Adamaszek M (2010) Combinatorics of the change-making problem. Eur J Comb 31(1):47–63
Bodlaender HL (2009) Kernelization: new upper and lower bound techniques. In: Chen J, Fomin FV (eds) IWPEC 2009, volume 5917 of lecture notes in computer science. Springer, Berlin, pp 17–37
Bringmann K (2017) A Near-Linear Pseudopolynomial Time Algorithm for Subset Sum. In: ACM-SIAM symposium on discrete algorithms, pp 1073–1084
Cai X (2009) Canonical coin systems for CHANGE-MAKING problems. In: 9th international conference on hybrid intelligent systems (HIS 2009), Shenyang. IEEE, pp 499–504
Chang SK, Gill A (1970) Algorithmic solution of the change-making problem. J ACM 17(1):113–122
Cowen LJ, Cowen R, Steinberg A (2008) Totally greedy coin sets and greedy obstructions. Electron J Comb 15(R90):1–13
Cygan M, Fomin FV, Kowalik L, Lokshtanov D, Marx D, Pilipczuk M, Pilipczuk M, Saurabh S (2015) Parameterized algorithms. Springer, New York
Downey RG, Fellows MR (1995) Fixed-parameter tractability and completeness II: on completeness for W[1]. Theor Comput Sci 141(1–2):109–131
Downey RG, Fellows MR (1999) Parameterized complexity. Springer, Berlin
Downey RG, Fellows MR (2013) Fundamentals of parameterized complexity. Springer, New York
Etscheid M, Kratsch S, Mnich M, Röglin H (2015) Polynomial kernels for weighted problems. In: Mathematical foundations of computer science. Lecture notes in computer science, vol. 673. Springer, Berlin, pp 287–298
Fellows MR, Koblitz N (1993) Fixed-parameter complexity and cryptography. In: Conference applied algebra, algebraic algorithms and error-correcting codes (1993), volume 673 of lecture notes in computer science. Springer, Berlin, pp 121–131
Flum J, Grohe M (2006) Parameterized complexity theory. Springer, Berlin
Frank A, Tardos E (1987) An application of simultaneous diophantine approximation in combinatorial optimization. Combinatorica 7(1):49–65
Horowitz E, Sahni S (1974) Computing partitions with applications to the knapsack problem. J ACM 21(2):277–292
Hu TC, Lenard ML (1976) Optimality of a heuristic solution for a class of knapsack problems. Oper Res 24(1):193–196
Kannan R (1987) Minkowski’s convex body theorem and integer programming. Math Oper Res 12:415–440
Karp RM (1972) Reducibility among combinatorial problems. In: Miller RE, Thatcher JW (eds) Complexity of computer computations. Plenum Press, New York, pp 85–103
Koiliaris K, Xu C (2017) A faster pseudopolynomial time algorithm for subset sum. In: ACM-SIAM symposium on discrete algorithms, pp 1062–1072
Lueker GS (1975) Two NP-complete problems in nonnegative integer programming. Technical Report 178, Department of Computer Science, Princeton University, Princeton, N.J
Magazine MJ, Nemhauser GL, Trotter LE Jr (1975) When the greedy solution solves a class of knapsack problems. Oper Res 23(2):207–217
Martello S, Toth P (1990) Knapsack problems. John Wiley & Sons, New York
Niedermeier R (2006) Invitation to fixed-parameter algorithms. Oxford University Press, New York
Pearson D (2005) A polynomial-time algorithm for the change-making problem. Oper Res Lett 33(3):231–234
Pisinger D (1999) Linear time algorithms for knapsack problems with bounded weights. J Algorithms 33(1):1–14
Wright JW (1975) The change-making problem. J ACM 22(1):125–128
Author information
Authors and Affiliations
Corresponding author
Appendix: NP-Hardness
Appendix: NP-Hardness
It is well known that Subset Sum is NP complete, see Karp (1972). We prove hardness of Min 0-1-CM and Min UCM via a reduction from Subset Sum. To this end, a list of n not necessarily different positive integers \(a_1 \le a_2 \le \dots \le a_n\) and a sum \(a\in \mathbb {N}\) is given. The task is to decide if values \(x_i\in \{0, 1\}\) exist such that
We equivalently solve this task using Min 0-1-CM or Min UCM with 2n coin denominations (\(1\le i\le n\))
and amount
Lowest \(\lceil \log _2(n a_n)\rceil \) bits are used to sum up n values to represent a without carry: For each \(1\le i\le n\), either amount \(a_i\) or zero is added. The next n bits ensure that each \(a_i\) is taken at most once. Therefore, it does not matter if we use Min 0-1-CM or Min UCM. Finally, the highest bit of \(c_i\) and \(c_{n+i}\), respectively, serves to count the number of coins that sum up to c. This information seems to be redundant but is needed to avoid errors due to carries.
If there is a carry originating from the section of the lowest \(\lceil \log _2(n a_n)\rceil \) bits, then more than n coins are added, and independently of carry bits, the highest bits represent a number greater than n—which is excluded by definition of c. Therefore, there is no carry to be added to the middle section of n bits.
We now show that we have to add up exactly one coin from each pair \((c_i, c_{n+i})\) to set all these n bits. Obviously, these n coins set the bits. Powers of two make up a canonical coin system that supports the standard greedy algorithm. All other choices that set all n bits need more than n coin values: If a bit occurs twice than it can be replaced by the next higher bit so that there is a solution with less bits. But solutions with more than n added coins are excluded by the highest bits of the coins that have to sum up to n. A carry of the middle part would only additionally increase this counter.
If Min 0-1-CM or Min UCM finds a solution, then it consists of exactly n different coin denominations where either \(c_i\) or \(c_{n+i}\) is part of the solution. Values \(a_i\) of chosen coins \(c_i\), \(1\le i\le n\), sum up to a. Vice versa, each solution of Subset Sum leads to a solution of both change making problems that adds coin \(c_i\) if \(a_i\) is in the subset sum. Otherwise coin \(c_{i+n}\) is used to represent c. Instance sizes of both subset sum problems are polynomially bounded by the instance size of Subset Sum.
Min UCM is a special case of Min BCM so that we have also proven NP hardness of Min BCM.
Rights and permissions
About this article
Cite this article
Goebbels, S., Gurski, F., Rethmann, J. et al. Change-making problems revisited: a parameterized point of view. J Comb Optim 34, 1218–1236 (2017). https://doi.org/10.1007/s10878-017-0143-z
Published:
Issue Date:
DOI: https://doi.org/10.1007/s10878-017-0143-z