24,419 15,283 88MB
Pages 572 Page size 409.5 x 528.75 pts Year 2011
Vice Prc:oi~pb:tn IN rok of learning as wmchng lhe ruch of the ck!itptr 1010 unknown mnronmmb. and •e show hovo' that role consnainti 11en1 dot&n. (a,'Oring t~plic:it ~;;no\\ I· cdet rtpre\.C:ntation and reasoning.. We treat robocks and' •~tOn not t i mdepenck:nlly defined probktn,. btlt aJ. OC'~dse 'll fds. 8«-JtUSC this rul~ out mos• ol ~~~pll~ic$, t i "'~the imC'I'Ic.ion. tot~ ~c.ivism w~ ~popuiJt iQ son~ .:in:k$.
Sc~.•itlg reprogrammed. The Advice Taker thus embodied the centr..\1 principles of knowledge represcntatiOft Olnd ~soni ng : th:at it is useful 10 have a fonnal. explicit n:pn."$Ciltation of the world and its workings and to be able to manipulate that rtpresem:uion with deductive pi'OC~~$. It is retMitkable how much of 1he 19S8 paper n::mai1l$ relcv:~m t od~y. 1958 also marl:t..' d the year thm M:m•in Minsky moved to MIT. His initial collabor.uioo wi1h McCanh)' did n01last. hov.-c:\'ct. McC:~tthy S-lressed rtprcscntation a11d teaSning in for· mal logic. wht.'fCa.;; Minsky wn.~ more interested in getting progr.uns to work and eventually developed a.n anti·logic Quilook. In 1963. McCanhy S~:atted 1he AI lab a1 Stanford. His l)lan to use logic to build the ultimate Advice Take r was ad\':UlCI..'d by J. A. Robinson's discovery in 1965 of the resolution mc1hod (a complete lheorem·proving algori1hm for fi rst"()rder logic: Sl"t Ch;1peer 9). Work at Stanford emphasizc.-d gcneml-purpose m.ethods for logical reasoning. Applications of logic included Cordell Green's question-answering and planning systems (Green. 1969b) and the Shakey robotics J)I'Ojcroorh-the ck.an separ:nion of the knowledge (in the fonn or nllt.'S) from the rea~oning C(lfnponem, With Ibis leswn in nti1td. Feittl'nb:wm :1nd oil~~ at Stanford began the l-leuriSliC: Pro· gr.tnuning I:Jroject (HI'I)) to inn~..litpte the cxtcm co which the new methodology or UJ~rt systems could be applied 10 other area" or human expcor1i~. n,e next naajOr effor1 was in the 3rea of mrdic.al dia&oosk Fd&cnl»um. 8~h:u1an. and Or. Edward Shortlitrc dc\·cloped MYCIN to di:a.gnose blood infeCtiON. With about 450 ruiC'~. MYCIN w;as able tO perform :\.'\, well a..o; some expem. and com.ldcr.abl y bener lh;~n JUfliot doctors. It also cootainctt '" o major differmcu from DE., ORAL.. F'tN, unhl.t the- DE., ORAl. Nks.. no gener.allbeoftucal modd existed from "hic-h tht M YC" Nk' could be~ "Tbe) h:ld 10 be xquitul from «.tensi\"C irwcnic•rfioJ o( op:ru.. "hom lutn il((flll~ them from kxtboob. odlc:r ~ and dift'ICI ~perimcc o( cases. S«ond. the Nlo hd &o rtftC'C11he UtKlC'fUin1y associaled v. nh mo:tlCOll J.:nooA·kdgc'. M YCIN ~ a C'aln dus of unttruinly called ttrtainly fadors (see Ch3pccf 14), v."hieh seemed (a11he lll'lW) to fil wC'II v.ith ho-•dociM assessed 1he impact of C'\'iden« on the diagnosis. The imponance ()( dom:un l-00\lo ttdcc \1, ~ al,oo tppat('nt in the area. of Uf'lder,q:me to scope out wh.:u could be done :uul to lcatn how I'ICural nets differ from "tmditional" techniques. Using improved methodolosy and thcoretit·;LI fr.un~.--works. the fi eld arrived m an unden;tanding in which neur:tl ners can now be compared with com:.sponding techniques from stali.slics, p:utem rccQ&nirion. and machine learning. and the mos.t promising ll"t'hnique C-an be a pplied to each applic-ation. t-\s a resuh of tlw.·~""C dl.-velopmt.'ltts. so-calle-d data mining lechnology hn.~ spawned a vigorous new industry. Jud~:-a Pearl's ( 1988) Pmlxd!ilislic Reas(millg in l mdligt•llt Systmrs led 10 a new at.-ceplance of prob.1bili1y nnd cloecision 1hoory in AI. following a resurgence of interest epitomi1.ed by Pe1c:r Q)C(scman's (1985) :utic le " In Defense of Probabilily." The B:"Q'C'Si:.tn network fomtalism wn..-. invented to aiiO\Vefficient rtprcse111a1ion of. and rigorous rcn..wning wilh. ut)C(rtain knowledge. This ai)J)t\l."'C.h largely oven--omes many problems of the prob."l.bilistic f'C3soning syst em.~ of !he 1960s and 1970s: it now dominates AI research on tmcenain reasonill!: a11d expen S)'$1Cms. The •l.Jll)ro;)Ch allows for learning from experience. and it combines the best of classical Al and neur.d nets. Wol'k by Judea Pe.vl ( 1982:\) and by Etic Hotvitz and David Hl"Ckcnn:ul (Horvilz and Hed;ennan. 1986: Horvilz et 11/.. 1986) promoted the i ~ of tttmrwri•-e cxr>en systems: ones that :'let rationally :u:cOfdin.g to the laws or decision tllCOI")' and do not try to imitate the thought stC"ps of human t.~xpc rts. The Windows1'M opc-r.tling S)'S· tem includes several nonnative diagnostic expert systems for rorn.--cting problems. Ol31>ters 13 to 16covc-nhisan:-:1. Similar gentle rc\'Oiutions have occurred in R.>botics, computer \•ision. and knowledge n:-presc-nt:uion. t-\ beuer wldel'$tanding of the problems and their complexity propc.·nie~"· com· bincd with i ncrea..~ mathem:uical sophistication, h:.s led to wori:-able rc$Carch agendas and robuSI methods. Although inc-rt:tSed fonn ::aliz.ation and SJX-eiali1'.:.tion k-d fields suc-h as vision and robotic.;; to become somewh:.t ii;olatod from "mainstream" AI in the 1990$. this trend has reversed in n.·tttH years as tools from moc-hine le:t.ming in particul:'lr have proved effcc1ivc for many problems. 1ne proeess of reinlt.-g.r.nion is already yielding signiflc-a.tl be.netits
1.3.9 The emergence ofinteUigent agents (1995-present) Per1taps encour.A.ged by the pR.>gress i11 soh•in_g the subpR.>blcms of AI. researthers have :llso started to look at the "'whole ttgt'nC problem again. 1'he work of Allen Newell. John L:tird. and P.,ul Rose,,bloom on SOAR (Newell. 1990: Laird t'l til.. 1987) is the best·known example of a complete agent arc-h it~"Cturr. One of lhe most impol1:ull i:nvirorunents for intelligent agents is the lntcmet. AI systems have become so common in Wl.'b--bascd applications that the ···bot"' suffix h."'S entered e'·ctyd~y langu~e. MOt\.-'~l\'Cr. AI u:clmolog.ies underlie many
27
The History of Aniliciallnlt."-Uige.nce
Lntemel IOOis. such as searc-h engines. recommender systems. and Web si1c ;aggreg:UOI"$.. One consequence of trying 10 build complete agents is the renli7...'ltion chal the previously isolated subfield$ of A I .night ocOOISI~p to l(anl
Chapter
28
I.
Introduction
Sc label new examples. s~nko ~nd Brill (2001) show that t(!('hniques like this pcrfonn C\ 'Cn better ns th.: nmount of available text ~s from a million words to a biHion and thou the increase in perfonnanee from using more d;ua exeanicular arc notorious for "sour g.rapes''-bdieving they did not n:ally want something (e.g.. a Nobel Pri::-.e) after not gening it. Obvio.asly,thcrc is 1'101 one fixed pctfonnance meMurc for all tas.ks and agems: lypically. a designer will devise one app-ropriale to the ci~um.•:t:tnre..ohex wMp. The female spi'ICX will dig:. buiTOw. go out and Sling a calt~rpi llur and drag it to the burrow. enter the burrow again to check all is well. dr.)_g the e:nerpillar inside. and lay its eggs. 11w: caterpiii.'Lt serves as a food source when the eggs hatch. So far so gOd. but if an entomologist mo"es the catt·rpillar a few ioc:hes away while 1he sphex is doing the check. it will te\'C11 co ti'IC ""drag"' step of its plan and will continue the plan witllOUt modification. e'•en after dozens of catcrpillar-mo"'ing intervention.«. The sphex is unable to lc:.rn 1h.at its innate plan is failing. and thus will not change it. To the t>:tent that ;ut ag~-nt relit'S on the prior knowk."dge of its designer mther than on its cw.•n pcreepc.s. we s.'ly thtll tl'le agent lacks autonomy. A m.tiona.l agt·nt should be autonomous-it should IC!lm wh.'lt it can to compensate for panial or incom.'"Ct prior knm •ledge. f« e,'(ample-. a vaeuurn-c leaning agent that leams 10 fore-S(~ where m•d wllC-n additional dirt will appear will do better th:ut one that doe.int out. before the reader beron'feS: :~lanr)('d. th:n a fully autom:ued taxi is currently somewhat beyond 1hc capabili1ics of existing technology. (page 28 describes an existing driving roboc.) Tin~ full dri,•ing_ task is eKtrtmely QPC'II~udt·d. 11.ere is no limit to the no\'cl combin:uions of cin:um..;tances thm can arise--another ~a..eiU' in Exercise 2.4. ll1nay conle as~ surprise to SOn\C read· ers thai our list of :.gent ty~s ineludcs some progrnm.OSS-iblc. In COIIIr.l.t>t. some sol"'wnrt SJel.'n lS (or software robot..« or sof1bots) c.xLt>t in rich. un limired domains. Imagine a soflbol Web site opcra10r designed 10 scan Interne• news sources :tnd show the interesting items to its users. while selling advenising space to gt'lte-mte re\·enue. To do well. that oper:ttor will nt."td some naturnl I:Uiguage pi'OCC$sing abilities. it will need 10 !c-am what each user and ndvc:l1iscr is interested in, :111d il will n!X'd t., change its plans dyn:unieally- fOr example. wf'K"n the cormec1ion for one news sou.rc:e gOC".s down or \vi'IC.n a new one comes online. Tb: lntcmcl is an environment whose complcxit)' rivals that of 1b: 1))1)'$iC-al world ~nd \vltOSe inhabitanls include many ~n ifi c-ial :u'ld human ns. For example, a ches s toum:llnCnt consists of ;1 s-.'qUCitC"e or g;une~.:;: e:K·h game is an epoi50de because (by and l;uge) the contribution or the mo,·e$ in one game to the :.gent's O\'t.•r.tll pcrfonnance is not affected by the moves in its prt"vious game. On the other hand, decision making within a single gmne is ce-nainly sequential. 'lllc code rt"pository associated with this book (aima.es.bcrkcley.cdu) includes implc· n'ft'ntations or a number of e1wironment:1. togethe-r with a ge.ncral-purpose environmenl simu· lator that pi~ one or more agenL;; in a simulat-."rtd:i" g then initimt>·lmlld11g.
I Iuman ~ "lso h:we many such connections. so•ne of which are lcuml"n :l!o Ihe S(NII. The rtftC'X agen.'s rules for when 10 lum .-nd when 10 go scrnight will work only (or a !lil\gle de, lin:tlion: 1hey mus.r all be repl.ooed 10 s,o somewhere new.
:1 M:t O( JOOh it j ,
'--
The Structurt of .t-\gents ptR."C"pb
~ -
,....,..._.., X """'
lnteltigenl Agents
~~
Go:th alone :ue noc enough co acnel'l*te hi,&h.;;lu:tlily behavior in mosc e•wirn,ments. For txample, many action ~quence.'l will JCI cht l;t.Xi to it" ~lin:uion (lhe~b)' x-hievin& the goal) buc son:~e an:: quicker. saftt. mott rclwble, or c:he-:.pcr thm others. Goals ju:u provide a cf'lllk bin:uy disainccion bc.-l\loi'«n "'h.1ppy" and '"unha.ppy.. ~;ues.. A men &'!nrntl pn(onn:anCC' mc-~utt &bould allow a C'OMpari:SOn o( dtfrnenl wOfld 'IJtcs :~«Ofding 10 exactly hov. happy the)• ,.ouJd nuke the arm~. B«;wse "tbpp) .. ~ not ~nd nry scientific. ccononusts and compster scientists use lbe kml utillly uNn& with It \lltlhy fu.nc:llo" !hat n.r:a:,(Uf't'!l il.s t)rtf~telkC'\ ani()I1.J ..-u.ttll of the ~orld. 1'htn it thoost:ll l~
OUironlt. (Appt'IKtit: A define$ expectation more prtti.!otl)'.) In C'haP'et" 16. w-e show that all)' DIJOI\IJ q,ml must bdm:c- as ijit posses.s;es a Ullht')' funn.on v.tlooo;e Upx1cd \ '.IIUC' 11 tries lO mannuu. An q.rnt tml possc:s.ses an aplie'it uhllt)' funn.on c.an mal.C" r.II.KliO.II drcuions V.tth a ~ntral·purpciiSC: ~dn tha doe$ ROC dC'pmd Oft the 'fU'Ifir UIIIIC)' funaiof'l being maxamllt'd. In thiS ·~y. the defuu110n ol ntiOft;lhl)~l.&f'llm& as mbomllhoscllft'l funneon:s th mic,ht t~l.e and concludes - some more expeditious mrthod 5ttms desirable.- Tk mdhod he ~ i( to t"uld ~.uning machines and then to text. ehem. In l'n3n)' ~ of AJ. thl,. i.), """' the pttfemd n~thod fc.w ClnliQg swe-of·tht--.an S)'S&tmS. ~ tw ~r ach'"NIIa~t"• .._, ••e not.cd earbtr. i1 alto-·s the~ 10 opt'Dlt' m u.I.Wiy unknot4'11 tn\"lrot'lmeniS and to bc'c-k fron1 the critic on how the "'S-CIII io; doing "''d deeennines how the pcrfonnance element should be modified eo do bcner in the future. 11'e design of the teaming eleme11t depcnch ver)' much on ehe design of the perfonnance dcmem. When trying eo cksis n ru' l~J;C'nt !hat kan~J a t."t:rtain c:1pabili1y. the first quc..seion is riOI"I-Iow ~11 going to gee il to team thi,1" OOe" \Vhae kindofpedonnaneeelen-.nu ...,ill my agenl nero 10 do this OOC'C i1ha~ learned how?'' Ghm an agent design. learning mechrulisms ean be ron.~ed eo impro\'e e''tl')' part of the a&e••· Till: critic tells 1M leount.nJ element how ~ell !.he agent is domg with resprcc1o a fiud p::tfotnWlCC ~. The critic' i~ ~ b«~use the perttpcS tbemseh-es P'O\ ide no mdllc.llion of tbC' agt"nl·s SUC't't'SS.. Fot eumplt. a C'heS) pm;nm coukl f'tt"ci,~ a perttp md.talln, lhal it has cbc.rl:nwtd 1.ts orpoac-1'11. bu1 11 ne-eds a pn(CifllWI« suncbrd 10 know tlw this is :a IOOd ~ lht pc1'CC'JlC tbC'If Q)' '10. Ita' lm~ th:u the perf~
'*'not
~-------------------------------------------=C~h~~cr 2~·---'~"~'OOI-
.,.t
2.4.6 IA::itrning agents We ha'-e delcnbcd asmt programs v.ith \'MlOUS mtehock (cw \Ck-atn,g .-tMJOS. WC Jla\·e noc. ~ r... C'\pbtnrd how l.br agent procnms NI'W lltiD In hu (;I[IJ(JW. carly paptt. "'"''nn1 (19SO) ~the idea ofacnWI) pcogr.vnnuns h.1' ltlklh~t madunes by hand.
....... blot·
~J
"':s. = a
"a ;;
A~1U'*"'
Agen1
•.l jtU~ 2. 14 A tl'lodel·b:tSl-d, utili t y · N~I liJt:l\1, II u-.e11 a model of t l~ world. ~k>n& with It \lltlhy fu.nc:llo" !hat n.r:a:,(Uf't'!l il.s t)rtf~telkC'\ ani()I1.J ..-u.ttll of the ~orld. 1'htn it thoost:ll l~
OUironlt. (Appt'IKtit: A define$ expectation more prtti.!otl)'.) In C'haP'et" 16. w-e show that all)' DIJOI\IJ q,ml must bdm:c- as ijit posses.s;es a Ullht')' funn.on v.tlooo;e Upx1cd \ '.IIUC' 11 tries lO mannuu. An q.rnt tml possc:s.ses an aplie'it uhllt)' funn.on c.an mal.C" r.II.KliO.II drcuions V.tth a ~ntral·purpciiSC: ~dn tha doe$ ROC dC'pmd Oft the 'fU'Ifir UIIIIC)' funaiof'l being maxamllt'd. In thiS ·~y. the defuu110n ol ntiOft;lhl)~l.&f'llm& as mbomllhoscllft'l funneon:s th mic,ht t~l.e and concludes - some more expeditious mrthod 5ttms desirable.- Tk mdhod he ~ i( to t"uld ~.uning machines and then to text. ehem. In l'n3n)' ~ of AJ. thl,. i.), """' the pttfemd n~thod fc.w ClnliQg swe-of·tht--.an S)'S&tmS. ~ tw ~r ach'"NIIa~t"• .._, ••e not.cd earbtr. i1 alto-·s the~ 10 opt'Dlt' m u.I.Wiy unknot4'11 tn\"lrot'lmeniS and to bc'c-k fron1 the critic on how the "'S-CIII io; doing "''d deeennines how the pcrfonnance element should be modified eo do bcner in the future. 11'e design of the teaming eleme11t depcnch ver)' much on ehe design of the perfonnance dcmem. When trying eo cksis n ru' l~J;C'nt !hat kan~J a t."t:rtain c:1pabili1y. the first quc..seion is riOI"I-Iow ~11 going to gee il to team thi,1" OOe" \Vhae kindofpedonnaneeelen-.nu ...,ill my agenl nero 10 do this OOC'C i1ha~ learned how?'' Ghm an agent design. learning mechrulisms ean be ron.~ed eo impro\'e e''tl')' part of the a&e••· Till: critic tells 1M leount.nJ element how ~ell !.he agent is domg with resprcc1o a fiud p::tfotnWlCC ~. The critic' i~ ~ b«~use the perttpcS tbemseh-es P'O\ ide no mdllc.llion of tbC' agt"nl·s SUC't't'SS.. Fot eumplt. a C'heS) pm;nm coukl f'tt"ci,~ a perttp md.talln, lhal it has cbc.rl:nwtd 1.ts orpoac-1'11. bu1 11 ne-eds a pn(CifllWI« suncbrd 10 know tlw this is :a IOOd ~ lht pc1'CC'JlC tbC'If Q)' '10. Ita' lm~ th:u the perf~
'*'not
58
Chapccr 2.
Intelligent Agen~
underlying stan:h and gam e-plrogram. rationality. autonomy. n:tkx agent. modcl-basc:d ag"'nl. goal-b;cs(:d agent. utility-base-d agent. lea.ming agcm. 2.5
2.6 This cxc-ocL.;e e-x p ion·~" the differeoc.:ts bctw. The following exercises all ooncem the illlJ)Iement:uion of enviroomcms Md agents for the "'Culun·cleancr world.
Show your resuiiS. d. Can a reflex agent wilh .s1atc OUIJX.--rfonn a simple rellcx agent? De-.sign suc:h an agent
and measure its I)CI'fonn:ulCe on SC\'Cf';.ll e•wironments. Can )"'U dcsi£ 11 a rntion:li agent or this type? 2.12 Repeat Exercise 2.1 1 for the case in whic-h the location sensor i.." replactd wilh a ..bump" se-nsor that detetc.s the ag~-n t'.s auemp~.s to mo"e into ;m obstacle or 10 cross the boundaries of the- environment. Suppose 1he bump sensor stops working; how should 1he agent be.have? 2. 13 The V:tetJum environments in the- prec-eding exe-rcise-s have all ~~~ dc-lemlinistic-. Dis:· cuSS: possible agent programs for eac-h of the folloYo·ing stoch:.stie \·ers.ions-: "'· Murpl1y's law: tweiUy-five percent ofahe time. the Suck action fails 1.0 clean the floor if it is diny :Uld deposits dirt onto Lhe lloor iflhc fl oor is cleoo. How i.-. y·our agt"nt prognun aff«1ed if the dirt sensot g_ive.s lhe \\'TQ"-8 answer 10% of the tinle'? b. Small children: AI cac:h tim"' step. cac:-h c-lean square has a 10% chance of becoming diny. Can you come up with a rotional agent dcs.ign for this c:~se:?
S«tton 3. 1.
3
SOLVING PROBLEMS BY SEARCHING
/11 wllirh Wt' St'f' lrt}W on agmt am find a :1-t"qucl~t' tif llt'IIQnS tlttll tlt'hin't's its J:tJtil,f whtll no slr~glt- (Jl'tlon will do.
-
The ,.imple..l a.gcnb di)o(.:ussed in Ch-:tpter 2 wett the n:llu a_gent.;, wl1ic:h b:be their octions on a direct m~ppina (l'(lm st.'ltC$10 oct ions.. Such ageniS cann04 opcr!Ut well in cnviR)nments for ~·h•ch thi" m)ppi••g \lf'Ould be too laf8e to s1cn and ~oukl c;a~e too Ions 10 kam. (ioal·b:lsN lli&C:nh, on 1~ oche-r h;lnd. consider fu1un: :.c1ions and lhe dc"ir.~balaty of thdr ouk'omcs.
. . . . . b.*CI
3.1
Th•" f'hapccr deia'ibes one k:ind o( pl·ba.scd apl c:aUC'd a pn)l)lf1lt·S4lhing agt:nL
Prob&mt·M>hing agenb u.se alom.k repcumtation:s. as dc"'nbtd in S«tioo 2.4..7-ctw is. SUIC' of the- \\ot&d ~considered as whoks. with no trUrnal ~lure \l'(lbk to the p:obk:m"'O1IIOO "dlCCkm:uc.'' where the opponent's king is unckr aU:k' k and can' t escape-.
'''"'"'
69
Exrunple Probk m:s
• A path cost function that assigns a numeric cost to ead1 p..1th. 1'he problem-solving ageru chooses a cost funcc ion that reflce~s its own performance measure. For the agent trying; to get to Bucharest. time is of the essence. so the cost of a path might be its length in kilomch:r'$. In this cha1ncr, veeified goal s:tate. sud• as the one shown on the right or the figure. The standard romlulation is as follows:
GJ 0 000 0
[2] ~
(;o;1l State
A typical in!>lancc o( the 8--pu-r.~k.
• St.ates: A st:ue deseription :>pccifies the location or each of the eig.lu tiles and 1hc blank in one of the nine squares. • Initial state: Any l!l:lh! can be designated as the ini t i :~l ~t me . Note th:;\t any gi\'en go.11 can be reached from ex:~ctl)' h.'llf of the possible initi:'tl states (Exc:n:"i.~ 3.4). • Actions: The simplest fommlation defines the actions as movements or lllC blank space U:ft. Right. Up. or Down, Different subsets of these :U'e possible depending on w'llCre the blank is. • lran.ible.) • Path cosl: Each step t.-osts I. so lhe path cost is the number of steps i n the path. What abstrJCtions ha\'e v.-e includl-d ht.·re? The action." are abtstraOSitive intet:,ttr. Fijtu rt 3.5
Ahnos12 solu1ion
t () lhc $.queens pr(lbleltL
(Solution islcfl
!1$ :111 nercl~ .)
;\hhough eflicient spc.xi:d·pui'JX)Se algorithms exist for lhis J)I'Oblem and for the whole Jl·quecns family. it remains a useful teSI J)tOblem for searth algorithms.. 1bere are two m:Lin kinds of fonnulation. An increme ntal formulation involves opcrntors that lm.~m~llllhc st:lte dle algorithm th:u soh-es even the million-queens problem with ea.-.c.
To our knowledge there is no bound on how large n number might be con.stmctcd in the process of rtt~swt U)Qf'YM."ll
H:wing fonnulated some problem$, we now 1\Ced to solve 1hcm. A sohuion is an accion St"quc:-nce. so iWI:-a«h algorithms wo rk by COft.;:idering various possible action sequence-~"- The pos$ible :.c1ion sequences starting :uthe initial s.tate form a search tree with the initial s1rue at the 1'0()1: the br.ti\Che-s are actions and the flodlate sp.;,ce of 1he problem. Figure 3.6 shows the tirs.t few steps in growing 1he search tru for finding a route from ArJd to Bu.fe gencr.ttt'S b more nodc.'S. yielding t} nOOes m the third level, and so on. Now suppose that the solution is :'It depth d. In the woot ca..o;c. it is the la..'>t node gencmted at that le\'el. Then the tOial number of nodes gt'ltcraK'd is
b + b2 + b3 + · · · +b' = O(b'). (If the algorithm were to :1pply the goal test to nock.s when t-J:Iec:ted fO£ cxp:u1sion. rather thitcs.ti forexp:tnsioo :md addiog a second path
The progress of 1hc search is illusmucd in Figure 3. 16. The search pi"()C'('eds immediately to the dl"(! JC:',0
~
.0
~
~
~ ~
~
Ah .0
fig:un:: J.I9
rour it~·mlions of ite-mli\·c; deepcninJ, sean;h 011 a binal}' tree.
90
_ _ _ _ _ _ _ _ _ __;Cb::;:•~P'::;•:.. r ..,.:: l~_:: Solvlr~g l~ltms by Seatthi.ng
Section 3.4.
Uninronned Search Str.uegico:~
91
nt:\t ~to·bouom k\'tl are genera1ed 1\\ic:e. and so on. up to 1hr- ch•klrcn of the rooc. "hkh are S-C'ntr.ttcd d ltmcs. So 1he tOI:al number of nodes ~ted in 1hr won.a c~ ts
.\'(IDS)
(d)6+(d- 1)62 T
...
+( I)64 •
~ hJCb 11>" • IIIli( t.>dy best-first search Grt't~y best-first starch* trie~;: to expand the node that is closc:s:t to the goal. on the ground.;:
8
Our fif!>l Wition ~1«1 dis ' f'('(dy S«~rrlt: ocher autOOI-s h:.a\"C c-~1«1 it btsl·li~ $«rl'dt. Our n~ 'cntnl Pc-.t (198-1).
l$,iC O( the: !:mer lffln foliO¥>'$
M t badi3
2.&1
N~unt
160
Orad~a
234 380
242
l'itl'Sti
100
161
176 77
Rlmnl in tum gcnemte.o; Buchn.rest. which is the goal. For this panicular l)t()blcm. g.n:edy best·tln;.t search using IISLD finds ~ solution without ever
0
Hlrso,·a l_.. ugoj
implcmcmation of bcs•· fi rst graph search is identical 10 th:u for uniformst SC3n:h (Fig· ure 3.14). cxc.-cpt for the use off instead of g to order the priority queue. The choice or f dctemtincs 1he scttn:h smucgy. (For example. as Exercise 3.2 1 shows. best-ti~t tree search irlC-ludcs depch.first sc3tth a_;: a sp«ial cas~.) Most best-tir!l algorithms include as a component off :1 heuristic function. dcn01ed h(n ):
366
93
3.5.2 A• search:
.. """'
M ir1im i1~ng
the totalt."Stimatcd solution cost
'The mO.."t widely known fonn of bt.'$'1-fir.o;t sc:uth is t:alled A" se-arch (pronounced "A·.!itar St"!'lrch''). It evaluates nodes by combining g (n), the cost to reach rhc node, and li{n), rtw= cost to !WI from the rloOde to the goal: / ( " ) = 9(" ) + lo(n) . Since g( 11) gives the path cOOt from the Slllit riiOde to node n. and !1(11) is the estimated cost of the cheapest p:tth from n to che go:1l. we have
/ (11)
= estirn;ued cost of the chc.aJ)(:.St solution through 11 •
Thus. ir we nrc trying to tind the du~apc.•.st solurion. a reasonable thing to try first is the node with the lowest ''alue of 9 ( 11) + h(u). lt tunlS OUI Ih;~.t this str:ueg)' is more th:ln just re.nsonable: proviWcm. node. Qt:tior•) imo $t.IC«.UOr$ if $ll~$$()f':'i i.scn1p1y Uten n:luna /ailurr;. 00 f(l r e-:~eh $ in $1'1('(1'.~~0~ d(l ,. uprithm. 1bc main difference bct\l.'ttn IDA" and Sl:tndatd iter:uive decpenillg is th:u 1hc ctuofT usc..-d is the f -cost (.q+ II) rJ.thcr than the depth: at eac-h iterJ.tion. the cutoff ''tdue is the small· est /--coSt of any node that exceeded 1he c utoff on the pre,•ious iter.uion. ION is prnccieal for m:u1y problems with unil step ro:scs and avoid.;: the substanti;LI o,·t·rhc~ a.."soti:•tt.."l.
rt'C."Xp:uuljng the subtree at some later time. figure 3.27 shows how RS!!S reaches Bucharest. RBFS is somewh:u more efficient lh3.1) ION. bl11 still suO'c:tS from excessive 1l0de l'e· geoer.llioo. In the ex:.mlple in Figure 3.27. RBFS foii()WS the p..•uh \'ia Rimnic" Vilce.:t, ll'lell
of fo"om•n nodes to n."t"reatc !he l>e.'>t path and exu.•nd il one more node. Like A' lt'Ce search. RSFS is an O))lim:tl :tlf!Otithm if lhe heuristic func1 ion lt{ti) is admis:•ible. Its space complexity is linear in the depth of the deepest optimal solution. but its time complexity is r:nl'ler difficult to cha.t".)C''crii'..e: i1 depends boch on the accuracy of 1hc heuristic function and on how often the be-st path changes as nodes are expanded. IDA" :.nd RBFS sutTer from u:;ing too little memory. Benvcen i1erotions. IDA" retains only a sinf!k number: the curTtnl fst limi1. RBFS re1ains more infonnation in memory. but it uses only linear sp:.ce: even if more mt.'lnory were :wailablc. RBF'S h:a.s nO way to make usc of it. Because they forge• most of what they have done, boch :.lgorithmso ma)' end up reex· JXmding the same states many times owr, F'unhennore. they suffer the pc>ICtltially exportl!'ntial inc·rea.sc in complexity associ:ued with redund:uu p:tth.s in graphs (sec Section 3.3). h seems sensible. tltl!'.refore. to use ~II available memory. Two algorithm$ that do this arc MA" (memory-bounded A") and SMA' (simplified MA'). SMA' is-well-simpler. so we will describe it. SMA' t)nx«ds just like A'. exp:.lnding lhe best leaf ulltil memory is full. At this point. it cannoc add a l'leW node to the search tl'\.'(' withou1 dropping :.n old one. SMA" always drops the worst leaf 11ode-thilc heuristic uses whichever function i ~ mo:r-1 acc"nuc on Ihe node in question. llccau...e the COnlJKlnCIIl heuristiC$ are adm i~ible. It b. :ulmh10ible: i1 h ab.o e~y 10 pn.we that h b: con_ , l,tcnt. Funhermore. h dominate.;; 311 o( i t~ componcru hcuri,tk"S.
3.6.3 ~
"""'OIBIMI
G.:ncraling admis sible heuristics from subJ)roblcms: l•aucm d~ttabases
co"''
Admt\\lble hnlri!OIICS can aJso be deri\'M from the sotutaon ol a r.ubproblcm ot a given problma For C:\amplt, Fig\.ltt: 3.30 ~'$ a .).Ubprobkom O( lhe S ~pu.uJe U'SWICC in f"ag• Ult 3.28. The w.bprobkm 10\'0h"\"S g_etting ti.ks I, 2. J. 4 ln10 tht.r COr'r'«1 posit»am. Ck.arty. lhr CQ.J of the opuma.l solution of lhis wbprobkm is a to-'f'r bound on the cost ot the (:(lmooo pk«' problem. II turns OUIIO be mote a«Ural~ lhan Maniw.WI d~ 111 .MJm4" C';l5('S. fht Jdr;~ belund patltm c:bt2bascs i$ to AOR: thnot t'XXI '-OllltKift COSI< fot C'\'n')' pos!~bk 'ubprob'"" ~~Utance-in ow ~.:c:am.plt'. n'ft) ~'·'* confiatniJOn or lbt' four tiles and thr- blm.... (l'he loc:a~ions of me other foor tik'""' lmlc'\'"lnt fOf lhc purposes of solv· •na the subproble-m. but ntO\-n of lbo:sc- tiles do coon1 uwnud 1hc cos.l.) 'Tbc'l'l ~-c comput~ an Jldm,...sible hcvrislic l•t>B fOJ e:.cb romplcu.• state encounecttd during a M";atc;h WmpJy by loo._u_, up the c:~spondin,g subproblem confipr:nion in the dat nba.~. The d.11ab.1.(C itself is C'Ofhti\K.'1Cd by M:arching backiJ from the goa.l and n.•c.:ordins, the c:cN of e:.ch 1'1ew pancm en· cenSC' of this se:uch is amoniz4.-d over many Mlb:.l"umals such as Anijid(l/ l nu•/Ugt•llct• and Jcmrrt(l/ ofrht! J\ CM. The topic of p:•rallel search algori1hms was not CO\'ercd in 1hc chapter. p.•u'11)' because it n.o.quires a lengthy discussion o( parallel computer umil we n.•och a turning point. and this is the only action we nc:cd to do. Refonnulate the problem using 1hesc x •ions. Do we need 10 keep ltaek of the robol's oricnlalion now? d. In our initial & -scription or the problem we already abstrJcted fi'CMn the real world. rcSiriCiing :tetions ttnd remo,•ing de1ails. LiSt three such simplifications we made. 3.3 Suppose h VO friends li,·e in diff(·n:nt citie..; on a maJ). such :u the Romania map shown in Figure 3.2. On e\'ery tum, Wi.! can simuhaneously move each friend 10 ;a neighboring city on the map. The mnoont of time needed to move from city i to neighbor' j i.s C(Jualto the road dist.:mce d(i,j) between the c·ities. but Oil each tum the friend lh!IJ arrive. tlJrst must wait until 1he other one arTives (and cMis. the firs~ on his/her ce-ll phone) before the next tum can begin. We wantlhe two fricncl;; to meet as quick!)' as possible. a. Write a detailed fonnulation for this sc:Ltch problem. (You will find it hclpful lo define some romul nOiation here.) b. Lt:t D(i,j) be lhi." stmight·line distance bctwc."n. d . Appl)' one or more of the alg:orithms in this c.h;\ptcr to solve :l. rJ.nge or problems in the dom"in. and comment on their p:rfomumcc. 3.8 On P-'8¢ 68. we said th.:u we would 001 consider problems with negath·e path costs. In this exercise. we explore this n.>blem (TSP) can be soh·ed with the minimum-spanning· tree (MST) hcuri~k. whid1 estimates the cOS-1 of compl-eting_ a tour. g_ivel'llthal a pal1ial tour has already been C(H'lSttUCicd. The MST cos• of a SCI of cities is the s.mallc.s• smn of the link cOS1s of any tree that 1cr
--~----------------~
I
4,
Sc1cr
I
4,
Oe)ond Cla.,;;)ical ~h
funtlion Sl\ll'LAT£D-A '"'EALI:OOG(,.roWt-m.KltcJ.Jd rttums • .oil.lhOft
lnpuuc• ~.a probkm
S«t10n 4. 1.
Local Se~h Algorithms and Optimilati::oo::..:.P,::ro:::b::l Otht•n n.ITI'r•t- ,.cz~ dst cNrrrr~t - ,•ul only with p~balit)' t .).l:tY
3274102 1
l 247~ 24uH 24752411 1
~~Mrftk. a~ from lillie' 10 ~""-
c"wTu•l- M"KE-So~.lllr.mAL..STAn) for i•I IO'- dO
H
t m m24 H
:::;:~;:;:;~>--< I 2441S411 H
1@s2124 l 2441S411ill
"' ........ •i,gu~ 4.6 The gen('tit aiJOnltun. , uu~l rl'l1rd for d!JIIl'tnnc" rcopresenting S-.quec.n~:~a.to.. 1'hc lnicilll popubti011 m (a) , ~ tal\l.t'd by the llti'K"'~ f1.1m11on in (b), rewllil1$ in pat~ for nu11h1$ in (ter 4.
Beyond Classic-al Scan~h
Scc1ion 4.2.
abililies in (b). N01ice th3t one individual is selected 1wice and one not at all.A For e..ch p.'Lir to be matl'd, a cms.'im-c.r point is chosen randomly from !he positions in th~ string. In Figurt 4.6. thugh tim~ has elapsed n:tum tile b »e:micul:-tr Slate once we compute the closest cilies.. Let C, be 1hc set of cities whose closest ;"tirpott (in the current S-tate) is airpon i, Then, in the Heigltbr>rhOtXI of lire t'11~111 SI(IU'. where the C,s rtmain constant we h:.\'e 3
l(rJ, Yt• :r2.tl'l• :r.s, 93) =
L: L (:r, - :rd2 + (y, - y(")2 .
(4.1)
•• lc£(;,
Tttis expression is correct 10I)' any of the local scateh algOtithms described pre,·iousty. We co'rld also :q>ply stoc:'ha.'>tic hill climbing and simulatl-d anm•aling dire-ctly, without di.o;cretizing the space. These :tlgolse successors rnndomly. which can be dO•'Ie by generating random \'CC• tors of length 6. Many methods nuempc to usc 1he gradient of 1he land.scape lO find a maximum. The gr.tdic-nt of the objccth·e function i:s a vector VI that gi\'es the magnitude and direction or the ~cepe~ slope. For our probkm. we have
'1/ • ( {)J {)J {)J {)J {)J
IJJ)
&r1 ' &y1 ' 0:¥'2' &!t! · lJra · &y3
'
In some ca._IO a single belief s.~:uc. AI any given point. the agent is in a pankular belief state but does 001 know vohkh physical .st:ate it is in. The ini1ial befit('( SLate (oomplcle ignornncc) is tbc top center box. Ac1ions are repn-scntcd by labeled links.. Self-loops arc omiucd for datil)'.
buidt• the belief Slates :md de\·elop incrtmt lltal btliet-stale Sl'3rtb :algorithms that build up the solution o ne physi c:~ I state at 3 lime. For exam ple, in the scnsortcss v:.cuum wortd , the
inilial be-lief st:ate is { l , 2. 3. 4. 5. 6, i. 8}. the ph)•sical state sp:KC itself. Even the mMt erticic.nt s.oh•tion algorithm is oot of much use when no so!utions exi:u. Many things ju:1ans ahead, 1hc less often it will find itself up 1he creek wit!lout a p:tddle. Online search is a m·as:UII)' idea for unkllO'o\'n Cllvironmenls. wll('.re the agenl doe..,; 1101 know what Slates exist or what its :~C~ ions do. In this state of ignorsnce. ·the agent faces an exploration problem and must usc its actions as experiments in order too lcam enough to make dclilx--1':.\tion worthwhile. ·n,e canonical example of online search is a robol thnt is pi:K'Cd in ,'1;1 new building and mus1 explore it to build a map lhat it can use for geuing from A to B . Methods for esco:~ping from labyrinths-required knowledge ror a.piring heroes or nntiquit)'-:UC also examples of online searth algorithms. Spmial e:mmonty uSter 4.
Beyond Classic-al Scan~h
Scc1ion 4.5.
G
3
........
2
Onlir.c Searth Agc.nts and Unknown Environnu.·.nts
149
Althoug.h this s.ounds like a rt:.sonable rtqueSI . it is c.;asy 10 see that the beSI :.chievable compctiti\'e rntio is infin ite in some caes. For example. if some netions :are irn-l·trsibl ~ i.e.. they lc"d to:. state from wttich no action leads b:ld:. to the prt\•ious. st:ue- the online search might occidcrually reach a dcad·cnd state from which no goal state- is renchable. J>cr-
IL'I pS the tenn ··aceidcnutlly" is uncotwir.cing- :Jfler all. lhere might be :1n algorithm thar hilpjXns no! to tak.: t.h.: deOO-ic:t.lly.the :.gem's objecti\'e is to rtach a goal state while mi1limi.z.ing cost (1\ nod.er possible objective is simply to explore the e ntire cnviromncnt.) 1bc cost is the total p:tth cost of the p:uh that the agent ~ u;llly tr:wels. II is common 10 OOnlJ>ate this COSI with the path COS1 of the path the ugt'llt would follow if it b1ew I he searrl1 spac~ ;,. tukm1c~hat is. the 3C1u;d shoneSI path (or shoncst complete exploration). In the langu~e of online :dgotithms. this is callcdthe competilin ratio: we w(M.IId like it to be as small as possible.
Aflcre:.ch aetio·n. an online agent receives a pcrttpltelling it what su1c i1 has rc~: from this infonnation. it can augment its map or the cnvirocunent. The current map is used to decide where 10 go I'ICXI. 11•is imerlc:.n•ing of pl:.uuting :md ac1ion means thai online se.1rch algorithms are quite different from the oflline .search ;tlgorithms we h;we St."'t."-11 previously. For example. om inc algorithms such as A" can ex.p.1nd a node in one pall of t:he space :tnd ll'len immedimely exp:uld :1 node in another p;ut of the ~pact . because node expansion invol\'e.;; simulatl-d rnther thMt real actions. An online algorithm. on the other h~tld. can discover SI.K"Ces.sors only for a node Ihat il physiC':llly occupies. To a\'oid trnveling nJ11hc way across the tn."C to expand the nexc node. it seems bener 10 expand nodes in a locaf otdC'.r. l)(,o.pth·lirs:t search hao; ex:Ktl)' Ihis property ~usc (exccp1 when backtracking) the next node expanded is a ehikt of the pn..--vious node exJX1nded. An online depth-first SCliK'h nge-nt i..o; shown in 1-i gurc 4.21. This agenl stores its map in a table. RESULT(s. aJ. 1h.a.t recor\ts the state resulling from exccu1ing O'ICtion a in Slate s. Whenc\'c.~r an oct ion from the cum-nt state hao; not bc.:n explored. the agent 1rics that oc1ion. 1ltc difficulty COm($ when the ..gem has tried all the :'ICiions in ., st:ue. hlJ ofnine depch·llrst search. 1hc state is simply dropped from the quem~: in an onJinc sc:arch. the ~ nt has to backtr.Kk physic;1Jiy. In ter 4.
Beyond Classic-al Scan~h
Sct.11C:md JI~1Wn. initi;ali)' null if (;OAI.· "I"I~ST(.s') tht n rth 1rn #op if ~~ iS l!'.r:.Ue on Iynomial·time algorithms thtu arc oftl.'n ex tn~mely efficient in practice. • A genetic algorithm i.s a stocha.o;tic hill-dimbing search in which a Large populntion of Slates is ma.im:)illed. New st:u cs are ge1lCN1teairs of s•:nes (f()m the popul:ui01l.
• Loclll umrll methods such as hi.U
IS4
ChaJ>ter 4.
Beyond Classic-al Scan~h
• In nondttermi.nistk environments. agents eM for lt to get stuck • ·ith com·n ~txlc'? b. Con!\truct a noncom·ex polygon:tl mviron~t in '*tuch thr iii£Ctll aet~ ~uck. Rc:~ou
a,
Modify die hill-climbing algorithm so that. ins.tr;xl of dmns a depch· l ~an:h to decide whet't' to ao next, it does a dcp:h·k sc;~n;h, It ~1ld llnd the Jxo..,t k-stcp p.1th and do one ~t C JJ :~l ong il. and then repeal the Jmxes~. d . It there some J: for which the new algorithm it guuruntl"Cd IOtM:apc from loca l minima? t:. Ell.plnin how LRTN enables 1he ;agent to esc111>e from loc:1l m lnirt~ll in this ca.-.e. t' ,
~. 14
LiL.e DFS. online DFS is inromplete for rt\'tn.ible ~Hate 'P:ICes with inlinite p!Lths. For uampk. ~uppo;.r thai states are points on the infinite two-dunen,ion:twn vs. one-pawn endgames. Any gi\'en category. gencr.LIIy speaking. will cor1tain some state..,; th31 lead to wins, SQme th:u lead to draws. and some lhat lead to lt')SSCS. The evaluation ftmttion cannot know which st:.ti!'S are which. but it can n:turn a sir1gle \'alue that reflect...:: the pmponitm o( Slates wilh e:teh ou1come. For example, suppose our experience suggests that 72% of the states encountered in the hVOawns vs. one·j)awn category lead 10 a win (ulility + I): 20% to alos..o; (0). and 8% to a drnw ( 1/2). ·nu~n a reasonable ewluation for st:.\le-" in the category;, the tx()«te"head. Wirh alp!l.')o.beta sea.teh we get to about 10 plies. \lthich resuhs in an expert leve l ()f play. Sccrion 5.8 describes additiona l pn.ming tcc:hniqlk"s ttuLI can extend tJ.e cfl'ecli\'c SClll't"h depth to roughly 14 plies. ·ro reach gr.mdma.opro:K'h never '\Cicci\ actions thai gatht'r ;,. jqrmMiOtr (hLe t~ firsl lOO\'t' in Figure 5.13); nor will it Choo!l(: t~Ction' that htde lnforma1ion from lhc Oflpoorm or pt'O\'"idc information 10 a p311nrr b«IUl>C' i1 a~sutnes 1ha1 they already Lncw.· the 1nfonna1.on~ and i1 ~ill new:r blufT in pol.n.• b«au't' It "-"UI'rl« the opponent~ ~ 11\ank. In~ 17. 'A'C .,_., how IO«Xll51NC1 al.plthm" lh~ do all~ things by Vtl1UC' of '\Ohi~ the U\llt panWJy ~ decision problnn
18S
STATE·Of·THE-A RT G AME P ROGRAMS
(S.l)
(N'OCt« th» P(•) doG not appt"M cxpiK'tll)' in t~ summatiOn. because k Nmpks ate" af. ft'ad) dr.~-.n ~ng toP(.,).) As X~~~ 1~. Ilk M~m oo.n the r.anOOm ~pk tends to the cJtxt \'J.Iue, but n·cn fOt f:airty snu.ll .V~y. 100 to 1.000- tk mcthcxt gi\'CS :a good appro~om..u.on. It C".tn abo be applied to ckte:nnim!IIK' ~me~ ~ :.s Kneg:.••.PKI. gh~n SOITlC ~~no~ble ClUun:ue of P(.t). FOt &l&mes lake: whi$t ~hearts. where the-rei!~ no biddin.& or ~ni•'l ph;l$C! before pia)' rotnmentes. each deal will be cqu.ally likely Olnd ~ d.c: Vllluc' o( P(... ) :•re :Ill equal. For brklt;e. J)lll)' ill pn.-«ded by a bidding ph:ISe in which each te:un hWicates how m:ul)' trkks it expccu to win. S i n~ pla)•ers bid based on 1he ca.rd( they hold, the Olher pl:l)'l'r.> le:tm more about lhe probability of ¢11C-h deal. Taking lhi.s inlo nccoont in dl."Ciding how 10 l)lay the hand i!ltriet:y. for the re:LiOrt,hi1x . t\ wriety of pruning heuristit-s nre usc.-d to n.'duc~ the dfccti\'e brnnchin,g f:IICtor 10 I t~ th;an3 (c:omp.ued wilh the ae~ual bmnching fncror of about 35). The mos1 illlJ)()I1tutl of the~ i"thc null nuwe heuristic. whic~ gcncrJtl:$ a good lower bound on 1~ \'alue of t!l posi!ion. "'ina 11 ~hallow M'lllt"h in which the opponent gea-. 10 lilO\'e twice at the btgi.nni.ng. Thi.:; lower bound often aUows alpha- bet::a pruning without lht expense of a full-dcpch search.. Al-.o imponwn b. fulllity pruning. which helps decide in ach-anct which rl\0\U 1Aill eauJ>e a bru. C'utoll" Ill the "uccessor nodes. HYDRA can be .set:n M lhe ~.....~ 10 0H_P 8LLB. HYDRA runs on a 64-prottSSOr duSier "'ilh I gigabyte pn- prot\"~ and ._,,h cu\tom hardware in the fOtm o( FPGA (F~itJd J>ros.r.unmable Gale Amy) dups. II YDRA rexhc" 200 maiiKJn C"'31Uions per second. about the AmC' as 0oep Blue. bd. HYDRA ~ik'~ 18 plieS dttp ratbtr Ibm jusa 14 btause o( auressn'C' U$e of the null lnO\~ heufi~te and fON'M\1 prunlnJ.
Chaptc.r 5.
186
Scc1ion 5.8..
187
van1agc appt'Ill'S to be its evaluation function. whic-h has been lUIX-"layers ;\lt: JXI.ired into two teams. t\s in Section 5.6. optim ~l pia)' in p;:utiall)' observable gnme.s like bridge can include elements of infonna1ion gathering. communication, and careful weighing of pR>OObililies. Many of these techniques are used in the Bridge Baron pR>gr.un (Smith t!l lll.. 1998). which won the 1997 compuler bridge championship. While it does
lmem:uion:d Masu.~r Vasik Rsjlich. and :u lea~t three 01her grJndmasters.
not
Till: most rccem matches sugst-st that the top com puter chess progr.uns have pulled ahe:xi of all hum3.1l romerKiers. (See the historical n01es for details.)
complex. hierarchical plan..;: (sc.."C Chapter I I ) involving_ high·lcvcl icka.s. such as finc..-ssing nnd squ e-ezing. thai are famili.u 10 bridge pla)'ers. ll•e GJB prognun (Ginsberg. 1999) won the 2000 computer bridge championship quite decisively using the t-.·tome Carto med\0grorns have followed CIS 's kad. GIB 's major innovation is using explan ulion-buscd Ktntralization to c..-ompute and c:ttcr 16. we see IIO'o\• these ideas c:u1 be made pn.."Cise ;u.J impk ment:ablc-. Finally, let us reenmine the nature of search itself. r-\ lgorithms for heuristic senrch :md for game playing generate St-quenha--bela search :tlgorithm cornptHCS the same op1imal mo,·e as mi1limax. bot achiews much gremer efficicnc..")' by eliminating subtrees that are PI'O'\'abl)' im:k-vunt. • Usually. it is not feasible 10 consider lhe whole game t.n.-c (e\·en with alpha--beta). so we
Chaptc.r 5.
190
Bibliographical and
r\eed to cut the se3n:h off at some point 3nd apply a heuristi-c tvalualion funtdon th:u estimmcs the utility of a stale.
• Man)' gO'me programs precompute table.s of best mo,·e..o: i1lthe opening and endgame so that they can look up a move mther than scnrc·h. • Games of chance can ~ hlmdled by an extc.•nsion to the minimax algorithm th:u evnl u:ucs a chance nodt by 1akin.g the avct3.ge utility of all its childten. weighted by the 4
probabilil)' of e:.c:h child.
• Optimal pl;•y in games of imperfect inrormutjon. such a.-. Kricg.spiel :u1d bridge. requires reasoning about the currem and future belief' states of each player. A s.imJ)lc approximation can be obtained by 3\'t'f".-g:ing the value of an action ovt·r each possible configurotion of missing infonn:uion. •
!~grams have bcS~cd even champion human pla)'Crs at games such as chess. checkers. and Othello. Hum3lls retain the edge in M.-vtrJ.I g;unt"$ of imperfect infonnation. such as poker, bridge, and Krieg.spicl, and in games with very large brnnching factors and link= good heuristic knowledge. such as Go.
BHlLIOCRAPI-IICAL AND HISTORICAL NOTES
The eatly history of n)C(hanical game playing was mam.'d by numerous fliluds. The most notorious of these was Baron Wolfgang von Kcmpt"k'n's (1734-1804) '1'1ll: ·rurk." a supposed chess·playing autom:uon th:n defeated N_,poleon before being exposed as a magic-ian's trick cabinr Plrryi11g Cltcss (1950) th:tt had 1hc mC)St It•""l..,...l
"nle key idea h, local oonsisltnty. If we tn=at c~aeh \'Jrinble a" a node in a graph (see Figure 6.1(b)) and e..ch binary c-o nsuaint as an arc, then the J'M'OC't""" of enfon:ing local oonlli\tency in eac:'h p:trt of the g:1.1ph cau.ses inrotl!>b>h~tn v~tl ~.tes to be elimin:tted throughout the s.mph. ·n,erc arc differem I)'J>CS or local con"i.!itc.r•c>'· wl1ich we now CO\'Cr in mm,
6.2.1 IIIOCC~
Node tonsislency
A toirtale ~ri :tble (t:orrtsponding to a node in the CSI• netw.orl ) j, nodNonsisttnt if :til the \',lh.te' tn the variable's domain 53tisfy the v;an;tbk '~ un;~ry eot'''"'int~. For ex:unple. tn the v;viant of lhc Australia m:lp nodt-~1. h ~~ U....--a)'S pos.s•bk to eliminate all thC' wwy cons&raaniS u1 a CSP b)• runruns. nodC' ro«N"'-MCY· It is also possible 10 tnn.sfOtm all rt•ary romtr.atnb tnto binar) onr.s (sec Ex· m•~ 6.6). JkntM o( Ibis. i1 is commoo to define CSP sof\'C" thM wort ••th only birw)• C'Ofb.lr.aanl': "'l: mal.e dw a...~mp:ion for the ~ ~ 1h1" chap4n. nttpl w. he-re notc'd.
••th
6.2:.2 w:~PC\'
Al"t" consist.ency
A vari11bk 111 a CSP is art"- 1l. then the constraint c-annot be sati.Sfil-d. This leads 10 the following simJ)Ie all:,>Orithm: First. rcano,·e ;my v:ariable in the con~ saraint that has a singleton domain, and delete lhat variable's vnlue from the domains of the n.·maining v3riables. Repeat as: long as there are sin_gktOII variablt"S. I( at ;ut)' point :,\11 empty domain is proc1uc..-ro or there are more variables than domain values left the.n rut inconsis.1cncy h.'IS betlt detected. 'J11is method cnn deH.oc1the inronsistenC)' in the assignment { IVA= 'IY!d, NSIY = n:t/} for Figure 6. 1. Nocice th_a_tthe variables SA. NT. and Q are e mxtiv~ turnmulath ·ily. A problm~ is commutati\'C if the order of llf1plk.11ion of :my gi\·cn M't of acttOn\ has no dfecl on lhc: outrome. CSP~ are rommut :~tw~ b«au~ \\hen assigning \'IIUC' 10 \wiablcs. \\(' ~ach the.' S3tne p:uti.al :migntntfll r'C£afdk=" Of Oil'lkf. Theft' fort":. WC' n«d only oonsider a sintl~ 'oariabie aa earn node in the ""'ll«'h tttt. For~u:~npk. at the rOOl node of • ~•h CfC"C' for- coloring the nup of Ausnha, \lot n1e'ht mal.e a choic:c bdv."ttn S..l tt J, SA grttd, Md SA= 6/w . but "-e w.'OUid """"" thoo!-c bee"'""' SA = m1 and l'Jl 61.,1!. With 1h15 ~rit'tion. the nurnbn' of tw.n- b ,r, a_, "e wrould hope.
ru.IK'lion 8.ACKTI.AC'KI:rs
T:bmania! Obviou.sly this is s.iUy-~«in.c Ta..,m.mi;a c;annoc possibly resol"e lbt prob&cm "Ailh Solnh AUSir.ll:i.a. A~ intdligc-D~ approach to br;adJr.K'..InJ •~ 10 bx\:trxL: 10 a \~k that M1gfU fi~ the pobkm--a \-an;~bk lh3l "'"'" ~·bk for nul.t"J one of IN possible \'allk'S of SJI impossiblt. To do 111;, •'< '"lll«p lrx\. or • 1lll WJritlblu. IO ha,·e no COrl.Sifitem solutioo. In this case. the .Ki i.s IVA ;~nd NS ll'. -.o 1he alaorichm should b x ktrock to NSIV and skip 0\"er Tasmania. A bad;jumpin& alaorithm thou u;;c., conflict sets defined i.n this way
m.
IS calkd ronftict-dirKIOO b;lc.Yum.pin~tWc mUSt llC)'A npbin ~· these I'll!\\ ron1hct lltt5 _. compuled. Tbc ~ i~ in rxt quite simple. Tbc- "'krrntnaa.. (;ad~ ot a br.anc:'h of 1hC' seOlfCh at.-a.:rs occurs bttauS~: a \'MSablc ·s domain becomes m~ply: dul '~ ~ a J:l;an&.td conftin sc·t. ln our aampk. SA r,;ls. X1d ;,. «< os (y) ( 11\1 .~T Q}. We bos
.,....,;co
Chap!er 6.
220
Conscmint Satisf:tctiorl ProbJems
the . • Ifa vnriable appe-urs in 1wo subproblems in the tn."C. i1 must appear in ever)' subproblem along the p.)
aJtnl i ~ in the bouom lcfl conw:r, (:~~Cin¥ ri$hl. The tin.! :st~p l:lkcn b)' 1he :agttll in lht wumpus w(lrld. (:.)The initUI $il· uation, after perte1>1 (None, Nont', Nont', Ntmt, No,le). (b) Afler o.~~e mtw~. whh l>t~'«J'If (Nor1e, Brl'.!e:gress of th~ 3$f!r'll. (:..) After the third 1n0\'e, with pe~p: (Stt'nC'h, Nom:, Nont', Nom•, Nor1 tJ. (b) Afl~r the lifth roove, with 1>trap: (Sten~lt,
Bru.u, Cltttcr, Nont',
Non~J.
wumpus cannot be in 11.1 (. by 1.h~ rul~.s or LllC game. nnd it rnnnot be in (2.21 (or the agent w()uld have detected a Slei'M:h when it was in 12.1)), 11'1Crtfon:=. th¢ agent can infer th:Uihe wumpus is in (1.3). Tile notation W! indicau•.s this in (erenc~. Moreover. the lock or a bn."CZ~ in 11.2) implies that then:= is no pit in (2.2). Yet the agent h.'IS alre.ady inferred thou there mu.st be a pit in dther [2.2( or (3.1 (. so this ml~:&ns it mu.;;t ~in (3. 1). This is a (airly difficult inference. because it combines k1\0wlcdge gai1\e--, \ CElli CLD a: ' ..
The Jg(nl tw now pn:n't'd to irselfltw thtre i~ neilhrr a p11 nor a wumpus in 12.2). so it '"OK 10 100\"C t~. We do no1 showdr :ttt"nl'$ lil31C oftno-kdJC aal2.2]: "'" jusl as..wmt"
INillht ..,., IUmj and MO\'e$ 10 12.31. JivinJ U$ fi&u~ 7.4(b). In 12 •.ll. the~ dc1ects a &hlk'r. jO "~ pab the gold and rhea rerum homt.
N01t IIW on t>dlm. for "llidl
~
Illw11 n.cldtN or n 1 (no ph in 11.21). (b) Dotted line showli moe fa/$< fnL"ie
/tmt
li'U(!
tr-ue
true troe false troe
troe false false troe
,,,e fabl! ,,,e
tn1e
Fi:gurt 7.$ Tn11h t~bk:~ for the tivc logic {1 :mel n from fl Let us see how these inference rule.s and equivalences can be used in tile wumpus wortd. We stan wilh Lhe knowk" ( Po,2 V !',,,)) II ((/'o.2 V P2.1) => Bo.o).
Then we :tJ)p!y t\1\d·Eiimin:uion to Rc; to obtain
R,'
((Po.2 V P2 •1) => Bu ).
L..ogical e ~(Po,> v P,,, )) .
Now we can apply Modus l)onens with Rs and the pcreep1 R 1 (i.e.. -.8t,1), tooblain R9 :
..,(Pt,2V Pv ).
Finally. we nppl)' De Morg3n's rule. giving the conelusion Rto:
..,p, ,2/\ ..,fll,t .
Th.:\t is. tlCither 11.2] nor (2.1) contains a pit. We foond this proof by hand. but we can apply any of the: ~arc-h nl,gotiLhm.;; in Chapcer 3 10 lind a sequence of steps th:u constitutes tl proof. We jus1 need to define ::r proof problem as follows:
the initi"l knowlt"3.1
'""'""'
1)1
t, v .. . vf,_, vt,+l v ... vt"' · where each t is a literal aJ\d f 1 and m Me cCHnpltmtntary literals (i.e .. one is the ncg:.tiO•l
v -. P~.2
Tht.'re i:s one more technical aspect or the n.'SOiution n•le: the rcsuhing cl:u.•sc shoold comain only one copy of each lilcrnl.9 TIM! removal or multiple copies or lilerats i$ called fa ctoring,. FOr example. if we re-.sol\·e ( A V B) with ()l v ..,B ). we obla.in (A v A). whkh is reductd to jus! A. l11e sowulnrss of the re.~ol ution rule can be setn easily by considering the liter.al t. tt1at is complcmenUU)' 10 litem! mJ in the other clause. Jf t, is true. !hen mJ is fal~. and hence m 1 v · · · v mi - l v mi+ 1 v · · · v m~, must be true. beC'o:~usltlonallogk is logimlly t'lflU'mlt'nl to 11 t·mljunctltm of dmlst's. A ~nt cncc cxpres....OO tts a conjmll'1ion of clauses is said to be in conjuncth1e normal fonn or CNF (see Figure 7. 14). We now describe n.
254
Logieal AgenL.~
Scc1ion 7 .5.
255
3. CNF requires -. to :IPIX"M only i.n litcrnls. so we "nl(lve -. inwards.. by repeated appJi· cation of the following equivalences from Figure 7. 11:
-.(-.a)= a (double-ncgruion e limination) ~(cu\{1) =(-.a V ~11) (De MO'llan) ~ $1fi11bol ($ymbol 1 1\•••I\ Symbol1) ~ FaUe
l''igurt 7.J.a
A • rnmmar fCK«Nij1JnctiYc nQnn al fom\,llom clauses, and 4clinitc cl:t.IJSeS. A 1\ 8 ~ C is still a definite cl~u~ wht'fl it is writtl,l as ....... V ...IJ v C. but onl)' the' fom)Cr i11 conskk~ the c-anonic~! fonn forddlnilt: d:wses. 0 1)C mo~ d.UII is tht k·CNF sttltence, whic:h i112 CNF lltnU:ncc whc~ t:aeh d:1uk hti at n)C)!.~A iitcrnl$. A dausc suc-h 2S
2. Infe-rence with Hom clauses can be done through the ron,·nrd-chaining and h:.rk ward· tholinJng algorithms. which we explain next. BOth of tlk'Se algorithms are tl.s arc obvious :u•d easy (or humans to foil~·. 1nis type or inJettnce is the b:lSiS (Ot logic progr L1.t. bt.u it is simpler 10 write just Lu .
7.5.4
Forward a nd backwnrd c haining
The (orward-chotining_ algorithm PL-FC-ENTAtLS?(KD. q) dctennines it: a single proposition symbol q- the query-is entailed by a knowledge base or dclinitc daus.cs. It begins from known facts (positi\'e lilerab) in the knowk-dg_e base. If ;Lilthe premiSt'$ of an implic-;tlion arc known. then its conclusion is added to the set of known facts. For example. if 1.. 1.t and Dn.-eze are kl\0\\'11 :md (Lu A Bruu) 10 B u is in the knowledge bo:l$t'-. then /Ju can be rtddcd. This pl'()(-ess t.'OntintJt"S untillhe query q is ad P. f1gun• 7.15
II is easy to see that forward c:haining is sound: c.-..·e ry inferenc."t is es;scntiall)' :tn appli· cation of Modus l,oncns. Rlnv:~rd ch:'lining is also complete-: eV(:ty elll:'lile/$. model) n"1uniS true or /tJ./.1t
1r ¢\'Cry clause in dltt~.tu is true in model then rttum tr'14e ir S()fne cl~usc: in da•t.~e-1 is f;~lsc in model tht"ll rttun1 /o.l.•·c P,lta/ue- fiNI> ·PIJRE·SYMBOI.(symiK>l•'o daiLff$, modtl) ir P ill llOO•rm ll thtn retunl O J)l,..L(clau.~~ . symboL~- P, model U {P=mfet~}) P,•,al•~t! - ftND •UNIT•CLAUSf.(clcJ•Qt.ot, modd) ir P ill llOO•IIIIII then retun1 O J)l,..l,.(clau.~.• . symboL1- P, modt"l U {P=mfet~}) P ..- J::"tlt ST(.'~"!JI'ibob): rr.~t- R EST(.•ymborl.~)
A complete backtracking algorithm
The fit:).t algorilhm \\'C consider is ofien called 1hc Dtn•i s-IJutnnm algor-ithm. after I he scm· inal paper by M3r1in Da\'i:t :u1d Hilary Pu1nam ( 1960). 1ne algorithm is in fact the vcr.~.ion described by Davis, Logem:mn, and Loveland ( 1962), so we will call it Dl,ll after 1he ini· tials of all four authoo. DPLL l:lkes as input a sentence in oonjunctive normal fonn- a set of clauses. Like BAC" TRAC" INC·SB.ARCII and TT·ENTAILS'!. il is c:;;senlially a recursive, depth·l'irs,l enumcm1ion of possible models. II embodies three improvements over the simple sd1t1ne of TT·ENTAILS?:
.........
Et~rly
fa lse. C\'Cn wi1h a partially rompleted model. A clause is 1.rue if tmy lilet:'ll is true. even if the other litcmlo; do not )'CI ha\·c truth valU(.'S: hencx. lhc sentence a.o; a whole could be judged true even befOte the model is complelc. Fl ltellri$tic: A pure symbol is :.t symbolth:u always appears with 1hc same ..sign'' in all clauses. For example. in the thrt"gic. 'rhc idc.:~s be-hind I;INO·PlfRE·SYMBOL and FIND·UNIT·CLAUSE ~described in the tc.xl: c 0. WALKSAT'Aill C'\"C'flh.l;all) rtfl.im a model (if one exisas). bec:aloi:Sit tht random·v."Jll. '~~Ill C'\'t'ntua.ll)' hit
function WALKSAT(deM.K•.p.,..,.,- .Jft,_.) ~tunu a iO!Ittd)·"'' modd or /oflv~ inputs; cM-ast--•. a Kt ol da~HC"~ 11'1 P'"J'PO'dtOIW loftt p. die probilblllty ol C~I'IJ IO do a ......... •-..It"' 1*'\·c-. rypgJJy afOIIIIId ().$ ,_,. ..Jbpt~. numbn ot ll'f't alkltwrtcd be-few lr\"lftf, up
•odd- .a l'3nCiom a__q;apatn~ ot trwr/J.t~r 10 tht q lbbob • •~• for • 1 1o mu.jft~ do if motkl s.ab~ n.o ...., .• thfon ~um l'ltObl t'lfJw.&~- .a r.andomly ~!«ted ttau..c- from t"lltlll..n llutl,; f.t~ In modd "'ilh protdbility p R1p the' at~ 1n modfl of a randomly ~le«C'd t>)'mbol from clott.u: C'lsc: flip whkhc'\·cr "')'n,bolul rltnU>r maAilfl11t'l> the munber of !1011111\fied cbu"C5
stt of C'OOfbcts IS LqJc.. ..d rartl) used Oft('S are dropped.
4, Jbndom l"tSSarts (as .seen on ~c 124 for hall< lunbln&):
~--
I
can bt soh·at in vo ilh il'lldlige~W bactncting ttw bac'ls up alllht ••~y co tht ~kvant poinl or
not be babili1y drops fairly sharply aR.>und m/n = 4.3. Empirically, we find that the "cliO'.. stays in roughly the same place (for k • 3) :Uld gels sharper :u1d sharper as n increa:~cs. Theoretically, the satisfi ability threshold conj~tu re s.-1ys that for c\'cry J.· ~ 3. there is a threshold r.1tio rk $UCh thai. as n goes 10 intini1y. the probabilily that CNFk(n. rt1) is satisfiable becomes I for all \'alues of r below the threshold, and 0 for all values above. The conjecture remains unprow.".n. I
2M 1!00
~
•••
""'
1tro;l'3m for the W11mpus workl. h uses 3 p~h ional l:nowl · cd;e ba~ 10 infer the 1>1ate of the workl. atk.l :1 ron)blnation of problcm·solvinj. seareh :t1'1d donuin·spcdRc code to d~MJe what actions tO taR.
by n unique binnt)' number. we would ~ed numbers with 1og2(22•) = 2"' biL;; to label the curre•n belief state. That is. exact s-oue estim;uion m"y requiA! logical fomlulas whose size is ~xponemi nl in Lhe number o( symbols.. Ot'e very common and muur.d scheme for llJJPrtJXimtll~ &late e)\1immi01' is h) rel)rtsent bclie(slnte:.o; as conjunctions of lilemls. Lhat is. I·C'I' IF fonnulas. To do Lhis. lhe ngent program simply uics 10 l)f'()\'C X ' and -.)(' (()r c.:'lch symbol X' (as well as each 3temporn.l symbol whose U\llh \•alt.N! is 1l tl Logie
OerfetM>n of 3 I·CNF belie( sL1tc (bokl outline) as :~ llim1>l.y rcpttset'ltable, 10 the c:cac1 (wi"ly) belief g31e (sh:.e.kd rc'-ioo with daj;bed outli ne). 1!3eh I>OS.;;ible wotklii j;hown :'1..-t :1 c:irele: l11e shaded ooes are ron~isu:m v.·i1h 2ll 1he pctttpcs. FIJturt 7.2 1
«w~o.-;er...:uive al>l>mxim•.,tiun
provable litc:mls becomes the n~w belief state. "nd the p~vious belief suuc: is discarded. It is imt>Onant 10 undens1a11d tha1 this scheme may lose some illfonn;uion as time ges along. Forcxrunplc:. if the: scntcnC't' in Equation (7.4) wen: the true bt.'lid slate. then nc:ithcr Pa. 1 nor Pu would be provable indi\'idually and ncil.her would appear i11 thc 1-CNF belief s-:ue. (EJCet(-ise 7.27 explores Ot'le possible sohuio11 to lhis problem.) On lhc Other h-and. because e\·ery literal in the I ·CN'F belie:( slate is proved (rom the previous belief slale. nod 1he initi"l belief Sl"te is a t.nH: a.._~;;enion . we knO\.Io' thm cmire I·CNF belief Slate must be true. Thus. lilt• st'l tlj'possibl~ swus rt'flrt'smu•d by llu• 1-CN/o" bt'li~f stou• incltult•s all SJ(II~s Ilu:u ''re ;,. fiJCl possible gi\'4!" tlte fi•ll f.14!trl:JII fri$tln'): As illusu:.~t cd in Figure 7.21. 1hc I ~ CNr belief state ~ciS a..;~ simple outcr t-tn-tlope. or conSen ·ati,·e a pproxii11UUOn. ~II'Owld the ex:tcp up to l. If the ~ti.sil:lbilil y ;~lgoriUun finds a n~l. then ;1 plan isc:xlr.KIC:d by looking :~t thOt'C p~itiP is asscned itl.SICad. Now. SATPtAN will flrKI lhe plan !Font·anially observable c•wironmem: SATPLAN wo.•ld juSl set the unobscrv:tbk v:u-iablcs to the values it ncl"rOOChes 10 AI are :tn:tly7..cd in depth b)' Boden (1977). Tile deb3te was rcvi\·ed by. among others. Brooks (1991) and Nilsson ( 1991). and contjnues to this day (Shapar.IU ~~ :luJJ ( 1983) showed l.hat the Slune problems could be sol\'t.'d in constam time simply by guessing random a..o;sigrune.us.. 1bc random-generation method described in the chapecr produces much hardl~r problems. MOl ivnted by thco empirical suct.x·ss of local se:vch on these problems. Kou1soupias and Papadimitriou (1992) showed 1hat a sim· pie hill--climbing algorilhm can SOI\'e 11/mosr (1/1 sacistiability problem inst:utceS \"Cry quickly. ~aggcs1i ng &hat h:~td problems are rare. Moreover. Schi.Sning ( 1999) exhibiTed a mndorni1.cd hill-climbing algorirhm whose wom·txiJe expccled run lime on 3·SAT pm'blems (rhm is. sat· is:fiabilil)' of 3-CNF sentell(;eS) is 0 ( 1.33..1"}--:till exponential. but subsW.nliall)' faster than pt\!vious worst-case bounds. The current record is 0 ( 1.324") (lwama and 'Thmaki. 2004). Achlioptas rt al. (2004) and AleklmO\'iCh t•t P) is valid. d. o fJ if and only if the sente-nce (n {J) is valid. e. C). g. (C v(~A A~ D))s((;l => C)A(D => C)). h. (.4 v D) 1\ (~C v ~D v £)I= (.'I v D).
I. ( A V D) 1\ (~C v~ D v £)I= ( A V D) 1\ (~ D v £). j . (.4 V B ) 1\ -.(A ~ B) is satisfiable. k. ( A D) 1\ (~A V D) iss••isfi3blc . I. ( A 8 ) ~ C h.'IS the ~me number of models as (A 8 ) for any tixcd set of proposi1ion symbols th.:u includes A. 8. C.
=
7.6 Pro,·e. or find a coonterex:mlt)le to, each of the followi11g :\SS.Crtions: a. If o )s ~ or /1 I=~ (or bolh) !hen (o A /1) 1•"7
b. If o )2 (Ill\~) !hen o )s /l and o )s ~ · c. If o I= (ll v 1) 1hen o I= P oro I= 1 (or both). 7.7 Consider:\ \'OC:abulary with only four propos.ition& A, B. C. :mel D. How many models :trc there for Ihe foiiO\Io•ing sentences'!
•· /J v C. b.
.-.A v -.B v -.c v -.o.
c. (A ==> B ) A A A
~B A
C A D.
7.8 We have defined four binary logical connooh-es.. a. An: there any others that might be useful? b. ~low many binary COOIX't."'ivcs c;m lhl~re be? c. Wll)' are some of1hem not \'tl)' useful? 7.9 Using a method of yoorchoice. \'erify each of the equiv:'Liences in Figure 7 . I I (IX\8C 249).
7.10 Decide whether each of the following stnte-IX" Fire) -=> ( .....SmoJ.·~ -=> -.Pire) d . Smol.·e v Pire v -.Fire t . (( Smoke A J/oot) o Fire) Q ((Smoke ..,. Firt ) v ( 1/et.~l ~ Fire)) r. (Smol.·e c> Fire) :o- (( Smoke A Ileal ) :o- Fire) g. JJig v Dumb v(8ig => Dumb) 7. 11 Any proposilionallogic ~ntence is logic-:LII)' toquivalcntlo tl~ assertion that cnch pos· s.ible world in which i1 would be false is n01 the case. From this obsct\':ltioon. pro\'¢ th:u any sentence can be wriuen in CNF. 7.12
Use resolution 10 provt the SClUe fiCC -o..-1/\ -.fJ from the clauses in Exetti..~ 7.20.
7. 13 This exercise looks imo 1he rclationshit>between clauses and impHc:uion SClUe•lCCS.
Logieal AgenL.~
283
a . St1ow th:u the ¢13ust ( .,p, v · · · V ..,p"* V Q) is lotically equi~len t 10 the implieC logically equh•alenl. liow 1nany scm:uuically distint'l 2--CNF clauses c:ul be construct~.."Sitio•'31 re.solut ion always tenninatc-s i1' time polynomial inn given a 2-CNF sentence containing no more th:ut n di.> Q. b. Show that every clause (regardless of the: number (I( positive literols) can be wrinen in the foml ( P1 1\ ··· A P,") => (Q 1 V · · · V Q 11) . where the Ps and Qs are proposition
symbols. A knowledge b.'l.Se f.Xmsisilng of such senienc.' ((C => E) v ~£)
7. IS Thill question consitraint graph com-sponding to the SAT problem (-.X, V X'l) 1\ (-. X1 V X :J) A •.. A (-.X,... a V X ,.) fot the particular case tl = 5.
b. How m:~.ny sohuions are there for this ~neral SAT problem as a function of n'?
c:. Suppose we apply 8ACKTRACKINO·S£ARCU (p.'l.g(: 215) to find tr// soh.uions to a SAT CSP of the type given in (a). (To find till solutiOilS to :\ CSP. we simply modify the ba.s.ic algorithm so i1 comin~tC-S sc:trching afler each solution is found.) Assume that V'.lrinbles are ord P«l'ly) V ( Drinl..·!~ => P(lrly)J => !( Food 1\ Or;rli.'S) => Ptt,.tyJ, a. Dctcnninc. using cnumcrntion. whc1hcr this scmencc is valid. satistia'ble (btu not valid), or ullSlltisfiabk. b. Con\'en the lcft·h:md and rigJu-h:u•d sides of the main implication eac-h ste--p. :uld expl11in how the results confinn your answer 10 (a). c. J>nwe your att.w•er to (a) using resolution.
i ~no CNF.
showing
7. 19 A sentence i.o; in dh;j unctin! normal form (ONF) if it is the disjunctioo olconjunctions of lite-r.tls. f« example. the scnt(."llee (A 1\ B A -.C ) v (-.A A C ) v ( B A--G) is in DNF.
b. Whieh of the sesucnet-..~ in (a) can be txpres:$00 in Hom fo-rm'?
(A V 8)1\(~A VC) 1\ (~ B v D ) 1\ (~C v C) 1\ (~D v C)
7. 18
.
a. Any propositional l(lg_ic sentenct is logically equivalent to the assenion that some possible world in which it would be true is in fact lhe ca.eakers c.hosc bt:«'i.al-purpose logics &~''t cenlin li1Kt' of ob~ (and the.' axioms aboullhrm) "firM da~s.. sta1us wi1hin 1he logic, r.tthrr than ''mpty dctiniqg them within 1hc kn""•led~ ba..~. lli jthtr-order logic \•iews the rtiO\ltOfl~ and funclion'i refemd 10 by first-on:ler log~ Mobjcc•s in 1hemsch't$. This allows one lo m ~l.c IL''-t'rtion~ abot.ll all n:l:uions.-for example. on~ could wish 1odefine what it m~an~ for :1 1\'lnlion 10 be ft'lm~ilive . Unlike mMI spcci:.ti·IXIrpo.temologic-~1 commitments.
In the next se lbc= crovm is a person. Ld "' lool c:attfully as lhi~ set of :t:SSMJOOS. Stnc~~:. 1t1 our modrtl. Kma John is che only l..nJ. lk 'oC'C"'nd ~~ assM.S dw he is a penon, as .,.,~~: .,.,ould hope'. 8u1 v.tw aboul
lh: oe.hcr four senttnaS• .,.,ilich appear to rrgtt cb.mu about I~ and C'tO'Iom? Is We p;xn ollhr I'I"'C':InJftl o( ..All~ are persons'"'? In fxt, the ochn four bloC'ftioos ~true in the modtl. bul fNl.( no cb.im v.hauoc:\n about me ~ qu;~hfiQltOM of kp. C':f'OI"'n§. or 1.ndec-d RIIChW. This is because none olthoe obJC(:b tJ l l t.n&- l..ool..an& a1 the 1ruth t1bk for • (Figu~ 7.8 on page 246). we see 1ha1 the •mplalton ., INC' v.hmc\