skip to main content
article
Free Access

A constraint approach to mastermind in logic programming

Published:03 January 1988Publication History
Skip Abstract Section

Abstract

Logic programming is a convenient tool for stating combinatorial problems due to its nondeterminism and its relational form. It is not surprising that simple and declarative programs can be written for problems like mastermind. However, due to their search strategy, logic languages are also very inefficient for solving the natural formulation of problems. Moving away from this natural formulation leads to much programming effort and to less modifable and extensible programs. This paper shows, on the mastermind example, that it is possible to write very declarative programs which will be executed efficiently by an extended logic programming language. The key idea is to embed consistency techniques inside logic programming. Within this approach, constraints are used actively to prune the search space in an "a priori" way instead of the passive way (for testing values) of usual languages. The resulting program outperforms all the proposed algorithms and achieves a speed-up of 40 over Shapiro's program in the average and a speed-up of 72 on Powers' benchmark.

References

  1. Clark, K.L. and Mc Cabe, F. The control facilities of IC-PROLOG. In D. Mitchie, Ed., Expert system in the micro electronic age, Edinburgh University Press, 1979, pp. 122-149.Google ScholarGoogle Scholar
  2. Colmerauer, A., Kanoui, H. and Van Caneghem, M. "Prolog, bases theoriques et developments actuels." T.S.I. (Techniques et Sciences Informatiques). 2, 4 (1983), 271-311.Google ScholarGoogle Scholar
  3. Dincbas, M. and Lepape, J-P. Metacontrol of Logic Programs in METALOG. Proceedings of the International Conference on Fifth Generation Computer Systems (FGCS'84), ICOT, Tokyo, Japan, November, 1984, pp. 361-370.Google ScholarGoogle Scholar
  4. Dincbas, M., Simonis, H. and Van Hentenryck P. Extending Equation Solving and Constraint Handling in Logic Programming. Colloquium on Resolution of equations in Algebraic Structures, Texas, May, 1987.Google ScholarGoogle Scholar
  5. Gallaire, H. Logic programming further developments. IEEE Symposium on Logic Programming, Boston, July, 1985, pp. 88-99. Invited paper.Google ScholarGoogle Scholar
  6. Haralick, R.M. and Elliot, G.L. "Increasing tree search efficiency for constraint satisfaction problems.". AI 14 (1980), 263-313.Google ScholarGoogle Scholar
  7. Mackworth, A.K. "Consistency in network of relations". AI 8, 1 (1977), 99-118.Google ScholarGoogle Scholar
  8. Naish, L. Negation and Control in Prolog. Ph.D. Th., University of Melbourne, Australia, 1985.Google ScholarGoogle Scholar
  9. Powers, D. "Plying Mastermind More Logically". Sigart Newsletter 89 (1984). 28-32. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. Shapiro, E. "Playing Mastermind Logically". Sigart 85 (1983), 28-29. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. Sterling, L. and Shapiro, E. The Art of Prolog: Advanced Programming Techniques. MIT Press, 1986. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. van Emden, M.H. RELATIONAL PROGRAMMING illustrated by a program for the game of mastermind. CS-78-48, Department of Computer Science, University of Waterloo, Ontario, Canada, 1978.Google ScholarGoogle Scholar
  13. Van Hentenryck, P. and Dincbas, M. Domains in Logic Programming. Proceedings of the National Conference on Al (AAAI-86), Philadelphia, USA, August 1986, pp. 759-765.Google ScholarGoogle Scholar
  14. Van Hentenryck, P. and Dincbas, M. Forward Checking in Logic Programming. Fourth International Conference on Logic Programming. Melbourne, Australia, May, 1987.Google ScholarGoogle Scholar
  15. Van Hentenryck, P. A Framework for Consistency Techniques in Logic Programming. IJCAI-87, Milan, Italy, August, 1987.Google ScholarGoogle Scholar
  16. Van Hentenryck, P. Consistency Techniques in Logic Programming. Ph.D. Th., University of Namur (Belgium), July 1987.Google ScholarGoogle Scholar

Index Terms

  1. A constraint approach to mastermind in logic 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 SIGART Bulletin
          ACM SIGART Bulletin Just Accepted
          Jan., 1988
          38 pages
          ISSN:0163-5719
          DOI:10.1145/44418
          • Editor:
          • Keith Price
          Issue’s Table of Contents

          Copyright © 1988 Author

          Publisher

          Association for Computing Machinery

          New York, NY, United States

          Publication History

          • Published: 3 January 1988

          Check for updates

          Qualifiers

          • article

        PDF Format

        View or Download as a PDF file.

        PDF

        eReader

        View online with eReader.

        eReader