Skip to main content

A Short Cut to Optimal Sequences

  • Conference paper
Programming Languages and Systems (APLAS 2009)

Part of the book series: Lecture Notes in Computer Science ((LNPSE,volume 5904))

Included in the following conference series:

Abstract

We propose a method for easily developing efficient programs for finding optimal sequences, such as the maximum weighted sequence of a set of feasible ones. We formalize a way to derive efficient algorithms from naive enumerate-and-choose-style ones by shortcut fusion, which is a program transformation for eliminating intermediate data structures passed between functions. In addition, we propose a set of transformations for exploiting our shortcut fusion law. As an implementation of our method, we introduce a library for finding optimal sequences. The library consists of proposed transformations, together with functions useful for describing desirable sequences, so that naive enumerate-and-choose-style programs will be automatically improved.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. Cormen, T.H., Stein, C., Rivest, R.L., Leiserson, C.E.: Introduction to algorithms, 2nd edn. MIT Press, Cambridge (2001)

    MATH  Google Scholar 

  2. Gill, A., Launchbury, J., Peyton Jones, S.: A short cut to deforestation. In: FPCA 1993 Conference on Functional Programming Languages and Computer Architecture, pp. 223–232. ACM, New York (1993)

    Chapter  Google Scholar 

  3. Gill, A.: Cheap deforestation for non-strict functional languages. PhD thesis, Department of Computing Science, Glasgow University (1996)

    Google Scholar 

  4. Peyton Jones, S., Tolmach, A., Hoare, T.: Playing by the rules: rewriting as a practical optimisation technique in GHC. In: Proceedings of 2001 ACM SIGPLAN Haskell Workshop. Technical Report UU-CS-2001-23, Institute of Information and Computing Sciences, Utrecht University, pp. 203–233 (2001)

    Google Scholar 

  5. Morihata, A.: Solving maximum weighted-sum problems for free. Technical Report METR 2009-20, Department of Mathematical Informatics, University of Tokyo (2009)

    Google Scholar 

  6. Peyton Jones, S. (ed.): Haskell 98 language and libraries: the revised report. Cambridge University Press, Cambridge (2003)

    Google Scholar 

  7. Takano, A., Meijer, E.: Shortcut deforestation in calculational form. In: Conference Record of FPCA 1995 SIGPLAN-SIGARCH-WG2.8 Conference on Functional Programming Languages and Computer Architecture, pp. 306–313. ACM, New York (1995)

    Google Scholar 

  8. Kühnemann, A., Glück, R., Kakehi, K.: Relating accumulative and non-accumulative functional programs. In: Middeldorp, A. (ed.) RTA 2001. LNCS, vol. 2051, pp. 154–168. Springer, Heidelberg (2001)

    Chapter  Google Scholar 

  9. Voigtländer, J.: Concatenate, reverse and map vanish for free. In: Proceedings of the Seventh ACM SIGPLAN International Conference on Functional Programming (ICFP 2002), pp. 14–25. ACM, New York (2002)

    Chapter  Google Scholar 

  10. Launchbury, J., Sheard, T.: Warm fusion: Deriving build-catas from recursive definitions. In: Conference Record of FPCA 1995 SIGPLAN-SIGARCH-WG2.8 Conference on Functional Programming Languages and Computer Architecture, pp. 314–323. ACM, New York (1995)

    Google Scholar 

  11. Chitil, O.: Type inference builds a short cut to deforestation. In: Proceedings of the 4th ACM SIGPLAN International Conference on Functional Programming, ICFP 1999, pp. 249–260. ACM, New York (1999)

    Chapter  Google Scholar 

  12. Yokoyama, T., Hu, Z., Takeichi, M.: Calculation rules for warming-up in fusion transformation. In: The 2005 Symposium on Trends in Functional Programming, TFP 2005, pp. 399–412 (2005)

    Google Scholar 

  13. Zantema, H.: Longest Segment Problems. Sci. Comput. Program. 18(1), 39–66 (1992)

    Article  MATH  MathSciNet  Google Scholar 

  14. Cohen, H.N.: Eliminating redundant recursive calls. ACM Trans. Program. Lang. Syst. 5(3), 265–299 (1983)

    Article  MATH  Google Scholar 

  15. Acar, U.A., Blelloch, G.E., Harper, R.: Selective memoization. In: Conference Record of POPL 2003: The 30th SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pp. 14–25. ACM, New York (2003)

    Chapter  Google Scholar 

  16. Liu, Y.A., Stoller, S.D.: Dynamic programming via static incrementalization. Higher-Order and Symbolic Computation 16(1-2), 37–62 (2003)

    Article  MATH  Google Scholar 

  17. Liu, Y.A., Stoller, S.D., Li, N., Rothamel, T.: Optimizing aggregate array computations in loops. ACM Trans. Program. Lang. Syst. 27(1), 91–125 (2005)

    Article  Google Scholar 

  18. Chin, W.-N., Khoo, S.-C., Jones, N.: Redundant call elimination via tupling. Fundam. Inform. 69(1-2), 1–37 (2006)

    MATH  MathSciNet  Google Scholar 

  19. Giegerich, R., Meyer, C., Steffen, P.: A discipline of dynamic programming over sequence data. Sci. Comput. Program. 51(3), 215–263 (2004)

    Article  MATH  MathSciNet  Google Scholar 

  20. Kabanov, J., Vene, V.: Recursion schemes for dynamic programming. In: Uustalu, T. (ed.) MPC 2006. LNCS, vol. 4014, pp. 235–252. Springer, Heidelberg (2006)

    Chapter  Google Scholar 

  21. de Moor, O.: Categories, Relations and Dynamic Programming. PhD thesis, Oxford University Computing Laboratory (1992)

    Google Scholar 

  22. de Moor, O.: A Generic Program for Sequential Decision Processes. In: Swierstra, S.D. (ed.) PLILP 1995. LNCS, vol. 982, pp. 1–23. Springer, Heidelberg (1995)

    Chapter  Google Scholar 

  23. Bird, R.S., de Moor, O.: Algebra of Programming. Prentice-Hall, Englewood Cliffs (1996)

    Google Scholar 

  24. Bird, R.S.: Maximum marking problems. J. Funct. Program. 11(4), 411–424 (2001)

    Article  MATH  MathSciNet  Google Scholar 

  25. Arnborg, S., Lagergren, J., Seese, D.: Easy problems for tree-decomposable graphs. J. Algorithms 12(2), 308–340 (1991)

    Article  MATH  MathSciNet  Google Scholar 

  26. Borie, R.B., Parker, R.G., Tovey, C.A.: Automatic generation of linear-time algorithms from predicate calculus descriptions of problems on recursively constructed graph families. Algorithmica 7(5-6), 555–581 (1992)

    Article  MATH  MathSciNet  Google Scholar 

  27. Sasano, I., Hu, Z., Takeichi, M., Ogawa, M.: Make it practical: a generic linear-time algorithm for solving maximum-weightsum problems. In: Proceedings of the 5th ACM SIGPLAN International Conference on Functional Programming, ICFP 2000, pp. 137–149. ACM, New York (2000)

    Chapter  Google Scholar 

  28. Sasano, I., Ogawa, M., Hu, Z.: Maximum marking problems with accumulative weight functions. In: Van Hung, D., Wirsing, M. (eds.) ICTAC 2005. LNCS, vol. 3722, pp. 562–578. Springer, Heidelberg (2005)

    Chapter  Google Scholar 

  29. Morihata, A., Matsuzaki, K., Takeichi, M.: Write it recursively: a generic framework for optimal path queries. In: Proceedings of the 2008 ACM SIGPLAN International Conference on Functional Programming, ICFP 2008, pp. 169–178. ACM, New York (2008)

    Chapter  Google Scholar 

  30. Mu, S.C.: Maximum segment sum is back: deriving algorithms for two segment problems with bounded lengths. In: Proceedings of the 2008 ACM SIGPLAN Symposium on Partial Evaluation and Semantics-based Program Manipulation, PEPM 2008, pp. 31–39. ACM, New York (2008)

    Chapter  Google Scholar 

  31. Puchinger, J., Stuckey, P.J.: Automating branch-and-bound for dynamic programs. In: Proceedings of the 2008 ACM SIGPLAN Symposium on Partial Evaluation and Semantics-based Program Manipulation, PEPM 2008, pp. 81–89. ACM, New York (2008)

    Chapter  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2009 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Morihata, A. (2009). A Short Cut to Optimal Sequences. In: Hu, Z. (eds) Programming Languages and Systems. APLAS 2009. Lecture Notes in Computer Science, vol 5904. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-642-10672-9_7

Download citation

  • DOI: https://doi.org/10.1007/978-3-642-10672-9_7

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-642-10671-2

  • Online ISBN: 978-3-642-10672-9

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics