Abstract
We demonstrate that it is useful to combine two independently studied methods, thinning and incrementalization, to develop programs that use dynamic programming. While dynamic programming is a fundamental algorithmic pattern, its development is often difficult for average programmers. There are several methods for systematically developing dynamic programming from plain problem descriptions by program transformations. We show that by combining two known methods, thinning and incrementalization, we can systematically derive efficient dynamic-programming implementations from high-level descriptions. The derivations cannot be achieved by using only one of them. We illustrate our approach with the 0-1 knapsack problem, the longest common subsequence problem, and association rule mining from numeric data.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
References
de Moor, O.: Categories, Relations and Dynamic Programming. PhD thesis, Oxford University Computing Laboratory, Technical Monograph PRG-98 (1992)
Bird, R.S., de Moor, O.: Algebra of Programming. Prentice Hall (1997)
Bird, R.S.: Maximum marking problems. J. Funct. Program. 11(4), 411–424 (2001)
de Moor, O.: A generic program for sequential decision processes. In: Swierstra, S.D. (ed.) PLILP 1995. LNCS, vol. 982, pp. 1–23. Springer, Heidelberg (1995)
Pettorossi, A., Proietti, M.: Rules and strategies for transforming functional and logic programs. ACM Computing Surveys 28(2), 360–414 (1996)
Sasano, I., Hu, Z., Takeichi, M., Ogawa, M.: Make it practical: a generic linear-time algorithm for solving maximum-weightsum problems. In: Proceedings of the 5th ACM SIGPLAN International Conference on Functional Programming, ICFP 2000, pp. 137–149. ACM Press (2000)
Liu, Y.A., Stoller, S.D.: Dynamic programming via static incrementalization. Higher-Order and Symbolic Computation 16(1-2), 37–62 (2003)
Giegerich, R., Meyer, C., Steffen, P.: A discipline of dynamic programming over sequence data. Sci. Comput. Program. 51(3), 215–263 (2004)
Liu, Y.A., Stoller, S.D., Li, N., Rothamel, T.: Optimizing aggregate array computations in loops. ACM Trans. Program. Lang. Syst. 27(1), 91–125 (2005)
Sasano, I., Ogawa, M., Hu, Z.: Maximum marking problems with accumulative weight functions. In: Van Hung, D., Wirsing, M. (eds.) ICTAC 2005. LNCS, vol. 3722, pp. 562–578. Springer, Heidelberg (2005)
Puchinger, J., Stuckey, P.J.: Automating branch-and-bound for dynamic programs. In: Proceedings of the 2008 ACM SIGPLAN Symposium on Partial Evaluation and Semantics-based Program Manipulation, PEPM 2008, pp. 81–89. ACM Press (2008)
Morihata, A.: A short cut to optimal sequences. New Generation Comput. 29(1), 31–59 (2011)
Pu, Y., BodÃk, R., Srivastava, S.: Synthesis of first-order dynamic programming algorithms. In: Lopes, C.V., Fisher, K. (eds.) Proceedings of the 26th Annual ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages, and Applications, OOPSLA 2011, pp. 83–98. ACM Press (2011)
Sauthoff, G., Janssen, S., Giegerich, R.: Bellman’s gap: a declarative language for dynamic programming. In: Proceedings of the 13th International ACM SIGPLAN Conference on Principles and Practice of Declarative Programming, pp. 29–40. ACM Press (2011)
Paige, R., Koenig, S.: Finite differencing of computable expressions. ACM Trans. Program. Lang. Syst. 4(3), 402–454 (1982)
Cai, J., Paige, R.: Program derivation by fixed point computation. Sci. Comput. Program. 11(3), 197–261 (1989)
Liu, Y.A., Teitelbaum, T.: Systematic derivation of incremental programs. Sci. Comput. Program. 24(1), 1–39 (1995)
Liu, Y.A., Stoller, S.D., Teitelbaum, T.: Static caching for incremental computation. ACM Trans. Program. Lang. Syst. 20(3), 546–585 (1998)
Cormen, T.H., Stein, C., Rivest, R.L., Leiserson, C.E.: Introduction to algorithms. MIT Press, Cambridge (2001)
Kleinberg, J., Tardos, É.: Algorithm Design Pearson Education Inc. (2006)
Fukuda, T., Morimoto, Y., Morishita, S., Tokuyama, T.: Mining optimized association rules for numeric attributes. J. Comput. Syst. Sci. 58(1), 1–12 (1999)
Fukuda, T., Morimoto, Y., Morishita, S., Tokuyama, T.: Data mining with optimized two-dimensional association rules. ACM Trans. Database Syst. 26(2), 179–213 (2001)
Peyton Jones, S. (ed.): Haskell 98 Language and Libraries: The Revised Report. Cambridge University Press, Cambridge (2003)
Agrawal, R., Imielinski, T., Swami, A.N.: Mining association rules between sets of items in large databases. In: Proceedings of the 1993 ACM SIGMOD International Conference on Management of Data, pp. 207–216. ACM Press (1993)
Koishi, M.: Derivation of two-dimensional maximum weighted sum problems using program transformations. Master’s thesis, Graduate School of Information Science, Tohoku University (2013) (in Japanese)
Mu, S.C.: Maximum segment sum is back: deriving algorithms for two segment problems with bounded lengths. In: Proceedings of the 2008 ACM SIGPLAN Symposium on Partial Evaluation and Semantics-based Program Manipulation, PEPM 2008, pp. 31–39. ACM Press (2008)
Schwartz, J.T.: Automatic data structure choice in a language of very high level. Commun. ACM 18(12), 722–728 (1975)
Schonberg, E., Schwartz, J.T., Sharir, M.: An automatic technique for selection of data structures in SETL programs. ACM Trans. Program. Lang. Syst. 3(2), 126–143 (1981)
Paige, R., Henglein, F.: Mechanical translation of set theoretic problem specifications into efficient ram code—a case study. J. Symb. Comput. 4(2), 207–232 (1987)
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2014 Springer International Publishing Switzerland
About this paper
Cite this paper
Morihata, A., Koishi, M., Ohori, A. (2014). Dynamic Programming via Thinning and Incrementalization. In: Codish, M., Sumii, E. (eds) Functional and Logic Programming. FLOPS 2014. Lecture Notes in Computer Science, vol 8475. Springer, Cham. https://doi.org/10.1007/978-3-319-07151-0_12
Download citation
DOI: https://doi.org/10.1007/978-3-319-07151-0_12
Publisher Name: Springer, Cham
Print ISBN: 978-3-319-07150-3
Online ISBN: 978-3-319-07151-0
eBook Packages: Computer ScienceComputer Science (R0)