Skip to main content
Log in

A column and constraint generation algorithm for the dynamic knapsack problem with stochastic item sizes

  • Full Length Paper
  • Published:
Mathematical Programming Computation Aims and scope Submit manuscript

Abstract

We consider a version of the knapsack problem in which an item size is random and revealed only when the decision maker attempts to insert it. After every successful insertion the decision maker can choose the next item dynamically based on the remaining capacity and available items, while an unsuccessful insertion terminates the process. We propose an exact algorithm based on a reformulation of the value function linear program, which dynamically prices variables to refine a value function approximation and generates cutting planes to maintain a dual bound. We provide a detailed analysis of the zero-capacity case, in which the knapsack capacity is zero, and all item sizes have positive probability of equaling zero. We also provide theoretical properties of the general algorithm and an extensive computational study. Our main empirical conclusion is that the algorithm is able to significantly reduce the gap when initial bounds and/or heuristic policies perform poorly.

This is a preview of subscription content, log in via an institution to check access.

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Fig. 1
Fig. 2
Fig. 3
Fig. 4
Fig. 5

Similar content being viewed by others

References

  1. Adelman, D.: Price-directed replenishment of subsets: methodology and its application to inventory routing. Manuf. Serv. Oper. Manag. 5, 348–371 (2003)

    Article  Google Scholar 

  2. Adelman, D., Klabjan, D.: Computing near-optimal policies in generalized joint replenishment. INFORMS J. Comput. 24, 148–164 (2011)

    Article  MathSciNet  Google Scholar 

  3. Balseiro, S., Brown, D.: Approximations to stochastic dynamic programs via information relaxation duality. Oper. Res. (2018). Forthcoming

  4. Bhalgat, A., Goel, A., Khanna, S.: Improved approximation results for stochastic knapsack problems. In: Proceedings of the Twenty-Second Annual ACM-SIAM Symposium on Discrete Algorithms, pp. 1647–1665. SIAM (2011)

  5. Blado, D., Hu, W., Toriello, A.: Semi-infinite relaxations for the dynamic knapsack problem with stochastic item sizes. SIAM J. Optim. 26, 1625–1648 (2016)

    Article  MathSciNet  Google Scholar 

  6. Blado, D., Toriello, A.: Relaxation analysis for the dynamic knapsack problem with stochastic item sizes. SIAM J. Optim. 29, 1–30 (2019)

    Article  MathSciNet  Google Scholar 

  7. Carraway, R., Schmidt, R., Weatherford, L.: An algorithm for maximizing target achievement in the stochastic knapsack problem with normal returns. Naval Res. Logist. 40, 161–173 (1993)

    Article  MathSciNet  Google Scholar 

  8. Dean, B., Goemans, M., Vondrák, J.: Approximating the stochastic knapsack problem: the benefit of adaptivity. In: Proceedings of the 45th Annual IEEE Symposium on the Foundations of Computer Science, pp. 208–217. IEEE (2004)

  9. Dean, B., Goemans, M., Vondrák, J.: Adaptivity and approximation for stochastic packing problems. In: Proceedings of the Sixteenth Annual ACM-SIAM Symposium on Discrete Algorithms, pp. 395–404. SIAM (2005)

  10. Dean, B., Goemans, M., Vondrák, J.: Approximating the stochastic Knapsack problem: the benefit of adaptivity. Math. Oper. Res. 33, 945–964 (2008)

    Article  MathSciNet  Google Scholar 

  11. Derman, C., Lieberman, G., Ross, S.: A renewal decision problem. Manag. Sci. 24, 554–561 (1978)

    Article  MathSciNet  Google Scholar 

  12. de Farias, D., van Roy, B.: The linear programming approach to approximate dynamic programming. Oper. Res. 51, 850–865 (2003)

    Article  MathSciNet  Google Scholar 

  13. Goel, A., Indyk, P.: Stochastic load balancing and related problems. In: Proceedings of the 40th Annual IEEE Symposium on the Foundations of Computer Science, pp. 579–586. IEEE (1999)

  14. Goyal, V., Ravi, R.: A PTAS for chance-constrained knapsack problem with random item sizes. Oper. Res. Lett. 38, 161–164 (2010)

    Article  MathSciNet  Google Scholar 

  15. Gupta, A., Krishnaswamy, R., Molinaro, M., Ravi, R.: Approximation algorithms for correlated knapsacks and non-martingale bandits. In: Proceedings of the 52nd IEEE Annual Symposium on Foundations of Computer Science, pp. 827–836. IEEE (2011)

  16. Henig, M.: Risk criteria in a stochastic knapsack problem. Oper. Res. 38, 820–825 (1990)

    Article  MathSciNet  Google Scholar 

  17. Ilhan, T., Iravani, S., Daskin, M.: The adaptive knapsack problem with stochastic rewards. Oper. Res. 59, 242–248 (2011)

    Article  Google Scholar 

  18. Kellerer, H., Pferschy, U., Pisinger, D.: Knapsack Problems. Springer, Berlin (2004)

    Book  Google Scholar 

  19. Kleinberg, J., Rabani, Y., Tardos, É.: Allocating Bandwidth for Bursty Connections. In: Proceedings of the Twenty-Ninth Annual ACM Symposium on the Theory of Computing, pp. 664–673. Association for Computing Machinery (1997)

  20. Kleinberg, J., Rabani, Y., Tardos, É.: Allocating bandwidth for bursty connections. SIAM J. Comput. 30, 191–217 (2000)

    Article  MathSciNet  Google Scholar 

  21. Kleywegt, A., Papastavrou, J.: The dynamic and stochastic knapsack problem. Oper. Res. 46, 17–35 (1998)

    Article  MathSciNet  Google Scholar 

  22. Kleywegt, A., Papastavrou, J.: The dynamic and stochastic knapsack problem with random sized items. Oper. Res. 49, 26–41 (2001)

    Article  MathSciNet  Google Scholar 

  23. Ma, W.: Improvements and Generalizations of Stochastic Knapsack and Multi-Armed Bandit Algorithms. In: Proceedings of the Twenty-Fifth Annual ACM-SIAM Symposium on Discrete Algorithms (SODA), pp. 1154–1163. SIAM (2014)

  24. Ma, W.: Improvements and generalizations of stochastic knapsack and markovian bandits approximation algorithms. Math. Oper. Res. (2018). Forthcoming

  25. Martello, S., Toth, P.: Knapsack Problems: Algorithms and Computer Implementations. Wiley, Chichester (1990)

    MATH  Google Scholar 

  26. Merzifonluoğlu, Y., Geunes, J., Romeijn, H.: The static stochastic knapsack problem with normally distributed item sizes. Math. Program. 134, 459–489 (2012)

    Article  MathSciNet  Google Scholar 

  27. Morita, H., Ishii, H., Nishida, T.: Stochastic linear knapsack programming problem and its applications to a portfolio selection problem. Eur. J. Oper. Res. 40, 329–336 (1989)

    Article  MathSciNet  Google Scholar 

  28. Papastavrou, J., Rajagopalan, S., Kleywegt, A.: The dynamic and stochastic knapsack problem with deadlines. Manage. Sci. 42, 1706–1718 (1996)

    Article  Google Scholar 

  29. Schweitzer, P., Seidmann, A.: Generalized polynomial approximations in markovian decision processes. J. Math. Anal. Appl. 110, 568–582 (1985)

    Article  MathSciNet  Google Scholar 

  30. Shi, W., Zhang, L., Wu, C., Li, Z., Lau, F.: An online auction framework for dynamic resource provisioning in cloud computing. IEEE/ACM Trans. Netw. 24, 2060–2073 (2016)

    Article  Google Scholar 

  31. Sniedovich, M.: Preference order stochastic knapsack problems: methodological issues. J. Oper. Res. Soc. 31, 1025–1032 (1980)

    Article  MathSciNet  Google Scholar 

  32. Steinberg, E., Parks, M.: A preference order dynamic program for a knapsack problem with stochastic rewards. J. Oper. Res. Soc. 30, 141–147 (1979)

    Article  Google Scholar 

  33. Trick, M., Zin, S.: Spline approximations to value functions: a linear programming approach. Macroecon. Dyn. 1, 255–277 (1997)

    Article  Google Scholar 

Download references

Acknowledgements

D. Blado’s work was partially supported by an NSF Graduate Research Fellowship Program under Grant No. DGE-1650044. Both authors’ work was partially supported by the National Science Foundation via grant CMMI-1552479.

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Alejandro Toriello.

Additional information

Publisher's Note

Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Appendix

Appendix

1.1 Proof of Proposition 2

Proof

For simplicity in notation, let us denote \(v^*_N(0)\) as \(v_N\) and \(w^*_N(0)\) as \(w_N\). We proceed by induction on the size of N, with the trivial base case that \(w_{\{i\}} = q_i c_i\). We now observe

$$\begin{aligned} w_N&= v_{ \{ 1, \dots , n \}} - \sum _{\begin{array}{c} U \subsetneq N \\ n \not \in U \end{array}} w_U - \sum _{\begin{array}{c} U \subsetneq N \\ n \in U \end{array}} w_U = v_{ \{ 1, \dots , n \}} - v_{ \{ 1, \dots , n-1 \}} - \sum _{\begin{array}{c} U \subsetneq N \\ n \in U \end{array}} w_U \nonumber \\&= \left( v_{ \{ 1, \dots , n-1\}} + q_n c_n \, \prod _{i \le n-1} q_i \right) - v_{ \{ 1, \dots , n-1 \}} - \sum _{\begin{array}{c} U \subsetneq N \\ n \in U \end{array}} w_U \nonumber \\&= q_n c_n r_{N \backslash n} - \sum _{\begin{array}{c} U \subsetneq N \\ n \in U \end{array}} w_U = q_n c_n r_{N \backslash n} - \sum _{\begin{array}{c} U \subsetneq N \\ n \in U \end{array}} \Bigl [ (-1)^{|U| + 1} \, q_n c_n \, \prod _{i \in U \backslash n} p_i \Bigr ] \nonumber \\&= q_n c_n r_{N \backslash n} - q_n c_n \left( \sum _{U \subsetneq N \backslash n} \Bigl [ (-1)^{|U| + 2} \prod _{i \in U} p_i \Bigr ] \right) , \end{aligned}$$
(16)

where \(r_U := \prod _{i \in U} q_i\), and the second to last equality follows from the induction hypothesis. Considering the following identity,

$$\begin{aligned} \prod _{i \in N} p_i = \sum _{U \subseteq N} (-1)^{|U|} r_U, \end{aligned}$$

we can thus simplify (16) above to yield

$$\begin{aligned} w_N&= q_n c_n r_{N \backslash n} - q_n c_n \sum _{U \subsetneq N \backslash n} (-1)^{|U|} \sum _{V \subseteq U} (-1)^{|V|} r_V \nonumber \\&= q_n c_n \left[ r_{N \backslash n} - \sum _{U \subsetneq N \backslash n} \sum _{V \subseteq U} (-1)^{|U| + |V|} \, r_V \right] \nonumber \\&= q_n c_n \left[ r_{N \backslash n} + \sum _{U \subset N \backslash n} \sum _{V \subseteq U} (-1)^{|U| + |V| + 1} \, r_V \right] . \end{aligned}$$
(17)

Examining the double sum in (17), for a set X, \(r_X\) appears once for each (strict) subset of \((N \backslash n) \backslash X\). Thus we have

$$\begin{aligned} \sum _{U \subsetneq N \backslash n} \sum _{V \subseteq U} (-1)^{|U| + |V| + 1} \, r_V = \sum _{X \subsetneq N \backslash n} r_X \sum _{Y \subsetneq (N \backslash n) \backslash X} (-1)^{|Y|+ 1}, \end{aligned}$$
(18)

where the exponent for \(-1\) is taken from the substitution of \(V = X\) and \(U = X \cup Y\).

On the other hand, the right hand side of (9) can be rewritten as

$$\begin{aligned}&q_n c_n \, (-1)^{|N| + 1} \prod _{i < n} p_i = q_n c_n \, (-1)^{|N| + 1} \sum _{X \subseteq N \backslash n} (-1)^{|X|} \, r_X \nonumber \\&\quad = q_n c_n \, \sum _{X \subseteq N \backslash n} (-1)^{|N| + |X| + 1} \, r_X \nonumber \\&\quad = q_n c_n \Bigl [ r_{N \backslash n} + \sum _{X \subset N \backslash n} (-1)^{|N| + |X| + 1} \, r_X \Bigr ] \end{aligned}$$
(19)

Comparing the double sum in (17) with the sum in (19), identity (18) implies that it thus suffices to show

$$\begin{aligned} S_{N,X} := \sum _{Y \subset (N \backslash n) \backslash X} (-1)^{|Y|+ 1} = (-1)^{|N + |X| + 1}. \end{aligned}$$

But viewing the sum \(S_{N,X}\) combinatorially, we can rewrite

$$\begin{aligned} S_{N,X}= & {} \sum _{i = 0}^{|N| - |X| - 2} \left( {\begin{array}{c}|N| - |X| - 1\\ i\end{array}}\right) (-1)^{i + 1} \\= & {} \sum _{i = 0}^{|N| - |X| - 1} \left( {\begin{array}{c}|N| - |X| - 1\\ i\end{array}}\right) (-1)^{i + 1} - \, (-1)^{|N| - |X| } \\= & {} - \sum _{i = 0}^{k} \left( {\begin{array}{c}k\\ i\end{array}}\right) (-1)^{i} + \, (-1)^{k} = (-1)^{k}, \end{aligned}$$

where the third equality substitutes \(k = |N| - |X| - 1\), and the last equality follows from the identity that the alternating sum of binomial coefficients is 0. Hence,

$$\begin{aligned} S_{N,X} ={\left\{ \begin{array}{ll} -1 = (-1)^{|N| + |X| + 1} &{} \text {if}\, |N|\,\text {and}\, |X|\,\text {have the same parity} \\ 1 = (-1)^{|N| + |X| + 1} &{} \text {if}\, |N|\,\text {and}\,|X|\,\text {have different parity.} \end{array}\right. } \end{aligned}$$

The entire argument above is identical for any subset \(M \subseteq N\). \(\square \)

1.2 Computational experiments—10-item instances discussion

Table 3 provides summary results for the computational experiments described in Sect. 5. The success rate is defined as the percentage of instances that reached the optimality gap within the time limit, while run time is the average run time in hours for the successful instances. The incomplete remaining gap refers to the geometric mean of the remaining gap of any instance that did not reach the target optimality gap within the time limit. We observe from Table 3 that distributions D6 and D7, the two distributions that do not have support for 0, have the highest success rate. Other distributions seem to have a lower success rate as the variance of the distribution decreases; these results suggest that both including 0 in the support and smoothing the distribution can make closing the final gap of less than 0.5% difficult. We also observed that uncorrelated instances tend to take less time to complete than correlated instances, which makes sense as correlated item sizes and profits tend to make more difficult deterministic knapsack problems.

Additionally, recalling that the 10-item instances actually solve to (numerical) optimality, Figs. 6 and 7 provide insight into which set cardinalities are more prevalent in the optimal solution. In particular, we observe a noticeable difference in the set size distributions between the Bernoulli instances (D1, D3, D4, D5) and non-Bernoulli instances (D2, D6, D7). The plot for Bernoulli instances is more skewed to the right and has a mode of two items, which further explains why the Quadratic relaxation (4) (which includes all singleton and pair item sets) was the best-performing approximation in earlier experiments for these instance types [6]. However, the plot for non-Bernoulli instances seems to become more normally distributed as the instance’s variance decreases: D2 is centered around set sizes of 3 and 4, D6 centered around set sizes 4 and 5, and D7 centered around set size 5. This suggests that, at optimality, less extreme instances favor variables that correspond to larger item set sizes, because individual items have a relatively smaller impact, as opposed to in the more extreme Bernoulli instances.

Table 3 10-Item instances summary
Fig. 6
figure 6

10 Items: \(w_{U}(\sigma )\) set size frequencies, Bernoulli

Fig. 7
figure 7

10 Items: \(w_{U}(\sigma )\) set size frequencies, non-Bernoulli

Fig. 8
figure 8

30 Items-distribution variance versus relative remaining gap

Fig. 9
figure 9

30 Items-fill rate versus relative remaining gap

Fig. 10
figure 10

30 Items-initial gap versus relative remaining gap

Fig. 11
figure 11

20 Items-distribution variance versus relative gap closed per loop

1.3 Additional plots—20 and 30-item instances

Figures 8910 display various parameters of the 30 item instances against the relative remaining gap, while Figs. 111213141516 display various parameters of the 20 and 30-item instances against the relative gap closed per loop (RGPL), an alternative metric for the general algorithm’s progress.

Fig. 12
figure 12

20 Items-fill rate versus relative gap closed per loop

Fig. 13
figure 13

20 Items-initial gap versus relative gap closed per loop

Fig. 14
figure 14

30 Items-distribution variance versus relative gap closed per loop

Fig. 15
figure 15

30 Items-fill rate versus relative gap closed per loop

Fig. 16
figure 16

30 Items-initial gap versus relative gap closed per loop

1.4 Raw data

Tables 456 present the raw data used to calculate the summaries in Tables 123 of the general algorithm’s performance in Sect. 5. They are separated by the number of items in each instance, recording results for 10, 20, and 30-items. For fairness in comparisons, the Avg. Inner Loops Metric for 20 and 30-item instances is only recorded for instances that completed 16 algorithm loops.

Table 4 General algorithm performance data, 10 Items
Table 5 General Algorithm Performance Data, 20 Items
Table 6 General Algorithm Performance Data, 30 Items

Rights and permissions

Reprints and permissions

About this article

Check for updates. Verify currency and authenticity via CrossMark

Cite this article

Blado, D., Toriello, A. A column and constraint generation algorithm for the dynamic knapsack problem with stochastic item sizes. Math. Prog. Comp. 13, 185–223 (2021). https://doi.org/10.1007/s12532-020-00189-0

Download citation

  • Received:

  • Accepted:

  • Published:

  • Issue Date:

  • DOI: https://doi.org/10.1007/s12532-020-00189-0

Mathematics Subject Classification

Navigation