## Dynamic programming via static incrementalization (1999)

### Cached

### Download Links

Venue: | In Proceedings of the 8th European Symposium on Programming |

Citations: | 26 - 12 self |

### BibTeX

@INPROCEEDINGS{Liu99dynamicprogramming,

author = {Yanhong A. Liu and Scott D. Stoller},

title = {Dynamic programming via static incrementalization},

booktitle = {In Proceedings of the 8th European Symposium on Programming},

year = {1999},

pages = {288--305},

publisher = {Springer-Verlag}

}

### Years of Citing Articles

### OpenURL

### Abstract

Dynamic programming is an important algorithm design technique. It is used for solving problems whose solutions involve recursively solving subproblems that share subsubproblems. While a straightforward recursive program solves common subsubproblems repeatedly and often takes exponential time, a dynamic programming algorithm solves every subsubproblem just once, saves the result, reuses it when the subsubproblem is encountered again, and takes polynomial time. This paper describes a systematic method for transforming programs written as straightforward recursions into programs that use dynamic programming. The method extends the original program to cache all possibly computed values, incrementalizes the extended program with respect to an input increment to use and maintain all cached results, prunes out cached results that are not used in the incremental computation, and uses the resulting incremental program to form an optimized new program. Incrementalization statically exploits semantics of both control structures and data structures and maintains as invariants equalities characterizing cached results. The principle underlying incrementalization is general for achieving drastic program speedups. Compared with previous methods that perform memoization or tabulation, the method based on incrementalization is more powerful and systematic. It has been implemented and applied to numerous problems and succeeded on all of them. 1

### Citations

8797 |
Introduction to Algorithms
- Cormen, Leiserson, et al.
- 2001
(Show Context)
Citation Context ...en implemented in a prototype system CACHET and applied to numerous problems and succeeded on all of them. 1 Introduction Dynamic programming is an important technique for designing ecient algorithms =-=[2, 15, 52]-=-. It is used for problems whose solutions involve recursively solving subproblems that share subsubproblems. While a straightforward recursive program solves common subsubproblems repeatedly, a dynami... |

2755 |
Dynamic Programming
- BELLMAN
- 1957
(Show Context)
Citation Context ...ntered again. This can reduce the time complexity from exponential to polynomial. The technique is generally applicable to all problems that can be solved eciently by memoizing results of subproblems =-=[4, -=-5]. Given a straightforward recursion, there are two traditional ways to achieve the eect of dynamic programming [15]: memoization [40] and tabulation [5]. This work is supported in part by ONR under... |

2500 |
The Design and Analysis of Computer Algorithms
- Aho, Hopcroft, et al.
- 1974
(Show Context)
Citation Context ...en implemented in a prototype system CACHET and applied to numerous problems and succeeded on all of them. 1 Introduction Dynamic programming is an important technique for designing ecient algorithms =-=[2, 15, 52]-=-. It is used for problems whose solutions involve recursively solving subproblems that share subsubproblems. While a straightforward recursive program solves common subsubproblems repeatedly, a dynami... |

579 | A transformation system for developing recursive programs
- Burstall, Darlington
- 1977
(Show Context)
Citation Context ... also shows exactly when and where subproblems not in the original computation have to be included. Our method is based on a number of static analyses and transformations studied previously by others =-=[6, 9, 21, 42, 47, 55, 56, 62]-=- and ourselves [30, 37, 38, 39] and improves them. Each of the caching, incrementalization, and pruning steps is simple, automatable, and ecient and has been implemented in a prototype system, CACHET.... |

461 | The Omega test: a fast and practical integer programming algorithm for dependence analysis
- Pugh
- 1992
(Show Context)
Citation Context ...b); the inequalities are obtained from inequalities on these arguments (in the where-clause of msub). The simplication here, as well as the manipulations below, can be done automatically using Omega [=-=50-=-], a system for manipulating linear constraints over integer variables, Presburger formulas, and integer tuple relations and sets. Represent the arguments of recursive calls so that the dierences betw... |

241 | KIDS: A Semi-Automatic Program Development System
- Smith
- 1990
(Show Context)
Citation Context ... also shows exactly when and where subproblems not in the original computation have to be included. Our method is based on a number of static analyses and transformations studied previously by others =-=[6, 9, 21, 42, 47, 55, 56, 62]-=- and ourselves [30, 37, 38, 39] and improves them. Each of the caching, incrementalization, and pruning steps is simple, automatable, and ecient and has been implemented in a prototype system, CACHET.... |

181 |
The Synthesizer Generator: A system for constructing language-based editors
- Reps, Teitelbaum
- 1989
(Show Context)
Citation Context ...uture study. 7 Implementation and experimentation results All three steps|caching, incrementalization, and pruning|have been implemented in a prototype system, CACHET, using the Synthesizer Generator =-=[53]-=-. Incrementalization as currently implemented is semi-automatic [29] and is being automated [63]. Determining input increment operations and forming optimized programs are currently done manually, but... |

113 |
Finite Differencing of Computable Expressions
- Paige, Koenig
- 1982
(Show Context)
Citation Context ... 38, 9, 11, 40, 20] or give general frameworks and strategies rather than precise algorithms [49, 8, 5, 46, 6, 3, 37, 47, 15, 39, 14]. Our work is based on the general principle of incrementalization =-=[36, 29]-=- and consists of precise analyses and transformations. In particular, tupling [38, 39] aims to compute multiple values together in an efficient way. It is improved to be automatic on subclasses of pro... |

93 |
Memo functions and machine learning
- Michie
- 1968
(Show Context)
Citation Context ...e efficient solutions involve memoizing results of subproblems [4, 5]. Given a straightforward recursion, there are two traditional ways to achieve the effect of dynamic programming [13]: memoization =-=[32]-=- and tabulation [5]. Memoization uses a mechanism that is separate from the original program to save the result of each function call or reduction [32, 18, 21, 33, 23, 41, 43, 37, 17, 1]. The idea is ... |

89 |
The promotion and accumulation strategies in transformational programming
- Bird
- 1984
(Show Context)
Citation Context ... also shows exactly when and where subproblems not in the original computation have to be included. Our method is based on a number of static analyses and transformations studied previously by others =-=[6, 9, 21, 42, 47, 55, 56, 62]-=- and ourselves [30, 37, 38, 39] and improves them. Each of the caching, incrementalization, and pruning steps is simple, automatable, and ecient and has been implemented in a prototype system, CACHET.... |

89 |
Mechanical program analysis
- Wegbreit
- 1975
(Show Context)
Citation Context ...ng auxiliary information may result in a slower program on certain inputs. We can determine statically whether such information is cached in thesnal program. If so, we can use time and space analysis =-=[32, 54, 59, 60, 61-=-] to determine conservatively whether it is worthwhile to use and maintain such information. The trade-o between time and space is an open problem for future study. Additional properties. Many dynamic... |

78 | Automatic Complexity Analysis
- Rosendahl
- 1989
(Show Context)
Citation Context ...ng auxiliary information may result in a slower program on certain inputs. We can determine statically whether such information is cached in thesnal program. If so, we can use time and space analysis =-=[32, 54, 59, 60, 61-=-] to determine conservatively whether it is worthwhile to use and maintain such information. The trade-o between time and space is an open problem for future study. Additional properties. Many dynamic... |

74 |
Towards an Automated Tupling Strategy
- Chin
- 1993
(Show Context)
Citation Context ...introduces appropriate data structures for the table, and computes the table entries in a bottom-up fashion so that the solution to a superproblem is computed using available solutions to subproblems =-=[5, 11, 12, 13, 14, 24, 45, 46, 47, 48]-=-. This overcomes both disadvantages of memoization. First, tableslling and lookup are compiled into the resulting program, so no separate mechanism is needed for the execution. Second, strategies for ... |

73 | Rules and strategies for transforming functional and logic programs
- Pettorossi, Proietti
- 1996
(Show Context)
Citation Context ...introduces appropriate data structures for the table, and computes the table entries in a bottom-up fashion so that the solution to a superproblem is computed using available solutions to subproblems =-=[5, 11, 12, 13, 14, 24, 45, 46, 47, 48]-=-. This overcomes both disadvantages of memoization. First, tableslling and lookup are compiled into the resulting program, so no separate mechanism is needed for the execution. Second, strategies for ... |

71 | Analysis and caching of dependencies
- Abadi, Lampson, et al.
- 1996
(Show Context)
Citation Context ...8463,1627g. Email: fliu,stollerg@cs.sunysb.edu. 1 Memoization uses a mechanism that is separate from the original program to save the result of each function call or reduction as the program executes =-=[1, 19, 20, 25, 27, 28, 40, 41, 45, 49, 51]-=-. The idea is to keep a separate table of solutions to subproblems, modify recursive calls tosrst look up in the table, and then, if the subproblem has been computed, use the saved result, otherwise, ... |

71 |
Incremental computation via function caching
- Pugh, Teitelbaum
- 1989
(Show Context)
Citation Context ...8463,1627g. Email: fliu,stollerg@cs.sunysb.edu. 1 Memoization uses a mechanism that is separate from the original program to save the result of each function call or reduction as the program executes =-=[1, 19, 20, 25, 27, 28, 40, 41, 45, 49, 51]-=-. The idea is to keep a separate table of solutions to subproblems, modify recursive calls tosrst look up in the table, and then, if the subproblem has been computed, use the saved result, otherwise, ... |

68 |
Tabulation Techniques for Recursive Programs
- Bird
- 1980
(Show Context)
Citation Context ...ntered again. This can reduce the time complexity from exponential to polynomial. The technique is generally applicable to all problems that can be solved eciently by memoizing results of subproblems =-=[4, -=-5]. Given a straightforward recursion, there are two traditional ways to achieve the eect of dynamic programming [15]: memoization [40] and tabulation [5]. This work is supported in part by ONR under... |

53 |
Lazy memo-functions
- Hughes
- 1985
(Show Context)
Citation Context ...8463,1627g. Email: fliu,stollerg@cs.sunysb.edu. 1 Memoization uses a mechanism that is separate from the original program to save the result of each function call or reduction as the program executes =-=[1, 19, 20, 25, 27, 28, 40, 41, 45, 49, 51]-=-. The idea is to keep a separate table of solutions to subproblems, modify recursive calls tosrst look up in the table, and then, if the subproblem has been computed, use the saved result, otherwise, ... |

48 | Static caching for incremental computation
- Liu, Stoller, et al.
- 1998
(Show Context)
Citation Context ... our method can. Each of our examples is non-trivial and requires advanced algorithm design discipline to derive even by hand. Compared with our previous work for incrementalizing functional programs =-=[37, 38, 39-=-], this work contains several substantial improvements. First, our previous work addresses the systematic derivation of an incremental program f 0 given both program f and operation . This paper descr... |

48 |
The Analysis Of Algorithms
- Purdom, Brown
- 1985
(Show Context)
Citation Context ...en implemented in a prototype system CACHET and applied to numerous problems and succeeded on all of them. 1 Introduction Dynamic programming is an important technique for designing ecient algorithms =-=[2, 15, 52]-=-. It is used for problems whose solutions involve recursively solving subproblems that share subsubproblems. While a straightforward recursive program solves common subsubproblems repeatedly, a dynami... |

41 |
Formal Program Construction by Transformations
- Bauer, Moller, et al.
- 1989
(Show Context)
Citation Context ...abulation. Previous methods for this problem either apply to specic subclasses of problems [11, 13, 14, 24, 46, 48] or give general frameworks or strategies rather than precise derivation algorithms [=-=3, 5, 6, 8, 9, 16, 17, 45, 47, 55, 56, 62]-=-. Our work is based on the general principle of incrementalization [37, 44] and consists of precise program analyses and transformations. In particular, tupling [9, 46, 47] aims to compute multiple va... |

39 | Systematic derivation of incremental programs
- Liu, Teitelbaum
- 1995
(Show Context)
Citation Context ...s not in the original computation have to be included. Our method is based on a number of static analyses and transformations studied previously by others [6, 9, 21, 42, 47, 55, 56, 62] and ourselves =-=[30, 37, 38, 39]-=- and improves them. Each of the caching, incrementalization, and pruning steps is simple, automatable, and ecient and has been implemented in a prototype system, CACHET. The system has been used in op... |

38 | Automatic accurate time-bound analysis for high-level languages
- Liu, Gomez
- 1998
(Show Context)
Citation Context ... auxiliary information may result in a slower program on certain inputs. We can determine statically whether such information is cached in the final program. If so, we can use time and space analysis =-=[27]-=- to determine whether it is worthwhile to use and maintain such information. Many dynamic programming algorithms can be further improved by exploiting greedy properties of the given problems [7]. Our ... |

33 | Tupling calculation eliminates multiple data traversals
- Hu, Iwasaki, et al.
- 1997
(Show Context)
Citation Context ...introduces appropriate data structures for the table, and computes the table entries in a bottom-up fashion so that the solution to a superproblem is computed using available solutions to subproblems =-=[5, 11, 12, 13, 14, 24, 45, 46, 47, 48]-=-. This overcomes both disadvantages of memoization. First, tableslling and lookup are compiled into the resulting program, so no separate mechanism is needed for the execution. Second, strategies for ... |

33 |
Programming with Invariants
- Paige
- 1986
(Show Context)
Citation Context |

33 |
Dynamic Programming
- Sniedovich
- 1992
(Show Context)
Citation Context ...seconds). 8 Related work and conclusion Dynamic programming wassrst formulated by Bellman [4], where \programming" refers to the use of tabular solution method, and has been studied extensively s=-=ince [58]-=-. Bird [5], de Moor [17], and others have studied it in the context of program transformation. While some work addresses the derivation of recursive equations, including the original work by Bellman [... |

30 |
Program improvement by internal specialization
- Scherlis
- 1981
(Show Context)
Citation Context |

27 |
Memo" functions and machine learning. Nature
- Michie
- 1968
(Show Context)
Citation Context ...that can be solved eciently by memoizing results of subproblems [4, 5]. Given a straightforward recursion, there are two traditional ways to achieve the eect of dynamic programming [15]: memoization [=-=40-=-] and tabulation [5]. This work is supported in part by ONR under grants N00014-99-1-0132 and N00014-99-1-0358 and by NSF under grants CCR-9711253 and CCR-9876058. This article is a revised and exten... |

26 |
Finite Dierencing of Computable Expressions
- Paige, Koenig
- 1982
(Show Context)
Citation Context ...6, 48] or give general frameworks or strategies rather than precise derivation algorithms [3, 5, 6, 8, 9, 16, 17, 45, 47, 55, 56, 62]. Our work is based on the general principle of incrementalization =-=[37, 44]-=- and consists of precise program analyses and transformations. In particular, tupling [9, 46, 47] aims to compute multiple values together in an ecient way. It is improved to be automatic on subclasse... |

25 |
Eliminating redundant recursive calls
- Cohen
- 1983
(Show Context)
Citation Context |

25 | From recursion and iteration: what are the optimizations
- Liu, Stoller
- 1999
(Show Context)
Citation Context ...ee that recursive data structures give the same asymptotic speedup as arrays for some examples. Our recent work on transforming recursion into iteration can help eliminate the linear stack space used =-=[36]-=-. There are dynamic programming problems, e.g., 0-1 knapsack, for which the use of an array, with constant-time access to elements, helps achieve desired asymptotic speedups. Such situations become ev... |

24 |
Incremental reduction in the lambda calculus
- Field, Teitelbaum
(Show Context)
Citation Context |

24 |
Goal-Directed Program Transformation
- Wegbreit
- 1976
(Show Context)
Citation Context |

22 |
Applicative caching
- Keller, Sleep
- 1986
(Show Context)
Citation Context |

22 | Discovering auxiliary information for incremental computation
- LIU, STOLLER, et al.
- 1996
(Show Context)
Citation Context ...s not in the original computation have to be included. Our method is based on a number of static analyses and transformations studied previously by others [6, 9, 21, 42, 47, 55, 56, 62] and ourselves =-=[30, 37, 38, 39]-=- and improves them. Each of the caching, incrementalization, and pruning steps is simple, automatable, and ecient and has been implemented in a prototype system, CACHET. The system has been used in op... |

16 |
Tupling functions with multiple recursion parameters
- Chin, Khoo
- 1993
(Show Context)
Citation Context |

15 | Automatic Accurate Cost-Bound Analysis for High-Level Languages
- Liu, Gomez
(Show Context)
Citation Context ...ng auxiliary information may result in a slower program on certain inputs. We can determine statically whether such information is cached in thesnal program. If so, we can use time and space analysis =-=[32, 54, 59, 60, 61-=-] to determine conservatively whether it is worthwhile to use and maintain such information. The trade-o between time and space is an open problem for future study. Additional properties. Many dynamic... |

15 | Loop optimization for aggregate array computations
- Liu, Stoller
- 1998
(Show Context)
Citation Context ...as will be described in a future paper. Although we present the optimizations for a functional language, the underlying principle is general and has been applied to programs that use loops and arrays =-=[30, 34]-=-. Auxiliary information. Some values computed in a hoisted program might not be computed by the original program and are therefore called auxiliary information [37]. Both incrementalization and prunin... |

14 | From dynamic programming to greedy algorithms
- Bird, Moor
- 1993
(Show Context)
Citation Context ...n time and space is an open problem for future study. Additional properties. Many dynamic programming algorithms can be further improved by exploiting additional properties, such as greedy properties =-=[7-=-], of the given problems. For example, Hu and Shing [22, 23] give an O(n log n)-time algorithm for the matrix-chain multiplication 19 problem. Our method is not aimed at discovering such properties. ... |

14 | Eliminating dead code on recursive data
- Liu, Stroller
- 1999
(Show Context)
Citation Context ...sing the incremental version ^ f 0 0 . 16 5.1 Pruning Pruning requires a dependence analysis that can precisely describe substructures of trees [38]. We use an analysis based on regular tree grammars =-=[31, 35]-=-. We have designed and implemented a simple algorithm that uses regular tree grammar based constraints to eciently produce precise analysis results [33, 35]. Pruning can save space and time and reduce... |

14 |
Specification and Transformation of Programsâ€”a Formal Approach to Software Development
- Partsch
- 1990
(Show Context)
Citation Context |

13 | A generic program for sequential decision processes
- Moor
- 1995
(Show Context)
Citation Context ... and conclusion Dynamic programming wassrst formulated by Bellman [4], where \programming" refers to the use of tabular solution method, and has been studied extensively since [58]. Bird [5], de =-=Moor [17]-=-, and others have studied it in the context of program transformation. While some work addresses the derivation of recursive equations, including the original work by Bellman [4] and the later work by... |

13 | Automatic accurate stack space and heap space analysis for high-level languages
- Unnikrishnan, Stoller, et al.
- 2000
(Show Context)
Citation Context |

12 |
Improving recursive functions by inverting the order of evaluation
- Boiten
- 1992
(Show Context)
Citation Context ...abulation. Previous methods for this problem either apply to specic subclasses of problems [11, 13, 14, 24, 46, 48] or give general frameworks or strategies rather than precise derivation algorithms [=-=3, 5, 6, 8, 9, 16, 17, 45, 47, 55, 56, 62]-=-. Our work is based on the general principle of incrementalization [37, 44] and consists of precise program analyses and transformations. In particular, tupling [9, 46, 47] aims to compute multiple va... |

12 | Structure and design of problem reduction generators
- Smith
- 1991
(Show Context)
Citation Context ...thers have studied it in the context of program transformation. While some work addresses the derivation of recursive equations, including the original work by Bellman [4] and the later work by Smith =-=[57-=-], our work addresses the derivation of ecient programs that use tabulation. Previous methods for this problem either apply to specic subclasses of problems [11, 13, 14, 24, 46, 48] or give general fr... |

11 |
Recursive programming through table look-up
- Friedman, Wise, et al.
- 1976
(Show Context)
Citation Context |

11 | Dependence analysis for recursive data
- Liu
- 1998
(Show Context)
Citation Context ...sing the incremental version ^ f 0 0 . 16 5.1 Pruning Pruning requires a dependence analysis that can precisely describe substructures of trees [38]. We use an analysis based on regular tree grammars =-=[31, 35]-=-. We have designed and implemented a simple algorithm that uses regular tree grammar based constraints to eciently produce precise analysis results [33, 35]. Pruning can save space and time and reduce... |

11 |
Program derivation via list introduction
- Pettorossi, Proietti
- 1997
(Show Context)
Citation Context |

11 | Automatic accurate live memory analysis for garbage-collected languages
- Unnikrishnan, Stoller, et al.
- 2001
(Show Context)
Citation Context |

11 |
A Powerful Strategy for Deriving Efficient Programs by Transformation
- Pettorossi
- 1984
(Show Context)
Citation Context ...introduces appropriate data structures for the table, and computes the table entries in a bottom-up fashion so that the solution to a superproblem is computed using available solutions to subproblems =-=[5, 12, 38, 37, 9, 11, 39, 40, 20, 10]-=-. This overcomes both disadvantages of memoization. First, table filling and lookup are compiled into the resulting program so no separate mechanism is needed for the execution. Second, strategies for... |