skip to main content
research-article

Sneaking around concatMap: efficient combinators for dynamic programming

Published:09 September 2012Publication History
Skip Abstract Section

Abstract

We present a framework of dynamic programming combinators that provides a high-level environment to describe the recursions typical of dynamic programming over sequence data in a style very similar to algebraic dynamic programming (ADP). Using a combination of type-level programming and stream fusion leads to a substantial increase in performance, without sacrificing much of the convenience and theoretical underpinnings of ADP.

We draw examples from the field of computational biology, more specifically RNA secondary structure prediction, to demonstrate how to use these combinators and what differences exist between this library, ADP, and other approaches.

The final version of the combinator library allows writing algorithms with performance close to hand-optimized C code.

References

  1. R. E. Bellman. On the Theory of Dynamic Programming. Proceedings of the National Academy of Sciences, 38 (8): 716--719, 1952.Google ScholarGoogle ScholarCross RefCross Ref
  2. A. F. Bompfünewerer, R. Backofen, S. H. Bernhart, J. Hertel, I. L. Hofacker, P. F. Stadler, and S. Will. Variations on RNA folding and alignment: lessons from Benasque. Journal of Mathematical Biology, 56 (1): 129--144, 2008.Google ScholarGoogle Scholar
  3. M. M. Chakravarty, G. Keller, and S. Peyton Jones. Associated Type Synonyms. In Proceedings of the tenth ACM SIGPLAN international conference on Functional programming, ICFP'05, pages 241--253. ACM, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. M. M. Chakravarty, R. Leshchinskiy, S. Peyton Jones, G. Keller, and S. Marlow. Data Parallel Haskell: a status report. In Proceedings of the 2007 workshop on Declarative aspects of multicore programming, DAMP'07, pages 10--18. ACM, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. K. Claessen and J. Hughes. QuickCheck: A Lightweight Tool for Random Testing of Haskell Programs. In Proceedings of the fifth ACM SIGPLAN international conference on Functional programming, ICFP'00, pages 268--279. ACM, 2000. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. T. H. Cormen, C. E. Leiserson, R. L. Rivest, and C. Stein. Introduction to Algorithms. The MIT press, 2001. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. D. Coutts, R. Leshchinskiy, and D. Stewart. Stream Fusion: From Lists to Streams to Nothing at All. In Proceedings of the 12th ACM SIGPLAN international conference on Functional programming, ICFP'07, pages 315--326. ACM, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. R. Durbin, S. Eddy, A. Krogh, and G. Mitchison. Biological sequence analysis. Cambridge Univ. Press, 1998.Google ScholarGoogle ScholarCross RefCross Ref
  9. R. Giegerich and C. Höner zu Siederdissen. Semantics and Ambiguity of Stochastic RNA Family Models. IEEE/ACM Transactions on Computational Biology and Bioinformatics, 8 (2): 499--516, 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. R. Giegerich and C. Meyer. Algebraic Dynamic Programming. In Algebraic Methodology And Software Technology, volume 2422, pages 243--257. Springer, 2002. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. R. Giegerich and P. Steffen. Challenges in the compilation of a domain specific language for dynamic programming. In Proceedings of the 2006 ACM symposium on Applied computing, pages 1603--1609. ACM, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. R. Giegerich, C. Meyer, and P. Steffen. Towards a Discipline of Dynamic Programming. Informatik bewegt, GI-Edition-Lecture Notes in Informatics, pages 3--44, 2002. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. R. Giegerich, C. Meyer, and P. Steffen. A Discipline of Dynamic Programming over Sequence Data. Science of Computer Programming, 51 (3): 215--263, 2004. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. R. Giegerich et al. Algebraic Dynamic Programming Website. http://bibiserv.techfak.uni-bielefeld.de/adp/, 2004. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. D. Grune and C. J. Jacobs. Parsing techniques: a practical guide. Springer-Verlag New York Inc, 2008.Google ScholarGoogle ScholarCross RefCross Ref
  16. I. L. Hofacker, W. Fontana, P. F. Stadler, L. S. Bonhoeffer, M. Tacker, and P. Schuster. Fast Folding and Comparison of RNA Secondary Structures. Monatshefte für Chemie/Chemical Monthly, 125 (2): 167--188, 1994.Google ScholarGoogle ScholarCross RefCross Ref
  17. C. Höner zu Siederdissen and I. L. Hofacker. Discriminatory power of RNA family models. Bioinformatics, 26 (18): 453--459, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. C. Höner zu Siederdissen, S. H. Bernhart, P. F. Stadler, and I. L. Hofacker. A folding algorithm for extended RNA secondary structures. Bioinformatics, 27 (13): 129--136, 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. P. Hudak, J. Hughes, S. Peyton Jones, and P. Wadler. A History of Haskell: Being Lazy with Class. In Proceedings of the third ACM SIGPLAN conference on History of programming languages, HOPL III, pages 1--55. ACM, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. G. Hutton. Higher-order functions for parsing. Journal of Functional Programming, 2 (3): 323--343, 1992.Google ScholarGoogle ScholarCross RefCross Ref
  21. M. P. Jones. Type Classes with Functional Dependencies. Programming Languages and Systems, pages 230--244, 2000. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. G. Keller, M. M. Chakravarty, R. Leshchinskiy, S. Peyton Jones, and B. Lippmeier. Regular, Shape-polymorphic, Parallel Arrays in Haskell. In Proceedings of the 15th ACM SIGPLAN international conference on Functional programming, ICFP'10, pages 261--272. ACM, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. K. Lari and S. J. Young. The estimation of stochastic context-free grammars using the Inside-Outside algorithm. Computer Speech & Language, 4 (1): 35--56, 1990.Google ScholarGoogle ScholarCross RefCross Ref
  24. C. Lattner and V. Adve. LLVM: A Compilation Framework for Lifelong Program Analysis & Transformation. In Code Generation and Optimization, 2004. CGO 2004. International Symposium on, pages 75--86. IEEE, 2004. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. R. Leshchinskiy. Recycle Your Arrays! Practical Aspects of Declarative Languages, pages 209--223, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. R. Lorenz, S. H. Bernhart, C. Höner zu Siederdissen, H. Tafer, C. Flamm, P. F. Stadler, and I. L. Hofacker. ViennaRNA Package 2.0. Algorithms for Molecular Biology, 6 (26), 2011.Google ScholarGoogle Scholar
  27. M. Mernik, J. Heering, and A. M. Sloane. When and How to Develop Domain-Specific Languages. ACM Computing Surveys, 37 (4): 316--344, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. M. Nebel and A. Scheid. Evaluation of a sophisticated SCFG design for RNA secondary structure prediction. Theory in Biosciences, 130: 313--336, 2011. ISSN 1431-7613.Google ScholarGoogle ScholarCross RefCross Ref
  29. R. Nussinov, G. Pieczenik, J. R. Griggs, and D. J. Kleitman. Algorithms for Loop Matchings. SIAM Journal on Applied Mathematics, 35 (1): 68--82, 1978.Google ScholarGoogle ScholarCross RefCross Ref
  30. B. O'Sullivan, D. B. Stewart, and J. Goerzen. Real World Haskell. O'Reilly Media, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  31. S. Peyton Jones. Call-pattern Specialisation for Haskell Programs. In Proceedings of the 12th ACM SIGPLAN international conference on Functional programming, ICFP'07, pages 327--337. ACM, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  32. E. Rivas, R. Lang, and S. R. Eddy. A range of complex probabilistic models for RNA secondary structure prediction that includes the nearest-neighbor model and more. RNA, 18 (2): 193--212, 2012.Google ScholarGoogle ScholarCross RefCross Ref
  33. G. Sauthoff, S. Janssen, and R. Giegerich. Bellman's GAP - A Declarative Language for Dynamic Programming. In Proceedings of the 13th international ACM SIGPLAN symposium on Principles and practices of declarative programming, PPDP'11, pages 29--40. ACM, 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  34. R. Sedgewick. Algorithms. Addison-Wesley Publishing Co., Inc., 1983. Google ScholarGoogle ScholarDigital LibraryDigital Library
  35. P. Steffen. Compiling a domain specific language for dynamic programming. PhD thesis, Bielefeld University, 2006.Google ScholarGoogle Scholar
  36. The GHC Team. The Glasgow Haskell Compiler (GHC). http://www.haskell.org/ghc/, 2012.Google ScholarGoogle Scholar

Index Terms

  1. Sneaking around concatMap: efficient combinators for dynamic programming

      Recommendations

      Comments

      Login options

      Check if you have access through your login credentials or your institution to get full access on this article.

      Sign in

      Full Access

      • Published in

        cover image ACM SIGPLAN Notices
        ACM SIGPLAN Notices  Volume 47, Issue 9
        ICFP '12
        September 2012
        368 pages
        ISSN:0362-1340
        EISSN:1558-1160
        DOI:10.1145/2398856
        Issue’s Table of Contents
        • cover image ACM Conferences
          ICFP '12: Proceedings of the 17th ACM SIGPLAN international conference on Functional programming
          September 2012
          392 pages
          ISBN:9781450310543
          DOI:10.1145/2364527

        Copyright © 2012 ACM

        Publisher

        Association for Computing Machinery

        New York, NY, United States

        Publication History

        • Published: 9 September 2012

        Check for updates

        Qualifiers

        • research-article

      PDF Format

      View or Download as a PDF file.

      PDF

      eReader

      View online with eReader.

      eReader
      About Cookies On This Site

      We use cookies to ensure that we give you the best experience on our website.

      Learn more

      Got it!