Artificial Intelligence: A Modern Approach (3rd Edition)

  • 11 9,196 0
  • Like this paper and download? You can publish your own PDF file online for free in a few minutes! Sign Up

Artificial Intelligence: A Modern Approach (3rd Edition)

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 ro

24,215 15,283 88MB

Pages 572 Page size 409.5 x 528.75 pts Year 2011

Report DMCA / Copyright

DOWNLOAD FILE

Recommend Papers

File loading please wait...
Citation preview

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\ •..

P..trcnl and c hild are invcrse relation..::: Parer~t (1),c)

"*

V :r ... ::}

ChiM(~', I)) .

V g,c Cnuu/J)(l'ffmt(g, c) 3 t) Pare"t (g.J1) 1\ Panmt(JJ, f') .

A sibling is another child of one's p.1rents:

f. y 1\ 3p

Parr.~Qrl (:r) .

Axioms can al~ be "just plain facts," such as M(J[e(Jim ) and S(lu.~c(Jim , l.twm). Soch facL;; fonn the Mtde(li)A Spoti.Re{h,w) .

v,),r

Using First·Onkr Logic

HtX

Now we can deline addi1ion in tenns of 1he succe.ssor func1ion: 'lf l)r NalNum( nr) => + (0. m) = m. Vm , n NatNum(m) 1\ NatNtun(n) ~ + (S'(m), n) = S (+(m, t•)) . 1lte first of tl~eSe :l.Xioms says that adding 0 to any n3M'J.I number m gi\·es m itself. N01ice the usc of the binary (unction symbol "'+ ·· in the lcml +(nr. 0); in Ofdin:uy mathematics. the tcnn would be wriuen m + 0 usi•'8 infix not:uion. (The nota1i011 we ha\'e used for fi~ ·Otder 9 'Th¢ P4.11 is I ifand only if any of its inpu1s is 1: 'I g Cntt(g) II 7)/pe(g) = 0 11 => Signa/(Oul( l ,g)) • l c> 311 Sigm,J{Ita{tl,g)) • J . 7. An XOR gate's 0t1tput is I if and only if its inputs nrc different: 'fg Catt(g)A '/Ype(g) • XOR ., S;g,.e(g)ll(k = ANDVk = ORVk = XOR) => Arity(g, 2, I} 10. A circuit has tcnnirULis. up 10 its input and output arity. and nothing be)'ood its arity: Vc, i,j Cir-cuil(c) 1\ .lb-ily(c.i. j) ~ Vn {n :S i => Termirwl(/n(c.n))) 1\ (11 > i => /tt(c, n) = Not/ling) 1\ Vn (n~j => 1'er'l'rlin(Jl( Out(c,n)))/\(rl>j => Out(c.. n}=Notlrirt!J} II. G:m:s. tcnn iMis. signals. g:ate l)'p) II Type(A2) = AND Cote(01) II 7ltl>e(Oo)= OR.

312

Chaj)lcr 8.

Firs:t·Order Logic

8 ,5

Thert we show the connections between them: Connu l« l ( Out( I , X1 ).1n(l , X,)) Comoreled(h o( l. C 1), In( I, X 1)) G' ~( MnpColor(z) = MapColor(y)) . (iii) 'V x. y Cotmlr'1J(x) A Cou11try(y) A 8onlel"$(.t:, y) 1\ ~( MapColor(z) = M•1•Color(y)). (i\•) V:r.y (CourltnJ(x) 1\ Co~tnl,:y(y) 1\ BonJer$(x,y)) => J\la,)Co/or(:r; ~ y).

8. 11

Complete the following exercises about logical scnntenccs:

a. Translate into g001/, ~tamral English (no :rs or ys!): V z . y.l Spea.k5Ltmguagc(x.l) 1\ SJ.'(.'f.tJ.·$Language(y.l) => Vnder.stnnds(:r,y)A Urulertress

x,

'•

x,

7,

~

Yo

x, Y:

x, Y,

•·igurt 8.$

z,

~

x, x: x,

• z. z, Y,

z,

~ I~

~

X,

'• '• Yo

7.!

z,

,.

..z,

A (C)ur•bil adder. i!.'lch Ad, ill ;a one•b1t adder, ;all in Fi.gun: 8.6 on pa,ge 309.

h. Then::: is a barber who shav~s all me-n in cown who do not sh:lve che:mselves.. i. A person born in the UK. each of whose paretus is a UK citizen or a UK resident, is a UK cititen by birth. j . A person bom outside the UK. one of whose p:m::nts i.Iic:~tion for your country. identify the rult"S detennining eligibility for a passpon, :tnd lmnslatc them into first-order logic, following Ihe steps outlined in Sela•t•r. r. E\'ery song that McCartney sing." on Rt'l-·o/w•r wa-. wrillcn by McCartney. g. Gershwin did noc write :my of1hc songs on Remla·er. h. Every song th;1t Gershwin wrote has OC"Cn recorded on some album. ( Possibly different songs arc recorded on difTen:m albums.) i. l11ere is a single :tlbum that cor1tains evc.ry song that Joe hn.s wrlne-n. j . Joe owns a copy of an album Ihat has Billie Holiday singing "'The i\-t:ml Lo''e." k. Joe owns a copy of every album that has a song sung by McCartney. (Of cour1e. each diffcrt.'1lt album is inst:rnti:ned in a different physical CD.) I. Joe owrt Evii(Rir.ha.nl) Ki11g(FMher(John)) 1\ Cn:.:Jy(F(IJiter·( Jol,l)) => Et:il(F(I/her ( .Jol,l)).

INFERENCE IN

9

FIRST-ORDER LOGIC

The rule of Uni n~·.rs.'ll l nslan1iation (Ul for sho11) S.'\)'S lhat we c:t.n iMer atl)' scmence oblai~d by subs-tiiUiing a ~round term (a 1cnn without variables) for the vari;rble-. 1 i o write out the inference rule foml:tlly. \lo't use the r)(ltion of subs titutions imroduccd in Section 8.3. Let S UB.)I(O,o) denote the n.·s ult of applying the s ubstilution Oto the sen tence o. Tht·n the rule is wriuen

In wlti('/t Wt' dfjitre (fft:t:til'e

proc~d11rt:S for

mu u·ahrg

qt~cJtiQIIS

'Vtr 0

jJOSt•tl in first·

ordalogic'.

Chapter 7 s howed how sound :md complete infcn:.nce can be aclaie\'t.-d for propositional logic. In this c hal)ter, we ex1eocl !hose results 10 obl.ain algorilhm:o; that can answer any answer· able question staled in li~t ·Order lo~ie. SectiOn 9. 1 inlroduo')A .. . A SUBST(9.~') implication PI A . .. A p,. ~ q "'~ c:.n infer

S UIST(B.po)A ... A S U BST(9.~ ) •

SU8$T(9,q).

~ow.

9 •n ~u.cd Modus J>onens is dtfintd so tlul SuBST(B.p/)• SI.iasT(I.p.). for a.U t; l~forc d~ fi.s~ of lhcsc t•'O sen1encn ~ lht pcntu;,c ol the ~ t:Ua.ly. IIC'I'K't'. Sl.IST(I. q) folm"'S by ModllS Ponens. ~fll"f'alued Modus Pontns is a lifted '~ion of Modu~ Pontns-lt r.u'I;(S Modvs Pontrn from &:JOUnd ('~·frtt) propos.i1ional IOJ.c to fir~-otdrtr log-c. We "'LU !ott in lbc mot ot th1s t'hOlplff tha1 we can ck\-clop lifted \'Cf'ions oft~ f~a.rd cha..nin&. b.ad:w:atd ch;unil'la. :.nd ~ution algorithms introduced in Ch:~pter 7. The key adVIW'II;age of lifted 1nfc~ncc rules over propos:itionaliz:uion i-(0 th:u they malo.c only thoie sub$tilutions 1h:u a~ teqi.Urtd 10 allow ~kular inferences to proc-ced.

9.2.2

Unification

l~iflcd infcn.•nce rule... require tinding subslitmioni th ~t m!Ll:c: diffel\'nl logical expressions loolo. ldcruk:LI. 11Lis proces.s is c:tlled uniJinuion :uKI is a l.cy componem of ~II ti~.oOrder inference alsorithm!~... ·nu· UNIFY algorithm 1ak~ rwo 'cmcnccll ;u~ returns a unitif!r for t~rn if 01.e ex is~:

UNWY(I>,q)- 8 whtlbstitution built up so far (optional. defaults to ('.mp!y)

~JiJ(IIJJ,t.))

l:.q,-1(Jt.JtkM•.IJ

1~'1(18.1./J(f.()UND?(y) r ln•n rttu rn Us tFY(:r.AR(iS,y,,\R VS, UstFY(z.OI•,y.OP.O)) tlst if l.ISr?(z) a.-d l.tST?(y) tht n retu rn UstFY(r .REST, g. REST, UNtfY(r.l:ntST, y. FtltST,0))

tlse n:tu rn f:t.ilurc function UNIFY· VAR(t.." ttr. s . O) l't'lums n .substitution

ir{n'l'r/t'lll} E Othenrtlum UNI I'''(t'CI/, :r,O) tlst it {r/tVJI} E 0 then ~turn USU·' V(tlll., rvd,O) tlse itOCCUR · CH~CK?(e'(fr,r) then return f:silun: tlsr rtturn ndd {t.VJr#} to Q The unitie:uion algorithm. 1nc algorithm works by compo~.ring the lltruC'Iures or the inputs. dement by tlemcnl, The subslittnioo () th111 is the atg_Unle1ll to UN IF\' is bvill up along the""~)' :.md i,s used to emkt ,sme thatlat~··tf.:OfllP'lriSOilS an: t:oosistcnt with binding,s that wen; established earlk r. In a compotmd cx.pn:$$ion llUCh as F(A. 8 ). the Or field pkk,s out the function symbol F' and the ARQS Acid pkksoutthc 2fl!:lllt)Cnt li.st (A. 8 ).

•' i gun! ?.1

sentence in 1hc knQWiedgc base. 11lc problem we used 10 illusu:ttc unification-finding all facts that unify with KnoutS(John, x)-is an in.s~ance of FsTCIIing. The sim1>1est way I() implcmem STOR E and F eTCH is to l:eep all the facts in one long lisa ;md unify e3C-h query against every ek.ment of the list. Such :a pi"'Ce$$ is ineJticknt. but it works. and it's all you need to underStand the n:..~t of the chapter. 10e remainder of this section outlines ways to make retrieval more effic-ient: it can be skippe-d on t'irst reading. We c.an m»:e FETCII n.ore eflkient by ensuri1lg that unilications are anernp«ed only with sentences that ha\'c .~om~ chance of unifying. For example-. there is no point in trying to unify K w>ws( Jolm . .r:) with Brother( Ril.'.hon.l, Joint). We can a\'oid such unifications by induing the f3C1s in the knowledge base. A simple scheme c:llled p~dica tc indexing pots all the Knows (~IS in one bud::ec and all the Brotlu:r faces in anOlher. T he buc'-keiS can be ston.·•d inn hash table for efficient access. J>rtdj.c:}te indexing is useful when there are many J>redic:ne symbols but only a few clauses for each symbol. Sometimes. howe\•er. a predicate h-tL'O many clauses. For example. suppose th:u the 1:\X authorities wam to kceJ) track or who employs whoen. usielg a predi· cate 6mJ)IO!J$(:r. y). This would be a very large bucket with perhaps millions of employers

(0)

t'ig:u rt ~.1 (2) 1'he subsump1 ioo l~niee whose lowe:« 1)Q~Je is Emplq~(I0.\1, RicllDrd). (b) 1'he !il.lbSa,unption lauice for lht scmenoe Emr}lq'ft(Jt)/m, John).

and tens: of millions of employees. Answering a query sut:h a,..:; Employs( :c. RicJwnJ) with predic-ate indexing would require scanning the entire bucket. For this p.:1rtkular query. it would help if facts were indexed bolh b)' predicate: :uld by second srgumcnt, perhaps llSing a combined hash table l:ey. Then we c-ould s.imply COit~truct the key from the query and retrieve cx3CII)' those facl~ that unify with the qucl)'. For Other queries. such :tS Employs( llJM , y). we would need co ha\'t indexed the facts by c-ombining the J>~d icate with the first argument. Therefo~. f:tets can be ston.'d under multiple index keys. rendering them ir~:uuly :tcces:sible 10 v:uious IBM employ? Em,)Jous(x. y ) \Vh() empiO)'S whom? Em,>IOSitive·lite1'31 l'eSlriclion. but man)' ca11. Consi«r the foliOVo•ing problem: The law ~ys tbat it is a crime for an American to sell weapons to hostile nations. The country Nono. an tncmy ot AmC'rica. has some missiks. and fill of its missiles wtrt sold to it by Colonel Wt.~• . wflo i:s Amcrie:•n.

We will PfO''e that W~t is a criminal. F'in;t. we will rtpttscnt these fac1s as tirs1-order definite clauses.. The next section shows how the forward-chaining algorithm solves the problem. " •.. it is a crime for an American to sell weapons to hostik natiOn5'': Americort(z) A IVcapqn(y) A &lU(a-. y. z) A J/ostik{::) o Crimimal{z),

(9.3)

"Nono .•• has some missiles: · 11testntenee 3z Oum.s(Nono.J:)A Mi$sile(z) is t~sformed into two definite clauses by Existentirtl lnstrtntimion, introducing a new const.:uu .\/ 1:

Owr1$(N01to, J\11)

(9.4)

.!liR3i/e(M 1)

(9.5)

..All of its missiles were sold to it by Colonel WesC:

Mia.rile(x) 1\ Owns(N(mo, ;r) => Sells( IV~t. :r, Nono) .

(9.6)

We will also need 10 know tOOt missiles are weapons:

Mi.ssile(x) =>

Weapor~ (:£)

(9.7)

; lmen'CQ) =>

llost il~(.r;).

(9.8)

··wcsl. who is American .. .

Ameril.'llll( IVest) . '1'1~~: c.-ounuy

(9.9)

Nono. an enemy of America .. ."·

Ent!my(Noflo . America) .

(9.10)

This koowkdg.e ba.o;c contains no (unction symbols and is therefore :u1 instance of the cla.s of Oa t.alog knowledge OOses. 0 :-u alog is a l angu~ that is resrricu~d to fin;l-order definite clauses with no function symbols. Oatalog gets its nrunc blx·;tuse it c;m repn.·~o;cnt the type of ~:nemcnt.s typically made in relational databa..~. We will see that the absence or funcc ion symbols m:tkt.·~o: infC'n:nce mm·h easier.

9.3.2 A simple forward-cha ining algorithm The first forward NatNum(S(n )),

fo r cach b!>~.tetl lh;ti $U&ST(0.1~ A,,, A p,.)= S U6ST(0.pt A ••• 1\ p~) (or SQfne pt, . .. , p~ in KO

Vtl

,, ..... S U6ST(0,q) i.r f/ do\.~ no! unify wilh $Orne sentence :.ln·:ldy in Kl) or m"'u' IIK'II 1 add q 10 IH"Uf 9 - UN"tFY(q'.CI) if 0 is not foil then return 0

then forward chaining :tdds NulNum(S(O)). N(JlNum(S(S(O))). NatNwn(S(S(S(O)))). :tnd so on. This problem is un.'l\'()idable in gener:.tl. As with general lirst·order logic_. ent~il­ rnt.·nt with definite clauses is scmidecidable.

9.3.3

add Jlt-11'1 10 K 8 rtlurn fo~c

•·igun.' 9.J A conccptu;ally Slr.tig.htforward. btn V('l)' ind lk icnt rorward,haining al,go· rilhm. On c-liCh iter.ttioo. it adds to KB nil the ntomic S('ntenc-es that can be inferred i.n one S'ep (rom the implicnzion S('.ntc:n~;es and the :uomit SCniCntlC$ lllrc;td)' in KB. lbe function STANDAR.DIZE·VARIA81..ES n.•pi;K(;S all \•ruil'bk$ in il$ l.lrJUm('-111$ with RCW ones lh;U h;we no1b«n uscd before. C"""-''WtM;f

.l

Aowroh.,(M',~I

w......f""(M1)

I SrliJI! WrM.AI

'The 1>roblcm of matching 1he J)rtmise of a l\lle agains1 the facts in lhe knowledge base migh1 seem simple enough. For example. suppose " 'C want to aptll)' the rule ~..._)

\A

,V.ulk(M )

The forwW·cl"1ining algorithm in Figure 9.3 is designed for ease of underslanding rather than for e ffi c-iency of operation. Thf:re an: 1hrcc- po$siblc sources of incftlc-ienc-y. f':irst. 1he "inner loop" of the algoritlun invol\'ts find ing aU possible uniliers such that the premise of a rule unities wilh a suitable sel of facts in the knowledge base. This is oflcn called Jlattcm mald 1ing and CM be w:ty expensh·e. Second. the :tlgoritlun n.--checks every l\1le on e '·ery itct:u ion to see whether' i1s premises are satisfied. e"cn if very few additions are made to the knowll'dge base on eac-h itemtion. f inall)'· the algorithm migtu gencr.ue m any facts l.hat are im:lev:uu to the goal. We address e..c-h of these issues in turn. M alchinJ:t ruJes against known f

ll'et~J;tOn {:r) .

'Then we need 10 fi nd all the facts Ihal unify with Mi.'/1(n. ot) 1\ D>/1(•1. 9) 1\ 0.61•· ••w) 1\ 0./1(,_, el1 systems. M1my other ~imil:u lt)'Stcms have been b\1ih with the same undel'l)'ini h"t .. ' hnoloi)'. which has been irtt)>lemcrucd irlthe gcncml-puq>Otse language 0 1~~-S . l~luc.1ion systems arc also popular in cos:nilh•t Ul'\"hiletrict forw:1rcl ch:1ining 10 a selecu.-.:.1 Mlbscl of ruks. 11!1 in J)L·I:C-ENTAILS"! (p.:tgc 258). A third 3Jll)roOCh h~ oc emerged in the tlcld of declucth·\' databases. which :u-e large-scale d:uaOO;;cs, hke n:h•riortlll dat:~ba.,cs. but which usc fo~rd ch.ltininr. :as the standard infert:nce tool mther thln SQL qucrb. 'The idca is to rewritc 1hc rule '-d, u.!>inJ information from the 'ool, so that only rclev.nt \'llriablc btndinp-chOSIC' br:lanJ-i~ to a so-alled m~k ~ tpl:!:;':;'_9 :;·~_;1 nfcn:nc~ in Fi~t ·Otder Logic:



Scc1ion 9.4.

£oal ..X ia 4 +3" succeeds ">itb X bound 10 7. On the OCher hand, d.e aoai''S is X+Y.. falls. b«MJSI." thr buLit-in functions do nol do n.r.uy fqualion \01\ .......J ~art' bualt-m prtchcates tJut ha\"(" sHit df«U "hen f\CCUiccl ~ mdude inpuiOUipul pn::d~ and lhe •ssertJretract rmhal~ f01 mocJaf)a!'f. tht tno.~ ""-". Such pmhan U...- no countOiuhon. and all 'ueh brnnche!> ean be soh-ro m 1>ar.tJiel. The ~nd. called ANI).panlllt:lisrn, rome!l from the pos,;ibility of soh•ing e:r.c:h coojunct in the body of :m implic-:ttion in parallel. ANO··~ m ll clhm i'i more: difficuh I() ~hiev~. ~cau~ liOiutions for the whole conjunction n.-quire (01\\i,tent bindings for :all the vari nbl t~. Each conjuncth·e brnnch must communic:1te with the Other brnnches 10 cnsun:= a gJoOOi liOIUiion.

9.4.4

B

C

small·sole AI

-rn>JCme lr:nowledge b.'lSCS. it faiL.; 10 pro,·c K'ntttw:t 111:11 :1re l'ntaill-d. Notice that (o~td cl"'lining does nor suffer rrom thi:( problem: once path (a , b). path (b , c) . and pat h(a,c) :u-e inftrred. forw;m.1 chaining halts. Ocpch·fiN b.1ckward chainins also has problem. with 1\."SC of which invoh•e finding all pos.-lll>t is.~ CLP systems inoorpon.te 'O , Y>O, Z>O, X+V>•Z, Y+Z>• X, X+Z>•Y. If """ as1 Prolo:c the qutf)' triangle (l , 4, S). 11 .,_u«ftds. On the other holnd. if ..-...-easl. tr i anqle( 3, 4, Z ). no solulion will be (ound. b«:au"'C lbt $Ubfcxll Z>•O cannot be twldkd by Proto«: ,..-e can't comp:we an unbound \~lit aoO.

9.5

R ESOLUTION

Tbc bsl of our lhrtt famihes of k>Jcot.l \)"'-tnl'' '"' bbtd on rtie>tution. \\'"c saw on~ lSO tbOJI propositiorW roolulton wmg n:fuu~~ron ~~a compkle 1nfermcc prooedUI'C' for~· tKJRal !ope. In this ~1011. v.-c ~be: hl,w. 10 c-xltnd nosolutton to 6M-ordcr los,lc.

9.5.1 Conjunctin nomud form for llrst-ordtr logic As in the prop IA>ve.•(x,y)J ~ (3y Lo~s(y. .r)j V < )3: ,lnimol(:) 1\ Kill>( )V y ~L•~•(y. Lot~s(JacJ.:,-r) Kili$(Jock. Ttma) V K ilt.,( Cu•iosity. nma)

A.

~ N.N0..:NJII"',.,_U

C. 0.

.lfl-....:.11,1

""'~olv...ow.,_,.__.,,~.~

E.

Cat('l\ma)

F.

V:r Cat(:r) => Aoimal(x)

•• ..u..... - ........ ......

0.•\'~J

~·--.. WJ-ot ~•.._.AafflHJ

-·-

~M(.\1-.U,)V~'"-'i

-.G.

4' .-J'.C•Iution theorem gi\'en in Chapter7. which states that propositional resolution is complete for ground semenccs. 3. We then use a lirting lemma lo show !haL for any proposiliomll resolution proof u.o;ing 1he SCI of grotuld sentences. lhen: is a COI'I"eSpoElding fitst·orroof pro.

MeLhods: for a\'Oiding unnecess..'lty looping in recursive Iogie progr:u"s: were de\·clopcd

tx.'durc. Alan Turing ( 1936) and Alonzo Church ( 1936) simulla tx•ou.sly showt.'rdet logic was n04 decid.:'lblc. The excelle1U text by Enckrton ( 1912) explains all of these results i.n a rigorous yet understandable fashion. Abraham Robinson proposed th:u an auu"Mnatcd f'C:'ISOilcr euld be buih using proposi· tionali~.ation and Herbmnd's thl"'f\"m. and Paul Gilmore ( 1960) wrote the first program. Davis and l~nnam ( 1960) introduced the proposilionalii'.JIIion method of Scccion 9.1. Prawitt(l960) developed the key idea of lcning the quest for propositiona l inconsistency drive the scaroh, and gt"llC-rnting tt·m1s from the llelbr.md unh·1!'-l"SC onl)' when they we~ neO$ition:sl inco1t~ isacncy. After further development by other researchers. this idea led J. A. Robins011 (no relation) to dt..-velop resolution (Robin.~l. 1965). In AI, resolution was adopted for question-answering systems by Cordell Green and Benr.un Raphael ( 1968). Early 1-\ l implementations put a good deal of effon into data scruands of Problems forl'lll-omn PRwers) is a libr:uy of thcorem·pnwing: Jl(oblt 1n s. useful for comparing the petform:ulCC of sy&~ cms (Sutcliffe :utd Sunner. 1998: Sutcliffe er (1/.• 2006). Thoon::m prm'Crs have CQmC up with no,'CI m :n~m:u i cal rcsuhs 1h:n eluded human m:uhem:uicians for decades. :tS de1ailcd in che book AwmtWtt>d R~aslmi11g all(/ tit~ DiscO\"• t'f)' of Missi11g Elt•ganl Proofs (Woi; ;u.d Pie-per. 2003). The SAM (Scmi.,~-\utomated M:1th· em:uics) progmm was 1he firs1, proving a lemma in lauicc 1hcory (Guard ~~ a/., 1969). The A URA progr.1m has also answered opcnq~tions in scvcr.tl area..; of m3thcmatisioo x. Rcwrih• rules are a key component of equational reason·

ing sysrem!l. Use lhe predicme rewrite ( x, Y} 10 teJ)testm rewrite ntles. Fot eKMl J,~.Ihe earticr rewrite rule is wrinC inuodu~ a rep«:!bkm" th;u snte.. up to probkms tfw could oot be h.mdlcd by those: earl•n npprooches. khon I0.1 de,·cklps :an e~ive )'tl ~fully ~tr.arned 1~U3ge for representing pbMrns ptObkms.. 5«-tion 10.2 :silO'A-s heM forwo-.d and bod.•W '(i('Mt'h alpithms can L1lt' ad\.nl~t of this ITpm;tnlai.M>n. primarily ~ a«ur.ale heurilCia lh=ll ean be~ auKJnWI(";lll) from tbt- SIJ\IICtUrC' oltbt- ~lOR. (l'h1s rs co 1ht .....,)' m •'hkh eff«''.n'e dom-aan·inckpmdenc hcvtislia: ·~ constnK'N (Of C'(llbiDAnl3o;llli:)fxtion pt(lblcms tn ~pen 6.) S«t110n 10.3 sbcrr.-os 00.• ~ dlla wue1un: calk-d Lhe planrunJ Jraph nn mate lhc' -.e::utlion means that 7M~ck 1 and n.,it'kt :art: dbtinct. The following llucnts :u~ um allowed inn lltatc: At(r, y} (because it is rl(}n-g.round). -.poo,. (because it is a ncg:uion). :rnd At(Nrthf·•·(f 'h'rl), Sylirli"U) (because it u..o;es :t function ~ymbol). The reprtSlnne from one location 10 mlOCbcr:

an»ocous

10. 1

In response to Ibis. pl:itlnina ~arthtf' tQ\·~ ~ttltd on a factort'd l't'PI"'C'St.ntatiou·OM in "'hich a state of tht is I'C'pR:st:nkd b) a coll«tton or \-ari.:l.bks. We USt" a l;;an&u:..~

D EFINITION Of CLASSICAL PLANN ING

Actum(Fly(l>.from, to), I,Recmm:Al(l'·/mm) 1'1 Plmu'( /)) 1'1 A•f?JOrlUI'Om) 1'1 Airport( to) Efl'ECT: ~,u{p.f,..m )"

'l'he problem-solving ~enc of CMp1er 3 can find M.XJUCrM:c~ of aclions lh:at re~uJt in a g.

"""

Jlt(t>.to))

The schema consins ()(the ac1ion nanl(. :a JJ,I of all the v;ui:ables used in lbc: schema. :a pl"t'l"''ndition and :an dfc.'CI. Afthouah 'AC ha\·cn'l '\tid yet how the :action schema convem into log.ical sentenec:s. think of lhe vatrlny Vl~riablc~ in a are universally quanti tit-d. 1::-o r ex:unplc,

_ _ _,.,.

oam:t* M:O~

1ft•, from, to ( Hy(p, from, lo) E ACTIONS(•)) .,. If ~ (At(,,, from) 1\ PlfUlt:.{ll) A Air}JOrtUmm) A A "'liOrl(to)) We \:l)' th;n l.c'tion o is upplic-11ble in state li ir the l)~cwldition" are ~·li~lled by .,, When an IK'1ion M:hc:m:a tJ contains variables, it msy h:wt multiple applka.bloC in~ant i:rtions. For namp~. wi1h 1he initial Slate deftned in Figure 10.1. lllr' f1v action cube instamiated as f'fy (P•• S,.~O . JFK ) or a.'l Fly(P2,JFK. SFO). bolh or •hkh ~ apphc.abk- IU l..tw! inilial Me in which that action is \'Cf)' rek"Vrutt to the go;LI- it gets us IWO·thirds of the way there. But it is not rtlc''-'nt in the 1cchnical sense defined here. because this action eould noc be the fmal step of a solution-we would always m."Cd at least one more SIC!) to achieve C. Gh·c-n tile goal tlt(Cz . SFO). sevt.'f".ll in.;;tantiation." of U11lood are relevant: we could chose any specific plane to unload from, ot we CQuld le:wc 1hc plane tutspccitied by using the action Utrl.ood(C2,tl, SFO). We can reduce the bmndting f:t1.1or witl.out ruling out ruty solutions by always using the ac1ion fonned by substituting the most general unifier into the (standan.:JiZi..'d) 3CLion schema. As ) A E(ltf"ll( ('aJ.r) will IX" 0 + 1 = 1. whereas the COI'1'ttl :.ru."er is 2• .ac::hie''ed by the piJn !Eat( CaJ.·r), OtU.t'( Cal.t )). 11lat dot$11'1 see.n 110 bad. 1\ mon: sc:rious m-or i.o; 1h:u if Bakt{ Ca.l.·t') ~o~.ere no1 in the M:'l actions. then the pear. then: i.s no plan). but if 9 docs appear. then all the planning gr:tj)h promises I ~ 1 h~1 lhcre jo; :1 plan rh:u f)tMsibly a~.•hievc~ f1 :uKI h:IS llO "obvious.. na.ws. An obv iou ~ fl nw h dell ned as a ltaw that can be: dc:tCCicd by con!iidcring two ac1ions or cwo lil ernl ~ a1 t1 tinle- in ocher words. by looking. at chc: rnutex rtlatio.\s. 'Tlwre oould be more subtle flaws ilwolvlng three, foor. or more :IClions. bu'l CXJX"rience has shown lhat it is 001 wo11h lhe Clate. The positi\"t': fluem s fR>m rhc problem reJ>enl in $ 0, !oO we tw.-ed 1lOI c:LII Ex·rRAC'r-SOLUTIONwe are ctrtain lhat there is no soluliOft )'Cl. ln,le:•d . EXI•ANO•GRAPII adds into 1\o the three :telions whose preconditions exi'i.t :tllcvtl So (i.e•• alllhe acllotts except p,lQn(Spn'-r, A:tlf')). IICN\g with persisr.ellC'PIIRl tiRl probkm ufltr t..'(J~*'~M>nto k:''tl S 2 •

tl.l utu l lnh art .!o.IM>\\n M Jr.'l)'lil~~r:s. Not all linl:.'\11\'i .,J)C)\\1', b«'u...c the ~IUU C'rrd lr~f: 4~·ed thtm

'fl"'"'

would)).! 100

:siL Tht ~W>Iu tion i~ ind ic'~tt'd by bokl ht~\ a1'1d atulh-.r~.

• llltrrfrrrmY: Rrmot!((Flal, A:dt!) is mu1ex with L«wtOtv-n~tgM lx-cau!it one has the prcccwhtion Al( flol . A.z:le) :and lhe othe-r h:H iu nt'J;ahon a,*" effect. • Contpt'tt'nl nuJs: Pu.tOn(Spart'. Azlt) h. muiC':'- ~•th Rrmotv(tloi. Azk) bec-ause one has Af(FIAl. Azlt:) as a prttandition and ahe ochn' has tb rqaLM'In. • lnNJ~Uuttnl appon: At(Spon ..ol.zl~) is mule,; ••th At(Fl•t . .1h k) m S, bcausc tM only •-.y At(Spo~. Adiect of C:tJJ!:O we load. fly, and unload. and for aUbut the last pie« we need 10 ny ~k 10 airpor1 A to get t~ nex1 pte«. How long do we ha\e co L«-p eAp;u' "'ill the action. • MtllfJ't'S dt't'fr'Wit' monmonicolly: L( two:.etion~ are mutex :u a gh't'n lt'\•el A,.then they will \\l'\0 be: m \IIC'X for all pre~·i(}tiS le\·el.s :u which they both nJ)JX'Ilr. 'Ole S..1nl(: holds for mut exc~ bctwef.'n litcrnls. h migltt not :tlways appear thul wuy in the figures. lx.-.:ause

1hc llg" rc'- have a simplification: ehcy di..tpt :~y ncilhcr lilcral'> that cannot hold a1 level S, n()r :~tCiQn~ chat cannot be ex«uted at le,•el A•. We can ~e that ··mutexes decrease nlOilOIOflically.. i" true if )'OU consider that t~ invitd,.e htet.'l l ~ >'nd actiorlt 3~ mutex \\'ith ~·erything. 1'he proof can b! lundkd by cases: if :Ktton.s A and 8 1m: nMc:c. nl Jn·el .4•. it muM tx- becou•~ of one of lbe lhttt t)'ptS of mutn 'J'h( flnttwo. tncofbblml df«U and uUrfC"''n''«, ~ propenies of ttr actions ~l\C", "0 1f the xtion." ~ mlllex 11 .4,. tht) '41ilU be muk'x a.nuy Jn~l The thud~. ll>b of lllr.'li~;ht(orward steps:

• Propositionalile the actions: repl~e ueh :w:tion ~>C:hc-ma with a sec of ground :.ctioo~ formed by substitutin' cotm~nb for ~:;.eh or the 't'Jtbblc' if their :11:111 and actions are the s~me : ( RESULT(&. a) a Re.SULT(.s',a')) Q (s • s' A a • a'). Some examples of at"! ions nnd situations :1tc sh~·n in Figure I 0.12. • A function orrelatio•' th:.u c:u1 vary from one situation to the 11)

• E.1ch fluent is describc,. .. )¢ A 1 (y,. . .)

390

Chapter

10.

ClLAN. :ukJ FF have mo\'ed the field of plnnning fonvovd. by ~ising the le\·el of pcrfonnance of planning sysu:ms. by clarifying the repre· selllntional :md combinatorial issues in\'olvcd, :ukJ by the development of useful heuristics. HO\\'e\'Cr. thett: is a question ofhO\\' far these techniques will scale. It seems likely that funMt progress on larger problems cannot rely only on faetored and propositional rcprescntalions. and will require some kind of synthi.'$iS of first-order and hiemrehieal re presen t~ations with the efficient heuristics currtntly in 11se.

algorithmic approaches for solving them. 1'bc points to reme mber.

We described

1~

POOL rtpresti\Lfllion foi' plaMing ptoblems and se\'tl';ll

• Planning system." ;are problem-sol\'ing algorithms thai operate on explicit propositional or n.:la1ionaJ rtpreSritllms (2006) rovers both classical ;lnd stochas:tie planning. with extensive coverngc of robot motion planning. Planning I"C$CM'Ch h:tS becrl central to AI since its ince,xion. :l.nd p.,pcrs 011 piMning are a staple of mainstream AI joumals nnd conferenc.'t's. 1'bere are also sp:cialii'.cd oonfercnccs such as the lmemalional Collference 011 A I PlaMing S)•srcn\S. the lntcmalional WOt'kshop on f>lam1ing and Scheduling for Sp.'l, JFK) 11 At(P2 , SFO) 11 Ptmre(P1) 11 P/o,.e(P2 ) A AirJJOri(JFK)A Airport(SFO) '! 10.3 The monkey-and·banan:LS problem is faced by a monkey in a 1:\bor:UOI)' with some b.m.'lna." hanging out or ~3C'h from the ceiling. A box i.." avaibble rhar will enable rhe monkey to reac.h the OO.nMas if he climbs on it. Initially. the monkey is a1 A.1he brulanii.S at 8. and the box ru C. The monkey and box hnve heigh! Low. bur if the monkey climbs onlo the box he will have height lligil. lhe S:'lti)C as rhc bananas. The actions available 10 rhe monkey include Co (rom one place 10 another. Pu.blem. sussw.-.NI()f.IU

10.7 Figure 10.4 (psge 371) shows a blocks-world problem 1h:u is known as lhe S ussman ano1naly. 11-e problem was ' cli.''lncnl

of yuamnt«d

re-turn 0 1iCOM POS~lucm rt:llfl, f'roblr·m, I NITIAL· STATE. plo11 ,finol$1tJLc) llln - ~nc lll.J.\ in plan J~rt:fiz, snffi.r - the aceion subscquen«s bcfate anc,l after llln in pion ror t:~th ~ltltlt'll« in R i;fo1SEMENTS(Iila,onloo-mt",lll('rQI'("hy) do /•vn tu~r - IsS ERT(A Pt>F.N u( p1Y'jiz, $rtJ•ten«:•.•·uffu), / ronh('r')

run('tion 0ECOMPOSE(hiemre/ly.8o.p/on.$J) rrtu.rns a .solution .~utior~ - an ctnjlt)' t~lan "''ile plan i$ !'tOt ctnpt)' do

artum- R£MOVe·LAST(plan) ·'• - a state in R£ACtl-($q, pl4n) sudl th3t stE R .;:Acu -(.~.. ~tction ) problem - a problem wilh I NITIAL·STATti • $ 0 a.nd COAL • $J

s,-s.

415

quence and prunes away the other options. Notice that c leaning a set of rooms by cleaning e3C'h room in tum is hardly rocket science: it is easy for humans precisely because of the hierd.rchical SlruCh•re of the task, When we considef" how difficult humans lind it 10 solve small puuJes such as the 8·J>U7.:t:lc, it st..'t'lns likely that lhe human capacit)' for solving com-

run c:tion ASOiiUC·SEARCII(problt'l'n. liicmrchJI. in1lialPtan) n:tums .solution Of fail

i(

Planning and Acting in Nondetenninistic Domains

11.3

PLANNING AND ACTING IN NONDETERM IN ISTIC DOMA INS

s()/tdi.on - A PI' EN 0( ANGELl C· StiARCII(problcm. hierorc/1y. odion), $oltlllion)

nh1.rn $()/utio" A hier:arehkill pll.lllning ;dgoritJun tho•t ~ses wtgc:lic SC!lnantic$10 identify ;~nd cofllmil t Q l•igh•k \'c:l pl;ms. th;~t wort while 01\'0Wing high ·lcvel pliln~ tl1llt doon 't, 1'hc ~i· eatc M AKISO·PR001tti$S c heeks 10 n~;~.lcc: sun: th011 we an:11 't sh•e k in an intlnilc ~3n:ssion o( refinement.~. At top ic~·c:J, call ASVEI.tC· SEARCU with (AdJllS the mihalPlotl ,

•'iJ;un: 11 ..8

goal through the linal action. The ability to eonunit 10 or reject high.Je,•el plans ea11 give ANOELI(>SEARCII a signific:mt computational :.dvantage over HIERARCIHCAL·SEARCII. which in tum rna)' h!l\'C a l:uge a.c:-rccpt5 it will obtain when il is executing the plan. Ttl.:: percept will be supplied by the agcn!'s sensors when it is actually acting. bul when it is pl:;ltlning it wiii i'M."'4."d a model of it..:: sensors. In Chapter 4. this model was given by a funclion. PER CEPT(~). For planning. we sugmenl I,ODL wilh s new type of schema. the J>tn:tpt schema:

Pem:pt( Color(7, c), PROCONO: Objocl(.c) A In \fiew(z) Perr:ept( Color(can, c), PROCONO:Cari{l.oquenccs and a nonnc-gligibk chance of happening. Thus.. a car driver contempl:uing; a 1rip across the Sahara: docse-n shoold make explici1 comingency pl.:ms for breakdowns. whereas a 1rip tO 1he supenn:utct requiteS less :tdv;uK"¢ planning. We 1\C:XIIook at each of the thn.- t approaches in more detail.

11.3.1 Se.nsorless planning Section 4.4.1 (page 138) inlroduccd the basic idea or sesrc-hing in belie(-$1.:tle sp.'tcc to find 3 solulion for sensories..; problem..... Conversion or a sensorless planning problem 10 a belief· Sl:tte pl;uming problem wtks much the same way :.\Sit did in Section 4.4.1: the main differ· ences :ln.' that the underlying physical transition model is reprcscn1ed by a c:olle, = Color(z.C(z)) II o,,... (c...,, II Color(G~····.C(Co.. ,)) A Color( TaWe. C( Can 1)) ,

The linal belief state S.'llistles Ihe go.'ll. Color(Table,r) A Color( CJ.oir, r). with the variable c bound to C(Canl). The pn.•ecding analysis of lhe upd:ate mle ha.ersccs of previously visited belief states is also ~y. :n least in the proposi1ional case. l11e tty in the ointmc:IH of this l)ku:\Jll pic;1ure is th,;u it only wMs for :ACiion schali.. our belief :~-.tate manageable. There is anOther. quite diffe.rent il.J)pt(t~ch to the J>roblem of unmanageably wiggly be·

lief states: don't bother computing them Ill all. Suppose the ini1inl belief state is bo and we would like 10 know the belief SltUe resulting frorn the .-ction sequence la1... • ,a ,~l · lnsteOO of computing it explicitly. just represent it a..'> ···~Jo then la1.. .. ,a,...J:· 1'bis is a laZ)' but un· ambiguous reprtsent:lliOil of the belief state. and it's rescnlation of HLA.. :; and :u1gelic scm ~uttiC$ is due to M;uthi tt (1/. (2007. 2008). K;unbh:unpati d lil. (1998) have pro~ :u1 approach in which decompositions are ju~ another fonn of plan refineme-nt. simil:t.r to the rclinc-mcnts for non-hierarchical paniaJ-ordcr planning. Beginning with the work on maci'Oo(}J>erJtM in Sl'Rti•S. one of the goals of hier.m:hical plarming ha.o;l)e.en the reuse ofpre\'ious planning experience in the fom1 of genemli7.ed plans. The technique of tx(JI:-tn:~lion ·b•lStd ltolnling. blcm of eomingcm planning rceei\'ed more anemion after the publication of Drew McDermott's (1978a) influentiaJ art ide. Plmwlng and 1\ cting. llle contingent-pl:ulning approach described in tl~ chapter is based on Hoffm:um :uld Brafman (2005). and wail influenced by the efficient SCt~rdl algorithms for C)'clic AND-QR g,rJphs developed by Jimenez and Toms (2000) and Hansen and Zilberstein (2001). Benoli et lll. (2001b) describe MBP (Modci·B a.~d Planner). whic-h uses binal)' odeci..o;ion diagrams 10 do confoml:Ull and COrllingtlll planning. In retrospt'C1. it i..o; now postoiblc 10 sec how the major cla..;sical pl:utn ing algorithms led to extended ve-rsions for UJM.'C!nain domains. Fast-fotw:trd heuristic search tltroYgh state sp:~ce led to forw.ud search in belief space (Bonet and Gcffntr. 2000: Hoffmann n.nd Brafman. 2005): SATPLAN led 10 ~ochastic S1\T PLAN (M.-jeteik :tnd L-ittman. 2003) .-uld 10 pl:u1ning with quantified Boolean logic (Rinlnncn. 2007): panial o«~

l11teme1i\'e Planning and ExecuLion monii(Hing) (Wilkins. 1988. 1990) \V3S Lhe firs1 planner

Vlassis (2008). and Sllolmm and l.e)'IOil·Brown (2000). There is :m :mn'"" conference on

to deal systematically wil.h the problem of n.•pl:mning. II has lx.'t'n used in dcmonstralion projcciS in several dom:Uns. including piM11ing opet'Jtions on the nigh1 deck of aJI aitcr.lfl carrier. job-sl1op scheduling for an Austr.llian bc."ednault (1986) g.ives a STRIPS•St)'le et of the goal set: can an)•thing be concluded aOO.u whether 1he plan :tchieves the go."'J'? What if 11~ pes· simistic reachable stl doc:s-n't intersect the g.oal se1'? Explain. 11.5 Write an algorithm 1h:u takes an initial Slate (spec-ified by a set of pi"(>J)OSitionttllitersls) and a sequence of IU..As (eac-h delincd by pn.'Conditions and ;mgelic specitic.ations of opti· rnislic and pessimistic reachable scLS) and COfiiJ)lltes optimiSiic and pessim istic descriptions of the tt3Chable set of the sequence. 11.6 In Figure 11.2 we shO\\'l"d how 10 describe actions in a scheduling problem by using scp.tr.tte lields for D URATION. USE. ;md CONSUME. Now SuPJ>OSe we wanted 10 rombine scheduling with nondetcm~in istic pl:uming. which requires nondetenninisl ic :mel conditional effects. Consider e:teh of the three fields and explain if they should rtmain se~r:ue lie Ids. or if they should beoome cffec~s of the action. Gi\'e :m example for each of the thn.'(:. J I. 7 Soane of the opI.S- !IuI"Cd:thlalloo o( 1hr UJ)ptr Otle. Spt'tructure of t~ circuit remains con..lant, A more 'ctM:"r.al ontolo;y would con,kter ,jg..:•ls: at particular times. and would include the wire lc•,gth"' and pi'Oj,ag:.uion cJe.. lay\, 11U!> W'OU id allow US 10 $imulate the tim ins ptc>pCfl~ Of d't Cll'tUil. and ind«d such ~>irnulahon' are often carried OUI by cil't'Uit do.i~ We could 1ho inlroduee mete incer· ~••n& Cb.l>!ol"..' o( p1cs. for example. by descnbmc the 1echnolosy (Tll.. CMOS. and so on) a,. -.dl ~ tht inpu1-ou1pw specifieatioa. lf -.e ,. *lk'd to di.)('U\3< rdaablhl)' or dla.gnosis. \\C -.-oukt lft('l\dc lhc posstbthty thai the SltUC'tlltt o( tht ('1ft'UII 01' lhc fl'l\lPI:'I1k!J; o( lhe piC'S m•cN ddn&c -'fJOIII.Jni!OUSiy. To X"CCUUO (or SU'a)' ~run«s. "'f -.--ould need 10 ~d -.hrft- ~ -. ~ are on lhe boatd.

bdon,mg 10 the cl;ass of pts, ~h tu\anJ dtffm-nl propat.o. SmuJ;uty• .,.,..... m•Jhl 'tlt;""OlniiO allolA fot other anim3l:s besiock:s 1Autnf1U~'- II m(Jht no4 be possibilt 10 p.in ~·n the CXII!Ct sp«ir:s (rom tht aqjlable perttpl~. ~ 'AC -.ould DC'Cd to buLid up a bioiOJical l~' of philo9>phical and cornputalion:tl invt"1:· tig:uion. the answer is "Ma)'be." In ttli .. M'ttion. we I)~SCrtt one gcncml ·pu~ ontology th:u S)'nthe.sil'.cs ic~:ls rrom d~c ocnn•rics.. 1Wo m:titJr c:h:m•cteristics or gcocrnl·pui'J>OShould be :_t,plicable irl more or less any speci:al·l)tJJ'I)O.!oC domain (with the addition of domain·,pcdfic axioms). This means that no rcpre~ma · tiona! issue can be finessed or hn1.JlCXI under lhe c-arpet. • In any sufficiently de:m:llfw,lln& domain. dJffC'rmt arc.:u ol k:nowkdg.f! mus1 be ttnjfit'd. bttause ~asonins and problem -.olun& cou&d ul\oh"C SC'\"Cnl an-.as simuh::tneous:ly. A roboc eirwit·rep;tit S)'.,.~m. for i~.l'l«ds to reason about eireWu in tenns of dec· tric;aJ ronnecti\ity :and phys.italla)'OUI.Ind about tlJU('. both (or ci::rcuittimin& aroi)'SU aod cscilmling bbor C'OSb. The- 3-tn~ ~.,.,., tune themorc muse be tapabtt ol beins oombined ~'llh 1host dticnbtn& ~Jal byoul and must v.odi: cqa;aJJy v.ell for ~ :tnd mlnulC'S and for anc..trom" and meters. We should s:.J'f up front •tw 1M c-ncC'rpn~oe ol aener.al ontoloaic:al Cft~inttring h;ls ~ f~ h;Jd only limited success. No~ o( the" top AI a.pplar~ (u listed in Cbapcer I) mal.:C' u.~ of a sfw'ed ontology-they :all U'\C lipcd.al·purpo!'t' linowlo:lge cnginec-rin..,g. Soci:ll/political eon~idcr.ation.s c:m make it difficult for eompchll$ p:anae-s to a.gtte on an o ntology. As Tom Gruber (2004) S3)'$. "Every onto!~ h a lf'(ILI)' - :1 M.Xial at,rteml."'lt-:unong people with somC' common motive in s~ring;· Wl1en COIIlJ>clint; conttm.1 ouawcigh the mociv:uion for sharing. there can be no common ontolog)'. 'l'll())C ontologies that do exist have lx"t'n cre:1t1.'d alor1g four routes: I. By a tc:un ortrnincd ootologhtJ1ogicllul,, who :ll\'hitL•t•1 II~ ontology and wrile axioms. 11lc CYC sy~cm w~!o mO!>lly t-.uill thh wa)' (l.cn:u and Guha. 1990). 2. By imponing categ~. auributC"~. and \'atuc.., from an cxis1in.g d:uabasc or databa~;;. DBt>EDIA was built by import inc 'tructured race~ frotn Wikipedia (Bizet~~ ol.. 2007). 3. By pamng kXl documeru"' and C').lniC'III'IJ•nfOnnllion from them. TEXTRUSS£R \\'Ol~ budl by re;adin.s a LarJe rorpus of \\'f:b pq.~ C8anl.o ll1d Etzioni. 2008). 4. 8)• enticmg unstiUed an'I.JieUI'i to t"nkr oocnmonstn5oe tno\\kd£e. The OP'E.,~h'D system "'-u budt by \'Oion~ttn •ho prerccpcual inp.n, in fe~ categ()()• membership from the percci\·ed proper· ties of the objects. and then use..- category infonnation to make predictions ~1boutthe objects. For example, from its &1\.'Cil and yellow monied skin, one· fOOl diameter. ovoid shape. red Oesh. bl:K'k Si.X-" Splterical{x) 1 T..-nin.g a proposition in1o VI obj«l i$ enies.

Dogs E Dom ~li('.aUdSJH!Cies Notice that because D()f}s is a c:ucgo.y and is a member or Domt$titXJ,lt'f.ISpecies. the Iauer must be a car~gory of carto,gorit'S. Of course there are exceptions to many of the nbo\'e rules (p4mctured b•••s.ke«balls are not sphcrie:~.l ); we de.'ll wi1h these exceptions la•er. Ahhoug.h subclass and member tc.latiOilS :vc the mos1 impon:uu ones for /nler'$etlicn{e-1.Cl)= {)) E:rhaustiveDccompo.sition(s,c) e (Vi iEc 302 qesAiEq) Poration (.~.c) # Di$j

3t, ,t,.o L Pn,.tOj(.&, IJuncllOf(s)).

Funhennore. BunchO/(s) is th~ .fmllllest obj«t .mtisfying thi.~ ctmditimr. In other words.. Bun~hOj (s) muse be pan of any objc(l 1ha1 has all tl'te clemcn1s of s as parts:

Vy

fVz

xes=> PartOf(x. y)J => PortO/( Bu,doOf(,,),y).

These axioms are an example or a g2 € £urt:i$e.~ A iVrote(Nonrig,t> 1 ) A 1Vrote( R~t..~dl,l'1)

-=>

Difficully(e l) > DiDiculty(e2). e, € EzeJ'Ci.~e." A e2 € Eun:i$e.~ A Diffic-~tlty (el) > Diffic~tlly (e1) => &peeteJSoo•~(c1 )

< E,...teJSoore(e,) .

This is enough to allow one to decide which exeR:"ises 1odo. e,·en lhough no numerical "aluc-s (or difficulty were ewr us~..-d. (One does. howi..'\'t~r. have to discover who WTOie which exer· ciscs.) These sons of nwnotonie relationships among measures fonn the basis for the field of quulitntin.' physics. a subfield AI that in\'e..;tigates haw to reason about physical systems without phmging into detailed equations a11d numetic.'ll simulations. QuaJit:t.ti\·e ,mysics is discusse-d in the hisaorical no•es sctlion.

or

_...

.....

or

bE 011ltet'l\ PartOf(l),b) -=> 1> E Buller·,

We can now say that butter mi.'lts at around 30 degrees centigrJdc: bE lJ•,aer => Meil;,,!JP()ir~t(b, Ccnligmrlc(30)).

We could go on to say lhitt buut·r is yello\v, is les.s de-nse than w;llcr. is soft at room temper.t· lure, has a high fm eotllent, and YJ on. On the 01hcr hmd. bt111cr has no P.'H1icular size. shape, Or weight. We. t members all butter-objects weighing one pound, is not :. kind of sm.ff. If we cut a pound of buller in h."LLf. we do noc. alas. get two pOunds of buncr. What is actually going on is this: some properties :ttc intrinsic: lhC)' belong to the very subs1ance of the object. r:.uher 1han to the object as :.l whole. When you cut .m instance of .miff in half. the 1wo pieces retain 1he intrinsic propenies.-things likedenj;ity. boiling point na"or. color. ownership. :uld so on. On 1hc tMhtr hMd. their extrinsk- propenies--weig.lu. length. shape. n.lld so on- are not re1aim'tley) is an ob· jt,"t"' that reftn; to the fact of Shankar being in Berkeley. but does not by itself sa.y anything about wht."lhe-r it i.>< true. To asse-11 th3t a fluent i.s a