You are on page 1of 38

MODULE-

1 1.Whati
sAr
ti
fi
cial
Int
ell
i
gence?

Dat
a:Rawf
act
s,unf
ormat
tedi
nfor
mat
ion.

I
nfor
mat
ion:I
tist
her
esul
tofpr
ocessi
ng,
mani
pul
ati
ngandor
gani
zi
ngdat
ainr
esponset
oa
speci
fi
cneed.I
nfor
mat
ionr
elat
est
otheunder
standi
ngoft
hepr
obl
em domai
n.

Knowl
edge:I
trel
atest
otheunder
standi
ngoft
hesol
uti
ondomai
n–whatt
odo?

I
ntel
li
gence:I
tist
heknowl
edgei
noper
ati
ont
owar
dst
hesol
uti
on–howt
odo?Howt
oappl
y
t
hesol
uti
on?

Ar
ti
fi
cialI
ntel
li
gence:Ar
ti
fi
cial
int
ell
i
gencei
sthest
udyofhowmakecomput
erst
odot
hings
whi
chpeopl
edobet
teratt
hemoment
.Itr
efer
stot
hei
ntel
l
igencecont
rol
l
edbyacomput
er
machi
ne.

OneVi
ewofAIis
 Aboutdesigningsystemsthatareasintell
i
gentashumans
 Comput erscanbeacquiredwithabi
li
tiesnearl
yequaltohumani ntel
l
igence
 Howsy stem arr
ivesataconclusi
onorr easoni
ngbehindselecti
onofactions
 Howsy stem actsandperfor
msnotsomuchonr easoningprocess.

WhyAr
ti
fi
cialI
ntel
li
gence?
 Maki
ngmi
stakesonr
eal
-t
imecanbecost
lyanddanger
ous.
 Ti
me-
const
rai
ntsmayl
i
mitt
heext
entofl
ear
ningi
nreal
wor
ld.

TheAIPr
obl
em
Ther
ear
esomeoft
hepr
obl
emscont
ainedwi
thi
nAI
.
1. GamePlayi
ngandtheor
em pr
ovingsharet
hepr
oper
tyt
hatpeopl
ewhodot
hem wel
lar
e
consi
der
edtobedi
splay
ingi
ntel
l
igence.
2.Anotherimportantf
orayintoAIisfocusedon CommonsenseReasoning.Iti
ncl
udes
reasoni
ng aboutphysicalobj
ect
sand t hei
rr el
ati
onshi
pst
o each ot
her,aswellas
reasoni
ngaboutacti
onsandotherconsequences.
3.Toinvest
igat
et hissortofreasoningNowel
lShawandSi monbuil heGener
tt alPr
obl
em
Sol
ver(GPS)whi chtheyappliedtosever
alcommonsenset asksaswel
lasthepr
obl
em
ofperf
ormingsy mboli
cmani pulati
onsofl
ogicalexpr
essi
ons.Butnoatt
emptwasmade
tocreateapr ogram wi t
hal argeamountofknowl edgeaboutapar t
icul
arpr
obl
em
domain.
MODULE-
1

4.Thef
oll
owi
ngar
ethef
igur
esshowi
ngsomeoft
het
askst
hatar
ethet
arget
sofwor
kinAI
:

Onl
yqui
tesi
mpl
etaskswer
esel
ect
ed.
Percepti
onoftheworldaroundusi scr
uci
altooursurv
ival.Animalswit
hmuchl essintel
l
igence
thanpeoplearecapableofmor esophi
sti
catedvi
sualpercepti
on.Percept
iontasksaredi f
ficul
t
becausetheyinvol
veanal
ogsignals.Aper
sonwhoknowshowt oper
formtasksfrom severalof
thecategor
iesshowninfi
gurelear
nsthenecessar
yski
ll
sinst andar
dorder.

Fir
stperceptual
,li
ngui
sti
candcommonsenseski
l
lsar
elear
ned.Lat
erexper
tski
l
lssuchas
engineer
ing,
medici
neorfinancear
eacqui
red.

Thef
oll
owi
ngquest
ionsar
etobeconsi
der
edbef
orewecanst
epf
orwar
d:
1.
Whataretheunderlyi
ngassumptionsabouti
ntell
i
gence?
2.
Whatki
ndsoft echniqueswil
lbeusefulf
orsol
vingAIprobl
ems?
3.
Atwhatlevel
humani nt
ell
i
gencecanbemodel l
ed?
4.
Whenwilli
tber eal
i
zedwhenani ntel
li
gentpr
ogram hasbeenbui
lt
?

1.
2.TheUnder
lyi
ngAssumpt
ion

Phy
sicalSy
mbolSy
stem Hy
pot
hesi
s
Att
heheartofresearchi
nart
if
ici
ali
ntell
i
gence,
t heunderl
yi
ngassumpti
onsabouti
ntel
l
igenceli
e
i
nwhatNewel landSi mon(1976)callthephysicalsy
mbolsystem hy
pothesi
s.Theydefinea
phy
sical
symbol sy
stem asf
oll
ows:
1.Sy
mbol
s
2.Expr
essi
ons
3.Sy
mbol
Str
uct
ure
4.Sy
stem
A physi
calsymbolsy st
em consi
stsofasetofent i
ti
escal
l
edsy mbols,whicharephysical
l
y
patt
ersthatcanoccurascomponentsofanot
herty
peofenti
tycall
edanexpressi
on(orsymbol
str
uctur
e).Asy mbolstr
uctur
eiscomposedofanumberofi nst
ances( ort
okens)ofsymbols
rel
atedi
nsomephy si
calway.Atanyi
nst
anceoftheti
methesystem wi
l
lcontainacol
lect
ionof
thesesy mbolst
ruct
ures.Thesy stem al
socontai
nsacollect
ionofpr
ocessesthatoperateon
expressi
onstoproduceotherexpressi
ons:pr
ocessesofcr
eati
on,modi
fi
cat
ion,
reproduct
ionand
destruct
ion.

Theyst
atehy
pot
hesi
sas:
A phy
“ sicalsy
mbolsy
stem has t
he necessar
y and suf
fi
cientmeans f
orgener
al

i
ntel
li
gentact
ions’
.

Thishypothesisi
sonlyahypot
hesisthereappearstobenowayt oproveordisprov
eiton
l
ogicalgroundso,itmustbesubject
edt oempi r
icalval
idat
ionwefindthatiti
sf al
se.We
mayf i
ndthe bulkoft
heevi
dencesays t
hatiti
s t
rue butonl
yw aytodet
ermineit
s t
rut
hisby
experi
ment at
ion”

Comput ersprovi
det heperfectmedium f
orthi
sexperi
mentat
ionsi
ncet
heycanbeprogr
ammed
tosimulatephy si
calsymbolsy st
em wel i
ke.Theimpor
tanceofthephysi
calsy
mbolsyst
em
hypothesi
si stwofol
d.Itisasi gni
fi
cantt
heoryofthenat
ureofhumanint
ell
i
genceandsoisof
greatint
eresttopsychol
ogists.

Whati
sanAITechni
que?
Ar
tif
ici
alI
ntel
l
igencepr obl
emsspanav er
ybr oadspectrum.Theyappeartohaveveryl
itt
lei
n
commonexceptt hattheyar
ehar
d.Ther
earet echni
questhatar
eappropr
iat
eforthesol
uti
onofa
var
ietyoft
heseproblems.Ther
esul
tsofAIresearchtel
l
sthat

I
ntell
igencer
equi
resKnowl
edge.Knowl
edgepossessessomel
essdesi
rabl
epr
oper
ti
es
i
ncluding:
 I
tisvol
umi
nous
 I
tishar
dtochar
act
eri
zeaccur
atel
y
 I
tisconst
ant
lychangi
ng
 I
tdif
fer
sfrom dat
abybei
ngor
gani
zedi
nawayt
hatcor
respondst
otheway
sitwi
l
l
beused.

AIt
echniquei
samet
hodt
hatexpl
oit
sknowl
edget
hatshoul
dber
epr
esent
edi
nsucha
waythat
:
• Theknowl edgecapturesgeneral
izat
ions.Inot
herwor ds,i
tisnotnecessar
yt o
representeach indi
vi
dualsi t
uati
on.I nst
ead si
tuat
ions t
hatshareimportant
properti
esaregr
oupedt oget
her.
• I
tcanbeunderst
oodbypeoplewhomustprovi
deit
.Mostoftheknowledgea
pr
ogr
am hasmustul
ti
mat
elybepr
ovi
dedbypeopl
eint
ermst
heyunder
stand.
• I
tcanbeeasi
l
ybemodif
iedt
ocor
recter
ror
sandt
oref
lectchangesi
nthewor
ld
andi
nourwor
ldv
iew.
• I
tcanbeusedi
nagr
eatmanysi
tuat
ionsev
eni
fiti
snott
otal
l
yaccur
ateor
compl
ete.
• I
tcanbeusedt ohel
povercomeit
sownsheerbul
kbyhel
pingt
onar
rowt
her
ange
ofpossi
bil
i
tiest
hatmustusual
l
ybeconsi
der
ed.

I
tispossi
blet
osolveAIprobl
emswit
houtusi
ngAIt
echni
ques.I
tispossi
blet
oappl
yAI
t
echni
questosol
uti
onsofnon-
AIpr
obl
ems.

I
mpor
tantAITechni
ques:

 Sear
ch:Provi
desawayofsolvi
ngprobl
emsforwhichnomor
edirectappr
oachi
s
avai
l
able aswellas a f
ramewor
ki nt
o whi
ch anydir
ectt
echniques t
hatar
e
avai
l
ablecanbeembedded.
 UseofKnowledge:Pr
ov i
desawayofsolv
ingcompl
expr
obl
emsbyexpl
oit
ingt
he
st
ruct
uresoftheobj
ectsthatar
einv
olv
ed.
 Abst
ract
ion:Pr
ovi
desawayofseparati
ngimport
antfeat
uresandvar
iati
onsf
rom
themanyunimpor
tantonest
hatwoul
dother
wiseover
whelm anypr
ocess.
Exampl
e-1:Ti
c-Tac-
Toe

1.
1Thef
ir
stappr
oach(
simpl
e)

TheTic-Tac-Toegameconsi
stsofani
neel
ementv
ect
orcal
l
edBOARD;i
trepr
esent
sthe
numbers1t o9inthr
eer
ows.

Anelementcont ai
nstheval
ue0forbl
ank,1forXand2f orO.AMOVETABLEvectorconsi
stsof
9
19,
683element s(3)andisneededwhereeachelementisanineel
ementv
ect
or.Thecontents
oft
hev ectorar
eespecial
l
ychosentohel
pthealgori
thm.
Thealgori
thm makesmov esbypur
sui
ngthefoll
owing:
1.Viewt hevect
orasaternarynumber .Conv
ertitt
oadecimal number .
2.Usethedecimalnumberasani ndexinMOVETABLEandaccesst hev ect
or.
3.SetBOARD t ot hi
svectorindicati
nghow t heboardlooksaf terthemov e.Thi
s
approachiscapablei
ntimebuti thasseveraldi
sadv
antages.Ittakesmorespace
andrequir
esstunni
ng
eff
orttocal
cul
atethedeci
mal
number
s.Thi
smet
hodi
sspeci
fi
ctot
hisgameand
cannotbecomplet
ed.

1.
2Thesecondappr
oach

Thest ructureoft hedat aisasbef orebutweuse2f orablank, 3f oranXand5f oranO.


Avariablecal ledTURNi ndicates1f orthefirstmov eand9f orthel ast.Theal gor
it
hm consi
sts
ofthr
eeact i
ons:
MAKE2whi chreturns5i fthecent r
esquar eisbl ank;ot
her wisei tr etur
nsanyblanknon-
cor
nersquar e,i .
e.2,4,6or8.POSSWI N(p)r eturns0i fplayerpcannotwi nont henextmov e
andother wiser eturnsthenumberoft hesquar et hatgivesawi nningmov e.
Itcheckseachl ineusi ngpr oducts3*3* 2=18gi vesawi nf orX, 5* 5*2=50givesawinfor
O,andt hewi nningmov eist hehol deroft hebl ank.GO( n)makesamov et osquarensetti
ng
BOARD[ n]to3or5.
Thi salgor i
thm i
smor ei nvolvedandt akesl ongerbuti ti
smor eef ficientinst
oragewhich
compensat esf orit
slongert i
me.I tdependsont hepr ogrammer ’
sski ll
.

1.
3Thef
inalappr
oach

Thestruct ureoft hedataconsistsofBOARDwhi chcontainsani neelementv ect


or,a
l
istofboar dposi ti
onst hatcouldresultfrom thenextmov eandanumberr epresenti
ngan
esti
mat ionofhowt heboar dposit
ionleadst oanulti
matewi nforthepl ayertomov e.
Thisalgor i
thm looksaheadt omakeadeci si
onont henextmov ebydeci di
ngwhi ch
themostpr omisi ngmov eorthemostsui tabl
emov eatanystagewoul dbeandsel ectsthe
same.
Consideral lpossi bl
emov esandr epli
esthattheprogram canmake.Cont i
nuethis
processf orasl ongast imepermitsunt i
lawi nneremerges,andt henchooset hemov ethat
l
eadst ot hecomput erpr ogram wi
nning,ifpossibl
eintheshortestt i
me.
Actuall
yt hisismostdi ffi
cul
tt opr ogram byagoodl imitbuti ti
sasf arthatthe
techniquecanbeext endedt oinanygame.Thi smethodmakesr elati
velyfewerloadsont he
programmeri nt ermsoft hegamet echniquebutt heoveral
lgamest rategymustbeknown
totheadv iser.

Exampl
e-2:Quest
ionAnswer
ing

Letusconsi derQuesti
onAnswer ingsyst
emst hatacceptinputinEngl
i
shandpr ov
ide
answersal soinEngl i
sh.Thi
spr obl
em ishardert
hanthepreviousoneasi ti
smor edif
ficul
tto
specif
yt heproblem properl
y.Anotherareaofdif
fi
cul
tyconcernsdecidingwhethert
heanswer
obtai
nedi scorrect,ornot,andf ur
therwhati smeantby‘correct
’.Forexampl
e,considerthe
fol
lowingsituat
ion:

2.
1Text

Rani
wentshoppi
ngforanewCoat.Shef
oundar edonesher eal
l
yli
ked.Whenshegot
home,shef
oundthati
twentper
fect
lywi
thherf
av our
it
edress.

2.
2Quest
ion

1.
Whatdi
dRani
goshoppi
ngf
or?
2.
WhatdidRanifi
ndthatshel
i
ked?
3.
DidRanibuyanyt
hing?

2.
3Dat
aSt
ruct
ures

Asetoft emplatesthatmat
chcommonquest i
onsandpr oducepatter
nsusedtomat ch
agai
nstinputs.Templ atesandpatter
nsareusedsot hatat emplat
et hatmatchesagi ven
quest
ionisassociatedwi t
hthecorr
espondingpat
terntofindtheanswerintheinputtext
.For
example,t
het emplatewhodi dxygenerat
esxyzi famat choccursandzi stheanswertothe
quest
ion.Thegiventextandthequesti
onarebothstor
edasst r
ings.

2.
4Al
gor
it
hm

Answer
ingaquest
ionr
equi
rest
hef
oll
owi
ngf
ourst
epst
obef
oll
owed:

 Comparethet
emplateagai
nstthequest
ionsandst
oreal
lsuccessf
ulmat
ches
topr
oduceasetoftextpat
ter
ns.

 Passtheset
extpatt
ernst
hroughasubsti
tuti
onprocesstochanget
heper
son
orvoi
ceandproduceanexpandedsetoftextpat
terns.

 Applyeachofthesepat
ter
nst
othet
ext
;col
l
ectal
ltheanswer
sandt
hen
pr
inttheanswers.

2.
5Exampl
e

Inquestion1weuset hetemplat
eWHATDI DXYwhichgener
atesRanigoshoppi
ngforzand
aftersubsti
tut
ionwegetRanigoesshoppi
ngf
orzandRaniwentshoppi
ngforzgi
vingz
[equival
ence]anewcoat

I
nquestion2weneedav erylar
genumberoftempl
atesandalsoaschemetoall
owthe
i
nsert
ionof‘f
ind’befor
e‘t
hatsheli
ked’
;t
heinser
ti
onof‘r
eal
ly’
inthetext
;andt
hesubst
it
uti
on
of‘
she’for‘
Rani’
givestheanswer‘
aredone’.

Quest
ion3cannotbeanswer
ed.

2.
6Comment
s

Thi
sisaver
ypri
mit
iveapproachbasical
lynotmatchingthecri
t er
iawesetfor
i
ntel
l
igenceandworset
hanthat,usedinthegame.Surpri
singl
ythi
st ypeoftechni
que
wasactual
lyusedi
nELI
ZAwhi chwillbeconsi
deredlat
erinthecourse.
Met
hod2
2.
7Dat
aSt
ruct
ures

Astructurecal
ledEnglishconsi st
sofadi cti
onary,gr
ammarandsomesemant i
csabout
thevocabularywear elikel
yt ocomeacr oss.Thi sdatastructur
epr ovi
destheknowl edget o
convertEngli
shtextintoast orableinternalform andal sotoconv erttheresponsebackint o
Engli
sh.Thest r
uctur
edr epr
esentationoft het extisaprocessedf orm anddefinesthecontext
oftheinputtextbymaki ngexpl i
citallreferencessuchaspr onouns.Therearet hr
eetypesof
suchknowledger epr
esentat
ionsy stems:pr oductionrul
esoft heform‘ i
fxtheny ’
,sl
otandfil
ler
syst
emsandst atementsinmat hemat i
callogic.Thesy st
em usedher ewi l
lbetheslotandfil
ler
syst
em.

Take,
forexampl
esent
ence:

Shefoundar
edonesher
eal
lyl
iked’
.

Event2 Event2
i
nst ance: fi
nding i
nst ance: li
ki
ng
tense: past tense: past
agent : Rani modi fi
er: much
object: Thing1 object: Thi
ng1

Thi
ng1
i
nstance: coat
col
our: red

Thequest
ioni
sst
oredi
ntwof
orms:
asi
nputandi
ntheabov
efor
m.

2.
8Al
gor
it
hm

 Convertthequest i
ont oastructur
edf orm usi
ngEnglishknow how,t henusea
markert oindi
catethesubstr
ing(li
ke‘who’or‘what’
)ofthestr
ucture,thatshould
bereturnedasananswer .Ifaslotandf i
ll
ersyst
em isusedaspecialmar kercan
beplacedi nmorethanonesl ot.
 Theanswerappear sbymat chingthi
sst r
uctur
edform agai
nstthestructur
edt ext
.
 Thestructuredformismat chedagainstthetextandtherequestedsegment sof
thequestionareretur
ned.

2.
9Exampl
es

Bot
hquestions1and2generat
eanswersviaanewcoatandaredcoatrespect
ivel
y.
Quest
ion3cannotbeanswered,
becausether
eisnodi
rectr
esponse.

2.
10Comment
s

Thisappr
oachi
smor emeani
ngfult
hantheprev
iousoneandsoismoreef f
ect
ive.The
ext
rapowergi
venmustbepai
dforbyaddi
ti
onal
searchti
meintheknowl
edgebases.Awarning
mustbegi
venher
e:thati
s–t ogenerat
eunambiguousEngl
i
shknowledgebaseisacomplex
t
askandmustbelef
tunti
llat
eri
nt hecour
se.Theprobl
emsofhandl
i
ngpr onounsar
edif
fi
cult
.

Forexample:
Raniwal
kedupt
othesal
esper
son:sheaskedwheret
hetoydepart
mentwas.
Raniwal
kedupt
othesal
esper
son:sheaskedheri
fsheneededanyhel
p.

Whereasi
nt heorigi
nalt
extthel
i
nkageof‘she’
to‘
Rani’i
seasy,l
i
nkageof‘ she’i
neachoft
he
abovesentencest oRaniandtothesalesper
sonrequi
resaddit
ionalknowledgeaboutt
he
cont
extvi
at hepeoplei
nashop.

Met
hod3

2.
11Dat
aSt
ruct
ures

World modelcontai
ns knowledge aboutobject
s,act i
ons and si t
uat
ions thatare
descr
ibedintheinputt
ext
.Thisstr
uctureisusedtocr
eateintegrat
edt extf
rom inputt
ext.The
di
agram showshowt hesy
stem’sknowledgeofshoppi
ngmi ghtberepresentedandstored.Thi
s
i
nformati
onisknownasascr i
ptandinthiscasei
sashoppingscript
.(Seef i
gure1.1nextpage)

1.
8.2.
12Al
gor
it
hm

Conver
tt hequesti
ont o astructured for
m usi ng boththeknowl edgecont ained i
n
Method2andt heWor l
dmodel ,generat
ingev enmor epossibl
estruct
ures,sinceev enmor e
knowledgei
sbeingused.Sometimesf i
l
tersareintroducedtoprunethepossibleanswer s.
Toansweraquestion,
theschemef oll
owedi s:Convertt
hequesti
ontoast ructuredform
asbeforebutuset heworldmodeltor esolveanyambi gui
ti
esthatmayoccur .Thest ructur
ed
for
mi smatchedagainstt
hetextandther equestedsegment softhequest
ionar eret
urned.

2.
13Exampl
e

Bothquestions1and2generateanswer s,asi ntheprevi


ousprogr
am.Quest i
on3can
now beanswer ed.Theshoppingscr
iptisinstantiatedandf rom t
helastsentencethepath
thr
oughstep14i stheoneusedtoformt herepr esentati
on.‘
M’isboundtot heredcoat-
got
home.‘Ranibuysar edcoat
’comesfrom step10andt heint
egrat
edtextgenerat
esthatshe
boughtaredcoat.

2.
14Comment
s
Thi
spr ogr
am i smor epowerfulthanboththepreviousprogramsbecausei thasmor e
knowledge.Thus,likethelastgamepr ogram i
tisexpl
oit
ingAItechniques.Howev er,wearenot
yetinaposi t
iont ohandl eanyEngl ishquesti
on.Themaj oromi ssioni sthatofagener al
reasoningmechanism knownasi nf
erencetobeusedwhent herequiredansweri snotexpl
ici
tly
givenintheinputtext.Butthi
sapproachcanhandl e,wi
thsomemodi ficat
ions,quest
ionsofthe
foll
owingform withtheanswer —SaturdaymorningRaniwentshopping.Herbr othertr
iedtocall
herbutshedi dnotanswer .

Quest
ion:Whycoul
dn’
tRani

sbr
otherr
eachher
?
Answer
:Becauseshewasnoti
n.

Thi
sanswerisderiv
edbecausewehavesuppliedanaddit
ionalf
actt
hataper
soncannot
beintwopl acesatonce.Thi
spatchisnotsuf
fici
entlygener
alsoast oworki
nallcasesand
doesnotprovidet
hetypeofsol
uti
onwearereal
lylookingfor
.
LEVELOFTHEAIMODEL

Whati
sourgoal
int
ryi
ngt
opr
oducepr
ogr
amst
hatdot
hei
ntel
l
igentt
hingst
hatpeopl
edo?

Arewet r
yingt
opr
oducepr
ogr
amsthatdothet
asksthesamewaythatpeopl
edo?
OR
Arewet r
yingt
opr
oducepr
ogr
amsthatsi
mplydothetaskst
heeasi
estway
t
hati
spossi
ble?

Pr ogr
amsi nthef i
rstcl
assat t
emptt osolveproblemst hatacomput ercaneasi l
ysolve
anddonotusual lyuseAIt echniques.AItechni
quesusual l
yincludeasear ch,asnodi r
ect
met hodi savail
able,
theuseofknowl edgeaboutt heobjectsinvolv
edi nt
hepr oblem areaand
abstractiononwhi challowsanel ementofpr uni
ngt ooccur,andt oenableasol uti
ontobe
foundinr ealt
ime;otherwise,t
hedat acouldexplodeinsize.Exampl esoftheset r
ivi
alprobl
ems
i
nt hefirstclass,whi
char enowofi nt
erestonlyt
opsy chologistsareEPAM ( Elementary
PerceiverandMemor i
zer)whichmemor i
zedgarbagesy ll
ables.

Thesecondclassofpr obl
emsat
tempt
stosol
vepr
oblemsthatar
enon-t
riv
ial
foracomput
er
anduseAItechniques.Wewisht
omodelhumanperf
ormanceonthese:

1.Tot estpsy chologicaltheoriesofhumanper f


or mance.Ex.PARRY[ Col
by,
1975]–apr ogram tosi mulatet heconversationalbehaviorofapar anoi
d
person.
2.Toenabl ecomput erstounder standhumanr easoning–f orexampl e,
progr amst hatanswerquest ionsbaseduponnewspaperar t
icles
i
ndi cati
nghumanbehav i
or.
3.Toenabl epeopl etounder standcomput erreasoning.Somepeopl eare
rel
uct anttoacceptcomput err esult
sunl esst heyunderstandt hemechani sms
i
nv olvedinar ri
vingatther esul ts.
4.Toexpl oittheknowl edgegai nedbypeopl ewhoar ebestatgat heri
ng
i
nfor mation.Thi spersuadedt heear l
ierwor kerstosimulat ehumanbehav ior
i
nt heSBpar tofAISBsi mulat edbehav ior.Exampl esofthist ypeofapproach
l
edt oGPS( GeneralProblem Sol ver
).

Cr
it
eri
aforSuccess(
Tur
ingTest
)
In1950,AlanTuri
ngpr oposedt hemethodfordet
ermini
ngwhetheramachi
necanthi
nk.Hi
s
met hodhassi
ncebecomeknownast he“Tur
ingTest”
.Toconductt
hist
est
,weneedt
wopeopl
e
andt hemachi
netobeev al
uated.Tur
ingTest
providesadefi
nit
ionofi ntel
li
genceinamachi ne
and comparesthe int
ell
igentbehaviorofhuman
beingwitht
hatofacomput er.

OnepersonApl ay
st herol
eoft heint
errogat
or,who
i
si nasepar at
eroom f r
om t hecomput erandthe
otherperson.The i nt
err
ogat orcan ask setof
quest
ionstoboththecomput erZandper sonXby
ty
pingquesti
onsandr ecei
vingt ypedresponses.Thei
nter
rogat
orknowst
hem onl
yasZandX
andaimstodeterminewhot heper sonisandwhot hemachinei
s.
Thegoal
ofmachi
nei
stof
ool
thei
nter
rogat
ori
ntobel
i
evi
ngt
hati
tist
heper
son.I
fthemachi
ne

succeedsweconcl
udethatt
hemachi
necant
hink.Themachi
nei
sal
l
owedt
odowhat
everi
tcan
dotofoolt
heint
err
ogat
or.

Forexample,
ifaskedthequesti
on“Howmuchis12,324t
imes73,
981?”The
machinecoul
dwai tsever
alminut
esandt
henrespondwit
hwronganswer.

Theinterr
ogatorrecei
vestwosetsofr esponses,butdoesnotknow whichsetcomesf rom
humanandwhi chfr
om computer
.Aftercarefulexaminat
ionofr
esponses,
ifi
nter
rogat
orcannot
def
ini
telyt
ellwhichsethascomefrom thecomput erandwhichf
rom human,hent
t hecomputer
haspassedt
heTur
ingTest
.Themor
eser
iousi
ssuei
stheamountofknowl
edget
hatamachi
ne
woul
dneedt
opasst
heTur
ingt
est
.

Over
viewofAr
ti
fi
cialI
ntel
li
gence
I
twastheabi
l
ityofelect
roni
cmachi nestostor
elargeamountsofi
nformat
ionandpr
ocessi
tat
v
eryhi
ghspeedst hatgaver esear
chersthevisi
onofbuildi
ngsystemswhichcoul
demulate
(
imi
tat
e)somehumanabi li
ti
es.

Wewi l
lseet
heint
roduct
ionoft
hesyst
emswhichequalorexceedhumanabil
it
iesandseet
hem
becauseanimpor
tantpartofmostbusi
nessandgovernmentoperat
ionsaswellasourdai
l
y
acti
vi
ti
es.

Defi
nit
ionofAI:Arti
fi
cialInt
ell
igenceisabr anchofcomputerscienceconcernedwit
ht hest
udy
andcreati
onofcomput ersyst
emst hatexhibi
tsomeform ofi
ntelli
gencesuchassy st
emst hat
l
earnnewconcept sandt asks,systemst hatcanunder
standanat urall
anguageorpercei
veand
comprehendav isualscene,orsy stemst hatperf
orm ot
hertypesoff eatsthatr
equirehuman
ty
pesofintel
l
igence.

Tounder
standAI
,weshoul
dunder
stand
 I
ntel
l
igence
 Knowl
edge
 Reasoni
ng
 Thought
 Cogni
ti
on:
gai
ningknowl
edgebyt
houghtorper
cept
ionl
ear
ning
Thedefi
nit
ionsofAIv
aryal
ongt
womai
ndi
mensi
ons:
thoughtpr
ocessandr
easoni
ngand
behav
ior
.

AIisnotthestudyandcreat
ionofconvent
ionalcomput
ersystems.Thestudyofthemi nd,the
body,andthelanguagesascust
omari
lyfoundinthefi
eldsofpsychol
ogy
,physi
ology,cognit
ive
sci
ence,orli
ngui
sti
cs.

I
nAI
,thegoal
ist
odev
elopwor
kingcomput
ersy
stemst
hatar
etr
ulycapabl
eofper
for
mingt
asks
t
hatr
equi
rehi
ghl
evel
sofi
ntel
l
igence.
MODULE-
1

2.Pr
obl
ems,
Probl
em SpacesandSear
ch

Pr
obl
em:
Aprobl
em,
whichcanbecausedfordi
ffer
entreasons,
and,
ifsol
vabl
e,canusual
l
ybe
sol
vedi
nanumberofdi
ff
erentways,i
sdefinedinanumberofdi
ffer
entways.

Tobui
l
dasy
stem ort
osol
veapar
ti
cul
arpr
obl
em weneedt
odof
ourt
hings.
1.Def
inetheprobl
em pr
ecisel
y.Thisdef
ini
ti
onmusti ncl
udepreci
sespecifi
cati
onofwhat
t
heini
ti
alsi
tuati
onwil
lbeaswel laswhatfi
nalsi
tuat
ionsconst
it
uteacceptabl
esol
uti
ons
tot
heprobl
em
2.Anal
yzet
hepr
obl
em
3.I
sol
ateandr
epr
esentt
het
askknowl
edget
hati
snecessar
ytosol
vet
hepr
obl
em
4.Chooset
hebestsol
vi
ngt
echni
queandappl
yitt
othepar
ti
cul
arpr
obl
em.

Def
ini
ngt
hePr
obl
em asaSt
ateSpaceSear
ch
Pr
obl
em sol
vi
ng=Sear
chi
ngf
oragoalst
ate

Iti
sast r
uctur
edmethodforsolvi
nganunst r
uctur
edproblem.Thi
sapproachconsist
sofnumber
ofstates.Thestar
ti
ngoft heproblem is“Ini
ti
alStat
e”oft heprobl
em.Thel astpoi
ntinthe
probl
em iscal
leda“Goal
State”or“Fi
nalStat
e”oftheproblem.

Stat
espacei
sasetoflegalposi
ti
ons,star
ti
ngatthei
nit
ialstat
e,usi
ngt
heset
ofrul
estomovef
rom onestatetoanotherandat
tempti
ngt oendupinagoal
st
ate.

Met
hodol
ogyofSt
ateSpaceAppr
oach
1.Tor
epr
esentapr
obl
em i
nst
ruct
uredf
orm usi
ngdi
ff
erentst
ates
2.I
dent
if
ythei
nit
ial
stat
e
3.I
dent
if
ythegoal
stat
e
4.Det
ermi
net
heoper
atorf
ort
hechangi
ngst
ate
5.Repr
esentt
heknowl
edgepr
esenti
nthepr
obl
em i
naconv
eni
entf
orm
6.St
artf
rom t
hei
nit
ial
stat
eandsear
chapat
htogoal
stat
e

Tobui
l
dapr
ogr
am t
hatcoul
d“Pl
ayChess”
 wehav
etof
ir
stspeci
fyt
hest
art
ingposi
ti
onoft
hechess
boar
dEachposi
ti
oncanbedescr
ibedbyan8-
by-
8
ar
ray
.Ini
ti
alposi
ti
oni
sthegameopeni
ngposi
ti
on.
MODULE-
1

 r
ulest
hatdef
inet
hel
egal
mov
es
Legal
mov
escanbedescr
ibedbyasetofr
ules:
 Lef
tsi
desar
emat
chedagai
nstt
hecur
rentst
ate.
 Ri
ghtsi
desdescr
ibet
henewr
esul
ti
ngst
ate.
 boardposi
ti
onsthatr epresentawinf oronesideortheother
Goalposi
tionisanyposi t
ioninwhi chtheopponentdoesnothav
eal egalmov
e
andhisorherkingi sunderattack.
 Wemustmakeexpl ici
tthepr eci
ouslyimplici
tgoal
ofnotonlyplay
ingalegalgameof
chessbutal
sowi nningthegame, i
fpossible.

Pr
oduct
ionSy
stem
Theent i
reprocedur
ef orget
ti
ngasolut
ionf
orAIprobl
em canbeviewedas“Product
ionSyst
em”.
I
tprovidesthedesiredgoal.I
tisabasi
cbuil
dingbl
ockwhichdescri
bestheAIprobl
em andalso
descr
ibesthemet hodofsearchingt
hegoal
.It
smaincomponentsare:
 ASetofRules,eachconsi
sti
ngofal eftsi
de(
apatt
ern)t
hatdet
erminest
heappl
icabi
li
ty
oftheruleandr i
ghtsidethatdescri
bestheoper
ati
ontobeper f
ormediftheruleis
appl
ied.
 KnowledgeBase–Itcontainswhat
everi
nfor
mationisappr
opriat
ef orapar
ti
culart
ask.
Somepar t
softhedatabasemaybepermanent,whil
ethepart
sofi tmaypert
ainonl
yto
thesol
uti
onofthecur
rentprobl
em.
 ControlSt
rat
egy– Itspecifi
est heorderi
nwhichtherul
eswil
lbecompar edt
othe
databaseandthewayofr esolv
ingtheconf
li
ctst
hatar
isewhensev
eralr
ulesmat
chat
one.
o Thefi
rstr
equir
ementofagoalcontr
olst
rat
egyist
hati
tiscausemot
ion;
acont
rol
st
rat
egythatdoesnotcausemoti
onwill
neverl
eadtoasolut
ion.
o Thesecondr
equi
rementofagoodcont
rol
str
ategyi
sthati
tshoul
dbesy
stemat
ic.
 Ar
uleappl
i
er:
Product
ionr
ulei
sli
kebel f
owi(
condi
ti
on)t
henconsequenceoract
ion

Al
gor
it
hm f
orPr
oduct
ionSy
stem:
1.Repr
esentt
hei
nit
ial
stat
eoft
hepr
obl
em
2.I
fthepr
esentst
atei
sthegoal
stat
ethengot
ost
ep5el
segot
ost
ep3
3.Chooseoneoft
her
ulest
hatsat
isf
ythepr
esentst
ate,
appl
yitandchanget
hest
atet
o
newstat
e.
4.Got
oSt
ep2
5.Pr
int“
Goal
isr
eached”andi
ndi
cat
ethesear
chpat
hfr
om i
nit
ial
stat
etogoal
stat
e6.
St
op
Cont
rolSt
rat
egi
es
Br
eadth-fi
rstsearch
ASear chstrategy,
inwhichthehi
ghestl
ayerofadecisi
ontr
eei
ssear
chedcompl
etel
ybef
ore
proceedingtot henextl
ayeri
scal
ledBreadt
h-f
ir
stsearch(
BFS)
.
•Inthi
sstrategy,
noviabl
esolut
ionsar
eomit
tedandtheref
oreiti
sguar
ant
eedt
hatan
opti
malsolutioni
sfound.
•Thisstr
ategyisoft
ennotfeasi
blewhent
hesearchspaceislar
ge.

Al
gor
it
hm
1.Createav ari
ablecall
edLISTandseti ttobethestart
ingstat
e.
2.Loopunt ilagoal stat
eisfoundorLI STi sempty,Do
a.Remov ethefirstel
ementf r
om theLI STandcall i
tE.I
ftheLISTisempt
y,qui
t.
b.Forev erypatheachr ulecanmat cht hestat
eE, Do
(i
)Appl yther ul
et ogenerat
eanewst at e.
(i
i
)Ifthenewst ateisagoalstate,
qui tandretur
nt hi
sstate.
(i
i
i)Ot herwise,addt henewst at
etot heendofLI ST.
Adv
ant
ages
1.
Guar
ant
eedt
ofi
ndanopt
imal
sol
uti
on(
int
ermsofshor
testnumberof
st
epst
oreacht
hegoal
).
2.
Canal
way
sfi
ndagoal
nodei
foneexi
sts(
compl
ete)
.
Di
sadv
ant
ages
1.Hi
ghst
orager
equi
rement
:exponent
ialwi
tht
reedept
h.

Depth-
fi
rstsearch
Asearchstr
ategyt
hatextendst
hecurrentpat
hasfaraspossibl
ebeforebacktr
ackingt
othel
ast
choi
cepointandtr
yingt
henextalt
ernati
vepathi
scal
ledDepth-f
ir
stsearch(DFS).
•Thi
sstrategydoesnotguarant
eethatt
heoptimalsol
uti
onhasbeenfound.
•I
nthisstrategy
,searchr
eachesasati
sfact
orysol
uti
onmorerapi
dlyt
hanbreadt
hfi
rst
,
anadvantagewhent hesear
chspaceislar
ge.

Al
gori
thm
Depth-
fi
rstsear
chappl
i
esoper
ator
stoeachnewl
ygener
atedst
ate,
try
ingt
odr
ivedi
rect
lyt
owar
dthe
goal
.
1.
Ifthestart
ingst at
eisagoal stat
e,quitandr etur nsuccess.
2.
Otherwise,dot hefoll
owinguntil
successorf ailurei
ssignal
led:
a.
GenerateasuccessorEt othestarti
ngst ate.Iftherearenomor esuccessor
s,t
hensi
gnal
fai
l
ure.
b.
CallDepth-fi
rstSearchwithEast hestartingst ate.
c.
Ifsuccessisr etur
nedsignalsuccess;otherwise, conti
nueintheloop.
Adv
ant
ages
1.
Lowstor
agerequi
rement:l
inearwit
htreedept
h.
2.
Easi
l
yprogr
ammed: funct
ioncallst
ackdoesmostoft
hewor
kofmai
ntai
ningst
ateof
t
hesear
ch.
Di
sadv
ant
ages
1.
Mayf i
ndasub-opti
malsol
uti
on(
onethati
sdeeperormorecost
lyt
hanthebestsol
uti
on)
.
2.
Incomplet
e:wi
thoutadept
hbound,
maynotfindasolut
ionev
enifoneexi
sts.
MODULE-
1

Heur
isti
csear ch
Tof i
ndasol uti
oninpr opert i
mer atherthanacompl etesoluti
oninunlimitedti
meweuse
heuri
stics.‘
Aheuristi
cf unctionisaf uncti
ont hatmapsfrom probl
em st atedescri
pti
onsto
measur esofdesirabil
i
ty,usual l
yrepresentedasnumber s’.Heuri
sticsearchmet hodsuse
knowledgeaboutt hepr oblem domai nandchoosepr omisingoperator
sf i
rst
.These
heuri
sticsearchmet hodsuseheur i
st i
cfunctionstoeval
uat et
henextst atetowardsthe
goalstate.Forfi
ndingasol uti
on,byusingt heheuri
stict
echnique,oneshoul dcarryoutt
he
fol
lowingsteps:
1.
Adddomain—speci
fi
cinfor
mat i
ontoselectwhatisthebestpatht
oconti
nuesear
chi
ngal
ong.
2.
Def
ineaheuri
sti
cfunct
ionh(n)thatest
imatesthe‘goodness’
ofanoden.
Speci
fi
cal
l
y,h(
n)=est
imat
edcost
(ordi
stance)ofmi
nimal
costpat
hfr
om n t
oagoal
stat
e.
3.Theter
m, heuri
sticmeans‘ser
vingt
oai
ddiscov
ery
’andisanestimate,
basedon
domainspecifi
cinformat
ionthati
scomput
ablefr
om thecur
rentst
atedescr
ipt
ionof
howclosewear etoagoal .
Fi
ndingar outefr
om onecit
ytoanot
herci
tyi
sanexampleofasear
chproblem i
n
whichdif
ferentsear
chordersandt
heuseofheur
ist
icknowl
edgear
eeasil
y
underst
ood.
1.
Stat
e:Thecurrentcit
yinwhichthetravell
eri
slocated.
2.
Operat
ors:Roadslinki
ngthecurrentcit
ytootherci
ties.
3.
CostMetri
c:Thecostoft aki
ngagi venroadbetweenci t
ies.
4.
Heuri
sti
cinfor
mat i
on:Thesearchcoul dbeguidedbyt hedir
ect
ionoft
hegoalcit
yfr
om the
curr
entcit
y,orwecoul duseair
li
nedi st
anceasanest imateoft
hedist
ancet
ot hegoal
.

Cl
assi
fi
cat
ionofPr
oduct
ionSy
stem:
Basedont
hedi
rect
iont
heycanbe
1.For
war
dPr
oduct
ionSy
stem
 Mov
ingf
rom I
nit
ial
Stat
etoGoal
Stat
e
 Whent
herear
enumberofgoalst
atesandonl
yonei
nit
ial
stat
e,i
tis
adv
ant
agetousef
orwar
dproducti
onsystem.
2.Backwar
dPr
oduct
ionSy
stem
 Mov
ingf
rom Goal
Stat
etoI
nit
ial
Stat
e
 I
ftherei
sonlyonegoal
stateandmanyi
nit
ial
stat
es,
iti
sadv
ant
aget
ouse
backwar
dproducti
onsyst
em.

Pr
oduct
ionSy
stem Char
act
eri
sti
cs
Product
ionsyst
em i
sagoodwayt odescr
ibet
heoper
ationst
hatcanbeper
for
medi
nasear
ch
forsol
uti
onofthepr
oblem.
Twoquestionswemightreasonabl
yaskatthi
spoi
ntare:
 Canpr
oduct
ionsy
stems,
li
kepr
obl
ems,
bedescr
ibedbyasetofchar
act
eri
sti
cs
t
hatshedsomel
i
ghtonhowt
heycaneasi
l
ybei
mpl
ement
ed?
 I
fso,
whatr
elat
ionshi
psar
ether
ebet
weenpr
obl
em t
ypesandt
het
ypesof
pr
oduct
ionsy
stemsbestsui
tedt
osol
vi
ngt
hepr
obl
ems?

Theanswerforthef
ir
stquest
ioncanbeconsi
der
edwi
tht
hef
oll ngdef
owi ini
ti
onsofcl
assesof
product
ionsy
stems:
1.Amonot onicproduct
ionsystem isaproducti
onsy stem i
nwhichtheappl
i
cat
ionsofarul
e
neverprev
entsthelaterappli
cat
ionofanotherrul
et hatcoul
dalsohav
ebeenappli
edatt
he
ti
met hefi
rstr
ulewasselected.

2.Anon-
monot
oni
cpr
oduct
ionsy
stem i
sonewhi
cht
hisi
snott
rue.

3.Aparti
all
ycommut at
iveproduct
ionsyst
em isaproduct
ionsy
stem wit
ht heproper
tythati
f
theappli
cati
onofapar ti
cul
arsequenceofrul
estransf
ormsstat
eXi ntostat
eY,t henany
permutat
ionoft
hoserulesthati
sall
owableal
sotr
ansfor
msstateXint
ostateY.

4.A commutat
ivepr
oducti
onsy
stem i
sapr
oduct
ionsy
stem t
hati
sbot
hmonot
oni
cand
par
tial
l
ycommutat
ive.

Inaformalsense,ther
ei snorelat
ionshipbetweenkindsofproblemsandkindsofpr oducti
onof
syst
ems,si nceal
lproblemscanbesol vedbyal lki
ndsofsystems.Butinpract
icalsense,there
defi
nit
elyissuchar elati
onshipbetweenki ndsofpr obl
emsandt hekindsofsy st
emst hatled
themselvesnatur
all
ytodescribi
ngt hoseproblems.
MODULE-
1

Thefol
lowingf
igur
eshowst hefourcat
egori
esofproducti
onsyst
emspr oducedbyt hetwo
di
chot
omies,monotoni
cv er
susnon-monotoni
candparti
all
ycommut at
ivever
susnon-parti
all
y
commutati
veal
ongwithsomepr obl
emsthatcanbenat
ural
lybesol
vedbyeachtypeofsystem.

Monot
oni
c Non-
monot
oni
c

Par
ti
all
ycommut
ati
ve Theor
em pr
ovi
ng RobotNav
igat
ion

Chemi cal
NotPar
ti
all
ycommut
ati
ve Br
idge
Synthesis
Thef
ourcat
egor
iesofPr oduct
ionSy
stems

 Partial
lycommut ati
ve,monot oni
cpr oducti
onsystemsareusef ulforsolvi
ngignorabl
e
problemst hatinvol
vescr eati
ngnew t hingsrathert
hanchangi ngoldonesgener al
l
y
i
gnor able.Theorem pr ovi
ng is one example ofsuch a cr eati
ve process par
tial
l
y
commut at
ive,monotonicproducti
onsy st
em areimport
antforani mplementati
onstand
pointbecauset heycanbei mplementedwi t
houttheabil
i
tyt obackt r
ackt oprevi
ous
stateswheni ti
sdiscoveredthatanincorr
ectpathhasbeenfol
lowed.

 Non-monot onic,par
ti
all
ycommut at
iveproductionsystemsareusef ulforpr
oblemsin
whichchangesoccurbutcanber ever
sedandi nwhichorderofoper at
ionsi
snotcr i
ti
cal
.
Thisisusual l
ythecaseinphysi
calmanipulati
onproblemssuchas“ Robotnav i
gati
onon
aflatplane”.The8-puzzl
eandblockswor l
dpr obl
em canbeconsi deredparti
all
y
commut at
iveproducti
onsyst
emsar esignif
icantfr
om ani mplement at
ionpointofvi
ew
becauset heytendtoreadtoomuchdupl i
cationofindivi
dualstat
esdur ingt
hesearch
process.

 Pr
oduct
ionsyst
emsthatarenotpar
ti
all
ycommutati
veareusef
ulf
ormanypr
obl
emsi
n
whi
chchangesoccur
.Forexample“
Chemical
Synthesi
s”

 Non-
part
ial
lycommut
ati
veproduct
ionsy
stem l
essl
i
kel
ytopr
oducet
hesamenodemany
t
imesinthesear
chpr
ocess.

Pr
obl
em Char
act
eri
sti
cs
Inordert
ochoosethemostappropr
iat
emethod(oracombinati
onofmet
hods)f
orapar
ti
cul
ar
probl
em,iti
snecessar
ytoanal
yzetheprobl
em al
ongsev
eralkeydi
mensi
ons:
• I
sthepr
obl
em decomposabl
e?
• Cansol
uti
onst
epsbei
gnor
edorundone?
• I
stheuni
ver
sepr
edi
ctabl
e?
• I
sagoodsol
uti
onabsol
uteorr
elat
ive?
• I
sthesol
uti
onast
ateorapat
h?
MODULE-
1

• Whati
sther
oleofknowl
edge?
• Doest
het
askr
equi
rehuman-
int
eract
ion?
• Pr
obl
em Cl
assi
fi
cat
ion

I
sthepr
obl
em decomposabl
e?
Decomposabl
epr oblem can besol
ved easi
l
y.Suppose wewantt
o sol
vet
he pr
obl
em of
comput
ingtheexpressi
on.

Wecansol
vethi
spr
oblem bybreaki
ngitdownintothesesmal l
erprobl
ems,eachofwhichwe
cant
hensol
vebyusi
ngasmal lcoll
ecti
onofspecif
icrulesthefol
lowingfigur
eshowsprobl
em
tr
eet
hatasi
tcanbeexpl
oit
edbyasi mpler
ecur
siveint
egr at
ionpr
ogram thatworksasf
oll
ows.

Ateachstepitcheckstoseewhet hertheproblem i
tisworki
ngonisimmedi at
elysolvable.I
fso,
thent
heansweri sretur
neddi
rectl
y .I
ftheproblem i
snoteasil
ysolv
able,
theint
egr at
orchecksto
seewhetheritcandecomposet hepr obl
em intosmall
erprobl
ems.Itcancreat
et hosepr obl
ems
andcall
sitsel
frecursi
vel
yonusingt hist
echniqueofprobl
em decompositi
onwecanof tensolv
e
veryl
argeprobl
em easily
.

Cansol
uti
onst
epsbei
gnor
edorundone?
Supposewearetryi
ngt oproveamat
hematicaltheor
em.Weproceedbyfir
stpr
ovingalemma
thatwethinkwi
llbeusef ul
.Alemmathathasbeenpr ov
edcanbei gnor
edfornextst
epsas
event
uall
ywereal
izethelemmaisnohel
patall.

Nowconsi
dert
he8-
puzzl
egame.Asampl
egameusi
ngt
he8-
puzzl
eisshownbel
ow:
MODULE-
1

I
nat t
empt i
ngtosol v
ethe8puzzl e,wemi ghtmakeast upidmoveforexampl
e;wesli
dethetil
e5
i
nt oanempt yspace.Weact ual
lywantt osli
detheti
le6i nt
oemptyspacebutwecanbackt rack
andundot hefirstmove,sli
dingtil
e5backt owhereitwast henwecanknowt il
e6somi stake
andstil
lrecoveredfrom butnotqui taseasyasi nthetheorem movingpr
oblem.Anadditi
onal
stepmustbeper f
ormedtoundoeachi ncor
rectst
ep.

Nowconsi
derthepr
oblem ofpl
ayi
ngchess.Supposeachesspl
ayi
ngpr obl
em makesast
upi
d
moveandr
eali
zeacoupleofmoveslat
er.Buther
esol
uti
onsst
epscannotbeundone.

Theabovet
hreeprobl
emsill
ust
rat
ediff
erencebet
weenthr
eei
mpor
tantcl
assesofpr
obl
ems:
1)I
gnor
able:
inwhichsol
uti
onstepscanbeignor
ed.
Exampl
e:Theor
em Pr
ovi
ng
2)Recov
erabl
e:i
nwhi
chsol
uti
onst
epscanbeundone.
Exampl
e:8-
Puzzl
e
3)I
rrecov
erable: i
n whi
ch sol
uti
on st
eps cannot be undone.
Example:Chess

Therecoverabi
l
ityofaproblem playsanimportantr
olei
ndet
ermi
ningt
hecompl
exi
tyoft
he
cont
rolst
ructur
enecessar
yforproblem sol
uti
on.

Ignorableproblems canbesol v ed usi


ng asi mpl
econt rolst r
uctur
et hatneverbacktr
acks.
Recov erabl
e probl
ems can be sol ved by sli
ghtl
y compl i
cated contr
olstrat
egy thatdoes
somet imes make mi stakes using backtr
acking.Irr
ecoverabl
e problems can be solv
ed by
recoverablest
ylemethodsv i
apl anningthatexpandsagr eatdealofeffor
tmakingeachdecisi
on
sincethedecisi
onisfinal.

I
stheuni
ver
sepr
edi
ctabl
e?
Therearecer
tai
noutcomesev er
yti
mewemakeamov ewewil
lknowwhatexact
lyhappen.Thi
s
meansi ti
spossi
bletoplanenti
resequenceofmov
esandbeconfi
dentt
hatweknowwhatt he
resul
ti
ngstat
ewill
be.Exampleis8-Puzzl
e.
I
ntheuncertai
nprobl
ems,thi
spl
anningpr
ocessmaynotbepossi
ble.Exampl
e:Bri
dgeGame–
Pl
ayingBri
dge.Wecannotknowexactl
ywher
eallt
hecar
dsareorwhattheotherpl
ayer
swil
ldo
onthei
rtur
ns.

Wecandof ai
rl
ywel
lsincewehaveavai
l
ableaccurateest
imat
esofapr
obabi
l
iti
esofeachof
t
hepossi
bleout
comes.Afewexampl
esofsuchproblemsare
 Contr
oll
i
ngar obotar
m:Theout comeisuncer
tai
nforavar
iet
yofreasons.Someone
mightmovesomethi
ngint
othepathoft
hearm.Thegear
soft
hearm mightst
ick.
 Helpi
ngal awy
erdeci
dehow t
odef endhiscli
entagai
nstamurderchar
ge.Her
ewe
probabl
ycannoteven l
i
stal
lthe possi
ble out
comes,whi
ch l
eads out
come t
o be
uncert
ain.

 Forcer
tai
n-out
comeprobl
ems,pl
anni
ngcanusedt
ogener
ateasequenceofoper
ator
sthat
i
sguarant
eedtoleadt
oasolut
ion.
 Foruncert
ain-
out
comepr
obl
ems,asequenceofgener
atedoper
ator
scanonl
yhav
eagood
probabi
li
tyofl
eadi
ngt
oasol
uti
on.
 Pl
anr
evi
sioni
smadeast
hepl
ani
scar
ri
edoutandt
henecessar
yfeedbacki
spr
ovi
ded.

I
saGoodSol
uti
onAbsol
uteorRel
ati
ve?
Consi
dert
hepr
obl
em ofanswer
ingquest
ionsbasedonadat
abaseofsi
mpl
efact
s,suchast
he
fol
l
owing:
1)Mar
cuswasaman.
2)Mar
cuswasaPompei
an.
3)Mar
cuswasbor
nin40A.
D.
4)Al
lmenar
emor
tal
.
5)Al
lPompei
an’
sdi
edwhent
hev
olcanoer
upt
edi
n79A.
D.
6)Nomor
tal
li
vesl
ongert
han150y
ear
s.7)I
tisnow1991A.
D.
Supposeweaskaquestion“I
sMar cusal
i
ve?”Byrepr
esenti
ngeachofthesef
act
sinaformal
l
anguagesuchaspredi
catel
ogic,andt
henusi
ngformali
nferencemet
hodswecanfai
rl
yeasi
ly
der
iveananswert
othequest
ion.
Si
ncewear ei
nter
est
edintheanswertothequest
ion, i
tdoesnotmatt
erwhi
chpathwefoll
ow.I
f
wedofoll
owonepathsuccessf
ull
ytotheanswer,thereisnoreasont
ogobackandseeifsome
ot
herpathmightalsol
eadt oasol ut
ion.Theset ypesofpr obl
emsarecal
l
edas“ Anypath
Pr
oblems”.

NowconsidertheTr
avel
li
ngSal
esmanPr
obl
em.Ourgoali
stof
indt
heshor
testpat
hrout
ethat
vi
sit
seachcit
yexact
lyonce
Supposewef i
ndapat hitmaynotbeasol uti
ontotheprobl
em.Weal sotryall
otherpat
hs.The
short
estpath(bestpath)iscal
ledasasolut
iontotheprobl
em.Theset y
pesofpr obl
emsare
knownas“ Bestpath”problems.Butpat
hproblemsarecomputat
ionall
yharderthananypat
h
probl
ems.

I
sthesol
uti
onast
ateorapat
h?
Consi
dert
hepr
obl
em off
indi
ngaconsi
stenti
nter
pret
ati
onf
ort
hesent
ence
Thebankpresidentat
eadi shofpastasaladwit
hthef
ork
Ther
eareseveral
component softhissentence,eachofwhi
chmayhav emoret
hanone
i
nter
pret
ati
on.Someoft hesourcesofambi guit
yinthi
ssentencearet
hefol
l
owi
ng:
 Theword“Bank”mayref
ereit
hert
oaf
inancedi
nst
it
uti
onort
oasi
deofr
iver
.Butonl
y
oneoft
hesemayhav eaPresi
dent
.
 Thewor
d“di
sh”i
stheobj
ectoft
hewor
d“eat
”.I
tispossi
blet
hatadi
shwaseat
en.
 Buti
tismor
eli
kel
ythatt
hepast
asal
adi
nthedi
shwaseat
en.
Becauseofthei nteract i
onamongt heint
erpr et
ati
onsoft heconsti
tuentsoft hesentencesome
searchmayber equiredt ofindacompl et
ei nter
pret
erforthesentence.Butt osol
vet heprobl
em
offindi
ngthei nterpr
et ati
onweneedt opr oduceonlyt heint
erpret
ationitsel
f.Nor ecordofthe
processi
ngbywhi cht heinterpr
etat
ionwasf oundisnecessary
.Butwi ththe“water-
jug”probl
em
i
tisnotsuffi
cientt orepor tt
hefinalst
atewehav etoshowt he“path”also.
Sothesolut
ionofnatur
all
anguageunder
standingpr
obl
em i
sast
ateoft
hewor
ld.Andt
he
sol
uti
onof“Waterj
ug”pr
obl
em i
sapathtoastate.

Whati
sther
oleofknowl
edge?
Considertheprobl
em ofpl
ayi
ngchess.Theknowledger
equir
edfort
hispr
obl
em i
sther
ulesfor
determini
nglegalmoveandsomesi mplecontr
olmechanism t
hati
mplement
sanappropri
ate
searchprocedure.
Now consi
dertheproblem ofscanni
ngdailynewspaper
st odecidewhi
char esuppor
ti
ng‘
n’
par
tyandwhicharesupport
ing‘
y’part
y.Fort
hispr
oblemsarerequi
redl
otofknowl
edge.

Theabovetwoproblemsill
ust
rat
et hediffer
encebetweentheprobl
emsf orwhichalotof
knowl
edgei
simportantonl
ytoconstr
ainthesearchf
orasoluti
onandthoseforwhichal
otof
knowl
edgei
srequi
redeventobeabletorecogni
zeasolut
ion.

Doesat
askr
equi
rei
nter
act
ionwi
tht
heper
son?
Supposet hatwear etr
yingt oprovesomenewv er
ydi f
fi
cul
ttheor
em.Wemi ghtdemandapr ove
thatfol
lowst radit
ionalpatternssot hatmathemati
cianeachreadtheprov
eandcheckt omake
sureitiscor rect.Alter
nat i
vel
y ,f
indi
ngaproofofthet heor
em mightbesuffi
cientl
ydi
ffi
cultt
hat
theprogr am doesnotknowwher etostart
.Atthemomentpeopl earestil
lbet t
eratdoingthe
highestlev elstrat
egiesr equiredforaproof.Sothatthecomputermightli
ket obeablet oask
foradvice.
ForExampl
e:
• Soli
tar
yprobl
em,inwhichther
eisnointer
medi
atecommuni
cat
ionandnodemandf
oran
expl
anati
onofthereasoni
ngprocess.
• Conver
sat
ionalprobl
em,in whi
ch i
nter
mediate communi
cati
on i
sto prov
ide ei
ther
addi
ti
onal
assist
ancetot
hecomputeroraddi
ti
onalinf
ormat
iont
otheuser
.

Pr
obl
em Cl
assi
fi
cat
ion
Whenact ualproblemsareexami nedfrom thepointofv i
ew allofthesequestionsitbecomes
apparentthatthereareseveralbroadclassesint
owhi chthepr obl
em fall
.Thecl assescanbe
eachassoci at
edwi t
hagener i
ccont r
olstrat
egyt hati sapproachedf orsol
vingt heproblem.
Thereisav ar
ietyofproblem-sol
v i
ngmet hods,butt hereisnoonesi nglewayofsol v
ingall
probl
ems.Notal lnew problemsshoul dbeconsi deredast otall
ynew.Sol utionsofsi mil
ar
probl
emscanbeexpl oi
ted.

CHARACTERI
STI
CSOFPRODUCTI
ONSYSTEMS
Producti
onsystemspr
ov i
deuswithgoodway
sofdescr
ibi
ngt
heoper
ati
onst
hatcan
beperformedinasear
chf orasol
uti
ontoapr
obl
em.
Atthi
st i
me,twoquest
ionsmayarise:
1.Canpr oduct
ionsystemsbedescr i
bedbyasetofcharact
eri
sti
cs?Andhow
cantheybeeasi l
yimplemented?
2.Whatr el
ati
onshipsaretherebet
weenthepr
oblem ty
pesandt hety
pesof
producti
onsy st
emswel lsuit
edforsol
vi
ngt
heproblems?
Toanswert
hesequest
ions,
fir
stconsi
dert
hef
oll
owi
ngdef
ini
ti
onsofcl
assesof
pr
oducti
onsyst
ems:
1.Amonot oni
cpr oductionsy stem i sapr oductionsy stem inwhi cht he
applicationofar ulenev erpr eventsthel aterapplicationofanot herr ul
ethat
couldal sohav ebeenappl iedatt het i
met hef ir
str ulewassel ect ed.
2.Anon- monotonicpr oductionsy stem i
sonei nwhi cht hi
sisnott rue.
3.Apar tial
lycommuni cativepr oduct i
onsy stem isapr oductionsy stem wit
h
thepr opertythatiftheappl i
cationofapar ti
cularsequenceofr ules
transformsst atePi ntost ateQ, t
henanycombi nationoft hoser ulesthati
s
allowablealsot ransformsst atePi ntostateQ.
4.Acommut ati
v eproduct i
onsy stem isapr oductionsy st
em t hatisbot h
monot onicandpar ti
allycommut ati
ve.

Isthereanyr elati
onshi pbet weencl assesofpr oducti
onsy stemsandcl assesof
problems?Foranysol vablepr obl
ems, thereexistani nfini
tenumberofpr oductionsy stems
thatshowhowt ofi
ndsol uti
ons.Anypr obl em thatcanbesol v
edbyanypr oductionsy stem can
besol vedbyacommut ati
veone, butthecommut ati
v eonei spractical
lyuseless.I tmayuse
i
ndividual st
atest orepresentent i
r esequencesofappl icati
onsofr ulesofasi mpl er,non-
commut ativ
esy st
em.I nthef ormal sense, thereisnor elati
onshipbet weenkindsofpr oblems
andki ndsofpr oductionsy stemsSi nceal lproblemscanbesol vedbyal l
kindsofsy st ems.But
i
nt hepr acti
cal sense,thereisdef init
elysuchar elat
ionshipbetweent hekindsofpr obl emsand
thekindsofsy stemst hatlendt hemsel v estodescr i
bingt hoseprobl ems.

Parti
allycommut ative,monot oni
cpr oducti
onssy stemsar eusefulforsol
v ingi
gnorable
problems.Thesear ei mpor t
antfrom ani mplement ati
onpoi ntofviewwi t
houtt heabil
ityt
o
backtracktopr eviousst ateswheni tisdiscoveredt hatanincorrectpathhasbeenf ollowed.
Botht ypesofpar ti
al l
ycommut ati
vepr oducti
onsy stemsar esignifi
cantfrom an
i
mpl ement ati
onpoi nt;
theytendt oleadt omanydupl i
cationsofindivi
dual stat
esduringthe
searchpr ocess.Pr oductionsy st
emst hatarenotpar ti
all
ycommut ati
veareusef ulf
ormany
problemsi nwhi chper manentchangesoccur .

I
ssuesi
ntheDesi
gnofSear
chPr
ogr
ams

Eachsear chprocesscanbeconsi deredtobeat r


eetraversal
.Theobjectofthesearchi
st o
fi
ndapat hfrom theini
ti
alstat
etoagoal stat
eusingatree.Thenumberofnodesgener ated
mightbehuge; andinpracti
cemanyoft henodeswoul dnotbeneeded.Thesecr etofagood
searchrout i
neistogenerateonlyt
hosenodest hatar
el i
kelytobeuseful
,rat
herthanhavi
nga
precisetree.Ther ul
esareusedtorepresentt
hetreei
mpl i
citl
yandonlytocreatenodes
expli
citl
yiftheyar eact
uall
ytobeofuse.

Thef
oll
owi
ngi
ssuesar
isewhensear
chi
ng:
•Thetreecanbesear chedfor
war dfrom t hei
nit
ialnodetothegoal st
at eor
backwardsfrom thegoalst
atetot heinit
ialst
ate.
•Toselectapplicabl
erul
es,i
tiscriti
caltohaveanef fi
cientpr
oceduref ormatchi
ng
rul
esagainststates.
•Howt orepresenteachnodeoft hesear chprocess?Thisistheknowledge
repr
esentat
ionpr obl
em ort
hef r
amepr oblem.Ingames, anarraysuff
ices;i
nother
pr
obl
ems,
mor
ecompl
exdat
ast
ruct
uresar
eneeded.

Fi
nallyi
ntermsofdatastructures,
consi
deri
ngt
hewaterj
ugasat ypi
calpr
oblem doweusea
graphortr
ee?Thebreadth-fi
rststr
uct
uredoest
akenoteofal
lnodesgener
atedbutthedept
h-
fi
rstonecanbemodified.

Checkdupl
icat
enodes

1.
Observeallnodest hatar
ealr
eadygenerated,i
fanewnodei spresent
.
2.
Ifi
tdoesnotexi stsaddittot
hegraph.
3.
Ifi
talr
eadyexists,then
a.Sett
henodet hati
sbeingexpandedtot hepointt
othealr
eadyexi
sti
ng
nodecorrespondingtoit
ssuccessorratherthantothenewone.Thenew
onecanbet hrownaway.

b.I
fthebestorshortestpathisbeingdet
ermined,
checktoseei
fthi
spat
h
i
sbetterorworsethant heoldone.Ifwor
se,donothi
ng.

Bett
ersavethenewpat
handwor
kthechangei
nlengt
hthr
ought
hechai
nofsuccessor
nodesifnecessar
y.

Exampl
e:Ti
c-Tac-
Toe

Stat
espacesaregoodr epr
esent
ati
onsf orboardgamessuchasTic-
Tac-
Toe.Theposi
tionof
agamecanbeexpl ai
nedbyt hecontent
soft heboar
dandtheplay
erwhoseturni
snext.The
boardcanberepr
esentedasanar r
ayof9cel ls,
eachofwhi
chmaycontai
nanXorOorbe
empty .
•State:
 Pl
ayert
omov enext:
XorO.
 Boar
dconf
igurat
ion:

•Operators:Changeanemptycel
ltoXorO.
•Star
tSt ate:Boar
dempty;
X’stur
n.
•TerminalSt at
es:Thr
eeX’
sinarow;Thr
eeO’si
nar
ow;
All
cel
l
sful
l
.

Sear
chTr
ee

Thesequenceofstat
esf
ormedbypossi
blemov
esi edasear
scal
l cht
ree.Eachl
evel
oft
he
tr
eeiscal
ledaply.

Si
ncethesamestat
emayber eachabl
ebydi
ff
erentsequencesofmov es,
thest
atespace
mayingener
albeagraph.I
tmaybet r
eat
edasatreeforsimpli
cit
y,att
hecostofdupl
icat
ing
st
ates.
Sol
vi
ngpr
obl
emsusi
ngsear
ch
•Gi
venaninformal descri
ptionoft hepr oblem, constructaf
ormaldescri
pti
onasast
atespace:
 Defineadat astructuretor epresentt hest ate.
 Makear epresentat
ionf orthei nit
ialstatef r
om thegi
vendata.
 Wr i
teprogramst orepresentoper at
orst hatchangeagivenstat
e
r
epresentat
iont oanewst ater epresentation.
 Wr i
teapr ogram todet ecttermi nalstates.

•Chooseanappropriatesearchtechni
que:
 Howl argeisthesear chspace?
 Howwel l
structuredisthedomain?
 Whatknowl edgeaboutt hedomaincanbeusedt
ogui
det
hesear
ch?

PROBLEMS

Wat
er-
JugPr
obl
em
Probl
em i s“Youaregiventwo jugs,a4- l
i
treoneand a3-l
i
treone.Oneneitherhasany
measur i
ngmarker
soni t
.Ther
ei sapumpt hatcanbeusedt
ofi
llt
hejugswit
hwat er
.Howcan
yougetexactl
y2li
tresofwat
erinto4-
li
tr
ejug?”
Solut
ion:
Thest atespacefortheproblem canbedescr i
bedasasetofst at
es,wher
eeachstate
repr
esent
sthenumberofgal
lonsineachst
ate.Thegamest
artwi
tht
hei
nit
ialst
atedescr
ibed
asasetoforder
edpai
rsofi
nteger
s:
• St
ate:
(x,
y)
– x=numberofl
tsi
n4l
tsj
ug
– y=numberofl
tsi
n3l
tsj
ug
x=0,
1,2,
3,or4 y=0,
1,2,
3
• St
artst
ate:
(0,
0)i
.e.
,4-
li
tr
eand3-
li
tr
ejugsi
sempt
yini
ti
all
y.
• Goalst
ate:
(2,n)foranynthati
s4-l
it
rej
ughas2l
i
tresofwat
erand3-
li
tr
ejughasany
val
uefr
om 0-3sinceiti
snotspeci
fi
ed.
• At
tempt
ingt
oendupi
nagoal
stat
e.

Producti
onRules:Theser
ulesareusedasoperat
orstosol
vetheproblem.Theyarerepr
esent
ed
asruleswhoseleftsi
desareusedtodescr
ibenewstatet
hatr
esultfr
om approachi
ngtherul
e.
Thesol
uti
ont
othewat
er-
jugpr
obl
em i
s:
ChessPr
obl
em
Probl
em ofpl
ayi
ngchesscanbedefinedasaprobl
em ofmov
ingar
oundi
nast
atespacewher
e
eachstat
erepr
esent
salegalposi
ti
onofthechessboar
d.

Thegamest ar
twi thaninit
ialstatedescribedasan8x8ofeachposi t
ioncontainssymbol
standingfortheappropr
iat
epl aceintheof
ficial
chessopeni
ngposi
ti
on.Asetofrul
esisusedt o
mov ef r
om onestatetoanotherandat t
emptingtoendupononeofasetoffinal
stateswhichis
descri
bedasanyboar dpositi
oni nwhichtheopponentdoesnothavealegalmov eashis/her
ki
ngi sunderattacks.

Thestat
espacerepresent
ationisnat
uralf
orchess.Si
nceeachst
atecor
respondst
oaboar
d
posi
ti
oni.
e.ar
ti
fi
cial
wellorgani
zed.

I
nit
ial
Stat
e:Legal
chessopeni
ngposi
ti
on
Goal
Stat
e:Opponentdoesnothav
eanyl
egal
mov
e/ki
ngunderat
tack

Product
ionRules:
Theserulesareusedt
omov ear
oundt
hest
atespace.Theycanbedescr
ibedeasi
l
yasasetof
rul
esconsist
ingoftwopar
ts:
1.Lef
tsi
deser
vesasapat
ter
ntobemat
chi
ngagai
nstt
hecur
rentboar
dposi
ti
on.
2.Ri
ghtsi
det
hatser
vesdeci
dest
hechesst
obemadet
otheboar
dposi
ti
ont
oref
lectt
he
move.
Todescr
ibet
heser
ulesi
tisconv
eni
entt
oint
roduceanot
ati
onf
orpat
ter
nandsubst
it
uti
ons
E.
g.:
1. Whi
tepawnatsquar
e(f
il
e1,
rank2)
Movepawnfrom squar
e(f
il
ei,
rank2)ANDsquare(
fil
ei,rank2)AND
Squar
e(f
il
ei,
rank3)i
sempty Tosquar
e(fil
ei,
rank4)AND
Squar
e(f
il
ei,
rank4)i
sempt
y

2. Whi
tekni
ghtatsquar
e(fi
lei
,r
ank1)
mov
eSquare(1,
1)to Squar
e(i
-1,
3)
AND
Empt
ySquar
e(i
-1,
3)
3. Whi
tekni
ghtatsquar
e(1,
1)
mov
eSquare(1,
1)to Squar
e(i
-1,
3)
AND
Empt
ySquar
e(i
-1,
3)

8-
Puzzl
ePr
obl
em
TheProblem is8-Puzzl
eisasquaret
rayinwhi
ch8squar eti
lesarepl
aced.Theremaini
ng9th
squar
eisuncov er
ed.Eachti
lehasanumberoni
t.Afi
lethatisadj
acentt
otheblankspacecan
besli
deintothatspace.Thegoali
stotr
ansf
ormthestar
tingposi
ti
onint
ot hegoalposi
ti
onby
sl
idi
ngthetil
esaround.
Sol
uti
on:m
St
ateSpace:Thest
atespacef
orthepr
obl
em canbewr
it
tenasasetofst
ateswher
eeachst
ate
i
sposit
ionofthet
il
esonthetr
ay.

I
nit
ial
Stat
e:Squar
etr
ayhav
ing3x3cel
l
sand8t
il
esnumberoni
tthatar
eshuf
fl
ed

2 8 3

1 6 4

7 5
Goal
Stat
e

1 2 3

8 4

7 6 5
Product i
onRul
es:Theser ul
esar
eusedtomovef
rom i
nit
ialst
atetogoalst
ate.Thesear
ealso
definedastwopar t
sl ef
tsidepat
ter
nshoul
dmatchwi
thcur r
entposi
ti
onandl ef
tsidewil
lbe
resulti
ngposi
ti
onafterapplyi
ngt
herul
e.

1.Ti
l
einsquar
e(1,
1)
AND Mov
eti
l
efr
om squar
e(1,
1)t
o(2,
1)
Empt
ysquar
e(2,
1)

2.Ti
l
einsquar
e(1,
1)
AND Mov
eti
l
efr
om squar
e(1,
1)t
o(1,
2) Empt
y
squar
e(1,
2)

3.Ti
l
einsquar
e(2,
1)
AND Mov
eti
l
efr
om squar
e(2,
1)t
o(1,
1)
Empt
ysquar
e(1,
1)
1,
1 1,
2 1,
3
2 3 2
2,
1 2,
2 2,
3
3 4 3
3,
1 3,
2 3,
3
2 3 2

No.ofPr
oduct
ionRul
es:2+3+2+3+4+3+2+3+2=24

Sol
uti
on:

Tr
avel
li
ngSal
esmanPr
obl
em
TheProblem isthesalesmanhasalistofci
ties,
eachofwhichhemustv i
sitexact
lyonce.Ther
e
aredir
ectr oadsbetweeneachpai rofciti
esont heli
st.Fi
ndt her out
ethesal esmanshould
fol
lowfortheshortestpossi
bler
oundt r
ipt
hatbothstat
esandfinishesatanyoneoft hecit
ies.

Soluti
on:
StateSpace:Thestat
espacef orthi
sprobl
em representsst
atesinwhichthecitiest
raversedby
salesmanandstatedescri
bedassal esmanstart
ingatanycityi
nthegivenlistofcit
ies.Asetof
rulesisappl
iedsuchthatthesalesmanwillnottraver
seacitytr
aversedonce.Theser ul
esare
result
edtobest at
eswi t
ht hesalesmanwillcomplext her
oundt r
ipandr eturntohisst ar
ti
ng
positi
on.

I
nit
ial
Stat
e
 Sal
esmanst
art
ingatanyar
bit
rar
yci
tyi
nthegi
venl
i
stof
ci
ti
esGoal
Stat
e
 Vi
sit
ingal
lci
ti
esonceandonl
yandr
eachi
nghi
sst
art
ingst
ate

Pr
oduct
ionr
ules:
Theser
ulesar
eusedasoperat
orst
omovefr
om onestat
et oanot
her.Si
ncether
ei sapat
h
bet
weenanypai
rofci
ti
esi
ntheci
tyl
i
st,
wewr
it
ethepr
oducti
onrul
esforthi
spr
oblem as
• Vi
sit
ed(
cit
y[i
])ANDNotVi
sit
ed(
cit
y[j
])
– Tr
aver
se(
cit
y[i
],
ci
ty[
j]
)
• Vi
sit
ed(
cit
y[i
],
ci
ty[
j]
)ANDNotVi
sit
ed(
cit
y[k]
)
– Tr
aver
se(
cit
y[j
],
ci
ty[
k])
• Vi
sit
ed(
cit
y[j
],
ci
ty[
i]
)ANDNotVi
sit
ed(
cit
y[k]
)
– Tr
aver
se(
cit
y[i
],
ci
ty[
k])
• Vi
sit
ed(
cit
y[i
],
ci
ty[
j]
,
cit
y[k]
)ANDNotVi
sit
ed(
Nil
)
– Tr
aver
se(
cit
y[k]
,
cit
y[i
])

Tower
sofHanoiPr
obl
em
Probl
em isthestatespaceforthepr obl
em canbedescr ibedaseachst aterepr
esent
ing
posit
ionoft
hediskoneachpolethepositi
oncanbetreat
edasast ackthelengt
hofthestack
wil
lbeequalt
omaximum numberofdiskseachpostcanhandle.Thei
nit
ialst
ateoft
heprobl
em
wil
lbeanyoneofthepost
swil
lthecert
ainthenumberofdisksandtheothert
wowi l
lbeempty.

I
nit
ial
Stat
e:
 Ful
l(
T1) | Empt
y(T2) |
Empt
y(T3)GoalSt
ate:
 Empt
y(T1)|
Ful
l
(T2)|
Empt
y
(
T3)

Pr
oduct
ionRul
es:
Thesear
erul
esusedt
oreacht
heGoal
Stat
e.Theser
ulesuset
hef
oll
owi
ngoper
ati
ons:
 POP(
x) Remov
etopel
ementxf
rom t
hest
ackandupdat
etop
 PUSH(x,
y) Pushanel
ementxi
ntot
hest
ackandupdat
etop.[
Pushanel
ementxont
o
they
]
Nowt
osol
vet
hepr
obl
em t
hepr
oduct
ionr
ulescanbedescr
ibedasf
oll
ows:
1.Top(
T1)
<Top(
T2) PUSH(
POP(
T1)
,T2)
2.Top(T2)<Top(T1) PUSH(POP(T2)
,T1)
3.Top(
T1)<Top(T3) PUSH(POP(T1),
T3)
4.Top(
T3)
<Top(
T1) PUSH(
POP(
T3)
,T1)
5.Top(
T2)
<Top(
T3) PUSH(
POP(
T2)
,T3)
6.Top(
T3)
<Top(
T2) PUSH(
POP(
T3)
,T2)
7.Empt
y(T1) PUSH(
POP(
T2)
,T1)
8.Empt
y(T1) PUSH(
POP(
T3)
,T1)
9.Empt
y(T2) PUSH(
POP(
T1)
,T3)
10.Empt
y(T3) PUSH(
POP(
T1)
,T3)
11.Empt
y(T2) PUSH(
POP(
T3)
,T2)
12.Empt
y(T3) PUSH(
POP(
T2)
,T3)
Sol
uti
on:
Exampl
e:3Di
sks,
3Tower
s
1)T1 T2
2)T1 T3
3)T2 T3
4)T1 T2
5)T3 T1
6)T3 T2
7)T1 T2

MonkeyandBananasPr
obl
em
Problem:Ahungrymonkeyf indshimselfi
nar oom inwhichabranchofbananasishangi
ng
from theceil
i
ng.Themonkeyunf ortunat
elycannotreachthebananashoweveri
ntheroom
ther
ear ealsoachairandast i
ck.Theceil
ingisjustri
ghthi
ghsot hatamonkeyst
andingona
chaircouldknockthebananasdownwi t
ht hest
ick.Themonkeyknowshowt omov eround,
carr
yothert
hingsaroundreachf
orthebananasandwavet
hest
icki
ntheai
r.Whati
sthebest
sequenceofacti
onsforthemonkeytoacqui
relunch?

Sol
uti
on:Thestat
espacef orthispr
oblem i
sasetofst atesr
epresent
ingt
heposi
ti
onoft
he
monkey,posi
ti
onofchai
r,positi
onofthesti
ckandt woflagswhethermonkeyont
hechai
r&
whet
hermonkeyholdst
hest i
cksothereisa5-t
upl
erepr
esentat
ion.
(
M,C,
S,F1,
F2)
– M:
posi
ti
onoft
hemonkey
– C:
posi
ti
onoft
hechai
r
– S:
posi
ti
onoft
hest
ick
– F1:
0or1dependsont
hemonkeyont
hechai
rornot
– F2:
0or1dependsont
hemonkeyhol
dingt
hest
ickornot

I
nit
ial
Stat
e(M,
C,S,
0,0)
•Theobject
sareatdi
ff
erentpl
acesandobv
iousl
ymonkeyi
snotont
hechai
randnot
hol
dingthest
ick
Goal
Stat
e(G,
G,G,
1,1)
•Gist
heposi t
ionunderbananasandal
lobj
ect
sar
eunderi
t,monkeyi
sont
hechai
rand
hol
dingst
ick
Producti
onRules:
Thesearetheruleswhichhaveapathf
orsear
chi
ngt hegoalst
atehereweassumethatwhen
monkeyhol d a sti
ck then i
twi
llswi
ng i
tthis assumpti
on i
s necessar
yto si
mpli
fythe
repr
esentat
ion.
Someoft
heproduct
ionrulesare:
1)(M,C,
S,
0,0) (A,
C,S,0,
0) {Anar
bit
rar
yposi
ti
onA}

2)(
M,C,
S,
0,
0) (
C,C,
S,
0,
0) {
monkeymov
est
ochai
rposi
ti
on}

3)(
M,C,
S,
0,
0) (
S,S,
S,
0,
0) {
monkeybr
ingschai
rtost
ickposi
ti
on}

4)(
C,C,
S,
0,
0) (
A,A,
S,
0,
0) {
pusht
hechai
rtoar
bit
rar
yposi
ti
onA}

5)(
S,C,
S,
0,
0) (
A,C,
A,0,
1) {
Taki
ngt
hest
ickt
oar
bit
rar
yposi
ti
on}

6)(
S,C,
S,
0,
0) (
C,C,
S,
0,
0) {
monkeymov
esf
rom st
ickposi
ti
ont
ochai
r

posi
ti
on}7)(
C,C,
C,0,
1) (
C,C,
C,1,
1)

• {
monkeyandst
ickatt
hechai
rposi
ti
on,
monkeyont
hechai
randhol
dingst
ick}8)
(
S,C,
S,
0,
1) (
C,C,
C,0,
1)

Sol
uti
on:
1)(
M,C,
S,
0,
0)
2)(
C,C,
S,
0,
0)
3)(
G,G,
S,
0,
0)
4)(
S,G,
S,
0,
0)
5)(
G,G,
G,0,
0)
6)(
G,G,
G,0,
1)
7)(
G,G,
G,1,
1)

Mi
ssi
onar
iesandCanni
bal
sPr
obl
em
Problem i
s3mi ssionar
iesand3canni bal
sf i
ndt hemsel
vesonesi deoft heri
ver
.Theyhav e
agreedthattheywoul dl
iketogettheotherside.Butthemissi
onari
esarenotsurewhatelsethe
cannibal
shav eagr eedto.Sot hemissi
onari
eswantt omanagethetr
ipacrosstheri
veroneit
her
si
deoft heriverisnev erlessthanthenumberofcanni bal
swhoar eont hesameside.Theonly
boatav ai
lable holds onl ytwo people ata t i
me.How can ev eryone getacross wit
hout
missionar
iesriskinghangeager ?

Sol
uti
on:
Thestat
espacef
ortheprobl
em cont
ainsasetofst
ateswhi
chrepresentthepresentnumberof
canni
bal
sandmissi
onar
iesontheeit
hersi
deofthebankoftheri
ver.(C,
M,C1,M1,B)
– CandM ar
enumberofcanni
bal
sandmi
ssi
onar
iesont
hest
art
ingbank
– C1andM1ar
enumberofcanni
bal
sandmi
ssi
onar
iesont
hedest
inat
ionbank
– Bi
stheposi
ti
onoft
heboatwi
therl
eftbank(
L)orr
ightbank(
R)

I
nit
ial
Stat
e C=3,
M=3,
B=Lso(
3,3,
0,
0,
L)Goal
St
ate C1=3,
M1=3,
B=Rso(
0,0,
3,
3,
R)

Product
ionSy st
em:Thesearetheoper
ationsusedtomov efr
om onestatetoot
herst
ate.Si
nce
atanybankt henumberofcannibal
smustl essthanorequalt
omi ssi
onari
eswecanwr i
tetwo
product
ionr
ul esfort
hispr
obl
em asfol
lows:
• (C,M,C1,M1,L/C=3,M=3) (C-
2,M,C1+2,
M1,R)
• (
C,M,
C1,
M1,
L/C=3,
M=3) (
C-1,
M-1,
C1+1,
M1+1,
R)
• (
C,M,
C1,
M1,
L/C=3,
M=3) (
C-1,
M,C1+1,
M1,
R)
• (
C,M,
C1,
M1,
R/C=1,
M=3) (
C+1,
M,C1-
1,M1,
L)
• (
C,M,
C1,
M1,
R/C=0,
M=3,
C1=3,
M1=0) (
C+1,
M,C1-
1,M1,
L)

Thesol
uti
onpat
his

LEFTBANK RI
GHTBANK
C M BOATPOSI
TION C1 M1
3 3 0 0

1 3  2 0

2 3  1 0

0 3  3 0

1 3  2 0

1 1  2 2

2 2  1 1

2 0  1 3

3 0  0 3

1 0  2 3

2 0  1 3

0 0  3 3

You might also like