AI Algorithms Data Structures and Idioms in Prolog Lisp and Java 6th Edition by George Luger, William Stubblefield 0136070477 9780136070474 download
AI Algorithms Data Structures and Idioms in Prolog Lisp and Java 6th Edition by George Luger, William Stubblefield 0136070477 9780136070474 download
https://ebookball.com/product/artificial-intelligence-structures-
and-strategies-for-complex-problem-solving-1st-edition-by-george-
luger-william-stubblefield-0805311963-978-0805311969-19466/
https://ebookball.com/product/artificial-intelligence-structures-
and-strategies-for-complex-problem-solving-1st-edition-by-
william-luger-george-
stubblefield-0805311963-978-0805311969-19456/
Data Structures and Algorithms in Java 1st Edition by Peter Drake ISBN
0131469142 9780131469143
https://ebookball.com/product/data-structures-and-algorithms-in-
java-1st-edition-by-peter-drake-
isbn-0131469142-9780131469143-12422/
https://ebookball.com/product/think-data-structures-algorithms-
and-information-retrieval-in-java-1st-edition-by-allen-downey-
isbn-9781491972311-1491972319-15760/
Data Structures and Algorithms with Object Oriented Design Patterns in
Java 1st Edition by Bruno Preiss, PEng ISBN 0471346136 9780471346135
https://ebookball.com/product/data-structures-and-algorithms-
with-object-oriented-design-patterns-in-java-1st-edition-by-
bruno-preiss-peng-isbn-0471346136-9780471346135-19836/
https://ebookball.com/product/artificial-intelligence-structures-
and-strategies-for-complex-problem-solving-5th-edition-by-george-
luger-0321263189-978-0321263186-19470/
https://ebookball.com/product/data-structures-and-algorithms-
in-c-1st-edition-by-adam-drozdek-asin-b002wlxmby-25076/
https://ebookball.com/product/artificial-intelligence-structures-
and-strategies-for-complex-problem-solving-5th-edition-by-george-
luger-isbn-0321263189-978-0321263186-16442/
https://ebookball.com/product/data-structures-algorithms-and-
applications-in-c-1st-edition-by-adam-drozdek-
isbn-1133608426-9781133608424-17250/
Luger_all_wcopyright_COsfixed.pd2 2 5/15/2008 6:34:39 PM
AI Algorithms, Data Structures, and
Idioms in Prolog, Lisp, and Java
George F. Luger
William A. Stubblefield
Many of the designations used by manufacturers and sellers to distinguish their products are claimed as
trademarks. Where those designations appear in this book, and Addison-Wesley was aware of a
trademark claim, the designations have been printed in initial caps or all caps.
Copyright © 2009 Pearson Education, Inc. All rights reserved. No part of this publication may be
reproduced, stored in a retrieval system, or transmitted, in any form or by any means, electronic,
mechanical, photocopying, recording, or otherwise, without the prior written permission of the publisher.
Printed in the United States of America. For information on obtaining permission for use of material in this
work, please submit a written request to Pearson Education, Inc., Rights and Contracts Department, 501
Boylston Street, Suite 900, Boston, MA 02116, fax (617) 671-3447, or online at
http://www.pearsoned.com/legal/permissions.htm.
ISBN-13: 978-0-13-607047-4
ISBN-10: 0-13-607047-7
1 2 3 4 5 6 7 8 9 10—OPM—12 11 10 09 08
Exercises 266
Chapter 26 Case Studies: JESS and other Expert System Shells in Java 363
26.1 Introduction 363
26.2 JESS 363
26.3 Other Expert system Shells 364
26.4 Using Open Source Tools 365
Chapter 31 Case Studies: Java Natural Language Tools on the Web 423
31.1 Java Natural Language Processing Software 423
31.2 LingPipe from the University of Pennsylvania 423
31.3 The Stanford Natural Language Processing Group Software 425
31.4 Sun’s Speech API 426
Bibliography 439
Index 443
- Aristotle, Ethics
Why Another Writing a book about designing and implementing representations and
Programming search algorithms in Prolog, Lisp, and Java presents the authors with a
Language number of exciting opportunities.
Book?
The first opportunity is the chance to compare three languages that give
very different expression to the many ideas that have shaped the evolution
of programming languages as a whole. These core ideas, which also
support modern AI technology, include functional programming, list
processing, predicate logic, declarative representation, dynamic binding,
meta-linguistic abstraction, strong-typing, meta-circular definition, and
object-oriented design and programming. Lisp and Prolog are, of course,
widely recognized for their contributions to the evolution, theory, and
practice of programming language design. Java, the youngest of this trio, is
both an example of how the ideas pioneered in these earlier languages
have shaped modern applicative programming, as well as a powerful tool
for delivering AI applications on personal computers, local networks, and
the world wide web.
The second opportunity this book affords is a chance to look at Artificial
Intelligence from the point of view of the craft of programming. Although
we sometimes are tempted to think of AI as a theoretical position on the
nature of intelligent activity, the complexity of the problems AI addresses
has made it a primary driver of progress in programming languages,
development environments, and software engineering methods. Both Lisp
and Prolog originated expressly as tools to address the demands of
symbolic computing. Java draws on object-orientation and other ideas that
can trace their roots back to AI programming. What is more important, AI
has done much to shape our thinking about program organization, data
structures, knowledge representation, and other elements of the software
craft. Anyone who understands how to give a simple, elegant formulation
to unification-based pattern matching, logical inference, machine learning
theories, and the other algorithms discussed in this book has taken a large
step toward becoming a master programmer.
The book’s third, and in a sense, unifying focus lies at the intersection of
these points of view: how does a programming language’s formal structure
interact with the demands of the art and practice of programming to
xi
create the idioms that define its accepted use. By idiom, we mean a set of
conventionally accepted patterns for using the language in practice.
Although not the only way of using a language, an idiom defines patterns
of use that have proven effective, and constitute a common understanding
among programmers of how to use the language. Programming language
idioms do much to both enable, as well as support, ongoing
communication and collaboration between programmers.
These, then, are the three points of view that shape our discussion of AI
programming. It is our hope that they will help to make this book more
than a practical guide to advanced programming techniques (although it is
certainly that). We hope that they will communicate the intellectual depth
and pleasure that we have found in mastering a programming language
and using it to create elegant and powerful computer programs.
The Design of There are five sections of this book. The first, made up of a single chapter,
this Book lays the conceptual groundwork for the sections that follow. This first
chapter provides a general introduction to programming languages and
style, and asks questions such as “What is a master programmer?” What is a
programming language idiom?,” and “How are identical design patterns
implemented in different languages?” Next, we introduce a number of
design patterns specific to supporting data structures and search strategies
for complex problem solving. These patterns are discussed in a “language
neutral” context, with pointers to the specifics of the individual
programming paradigms presented in the subsequent sections of our
book. The first chapter ends with a short historical overview of the
evolution of the logic-based, functional, and object-oriented approaches to
computer programming languages.
Part II of this book presents Prolog. For readers that know the rudiments
of first-order predicate logic, the chapters of Part II can be seen as a
tutorial introduction to Prolog, the language for programming in logic.
For readers lacking any knowledge of the propositional and predicate
calculi we recommend reviewing an introductory textbook on logic.
Alternatively, Luger (2005, Chapter 2) presents a full introduction to both
the propositional and predicate logics. The Luger introduction includes a
discussion, as well as a pseudo code implementation, of unification, the
pattern-matching algorithm at the heart of the Prolog engine.
The design patterns that make up Part II begin with the “flat” logic-based
representation for facts, rules, and goals that one might expect in any
relational data base formalism. We next show how recursion, supported by
unification-based pattern matching, provides a natural design pattern for
tree and graph search algorithms. We then build a series of abstract data
types, including sets, stacks, queues, and priority queues that support
patterns for search. These are, of course, abstract structures, crafted for
the specifics of the logic-programming environment that can search across
state spaces of arbitrary content and complexity. We then build and
demonstrate the “production system” design pattern that supports rule
based programming, planning, and a large number of other AI
technologies. Next, we present structured representations, including
GL
BS
July 2008
Albuquerque
all good things - trout as well as eternal salvation - come by grace and grace comes by art and art does not
come easy…
Chapter This chapter introduces the ideas that we use to organize our thinking about
Objectives languages and how they shape the design and implementation of programs.
These are the ideas of language, idiom, and design pattern.
1.1 Introduction
Idioms and As with any craft, programming contains an undeniable element of
Patterns
experience. We achieve mastery through long practice in solving the
problems that inevitably arise in trying to apply technology to actual
problem situations. In writing a book that examines the implementation of
major AI algorithms in a trio of languages, we hope to support the reader’s
own experience, much as a book of musical etudes helps a young musician
with their own exploration and development.
As important as computational theory, tools, and experience are to a
programmer’s growth, there is another kind of knowledge that they only
suggest. This knowledge comes in the form of pattern languages and
idioms, and it forms a major focus of this book. The idea of pattern
languages originated in architecture (Alexander et al. 1977) as a way of
formalizing the knowledge an architect brings to the design of buildings
and cities that will both support and enhance the lives of their residents. In
recent years, the idea of pattern languages has swept the literature on
software design (Gamma, et al. 1995; Coplein & Schmidt 1995; Evans
2003), as a way of capturing a master’s knowledge of good, robust program
structure.
A design pattern describes a typical design problem, and outlines an
approach to its solution. A pattern language consists of a collection of
related design patterns. In the book that first proposed the use of pattern
languages in architecture, Christopher Alexander et al. (1977, page x) state
that a pattern
describes a problem which occurs over and over again in our environment, and
then describes the core of the solution to that problem, in such a way that you
can use this solution a million times over, without ever doing it the same way
twice.
Design patterns capture and communicate a form of knowledge that is
essential to creating computer programs that users will embrace, and that
The only way to rectify our reasonings is to make them as tangible as those of the mathematicians, so that
we can find our error at a glance, and when there are disputes among persons we can simply say, “Let us
calculate… to see who is right.”
—Leibniz, The Art of Discovery
17
—Je suis bien aise de vous voir un instant pour vous gronder, dit-
elle; je n’ai pas reconnu ce soir vos attentions ordinaires. Vous
n’avez donc pas pensé que le bruit de la salle à manger arrivait
jusqu’ici.
—En as-tu été incommodée? dit Christian en la regardant
attentivement.
—A moins d’avoir une tête de fer... il paraît que ces messieurs ont
un peu abusé de la liberté permise à la campagne. D’après ce que
m’a dit Justine, il s’est passé des choses qui eussent été mieux à leur
place à la Femme-sans-Tête.
—Tu souffres beaucoup?
—Une migraine affreuse. Je voudrais pouvoir un peu dormir.
—J’ai eu tort de ne pas prévoir cela. Mais tu me pardonnes, n’est-il
pas vrai?
Bergenheim se pencha sur la causeuse et passa un bras autour
des épaules de la jeune femme, en appuyant les lèvres sur le front
qu’elle tenait baissé. Pour la première fois de sa vie, il jouait un rôle
auprès d’elle et observait avec une attention implacable les moindres
expressions de son visage, les plus fugitives révélations de son
maintien. Il s’aperçut qu’elle frémissait sur le bras dont il l’avait
enveloppée, et sa bouche trouva prompt à se dérober et aussi froid
que le marbre le front qu’elle avait à peine effleuré.
Il se redressa et fit plusieurs tours dans la chambre en évitant de
la regarder, car l’aversion que lui annonçaient ces symptômes lui
parut une preuve complète et il craignit de ne pouvoir se contenir.
—Qu’avez-vous donc? demanda la jeune femme en remarquant
l’agitation de son mari.
Ces paroles rendirent au baron la prudence dont il avait besoin. Il
se rapprocha d’elle et répondit avec une sorte d’insouciance:
—J’éprouve une contrariété pour une cause assez frivole; il s’agit
de ta tante.
—Je sais. Elle est furieuse contre vous depuis le double malheur
arrivé à Constance et à son cocher. Quant à Constance, avouez que
vous êtes coupable.
—Elle ne se contente pas d’être furieuse; elle me menace d’une
rupture complète. Tiens, lis.
Il lui remit en disant ces mots une lettre pliée haut et large et
cachetée aux armes de Corandeuil. L’écusson accompagné de
supports, cimier, lambrequins et entouré de l’ancienne et
romanesque devise: Corandeuil, cœur en deuil! ressemblait plutôt,
pour la dimension, au sceau d’un diplôme qu’au cachet d’une lettre
ordinaire; il donnait d’abord une idée grave du contenu, et cette
impression se trouvait confirmée au premier coup d’œil par une
écriture droite, maigre, rigide, ainsi que par une belle orthographe
de douairière qui proscrivait sans pitié les a voltairiens et employait
volontiers les z au lieu des s.
ebookball.com