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.
展开▼