Efficient Memoization for Dynamic Programming with Adhoc Constraints

Joxan Jaffar, Andrew Santosa and Razvan Voicu


We address the problem of effective reuse of subproblem solutions in dynamic programming. In dynamic programming, a memoed solution of a subproblem can be reused for another if the latter's context is a special case of the former. Our objective is to generalize the context of the memoed subproblem such that more subproblems can be considered subcases and hence enhance reuse. Towards this we propose a generalization of context that 1) does not add better solutions than the subproblem's optimal, yet 2) requires that subsumed subproblems preserve the optimal solution. In addition, we also present a general technique to search for at most $k\geq 1$ optimal solutions. We provide experimental results on resource-constrained shortest path (RCSP) benchmarks and program's exact worst-case execution time (WCET) analysis.