Anda di halaman 1dari 45

RT804 Artificial Intelligence Module 1

____________________________________________________________________________________________________________________
Artificial Intelligence (ref: AI by Rich & Knight)
Artificial intelligence is the study of how to make computers do things which, at the moment,
people do better
!uch of the early work in AI focused on formal tasks, such as game playing and theorem
pro"ing
#ome of the game playing programs are
$heckers playing program,
$hess
#ome of the theorem pro"ing programs are
%ogic theorist,
&alernter's theorem pro"er
Another area of AI is common sense reasoning It includes reasoning about physical ob(ects
and their relationships to each other as well as reasoning about actions and their conse)uences
*g &eneral problem sol"er (&+#)
As AI research progressed, new tasks were sol"ed such as perception ("ision and speech),
natural language understanding and problem sol"ing in domains such as medical diagnosis and
chemical analysis
+erception
+erceptual tasks are "ery difficult because they in"ol"e analog signals
Department of Computer Science & Engineering St. Josephs College of Engineering & Technology Palai
,
Module 1
Introduction Definitions AI application areas Example prolems! "rolems and
prolem spaces ! "rolem c#aracteristics "rolem sol$ing % searc#ing& 'earc#ing
strategies (readt# first searc#& )niform cost searc#& D*'& Dept# +imited searc#& (i!
directional searc# ,onstraint satisfaction searc#-
RT804 Artificial Intelligence Module 1
____________________________________________________________________________________________________________________
-atural language understanding
.he problem of understanding spoken language is a perceptual problem and is hard to sol"e
/ut if we try to simplify the problem by restricting it to written language, then also it is e0tremely
difficicult .his problem is referred to as natural language understanding
In addition to these, many people can perform speciali1ed tasks in which e0pertise is
necessary *g *ngineering design,
#cientific disco"ery,
!edical diagnosis,
2inancial planning
.hese e0pert tasks re)uire knowledge that many of us do not ha"e, they often re)uire much
less knowledge than do the mundane tasks .his knowledge is easier to represent and deal with
inside programs
As aa result, the problem areas where AI is now flourishing most as a practical discipline are
primarily the domains that re)uire only speciali1ed e0pertise without the assistance of commonsense
knowledge .here are now thousands of programs called e0pert systems in day to day operation
throughout all areas of industry and go"ernment
Mundane tasks
+erception
o 3ision
o #peech
-atural language
o 4nderstanding
o &eneration
o .ranslation
$ommonsense reasoning
Robot control
Department of Computer Science & Engineering St. Josephs College of Engineering & Technology Palai
5
RT804 Artificial Intelligence Module 1
____________________________________________________________________________________________________________________
Formal tasks
&ames
o $hess
o /ackgammon
o $heckers
o &o
!athematics
o &eometry
o %ogic
o Integral calculus
o +ro"ing properties of programs
Expert tasks
*ngineering
o 6esign
o 2ault finding
o !anufacturing planning
#cientific analysis
!edical diagnosis
2inancial analysis
Department of Computer Science & Engineering St. Josephs College of Engineering & Technology Palai
7
RT804 Artificial Intelligence Module 1
____________________________________________________________________________________________________________________
Definitions (AI by Russel and -or"ig)
6efinitions of artificial intelligence according to 8 te0t books are gi"en below
Artificial intelligence is a system that thinks like human beings
, AI is an exciting effort to make computers think machines with minds, in the full
and literal sense.
2. AI is the automation of actiities that we associate with human thinking, actiities
such as decision making, pro!lem soling, learning..
Artificial intelligence is a system that thinks rationally
". AI is the stud# of mental faculties through the use of computational models.
$. AI is the stud# of computations that make it possi!le to perceie, reason and act.
Artificial intelligence is a system that acts like human beings
%. AI is the art of creating machines that perform functions that re&uire intelligence
when performed !# people.
'. AI is the stud# of how to make computers do things at which , at the moment , people
do !etter.
Artificial intelligence is a system that acts rationally
(. AI is the stud# of the design of intelligent agents.
). AI is concerned with intelligent !ehaior in artifacts.
Department of Computer Science & Engineering St. Josephs College of Engineering & Technology Palai
9
RT804 Artificial Intelligence Module 1
____________________________________________________________________________________________________________________
AI is a s#stem that acts like human !eings
2or this, a computer would need to possess the following capabilities
-atural language processing
.o enable it to communicate successfully in *nglish
Knowledge representation
.o store what it knows or hears
Automated reasoning
.o use the stored information to answer )uestions and to draw new conclusions
!achine learning
.o adapt to new circumstances and to detect and e0trapolate patterns
$omputer "ision
.o percei"e ob(ects
Robotics
.o manipulate ob(ects and mo"e about
AI is a s#stem that thinks like human !eings.
2irst we must ha"e some way of determining how humans think :e need to get inside the
workings of the human minds ;nce we ha"e a sufficiently precise theory of the mind, it becomes
possible to e0press that theory using a computer program
.he field of cogniti"e science brings together computer models from AI and e0perimental
techni)ues from psychology to try to construct precise and testable theories of the workings of the
human mind
Department of Computer Science & Engineering St. Josephs College of Engineering & Technology Palai
<
RT804 Artificial Intelligence Module 1
____________________________________________________________________________________________________________________
AI is a s#stem that thinks rationall#
2or a gi"en set of correct premises, it is possible to yield new conclusions 2or eg =#ocrates
is a man> all men are mortal> therefore, #ocrates is mortal? .hese laws of thought were supposed to
go"ern the operation of the mind .his resulted in a field called logic
A precise notation for the statements about all kinds of things in the world and about relations
among them are de"eloped +rograms e0ist that could in principle sol"e any sol"able problem
described in logical notation
.here are 5 main obstacles to this approach 2irst it is not easy to take informal knowledge
and state it in the formal terms re)uired by logical notation #econd, there is a big difference
between being able to sol"e a problem =in principle? and doing so in practice
AI is a s#stem that acts rationall#
An agent is something that acts A rational agent is one that acts so as to achie"e the best
outcome or, when there is uncertainty, the best e0pected outcome
:e need the ability to represent knowledge and reason with it because this enables us to
reach good decisions in a wide "ariety of situations :e need to be able to generate comprehensi"e
sentences in natural language because saying those sentences helps us get by in a comple0 society
:e need learning because ha"ing a better idea of how the world works enables us to generate more
effecti"e strategies for dealing with it :e need "isual perception to get a better idea of what an
action might achie"e
Department of Computer Science & Engineering St. Josephs College of Engineering & Technology Palai
@
RT804 Artificial Intelligence Module 1
____________________________________________________________________________________________________________________
AI application areas (AI by %uger)
.he 5 most fundamental concerns of AI researchers are knowledge representation and search
Knowledge representation
It addresses the problem of capturing the full range of knowledge re)uired for intelligent
beha"ior in a formal language, ie ;ne suitable for computer manipulation
*g predicate calculus,
%I#+,
+rolog
#earch
It is a problem sol"ing techni)ue that systematically e0plores a space of problem states, ie,
successi"e and alternati"e stages in the problem sol"ing process
.he following e0plains the ma(or application areas of AI
&ame playing
!uch of the early research in AI was done using common board games such as checkers,
chess and the ,< pu11le /oard games ha"e certain properties that made them ideal for AI research
!ost games are played using a well defined set of rules .his makes it easy to generate the search
space .he board configuration used in playing these games can be easily represented on a computer
As games can be easily played, testing a game playing program presents no financial or ethical
burden
Aeuristics
&ames can generate e0tremely large search spaces #o we use powerful techni)ues called
heuristics to e0plore the problem space A heuristic is a useful but potentially fallible problem
strategy, such as checking to make sure that an unresponsi"e appliance is plugged in before
assuming that it is broken
Department of Computer Science & Engineering St. Josephs College of Engineering & Technology Palai
B
RT804 Artificial Intelligence Module 1
____________________________________________________________________________________________________________________
#ince most of us ha"e some e0perience with these simple games, we do not need to find and
consult an e0pert 2or these reasons games pro"ide a rich domain for the study of heuristic search
Automated reasoning and theorem proing
*0amples for automatic theorem pro"ers are
-ewell and #imon's %ogic .heorist,
&eneral +roblem #ol"er (&+#)
.heorem pro"ing research is responsible for the de"elopment of languages such as predicate
calculus and prolog
.he attraction of automated theorem pro"ing lies in the rigor and generality of logic A wide
"ariety of problems can be attacked by representing the problem description as logical a0ioms and
treating problem instances as theorems to be pro"ed
Reasoning based on formal mathematical logic is also attracti"e !any important problems
such as design and "erification of logic circuits, "erification of the correctness of computer programs
and control of comple0 systems come in this category
Expert s#stems
Aere comes the importance of domain specific knowledge A doctor, for e0ample, is effecti"e
at diagnosing illness because she possesses some innate general problem sol"ing skill> she is
effecti"e because she knows a lot about medicine A geologist is effecti"e at disco"ering mineral
deposits
*0pert knowledge is a combination of theoretical understanding of the problem and a
collection of heuristic problem sol"ing rules that e0perience has shown to be effecti"e in the domain
*0pert systems are constructed by obtaining this knowledge from a human e0pert and coding it into
a form that a computer may apply to similar problems
.o de"elop such a system, we must obtain knowledge from a human domain e0pert
*0amples for domain e0perts are doctor, chemist, geologist, engineer etc .he domain e0pert
pro"ides the necessary knowledge of the problem domain .he AI specialist is responsible for
implementing this knowledge in a program ;nce such a program has been written, it is necessary to
refine its e0pertise through a process of gi"ing it e0ample problems to sol"e and making any
re)uired changes or modifications to the program's knowledge
Department of Computer Science & Engineering St. Josephs College of Engineering & Technology Palai
8
RT804 Artificial Intelligence Module 1
____________________________________________________________________________________________________________________
6endral is an e0pert system designed to infer the structure of organic molecules from their
chemical formulas and mass spectrographic information about the chemical bonds present in the
molecules
!ycin is an e0pert system which uses e0pert medical knowledge to diagnose and prescribe
treatment for spinal meningitis and bacterial infections of the blood
+rospector is an e0pert system for determining the probable location and type of ore deposits
based on geological information about a site
Internist is an e0pert system for performing diagnosis in the area of internal medicine
.he dipmeter ad"isor is an e0pert system for interpreting the results of oil well drilling logs
Ccon is an e0pert system for configuring 3AC computers
*atural language understanding and semantic modeling
;ne goal of AI is the creation of programs that are capable of understanding and generating
human language #ystems that can use natural language with the fle0ibility and generality that
characteri1e human speech are beyond current methodologies
4nderstanding natural language in"ol"es much more than parsing sentences into their
indi"idual parts of speech and looking those words up in a dictionary Real understanding depends
on e0tensi"e background knowledge
$onsider for e0ample, the difficulties in carrying out a con"ersation about baseball with an
indi"idual who understands *nglish but knows nothing about the rules of the game .his person will
not be able to understand the meaning of the sentence =:ith none down in the top of the ninth and
the go ahead run at second, the manager called his relief from the bull pen? *"en though hall of the
words in the sentence may be indi"idually understood, this sentence would be difficult to e"en the
most intelligent non base ball fan
.he task of collecting and organi1ing this background knowledge in such a way that it may be
applied to language comprehension forms the ma(or problem in automating natural language
understanding
Department of Computer Science & Engineering St. Josephs College of Engineering & Technology Palai
D
RT804 Artificial Intelligence Module 1
____________________________________________________________________________________________________________________
Modeling human performance
:e saw that human intelligence is a reference point in considering artificial intelligence It
does not mean that programs should pattern themsel"es after the organi1ation of the human mind
+rograms that take non human approaches to sol"ing problems are often more successful than their
human counterparts #till, the design of systems that e0plicitly model some aspect of human
performance has been a fertile area of research in both AI and psychology
+lanning and ro!otics
Research in planning began as an effort to design robots that could perform their tasks with
some degree of fle0ibility and responsi"eness to outside world +lanning assumes a robot that is
capable of performing certain atomic actions
+lanning is a difficult problem because of the si1e of the space of possible se)uences of
mo"es *"en an e0tremely simple robot is capable of generating a "ast number of potential mo"e
se)uences
;ne method that human beings use in planning is hierarchical problem decomposition If we
are planning a trip to %ondon, we will generally treat the problems of arranging a flight, getting to
the air port, making airline connections and finding ground transportation in %ondon separately
*ach of these may be further decomposed into smaller sub problems
$reating a computer program that can do the same is a difficult challenge
A robot that blindly performs a se)uence of actions without responding to changes in its
en"ironment cannot be considered intelligent ;ften, a robot will ha"e to formulate a plan based on
the incomplete information and correct its beha"ior A robot may not ha"e ade)uate sensors to locate
all obstacles in the way of a pro(ected path ;rgani1ing plans in a fashion that allows response to
changing en"ironmental conditions is a ma(or problem for planning
,anguages and enironments for AI
+rogramming en"ironments include knowledge structuring techni)ues such as ob(ect oriented
programming and e0pert systems frameworks Aigh le"el languages such as %isp and +rolog support
modular de"elopment
Department of Computer Science & Engineering St. Josephs College of Engineering & Technology Palai
,E
RT804 Artificial Intelligence Module 1
____________________________________________________________________________________________________________________
!any AI algorithms are also now built in more traditional computing languages such as $FF
and Ga"a
Machine learning
An e0pert system may perform e0tensi"e and costly computations to sol"e a problem /ut if
it is gi"en the same or similar problem a second time, it usually does not remember the solution It
performs the same se)uence of computations again .his is not the beha"ior of an intelligent
problem sol"er
.he programs must learn on their own %earning is a difficult area /ut there are se"eral
programs that suggest that it is possible
;ne program is A!, the automated mathematician which was designed to disco"er
mathematical laws Initially gi"en the concepts and a0ioms of set theory, A! was able to induce
important mathematical concepts such as cardinality, integer arithmetic and many of the results of
number theory A! con(ectured new theorems by modifying its current knowledge base
*arly work includes :inston's research on the induction of structural concepts such as =arch?
from a set of e0amples in the blocks world
.he I67 algorithm has pro"ed successful in learning general patterns from e0amples
!eta dendral learns rules for interpreting mass spectrographic data in organic chemistry from
e0amples of data on compounds of known structure
.eiresias, an intelligent front end for e0pert systems, con"erts high le"el ad"ice into new
rules for its knowledge base
.here are also now many important biological and sociological models of learning
*eural nets and genetic algorithms
An approach to build intelligent programs is to use models that parallel the structure of
neurons in the human brain
A neuron consists of a cell body that has a number of branched protrusions called dendrites
and a single branch called the a0on 6endrites recei"e signals from other neurons :hen these
combined impulses e0ceed a certain threshold, the neuron fires and an impulse or spike passes down
the a0on
Department of Computer Science & Engineering St. Josephs College of Engineering & Technology Palai
,,
RT804 Artificial Intelligence Module 1
____________________________________________________________________________________________________________________
.his description of the neuron captures features that are rele"ant to neural models of
computation *ach computational unit computes some function of its inputs and passes the result
along to connected units in the network> the final results are produced by the parallel and distributed
processing of this network of neural connection and threshold weights

Example pro!lems (AI by Russel)
+roblems can be classified as toy problems and real world problems
A toy problem is intended to illustrate or e0ercise "arious problem sol"ing methods It can be
used by different researchers to compare the performance of algorithms
A real world problem is one whose solutions people actually care about
-o# pro!lems
.he first e0ample is the
acuum world
Department of Computer Science & Engineering St. Josephs College of Engineering & Technology Palai
,5
RT804 Artificial Intelligence Module 1
____________________________________________________________________________________________________________________
.he agent is in one of the 5 locations, each of which might or might not contain dirt
Any state can be designated as the initial state
After trying these actions (%eft, Right, #uck), we get another state
.he goal test checks whether all s)uares are clean
) . pu//le pro!lem
it consists of a 7 C 7 board with 8 numbered tiles and a blank space as shown below
Department of Computer Science & Engineering St. Josephs College of Engineering & Technology Palai
,7
RT804 Artificial Intelligence Module 1
____________________________________________________________________________________________________________________
A tile ad(acent to the blank space can slide into the space .he aim is to reach a specified goal
state, such a s the one shown on the right of the figure
) . 0ueens pro!lem
.he goal of 8H )ueens' problem is to place 8 )ueens on a chess board such that no )ueen
attacks any other
(a )ueen attacks any piece in the same row, column or diagonal) 2igure shows an attempted solution
that that fails: the )ueen in the rightmost column is attacked by the )ueen at the top left
Department of Computer Science & Engineering St. Josephs College of Engineering & Technology Palai
,9
RT804 Artificial Intelligence Module 1
____________________________________________________________________________________________________________________
1eal world pro!lems
1oute finding pro!lem
Route finding algorithms are used in a "ariety of applications, such as routing in computer
networks, military operations planning and air line tra"el planning systems
.ouring problems
.hey are related to route finding problems 2or e0ample, consider the figure
$onsider the problem I3isit e"ery city in the figure at least once starting and ending in
+alai' *ach state must include not (ust the current location but also the set of cities the agent has
"isited
.ra"eling salesperson problem (.#+)
Is a touring problem in which each city must be "isited e0actly once .he aim is to find the
shortest tour
Department of Computer Science & Engineering St. Josephs College of Engineering & Technology Palai
,<
RT804 Artificial Intelligence Module 1
____________________________________________________________________________________________________________________
2,3I la#out pro!lem
It re)uires positioning of millions of components and connections on a chip to minimi1e area,
minimi1e circuit delays, minimi1e stray capacitances, and ma0imi1e manufacturing yield
1o!ot naigation
It is a generali1ation of the route finding problem Rather than a discrete set of routes, a robot
can mo"e in a continuous space with an infinite set of possible actions and states
Automatic assem!l# se&uencing of complex o!4ects !# a ro!ot
.he assembly of intricate ob(ects such as electric motors is economically feasible In
assembly problems, the aim is to find an order in which to assemble the parts of some ob(ect If the
wrong order is chosen, there will be no way to add some part later in the se)uence without undoing
some of the work already done
+rotein design
Aere the aim is to find a se)uence of amino acids that will fold into a three dimensional
protein with the right properties to cure some disease
Internet searching
It means looking for answers to )uestions for related information or for shopping details
#oftware robots are being de"eloped for performing this internet searching
Department of Computer Science & Engineering St. Josephs College of Engineering & Technology Palai
,@
RT804 Artificial Intelligence Module 1
____________________________________________________________________________________________________________________
+ro!lems (AI by Ritchie & Knight)
:e ha"e seen different kinds of problems with which AI is typically concerned .o build a
system to sol"e a particular problem, we need to do 9 things
, 6efine the problem precisely .his includes the initial state as well as the final goal state
5 Analy1e the problem
7 Isolate and represent the knowledge that is needed to sol"e the problem
9 $hoose the best problem sol"ing techni)ue and apply it to the particular problem
+ro!lem spaces (AI by Ritchie & Knight)
#uppose we are gi"en a problem statement =play chess? .his now stands as a "ery
incomplete statement of the problem we want sol"ed
.o build a program that could =play chess?, we could first ha"e to specify the starting
position of the chess board, the rules that define the legal mo"es and the board positions that
represent a win for one side or the other
2or this problem =play chess?, it is easy to pro"ide a formal and complete problem
description .he starting position can be described as an 8 by 8 array as follows
Department of Computer Science & Engineering St. Josephs College of Engineering & Technology Palai
,B
RT804 Artificial Intelligence Module 1
____________________________________________________________________________________________________________________
:e can define as our goal any board position in which the opponent does not ha"e a legal
mo"e and his or her king is under attack
.he legal mo"es pro"ide the way of getting the initial state to a goal state .hey can be
described easily as a set of rules consisting of 5 parts: a left side that ser"es as a pattern to be
matched against the current board position and a right side that describes the change to be made to
the board position to reflect the mo"e
:e ha"e defined the problem of playing chess as a problem of mo"ing around in a state space,
where each state corresponds to a legal position of the board :e can then play chess by starting at
an initial state, using a set of rules to mo"e from one state to another, and attempting to end up in
one of a set of final states
.his state space representation is useful for naturally occurring, less well structured problems
.his state space representation forms the basiss of most of the AI methods
*0ample 5
-he game of tic5tac5toe
#tarting with an empty board, the first player may place an C in any one of nine places *ach
of these mo"es yields a different board that will allow the opponent 8 possible responses and so on
:e can represent this collection of possible mo"es and responses by regarding each board
configuration as a node in a graph .he links of the graph represent legal mo"es from one board
configuration to another .hese nodes correspond to different states of the game board .he resulting
structure is called a state space graph
Department of Computer Science & Engineering St. Josephs College of Engineering & Technology Palai
,8
RT804 Artificial Intelligence Module 1
____________________________________________________________________________________________________________________
Department of Computer Science & Engineering St. Josephs College of Engineering & Technology Palai
,D
RT804 Artificial Intelligence Module 1
____________________________________________________________________________________________________________________
*0ample 7
Diagnosing a mechanical fault in an automo!ile
Aere each node of the state space graph represent a partial knowledge about the automobile's
mechanical problems
.he starting node of the graph is empty, indicating that nothing is known about the cause of
the problem *ach of the states in the graph has arcs that lead to states representing further
accumulation of knowledge in the diagnostic process
Department of Computer Science & Engineering St. Josephs College of Engineering & Technology Palai
5E
RT804 Artificial Intelligence Module 1
____________________________________________________________________________________________________________________
2or e0ample the engine trouble node has arcs to nodes labeled Iengine starts' and Iengine
won't start' 2rom the Iwon't start' node, we may mo"e to nodes labeled Iturns o"er' and Iwon't
turn o"er' .he Iwon't turn o"er' node has arcs to nodes labeled Ibattery ok'
*0ample 7
6ater 4ug pro!lem
:e are gi"en 5 (ugs, a 9 gallon and a 7 gallon one -either has any measuring markers on it
.here is a pump that can be used to fill the (ugs with water :e need to get e0actly 5 gallons of
water in to the 9 gallon (ug
.he state space for this problem can be described asd the set of ordered pairs of integers (0,y),
such that 0JE,,,5,7 or 9 and yJE,,,5 or 7> 0 represents the number of gallons of water in the 9
gallon (ug, and y represents the )uantity of water in the 7 gallon (ug
.he start state is (E,E) .he goal state is (5,n) for any "alue of n
Department of Computer Science & Engineering St. Josephs College of Engineering & Technology Palai
5,
RT804 Artificial Intelligence Module 1
____________________________________________________________________________________________________________________
In order to pro"ide a formal description of a problem, we must do the following
, 6efine a state space that contains all the possible configurations of the rele"ant ob(ects
5 #pecify one or more states within that space that describe possible situations from which the
problem sol"ing process may start .hese states are called the initial states
7 #pecify one or more states that would be acceptable as solutions to the problem .hese states
are called goal states
9 #pecify a set of rules that describe the actions a"ailable
+ro!lem characteristics (AI by Ritchie & Knight)
In order to choose the most appropriate method for a particular problem, it is necessary to
analy1e the problem along se"eral dimensions
Is the problem decomposable into a set of independent smaller or easier sub problemsK
$an solution steps be ignored or at least undone if they pro"e unwiseK
Is the problem's uni"erse predictableK
Is a good solution to the problem ob"ious without comparison to all other possible solutionsK
Is the desired solution a state of the world or a path to a stateK
Is a large amount of knowledge absolutely re)uired to sol"e the problem, or is knowledge
important only to constrain the searchK
$an a computer that is simply gi"en the problem return the solution, or will the solution of
the problem re)uire interaction between the computer and a personK
Department of Computer Science & Engineering St. Josephs College of Engineering & Technology Palai
55
RT804 Artificial Intelligence Module 1
____________________________________________________________________________________________________________________
Is the pro!lem decomposa!le7
#uppose we want to sol"e the problem of computing the e0pression
L ( 0
5
F 70 F #in
5
0 $os
5
0 ) d0
:e can sol"e this problem by breaking it down into 7 smaller problems, each of which can
then sol"e by using a small collection of specific rules
L 0
5
F70 F sin
5
0 cos
5
0 d0
L 0
5
d0 L 70 d0 L sin
5
0 cos
5
0 d0
0
7
M7 7 L 0 d0 L (,Hcos
5
0) cos
5
0 d0
70
5
M5 L cos
5
0 d0 H L cos
9
0 d0
H
H
H
L N (, F cos 50) d0
N L , d0 N L cos 50 d0
N 0 O sin 50
Department of Computer Science & Engineering St. Josephs College of Engineering & Technology Palai
57
RT804 Artificial Intelligence Module 1
____________________________________________________________________________________________________________________
8an solution steps !e ignored or undone7
Aere we can di"ide problems into 7 classes
Ignorable, in which solution steps can be ignored
Reco"erable, in which solution steps can be undone
Irreco"erable, in which solution steps cannot be undone
Ignorable problems ( eg .heorem pro"ing)
Aere solution steps can be ignored
#uppose we are trying to pro"e a mathematical theorem :e proceed by first pro"ing a
lemma that we think will be useful *"entually we reali1e that the lemma is no help at all Aere the
different steps in pro"ing the theorem can be ignored .hen we can start from another rule .he
former can be ignored
Reco"erable problems (eg 8 pu11le problem)
$onsider the 8 pu11le problem
.he goal is to transform the starting position into the goal position by sliding the tiles around
In an attempt to sol"e the 8H pu11le, we might make a stupid mo"e 2or e0ample, in the game
shown abo"e, we might start by sliding tile < into the empty space Aa"ing done that, we cannot
Department of Computer Science & Engineering St. Josephs College of Engineering & Technology Palai
59
RT804 Artificial Intelligence Module 1
____________________________________________________________________________________________________________________
change our mind and immediately slide tile @ into the empty space since the empty space will
essentially ha"e mo"ed /ut we can backtrack and undo the ,
st
mo"e, sliding tile < back to where it
was .hen we can mo"e tile @ here mistakes can be reco"ered
Irreco"erable problems (eg $hess)
$onsider the problem of playing chess #uppose a chess playing program makes a stupid
mo"e and reali1es it a couple of mo"es later It cannot simply play as though it had ne"er made the
stupid mo"e -or can it simply back up and start the game o"er from that point All it can do is to try
to make the best of the current situation and go from there
.he reco"erability of a problem plays an important role in determining the comple0ity of the
control structure necessary for the problem's solution Ignorable problems can be sol"ed using a
simple control structure Reco"erable problems can be sol"ed by a slightly more complicated
control strategy that does sometimes makes mistakes Irreco"erable problems will need to be sol"ed
by a system that e0pends a great deal of effort making each decision since the decision must be final
Is the unierse predicta!le7
$ertain outcome problems (eg 8 pu11le)
#uppose we are playing with the 8 pu11le problem *"ery time we make a mo"e, we know
e0actly what will happen .his means that it is possible to plan an entire se)uence of mo"es and be
confident that we know what the resulting state will be
4ncertain outcome problems (eg /ridge)
Aowe"er, in games such as bridge, this planning may not be possible ;ne of the decisions
we will ha"e to make is which card to play on the first trick :hat we would like to do is to plan the
entire hand before making that first play /ut now it is not possible to do such planning with
certainty since we cannot know e0actly where all the cards are or what the other players will do on
their turns
Department of Computer Science & Engineering St. Josephs College of Engineering & Technology Palai
5<
RT804 Artificial Intelligence Module 1
____________________________________________________________________________________________________________________
;ne of the hardest types of problems to sol"e is the irreco"erable, uncertain outcome
*0amples of such problems are
+laying bridge,
$ontrolling a robot arm,
Aelping a lawyer decide how to defend his client against a murder charge
Is a good solution a!solute or relatie7
Any path problems
$onsider the problem of answering )uestions based on a database of simple facts, such as the
following
, !arcus was a man
5 !arcus was a +ompean
7 !arcus was born in 9E A 6
9 all men are mortal
< All pompeans died when the "olcano erupted in BD A 6
@ -o mortal li"es longer than ,<E years
B It is now ,DD, A 6
#uppose we ask the )uestion =Is !arcus ali"eK? /y representing each of these facts in a formal
language, such as predicate logic, and then using formal inference methods, we can fairly easily
deri"e an answer to the )uestion .he following shows 5 ways of deciding that !arcus is dead
a0ioms
, !arcus was a man ,
9 All men are mortal 9
8 !arcus is mortal ,,9
7 !arcus was born in 9E A6 7
B It is now ,DD, A 6 B
D !arcus' age is ,D<, years 7,B
@ no mortal li"es longer than ,<E years @
,E !arcus is dead 8,@,D
Department of Computer Science & Engineering St. Josephs College of Engineering & Technology Palai
5@
RT804 Artificial Intelligence Module 1
____________________________________________________________________________________________________________________
;R
B It is now ,DD, A6 B
< All +ompeans died in BD A 6 <
,, All +ompeans are dead now B,<
5 !arcus was a +ompoean 5
,5 !arcus is dead ,,,5
#ince all we are interested in is the answer to the )uestion, it does not matter which path we
follow
/est path problems (eg .ra"eling salesman problem )
$onsider the tra"eling salesman problem ;ur goal is to find the shortest route that "isits each
city e0actly once #uppose the cities to be "isited and the distances between them are shown below
/oston -P !iami 6allas #2
/oston 5<E ,9<E ,BEE 7EEE
-P 5<E ,5EE ,<EE 5DEE
!iami ,9<E ,5EE ,@EE 77EE
6allas ,BEE ,<EE ,@EE ,BEE
#2 7EEE 5DEE 77EE ,BEE
;ne place the salesman could start is /oston In that case, one path that might be followed is
the one shown below which is 88<E miles long
/oston
Department of Computer Science & Engineering St. Josephs College of Engineering & Technology Palai
5B
RT804 Artificial Intelligence Module 1
____________________________________________________________________________________________________________________
(7EEE)
#an 2rancisco
(,BEE)
6allas
(,<EE)
-ew Pork
(,5EE)
!iami
(,9<E)
/oston
/ut is this the solution to the problemK .he answer is that we cannot be sure unless we also
try all other paths to make sure that none of them is shorter
/est path problems are computationally harder than any path problems
Is the solution a state or a path7
+roblems whose solution is a state of the world
eg -atural language understanding
$onsider the problem of finding a consistent interpretation for the sentence,
I .he bank president ate a dish of pasta salad with the fork'
.here are se"eral components of this sentence, each of which, in isolation, may ha"e more
than one interpretation #ome of the sources of ambiguity in this sentence are the following
.he word Ibank' may refer either to a financial institution or to a side of a ri"er
Department of Computer Science & Engineering St. Josephs College of Engineering & Technology Palai
58
RT804 Artificial Intelligence Module 1
____________________________________________________________________________________________________________________
.he word dish is the ob(ect of the "erb Ieat' It is possible that a dish was eaten /ut it is more
likely that the pasta salad in the dish was eaten
+asta salad is a salad containing pasta /ut there are other ways interpretations can be formed
from pairs of nouns 2or e0ample, dog food does not normally contain dogs
.he phrase Iwith the fork' could modify se"eral parts of the sentence In this case, it modifies
the "erb Ieat' /ut, if the phrase had been Iwith "egetables', then the modification structure would
be different
/ecause of the interaction among the interpretations of the constituents of this sentence, some
search may be re)uired to find a complete interpretation for the sentence /ut to sol"e the problem
of finding the interpretation, we need to produce only the interpretation itself -o record of the
processing by which the interpretation was found is necessary
+roblems whose solution is a path to a stateK
*g :ater (ug problem
In water (ug problem, it is not sufficient to report that we ha"e sol"ed the problem and
that the final state is (5,E) 2or this kind of problem, what we really must report is not the final state,
but the path that we found to that state
6hat is the role of knowledge7
+roblems for which a lot of knowledge is important only to constrain the search for a solution
*g $hess
$onsider the problem of playing chess Aow much knowledge would be re)uired by a perfect
chess playing programK Gust the rules for determining the legal mo"es and some simple control
mechanism that implements an appropriate search procedure
+roblems for which a lot of knowledge is re)uired e"en to be able to recogni1e a solution
*g -ews paper story understanding
Department of Computer Science & Engineering St. Josephs College of Engineering & Technology Palai
5D
RT804 Artificial Intelligence Module 1
____________________________________________________________________________________________________________________
$onsider the problem of scanning daily newspapers to decide which are supporting democrats
and which are supporting the republicans in some upcoming election Aow much knowledge would
be re)uired by a computer trying to sol"e this problemK Aere a great deal of knowledge is necessary
Does the task re&uire interaction with a person7
#olitary problems
Aere the computer is gi"en a problem description and produces an answer with no
intermediate communication and with no demand for an e0planation for the reasoning process
$onsider the problem of pro"ing mathematical theorems If
, All we want is to know that there is a proof
5 .he program is capable of finding a proof by itself
.hen it does not matter what strategy the program takes to find the proof
$on"ersational problems
In which there is intermediate communication between a person and the computer, either to
pro"ide additional assistance to the computer or to pro"ide additional information to the user
*g #uppose we are trying to pro"e some new, "ery difficult theorem .hen the program may not
know where to start At the moment, people are still better at doing the high le"el strategy re)uired
for a proof #o the computer might like to be able to ask for ad"ice .o e0ploit such ad"ice, the
computer's reasoning must be analogous to that of its human ad"isor, at least on a few le"els
+roblem sol"ing by searching
:e ha"e seen problems and problem spaces
#earch is a problem sol"ing techni)ue that systematically e0plores a space of problem states .hat is
to mo"e through the problem space until a path from an initial state to a goal state is found
Department of Computer Science & Engineering St. Josephs College of Engineering & Technology Palai
7E
RT804 Artificial Intelligence Module 1
____________________________________________________________________________________________________________________
*0amples of problem states might include the different board configurations in a game or
intermediate steps in a reasoning process .his space of alternate solutions is then searched to find a
final answer
:e can contrast this with human problem sol"ing Aumans generally consider a number of
alternati"e strategies on their way to sol"ing a problem A chess player typically considers a number
of alternati"e mo"es, selecting the best according to such criteria as the opponent's possible
responses A mathematician will choose from a different but e)ually comple0 set of strategies to find
a proof for a difficult theorem, a physician may systematically e"aluate a number of possible
diagnoses and so on
*g &ame of ticHtacHtoe
&i"en any board situation, there is only a finite set of mo"es that a player can make #tarting
with an empty board, the first player may place an C in any one of D places *ach of these mo"es
yields a different board that will allow the opponent 8 possible responses, and so on :e can
represent this collection of possible mo"es and responses as a state space graph
Department of Computer Science & Engineering St. Josephs College of Engineering & Technology Palai
7,
RT804 Artificial Intelligence Module 1
____________________________________________________________________________________________________________________
&i"en this representation, an effecti"e game strategy will search through the graph for the
paths that lead to the most wins and fewest losses and play in a way that always tries to force the
game along one of the optimal paths .his searching strategy is an effecti"e one and also it is
straightforward to implement on a computer
Department of Computer Science & Engineering St. Josephs College of Engineering & Technology Palai
75
RT804 Artificial Intelligence Module 1
____________________________________________________________________________________________________________________
3earching strategies
9readth first search (AI by %uger)
$onsider the graph shown below
A
/ $ 6
* 2 & A I G
K % ! - ; + Q R
# . 4
#tates are labeled (A, /, $R)
/readth first search e0plores the space in a le"el by le"el fashion ;nly when there are no more
states to be e0plored at a gi"en le"el does the algorithm mo"e on to the ne0t le"el A breadth first
search of the abo"e graph considers the states in the order A, /, $, 6, *, 2, &, A, I, G, K, %, !, -, ;,
+, Q, R, #, ., 4
:e implement breadth first search using lists, open and closed, to keep track of progress
through the state space Iopen' lists states that ha"e been generated but whose children ha"e not been
Department of Computer Science & Engineering St. Josephs College of Engineering & Technology Palai
77
RT804 Artificial Intelligence Module 1
____________________________________________________________________________________________________________________
e0amined .he order in which states are remo"ed from open determines the order of the search
Iclosed' records states that ha"e already been e0amined
"oid breadthS first S search ( )
T
open J U start V>
closed J U V>
while ( open not empty )
T
Remo"e the leftmost state from open, call it C>
if C is a goal,
then return #4$$*##>
else
T
&enerate children of C>
+ut C on closed>
6iscard children of 0, if already on open or closed>
+ut remaining children on right end of open>
W
W
return 2AI%>
W
$hild states are generated by inference rules, legal mo"es of a game or other state transition
operators *ach iteration produces all children of the state 0 and adds them to open
-ote that open is maintained as a )ueue (2I2;) data structure #tates are added to the right of
the list and remo"ed from the left
A trace of the breadth first search on the graph appears below
Department of Computer Science & Engineering St. Josephs College of Engineering & Technology Palai
79
RT804 Artificial Intelligence Module 1
____________________________________________________________________________________________________________________
;pen closed
A empty
/$6 A
$6*2 /A
6*2&A $/A
*2&AIG 6$/A
2&AIGK% *6$/A
&AIGK%! 2*6$/A
AIGK%!- &2*6$/A

And so on until open J U V


/ecause breadth first search considers e"ery node at each le"el of the graph before going
deeper in to the space, all states are first reached along the shortest path from the start state /readth
first search is therefore guaranteed to find the shortest path from the start state to goal
Department of Computer Science & Engineering St. Josephs College of Engineering & Technology Palai
7<
RT804 Artificial Intelligence Module 1
____________________________________________________________________________________________________________________
Depth first search (AI by %uger)
6ept first search goes deeper in to the search space whene"er this is possible
$onsider the graph
A
/ $ 6
* 2 & A I G
K % ! - ; + Q R
# . 4
6epth first search e0amines the states in the graph in the order A, /, *, K, #, %, ., 2, !, $, &, -, A,
;, +, 4, 6, I, Q, G, R
In depth first search, the descendent states are added and remo"ed from the left end of open
.hat is, open is maintained as a stack (%I2;) data structure
Department of Computer Science & Engineering St. Josephs College of Engineering & Technology Palai
7@
RT804 Artificial Intelligence Module 1
____________________________________________________________________________________________________________________
"oid depthSfirstSsearch ()
T
open J UstartV>
closed J U V>
while (open not empty )
T
remo"e leftmost state from open, call it C>
if C is a goal state
then return #4$$*##>
else
T
generate children of C>
put C on closed>
discard children of C, if already on open or closed>
put remaining children on left end of open>
W
W
return 2AI%>
W
A trace of depth first search on the abo"e graph is shown below
open closed
A empty
/ $ 6 A
* 2 $ 6 / A
K % 2 $ 6 * / A
# % 2 $ 6 K * / A
% 2 $ 6 # K * / A
. 2 $ 6 % # K * / A
Department of Computer Science & Engineering St. Josephs College of Engineering & Technology Palai
7B
RT804 Artificial Intelligence Module 1
____________________________________________________________________________________________________________________
2 $ 6 . % # K * / A
! $ 6 2 . % # K * / A
$ 6 ! 2 . % # K * / A
& A 6 $ ! 2 . % # K * / A
And so on until open J U V>
Iopen' records all states that are disco"ered and Iclosed' contains all states that are already
considered
62# is not guaranteed to find the shortest path to a state the first time that state is
encountered
Depth limited search
(AI by Russel)
to limit the depth of 62#, we can supply a predetermined depth limit, l to 62# .hat is nodes
at depth l are treated as if they ha"e no successors .his approach is called depth limited search
6epth first search can be "iewed as a special case of depth limited search with l J X
#ometimes depth limit can be based on knowledge of the problem 2or e0ample, on the map
of Romania, there are 5E cities .herefore, we know that if there is a solution, it must be of length ,D
at the longest, so l J ,D is a possible choice /ut in fact if we studied the map carefully, we would
disco"er that any city can be reached from any other city in at most D steps .his number, known as
the diameter of the state space, gi"es us a better depth limit , which leads to a more efficient depth
limited search
Department of Computer Science & Engineering St. Josephs College of Engineering & Technology Palai
78
RT804 Artificial Intelligence Module 1
____________________________________________________________________________________________________________________
:niform cost search
(AI by Russell)
/readth first search that we ha"e learned assumes that all path costs from a state to a
successor is same It e0pands the shallowest une0panded node
/ut uniform costs search e0pands the node n with the lowest path cost, instead of e0panding
the shallowest node -ote that if all step costs are e)ual, this is identical to breadth first search
4niform cost search does not care about the number of steps a path has, but only about their
total cost .herefore, it will get stuck in an infinite loop if it e"er e0pands a node that has a 1ero cost
action leading back to the same state :e can guarantee completeness pro"ided the cost of e"ery
step is greater than or e)ual to some small positi"e constant .he algorithm e0pands nodes in order
of increasing path cost
9idirectional search
(AI by Russell)
.he idea behind bidirectional search is to run two simultaneous searchesH one forward from
the initial state and other backward from the goal, stopping when the 5 searches meet in the middle
A schematic "iew of a bidirectional search that is about to succeed , when a branch from the
start node meets a branch from the goal node
Department of Computer Science & Engineering St. Josephs College of Engineering & Technology Palai
7D
RT804 Artificial Intelligence Module 1
____________________________________________________________________________________________________________________
/idirectional search is implemented by ha"ing one or both of the searches check each node
before it is e0panded to see if it is in the fringe of the other search tree> if so, a solution has been
found
:hat do we mean by =the goal? in searching =backward from the goal? 2or the 8Hpu11le and
for finding a route in Romania, there is (ust one goal state, so the backward search is "ery much like
the forward search If there are se"eral e0plicitly listed goal states, then we can construct a new
dummy goal state whose immediate predecessors are all the actual goal states
.he most difficult case for bidirectional search is when the goal test gi"es only an implicit
description of some possibly large set of goal states 2or e0ample, all the states satisfying the =check
mate? goal test in chess
8onstraint satisfaction search
(AI by Ritchie and Knight)
!any problems in AI are called to be the problems of constraint satisfaction In these
problems, the goal is to disco"er some problem state that satisfies a gi"en set of constraints
*0amples are cryptarithmetic pu11les, map coloring
$rypt arithmetic problem
Aere letters must be assigned particular numbers as their "alues A constraint satisfaction
approach to sol"ing this problem a"oids making guesses on particular assignments of numbers to
letters until it has to Instead, the initial set of constraints, which says that each number may
correspond to only one letter and that the sums of the digits must be as they are gi"en in the
problem, is first augmented to include restrictions that can be inferred from the rules of arithmetic
$onstraint satisfaction is a search procedure that operates in a space of constraint sets .he
initial state contains the constraints that are originally gi"en in the problem description A goal state
is any state that has been constrained =enough? 2or e0ample, for cryptarithmetic, enough means that
each letter has been assigned a uni)ue numeric "alue
Department of Computer Science & Engineering St. Josephs College of Engineering & Technology Palai
9E
RT804 Artificial Intelligence Module 1
____________________________________________________________________________________________________________________
$onstraint satisfaction is a 5 step process 2irst constraints are disco"ered and propagated as
far as possible throughout the system #econd, if there is still not a solution, search begins A guess
about something is made and added as a new constraint +ropagation can then occur with this new
constraint, and so forth
.he first step, propagation, arises from the fact that there are usually dependencies among the
constraints #o for e0ample, assume we start with one constraint, - J * F , .hen, if we added the
constraint - J 7, we could propagate that to get a stronger constraint on *, namely that * J 5
$onstraint propagation terminates for one of two reasons 2irst, a contradiction may be
detected If this happens, then there is no solution consistent with all the known constraints
.he second possible reason for termination is that the propagation has run out of stream and
there are no further changes that can be made on the basis of current knowledge If this happens,
search is necessary to get the process mo"ing again
At this point, the second step begins #ome hypothesis about a way to strengthen the
constraints must be made In the case of the cryptarithmetic problem, for e0ample, this usually
means guessing a particular "alue for some letter ;nce this has been done, constraint propagation
can begin again from this new state If a solution is found, it can be reported If still more guesses
are re)uired, they can be made If a contradiction is detected, then backtracking can be used to try a
different guess and proceed with it
$onstraint satisfaction algorithm
, propagate a"ailable constraints .o do this, first set ;+*- to the set of all ob(ects that must
ha"e "alues assigned to them in a complete solution .hen do until an inconsistency is
detected or until ;+*- is empty
a #elect an ob(ect ;/ from ;+*- #trengthen as much as possible the set of constraints
that apply to ;/
b If this set is different from the set that was assigned the last time ;/ was e0amined or
if this is the first time ;/ has been e0amined, then add to ;+*- all ob(ects that share
any constraints with ;/
c Remo"e ;/ from ;+*-
Department of Computer Science & Engineering St. Josephs College of Engineering & Technology Palai
9,
RT804 Artificial Intelligence Module 1
____________________________________________________________________________________________________________________
5 If the union of the constraints disco"ered abo"e defines a solution, then )uit and report the
solution
7 If the union of the constraints disco"ered abo"e defines a contradiction, then return failure
9 If the neither of the abo"e occurs, then it is necessary to make a guess at something in order
to proceed .o do this, loop until a solution is found or all possible solutions ha"e been
eliminated
a #elect an ob(ect whose "alue is not yet determined and select a way of strengthening
the constraints on that ob(ect
b Recursi"ely in"oke constraint satisfaction with the current set of constraints
augmented by the strengthening constraint (ust selected
.he following e0ample describes the working of the abo"e algorithm
$onsider the cryptarithmetic problem below
+roblem
# * - 6
F ! ; R *
HHHHHHHHHHHHHHHHHHH
! ; - * P
Initial state:
-o two letters ha"e the same "alue
.he sums of the digits must be as shown in the problem
.he goal state is a problem state in which all letters ha"e been assigned a digit in such a way
that all the initial constraints are satisfied
.he solution proceeds in cycles At each cycle, 5 significant things are done
, $onstraints are propagated by using rules that correspond to the properties of arithmetic
5 A "alue is guessed for some letter whose "alue is not yet determined
Department of Computer Science & Engineering St. Josephs College of Engineering & Technology Palai
95
RT804 Artificial Intelligence Module 1
____________________________________________________________________________________________________________________
In the first step, it does not usually matter a great deal what order the propagation is done in,
since all a"ailable propagations will be performed before the step ends In the second step, though
the order in which guesses are tried may ha"e a substantial impact on the degree of search that is
necessary A few useful heuristics can help to select the best guess to try first
2or e0ample, if there is a letter that has only 5 possible "alues and another with @ possible
"alues, there is a better chance of guessing right on the first then on the second Another useful
heuristic is that if there is a letter that participates in many constraints then it is a good idea to prefer
it to a letter that participates in a few A guess on such a highly constrained letter will usually lead
)uickly either to a contradiction or to the generation of many additional constraints
.he result of the first few cycles of processing this e0ample is shown below

# * - 6
F ! ; R *
HHHHHHHHHHHHHHHHHHH
! ; - * P
Department of Computer Science & Engineering St. Josephs College of Engineering & Technology Palai
97
RT804 Artificial Intelligence Module 1
____________________________________________________________________________________________________________________
Initial state
* J 5
$, J E $, J ,
6 J 8 6J D
$onflict $onflict
Initially, rules for propagating constraints generate the following additional constraints
!J,,
#ince 5 single digit numbers plus a carry cannot total more than ,D
#J 8 or D,
Department of Computer Science & Engineering St. Josephs College of Engineering & Technology Palai
99
- J 7
R J 8 or D
5 F 6 J P or 5 F 6 J ,E F P
! J ,
# J 8 or D
; J E or , ; J E
- J * or * F , - J * F ,
$5 J ,
- F R Y 8
* ZY D
5 F 6 J P
- F R J ,E F *
R J D
# J 8
5 F 6 J ,E F P
6 J 8 F P
6 J 8 or D
P J E P J ,
RT804 Artificial Intelligence Module 1
____________________________________________________________________________________________________________________
#ince # F ! F $7 Y D (to generate the carry) and !J,, # F , F $7 Y D, so # F $7 Y 8 and $7
is at most ,
; J E,
#ince # F ! (,) F $7 (ZJ,) must be at least ,E to generate a carry and it can be at most ,
/ut ! is already ,, so ; must be E
- J * or * F ,,
6epending on the "alue of $5 /ut - cannot ha"e the same "alue as * #o - J * F, and $5
is ,
In order for $5 to be ,, the sum of - F R F $, must be greater than D, so - F R must be
greater than 8
- F R cannot be greater than ,8, e"en with a carry in, so * cannot be D
At this point, let us assume that no more constraints can be generated .hen, to make progress
from here, we must guess #uppose * is assigned the "alue
-ow the ne0t cycle begins .he constraint propagator now obser"es that
- J 7, since - J * F,
R J 8 or D, since R F -(7) F $, (, or E) J 5 or ,5
/ut since - is already 7, the sum of these nonnegati"e numbers cannot be les than 7 thus R F
7 F (E or ,) J ,5 and R J 8 or D
5 F 6 J P or 5 F 6 J ,E F P, from the sum in the rightmost column
Again, assuming no further constraints can be generated, a guess is re)uired #uppose $, is
chosen to guess a "alue for If we try the "alue ,, then we e"entually reach dead ends as shown in
the figure :hen this happens, the process will backtrack and try $, J E
Department of Computer Science & Engineering St. Josephs College of Engineering & Technology Palai
9<

Anda mungkin juga menyukai