Abstract
Consider the dynamic program h(n)=min 1≤j≤n a(n,j), where a(n,j) is some formula that may (online) or may not (offline) depend on the previously computed h(i), for i<n. The goal is to compute all h(n), for 1≤n≤N. It is well known that, if a(n,j) satisfy the Monge property, then the SMAWK algorithm (Aggarwal et al., Algorithmica 2(1):195–208, 1987) can solve the offline problem in O(N) time; a Θ(N) speedup over the naive algorithm.
In this paper we extend this speedup to the online case, that is, to compute h(n) in the order n=1,2,…,N when (i) we do not know the values of a(n′,j) for n′>n before h(n) has been computed and (ii) do not know the problem size N in advance. We show that if a(n,j) satisfy a stronger, but sometimes still natural, property than the Monge one, then each h(n) can be computed in online fashion in O(1) amortized time. This maintains the speedup online, in the sense that the total time to compute all h(n) is O(N). We also show how to compute each h(n) in the worst case O(log N) time, while maintaining the amortized time bound.
For a(n,j) satisfying our stronger property, our algorithm is also simpler than the standard SMAWK algorithm for solving the offline case. We illustrate our technique on two examples from the literature; the first is the D-median problem on a line, and the second comes from mobile wireless paging.
Similar content being viewed by others
References
Aggarwal, A., Klawe, M.M., Moran, S., Shor, P.W., Wilber, R.E.: Geometric applications of a matrix-searching algorithm. Algorithmica 2(1), 195–208 (1987). A preliminary version appeared in Proceedings of the 2nd Annual Symposium on Computational Geometry, pp. 285–292 (1986)
Auletta, V., Parente, D., Persiano, G.: Placing resources on a growing line. J. Algorithms 26(1), 87–100 (1998)
Bar-Noy, A., Feng, Y., Golin, M.J.: Paging mobile users efficiently and optimally. In: Proceedings of the 26th Annual IEEE Conference on Computer Communications (Infocom’07), pp. 1910–1918 (2007)
Burkard, R.E., Klinz, B., Rudolf, R.: Perspectives of Monge properties in optimization. Discrete Appl. Math. 70(2), 95–161 (1996)
Eppstein, D., Galil, Z., Giancarlo, R.: Speeding up dynamic programming. In: Proceedings of the 29th Annual Symposium on Foundations of Computer Science, pp. 488–496 (1988)
Fleischer, R., Golin, M.J., Zhang, Y.: Online maintenance of k-medians and k-covers on a line. Algorithmica 45(4), 549–567 (2006). A preliminary version appeared in Proceedings of the 9th Scandinavian Workshop on Algorithm Theory, pp. 102—113 (2004)
Galil, Z., Giancarlo, R.: Speeding up dynamic programming with applications to molecular biology. Theor. Comput. Sci. 64(1), 107–118 (1989)
Galil, Z., Park, K.: A linear-time algorithm for concave one-dimensional dynamic programming. Inf. Process. Lett. 33(6), 309–311 (1990)
Klawe, M.M.: A simple linear time algorithm for concave one-dimensional dynamic programming. Technical Report 89-16, Department of Computer Science, University of British Columbia (1989)
Krishnamachari, B., Gau, R.-H., Wicker, S.B., Haas, Z.J.: Optimal sequential paging in cellular wireless networks. Wirel. Netw. 10(2), 121–131 (2004)
Larmore, L.L., Schieber, B.: On-line dynamic programming with applications to the prediction of RNA secondary structure. J. Algorithms 12(3), 490–515 (1991). A preliminary version appeared in Proceedings of the 1st Annual ACM-SIAM Symposium on Discrete Algorithms, pp. 503—512 (1990)
Wilber, R.: The concave least-weight subsequence problem revisited. J. Algorithms 9(3), 418–425 (1988)
Woeginger, G.J.: Monge strikes again: Optimal placement of web proxies in the Internet. Oper. Res. Lett. 27(3), 93–96 (2000)
Author information
Authors and Affiliations
Corresponding author
Additional information
The research of the first author was partially supported by the NSF program award CNS-0626606; the research of the second and third authors was partially supported by Hong Kong RGC CERG grant HKUST6312/04E.
Rights and permissions
About this article
Cite this article
Bar-Noy, A., Golin, M.J. & Zhang, Y. Online Dynamic Programming Speedups. Theory Comput Syst 45, 429–445 (2009). https://doi.org/10.1007/s00224-009-9166-x
Received:
Accepted:
Published:
Issue Date:
DOI: https://doi.org/10.1007/s00224-009-9166-x