Академический Документы
Профессиональный Документы
Культура Документы
in
INDEX
Sno. Topics
General Issues and Overview of AI
1 The AI problems
2 What is an AI technique
3 Characteristics of AI applications
Introduction to LISP Programming
4 Syntax
UNIT I 5 Numeric functions
6 Basic list manipulation functions
7 Predicates
8 Conditionals
9 Input output
10 local variables
11 Iteraction and recursion
12 Property lists
13 Arrays
UNIT I
The AI problems
An AI problem is simply a task that we might want an intelligent agent to solve the problem. It involves goal
possible actions and their results as well as data / percepts, cost / benefits and so on.
Example:
1. Find a book.
2. Find a way to got a book once it is found.
3. Find a way to move puzzle pieces to achieve a particular pattern.
4. Answer a question.
5. Interpret visual data.
And so on.
1. Block-word problem.
2. Monkey and Bananas problem.
3. 8-puzzle problem.
www.rgpvmca.blogspot.in
What is AI technique?
Characteristics of AI system:
Advantage of LISP
Application of LISP
AI
Symbolic algebraic manipulation
Natural language understanding
Machine translation
Formal logical reasoning
Expert system
Automatic programming
Robotics
Perceptions (vision, speech, understanding)
LISP Data
1. Symbols (They are atomic symbol or atoms) range (upto 30 characters) followed by letters, numbers
and some special characters.
www.rgpvmca.blogspot.in
Computation in LISP
Example:
(+ 2 2)
(+ 3 ( * 4 5))
(-5(*45))
( PRINT (H1MOM))
( * 3.145926 (EXPT R 2))
(SQRT 2.0)
(SETQ X 2)
(SET X ( + 2 2))
( COND ( ( > X Y )
( SETQ Y 3)))
Example:
Constructing LIST
Example:
Example:
Example:
The basic function that constructs new list structure is the function of CONS.
Example:
(cons a (b)) o/p (a b)
(cons a nil) o/p (a)
(cons a ( )) o/p (a)
(cons (a) (b)) o/p ((a) (b))
(cons a b) o/p (a b)
Note:
APPEND : Makes a new list consisting of the members of its argument lists appended together. It takes any
number of arguments.
Example:
www.rgpvmca.blogspot.in
REVERSE : Make a new list that is the reverse of the list given as its argument.
Example:
Example:
SUBSTITUTION : The function SUBST makes a new S-expression with a specified substitution
Example:
Example:
PREDICATES: A Predicates in LIPS is a function that returns either T (true) or NIL (false).
Logical Operators:
NOT
(NOT x) return T iff x is NILL , otherwise. It return NIL , NOT is therefore the same as NULL.
Example:
Condition resting:
Example: (if (<=3 2 )(* 3 9)(+ 4 2 3)) ...[if 3.2 then return 3*9 else return 4+2+3]
Global variables:
Local variables:
1. Read :
Example : (+ 7 (read))
2. Print:
Example: (print good morning)
o/p : good morning
good morning
(print (x y z u)) ..o/p : (x y z u).
o/p : (x y z u)
(x y z u)
3. Prinl : It is same as print except that the new-line characters and space are not provided.
Example: (print left) (prinl right)
o/p: left right
(print left) (prinl right)
o/p: left
right
www.rgpvmca.blogspot.in
Recursion: It is a function which calls itself repeatedly but each with a similar arguments than the argument
using in the preceding calls.
Example:
Logic: fact(1)=1
In Lisp:
(defun fact(n)
(cond
((= n 1) 1)
Example: Define a function LEN that return the number of top-most elements in a given list L:
(defun len(L)
(cond
( (null ) 0 )
)
www.rgpvmca.blogspot.in
Property List
By using property list we can associate property and values of object in LISP.
1. Putprop:
It return the attribute values LISP.
Example:
(putprop book rich & night Author) o/p: rich & night
(putpro book Tata McGrawHill Publisher)..o/p: Tata McGrawHill
(putprop book 1984 year) .o/p: 1984
2. GET:
It is used to retrieve the value of attribute or properties.
Syntax: (get <obj-name> <attribute>)
Example:
(get book year) o/p: 1984
(get book author) o/p: rich & knight
(get book publisher) o/p: Tata McGrawHill
Dim dimension
o/p matrix-3
Reference By :
1."Elaine Rich and Kevin Knight Artifical Intelligence - Tata McGraw Hill.
2. Artifical Intelligence 4 ed. Pearson.
3. Dan W. Patterson Introduction to Artifical Intelligence and Expert Systems, Prentice India.
4. Nils J. Nilson Principles of Artifical Intelligence, Narosa Publishing House.
5. Clocksin & C.S.Melish Programming in PROLOG, Narosa Publishing House.
6. M.Sasikumar,S.Ramani etc. Rule based Expert System, Narosa Publishing House.