Skip to main content

CHRAnimation: An Animation Tool for Constraint Handling Rules

  • Conference paper
  • First Online:
Logic-Based Program Synthesis and Transformation (LOPSTR 2014)

Part of the book series: Lecture Notes in Computer Science ((LNTCS,volume 8981))

Abstract

Visualization tools of different languages offer its users with a needed set of features allowing them to animate how programs of such languages work. Constraint Handling Rules (CHR) is currently used as a general purpose language. This results in having complex programs with CHR. Nevertheless, CHR is still lacking on visualization tools. With Constraint Handling Rules (CHR) being a high-level rule-based language, animating CHR programs through animation tools demonstrates the power of the language. Such tools are useful for beginners to the language as well as programmers of sophisticated algorithms. This paper continues upon the efforts made to have a generic visualization platform for CHR using source-to-source transformation. It also provides a new visualization feature that enables viewing all the possible solutions of a CHR program instead of the don’t care nondeterminism used in most CHR implementations.

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 EPUB and 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

Notes

  1. 1.

    The tracer is able to handle the problem of having multiple Jawaa objects with the same name by removing the old object having the same name before adding the new one. This is possible even if the removed head constraint was not communicated.

References

  1. Frühwirth, T.: Theory and practice of constraint handling rules, special issue on constraint logic programming. J. Logic Program. 37, 95–138 (1998)

    Article  MATH  Google Scholar 

  2. Abdennadher, S., Sharaf, N.: Visualization of CHR through source-to-source transformation. In: Dovier, A., Costa, V.S. (eds.) ICLP (Technical Communications). LIPIcs, vol. 17, pp. 109–118. Schloss Dagstuhl - Leibniz-Zentrum fuer Informatik (2012)

    Google Scholar 

  3. Rodger, S.H.: Introducing computer science through animation and virtual worlds. In: Gersting, J.L., Walker, H.M., Grissom, S. (eds.) SIGCSE, pp. 186–190. ACM (2002)

    Google Scholar 

  4. Duck, G.J., Stuckey, P.J., García de la Banda, M., Holzbaur, C.: The refined operational semantics of constraint handling rules. In: Demoen, B., Lifschitz, V. (eds.) ICLP 2004. LNCS, vol. 3132, pp. 90–104. Springer, Heidelberg (2004)

    Chapter  Google Scholar 

  5. Frühwirth, T.: Constraint Handling Rules. Cambridge University Press, Cambridge (2009)

    Book  MATH  Google Scholar 

  6. Abdennadher, S., Saft, M.: A visualization tool for constraint handling rules. In: Kusalik, A.J. (ed.) WLPE (2001)

    Google Scholar 

  7. Schmauss, M.: An Implementation of CHR in Java, Master Thesis, Institute of Computer Science, LMU, Munich, Germany (1999)

    Google Scholar 

  8. Ismail, A.: Visualization of Grid-based and Fundamental CHR Algorithms, bachelor thesis, the Institute of Software Engineering and Compiler Construction, Ulm University, Germany (2012)

    Google Scholar 

  9. Said, M.A.: Animation of Mathematical and Graph-based Algorithms expressed in CHR, bachelor thesis, the Institute of Software Engineering and Compiler Construction, Ulm University, Germany (2012)

    Google Scholar 

  10. Stasko, J.: Animating algorithms with xtango. SIGACT News 23, 67–71 (1992)

    Article  Google Scholar 

  11. Brown, M.H., Sedgewick, R.: A system for algorithm animation. In: Proceedings of the 11th Annual Conference on Computer Graphics and Interactive Techniques, SIGGRAPH 1984, pp. 177–186. ACM, New York (1984)

    Google Scholar 

  12. Brown, M.: Zeus: a system for algorithm animation and multi-view editing. In: Proceedings of the 1991 IEEE Workshop on Visual Languages, pp. 4–9 (1991)

    Google Scholar 

  13. Baecker, R.M.: Sorting Out Sorting: A Case Study of Software Visualization for Teaching Computer Science, chap. 24, pp. 369–381. MIT Press, Cambridge (1998)

    Google Scholar 

  14. Smolka, G.: The definition of kernel oz. In: Podelski, A. (ed.) Constraint Programming: Basics and Trends. LNCS, vol. 910. Springer, Heidelberg (1995)

    Google Scholar 

  15. Meier, M.: Debugging constraint programs. In: Montanari, U., Rossi, F. (eds.) CP 1995. LNCS, vol. 976. Springer, Heidelberg (1995)

    Google Scholar 

  16. Frühwirth, T., Holzbaur, C.: Source-to-source transformation for a class of expressive rules. In: Buccafurri, F. (ed.) APPIA-GULP-PRODE, pp. 386–397 (2003)

    Google Scholar 

  17. Kerren, A., Stasko, J.T.: Algorithm animation. In: Diehl, S. (ed.) Dagstuhl Seminar 2001. LNCS, vol. 2269, pp. 1–17. Springer, Heidelberg (2002)

    Chapter  Google Scholar 

  18. Sharaf, N., Abdennadher, S., Frühwirth, T. W.: Visualization of Constraint Handling Rules, CoRR, vol. abs/1405.3793 (2014)

    Google Scholar 

  19. Abdennadher, S., Frühwirth, T., Meuss, H.: On confluence of constraint handling rules. In: Freuder, E.C. (ed.) CP 1996. LNCS, vol. 1118. Springer, Heidelberg (1996)

    Google Scholar 

  20. Zaki, A., Frühwirth, T.W., Abdennadher, S.: Towards inverse execution of constraint handling rules. TPLP 13(4-5) (2013) Online-Supplement

    Google Scholar 

  21. Abdennadher, S., Fakhry, G., Sharaf, N.: Implementation of the operational semantics for CHR with user-defined rule priorities. In: Christiansen, H., Sneyers, J. (eds.) Proceedings of the 10th Workshop on Constraint Handling Rules, pp. 1–12, Technical report CW 641, (2013)

    Google Scholar 

  22. Fakhry, G., Sharaf, N., Abdennadher, S.: Towards the implementation of a source-to-source transformation tool for CHR operational semantics. In: Gupta, G., Peña, R. (eds.) LOPSTR 2013, LNCS 8901. LNCS, vol. 8901, pp. 145–163. Springer, Heidelberg (2014)

    Chapter  Google Scholar 

  23. Abdennadher, S., Schütz, H.: CHRv: a flexible query language. In: Andreasen, T., Christiansen, H., Larsen, H.L. (eds.) FQAS 1998. LNCS (LNAI), vol. 1495, pp. 1–14. Springer, Heidelberg (1998)

    Chapter  Google Scholar 

  24. Hundhausen, C., Douglas, S., Stasko, J.: A meta-study of algorithm visualization effectiveness. J. Vis. Lang. Comput. 13(3), 259–290 (2002)

    Article  Google Scholar 

  25. Bistarelli, S., Frühwirth, T., Marte, M.: Soft constraint propagation and solving in chrs. In: Proceedings of the 2002 ACM Symposium on Applied Computing, pp. 1–5. ACM (2002)

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Nada Sharaf .

Editor information

Editors and Affiliations

Appendices

Appendix

A Annotations

The bubble sort program’s annotations use node as a basic object. The x-coordinate is calculated through the index and the height uses the value.

figure p

For the \(n\)queens problem, the first set of annotations are the rectangles produced by the object “board” which users can choose through the interface. The number of vertical and horizontal squares (\(4\) in our case), the initial x and y-coordinates (\(30\) and \(30\) in our case), the squares’ widths (\(30\) in this case) in addition to the color chosen by the user automatically produces 16 associations for the solve constraint. The below constraints represent the rectangles that form the first two rows of the board and the two annotations for the in constraint.

figure q

Rights and permissions

Reprints and permissions

Copyright information

© 2015 Springer International Publishing Switzerland

About this paper

Cite this paper

Sharaf, N., Abdennadher, S., Frühwirth, T. (2015). CHRAnimation: An Animation Tool for Constraint Handling Rules. In: Proietti, M., Seki, H. (eds) Logic-Based Program Synthesis and Transformation. LOPSTR 2014. Lecture Notes in Computer Science(), vol 8981. Springer, Cham. https://doi.org/10.1007/978-3-319-17822-6_6

Download citation

  • DOI: https://doi.org/10.1007/978-3-319-17822-6_6

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-319-17821-9

  • Online ISBN: 978-3-319-17822-6

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics