Pusdo Code Ai

Loading...

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

0 comments

Post a comment

    Post a comment
    Embed Video
    Edit your comment Cancel

    Favorites, Groups & Events

    Pusdo Code Ai - Presentation Transcript

    1. 1 INTRODUCTION 1
    2. 2 INTELLIGENT AGENTS function TABLE -D RIVEN -AGENT( ¨§¦¤¢  ©  ¡¥£¡ ) returns an action static: ¨§¦¤¢  ©  ¡¥£¡ , a sequence, initially empty ¤¨© ¡   , a table of actions, indexed by percept sequences, initially fully specified append §¦§¢  ©  ¡¥£¡ to the end of¨§¦¤¢  ©  ¡¥£¡ % # \" © ¥ &$!! L OOKUP( , ¡   ©  ¡ ¥ £ ¡ (§'¨© ¨§¦¤¢  ) return $!¤ # \" ©¥ Figure 2.8 function R EFLEX -VACUUM -AGENT( [ 4!$¨2 $!10)  3© © # \" © ¥ \" , ]) returns an action if 7© £ !§6 5 4!$¨2=  3© © then return 9¥ ¤¢3 8 else if # \" © ¥ \" $!!$0)@ = A then return © D C '1@ B # \" © ¥ \" E $!!$0)@ else if = then return ©G 0H¡ F Figure 2.10 function S IMPLE -R EFLEX -AGENT( §¦§¢  ©  ¡¥£¡ ) returns an action static: §(I§£  ¡ 3 , a set of condition–action rules P1¨0 % ¡© © I NTERPRET-I NPUT( 02§¢  ©  ¡¥£¡ ) % ¡ 3 P(I§£ RULE -M ATCH( ,  ¡ 3 ¡ © © ¤4§£ $Q0 ) %&$!! # \" © ¥ RULE -ACTION[ ] I§£ ¡ 3 return $!¤ # \" ©¥ Figure 2.13 2
    3. 3 function R EFLEX -AGENT-W ITH -S TATE( ¨§¦¤¢  ©  ¡¥£¡ ) returns an action static: $Q0 ¡© © , a description of the current world state §(I§£  ¡ 3 , a set of condition–action rules #$!¤ \" ©¥ , the most recent action, initially none % ¡© © P1¨0 §¦§¢  $!¤ $Q0 ©  ¡¥£¡ # \" ©¥ ¡© © U PDATE -S TATE( , , ) % ¡ 3 P(I§£ RULE -M ATCH( ,  ¡ 3 ¡ © © ¤4§£ $Q0 ) %&$!! # \" © ¥ RULE -ACTION[ ] I§£ ¡ 3 return $!¤ # \" ©¥ Figure 2.16
    4. 3 SOLVING PROBLEMS BY SEARCHING function S IMPLE -P ROBLEM -S OLVING -AGENT( R§¦¤¢  ©  ¡¥£¡ ) returns an action inputs: R§¦¤¢  ©  ¡¥£¡, a percept static: 2 S¡ , an action sequence, initially empty $Q0 ¡© © , some description of the current world state 1)'C   \" , a goal, initially null §(§'¦  T ¡  \" £ , a problem formulation U PDATE -S TATE( , ) P1¨0 ©  ¡¥£¡ ¡© © % ¡© © 02§¢  $Q0 if is empty then do 2¤ S¡ F ORMULATE -G OAL( $)C % \" ) 1¨0 ¡© © %UT¤¤2R  ¡  \"£ F ORMULATE -P ROBLEM(   \" ¡© © $)'C $Q0 , ) T§(§'\"¦£  ¡ S EARCH( ) V2¤ % S¡ S2¡ F IRST( ) &$!! % # \" © ¥ R EST( ) S¦¡ W2 % S¡ return $!¤ # \" ©¥ Figure 3.2 function T REE -S EARCH( , T ¡  \" £ §(§'¦  7 C¡© £© $Q12!0 ) returns a solution, or failure initialize the search tree using the initial state of §(§'¦  T ¡  \" £ loop do if there are no candidates for expansion then return failure choose a leaf node for expansion according to $Q12!0 7 C¡© £© if the node contains a goal state then return the corresponding solution else expand the node and add the resulting nodes to the search tree Figure 3.9 4
    5. Figure 3.17 if then return £ else return ¡0I3 6$¤G q\" 3 sQ©4¤¥ r a¡££ 3 ¥¥ q\"© 3 ¢22§I0)\" s¨I¤¥ else if then return © 42¤2£ 3¡ 0I3 6$¤G v© I0¤2£ ¡ £   uw  3  ¡ if = then true Pr¢22§£I0)\" qs\"¨©I3¤¥ % a¡£ 3 ¥¥ s¨I¤¥ © I0¤2£ q\"© 3  3¡ R ECURSIVE -DLS( © T , , ) 6p6  §¡(§'¦  $¤0§¡§0¢30 T  \"£ £ \" ¥¥ RtI0§2£ % © 3  ¡ else for each in E XPAND( , ) do T¡  \"£ ¤¤'¦  ¡')# a \" £$¤2¤§0¢0 \"¡¥¥ 3 else if D EPTH[ ]= then return \"© 3 qsQ4¤¥ © 6pTH  ¡ a \" ')b# if G OAL -T EST[ ¡ a \" ')# ](S TATE[ ]) then return S OLUTION( ) ¡ a \" ')b# T ¡  \" £ §(§'¦  false P¢22§I0)\" ¨I¥ % r a¡££ 3 ¥¥ q\"© 3 function R ECURSIVE -DLS( , , ) returns a solution, or failure/cutoff © T 6p6  T ¡  \" £ ¡ a \" §(§'¦  ')b# return R ECURSIVE -DLS(M AKE -N ODE(I NITIAL -S TATE[ 6p6  © T T ¡  \" £ §(§'¦  T ¡  \" £ §(§'¦  ]), , ) function D EPTH -L IMITED -S EARCH( , ) returns a solution, or failure/cutoff © T 6pH  T ¡  \" £ ¤¤2R  Figure 3.12 return §$¤0§§0¢0 £ \"¡¥¥ 3 add to £ \"¡¥¥ 3 §$¤0§§0¢0  D EPTH[ ] D EPTH[ ]+1 ')# ¡ a \" %  , ) $!¤ ')b# # \" ©¥ ¡ a \" PATH -C OST[ ] PATH -C OST[ ] + S TEP -C OST( ¡ a \" ')# , %  ACTION[ ] # \" ©¥  $!¤i%  PARENT-N ODE[ ] ¡'a)\"b#h%  S TATE[ ] © I0¤2g%   3¡£ a new N ODE % f ]) do )b# ¡ a \" for each , ¤¤'¦  T ¡  \" £in S UCCESSOR -F N[ ](S TATE[ e  3¡ # \" ©¥ ¦© I0¤2£ $!¤ d the empty set % £ \"¡¥¥ 3 c§$¤0§§0¢0 ) returns a set of nodes T ¡  \" £  X ¡ a \" ¤¤'¦¨)b# function E XPAND( 'I6§0G ¡ C # £ I NSERT-A LL(E XPAND( ¤¤'¦  ')# T ¡  \" £ ¡ a \" , ), ) `'I6§0G % ¡ C # £ then return S OLUTION( ) ¡ a \" ')# if G OAL -T EST[ ')b# ¡ a \" ] applied to S TATE[ ] succeeds ¤¤'¦  T ¡  \" £ R EMOVE -F IRST( ) I'H§0G ¡ C # £ % ¡ a \" P')# if E MPTY ?( ) then return failure ¡ C # £ I'6§§G loop do ) 'I6§0G ¡ C # £ I NSERT(M AKE -N ODE(I NITIAL -S TATE[ T ¡  \" £ §(§'¦  ]), % ¡ C # £ `I'H§0G ) returns a solution, or failure ¡ C # £ GX T ¡  \" £ 'I6§0HY§(§'¦  function T REE -S EARCH( 5
    6. 6 Chapter 3. Solving Problems by Searching function I TERATIVE -D EEPENING -S EARCH( ¤¤'¦  T ¡  \" £ ) returns a solution, or failure inputs: §(§'¦  T ¡  \" £ , a problem for xHa % D©  ¡ 0 to y do RtI0§2£ % © 3  ¡ D EPTH -L IMITED -S EARCH( ¤¤'¦  T ¡  \" £ , !R'a D©  ¡ ) uv© I0¤2£ w  3¡ if cutoff then return tI0§0£ © 3  ¡ Figure 3.19 function G RAPH -S EARCH( 'I6§0H€¤¤'¦  ¡ C # £ GX T ¡  \" £ ) returns a solution, or failure 2$@¥ % a ¡  \" an empty set % ¡ C # £ `I'H§0G I NSERT(M AKE -N ODE(I NITIAL -S TATE[ ]), ) T ¡  \" £ §(§'¦  ¡ C # £ 'I6§0G loop do if E MPTY ?( I'6§§G ¡ C # £ ) then return failure P')# % ¡ a \" R EMOVE -F IRST( ) I'H§0G ¡ C # £ if G OAL -T EST[ T ¡  \" £ ¤¤'¦  ](S TATE[ ¡ a \" ')# ]) then return S OLUTION( ¡ a \" ')b# ) if S TATE[ ¡ a \" ')# ] is not in then a ¡  \" 2$@¥ add S TATE[ ] to )b# ¡ a \" 2$@¥ a ¡  \" % ¡ C # £ `'I6§0G I NSERT-A LL(E XPAND( , ), ) T ¡  \" £ ¡ a \" ¤¤2R  ')# ¡ C # £ 'I6§0G Figure 3.25
    7. 7 Figure 4.13 £ \" D C ¡ # % © #¡££ 3 $2¢1§‰hRR§0§I¤¥ ] © #¡££ 3 R¤2§I¥ if VALUE[neighbor] VALUE[current] then return S TATE[ j a highest-valued successor of © #¡££ 3 ¢¤2§I¥ % £ \" D C ¡ V$24$@¤b# loop do ]) T ¡  \" £ ¤¤'¦  M AKE -N ODE(I NITIAL -S TATE[ % © #¡££ 3 R¢¤2§I¥ , a node £$24$@¤b# \" D C ¡ local variables: , a node R§0§I¤¥ © #¡££ 3 inputs: , a problem ¤¤'¦  T ¡  \" £ function H ILL -C LIMBING( ) returns a state that is a local maximum ¤¤'¦  T ¡  \" £ Figure 4.6 if then return © 42¤2£  3¡ 0I3 6$¤G v© I0¤2£ ¡ £   uw  3  ¡ , [ ] RBFS( , , 1$6$§¤© $i§6pH  ¤c@gƒ 0¤2 ¤¤2R  ‘ ¡ d ©  # £ ¡   X © T G ˆ hf ©  ¡ T ¡  \" £ ) % 0§0 ‚ tI0§2£ ©¡ © 3  ¡ the second-lowest -value among £ \"¡¥¥ 3 §$¤0§§0¢0 ‚ Pe61b§¤¨t1 % ¡ d ©  # £ ¡ © if then return ©¡ , [ 0§0 ‚ 2It6$¤G ] ¡ £ 3  6p6t g™0¤0 P‚ © T G ˜ —©¡ – the lowest -value node in £ \"¡¥¥ 3 §$¤0§§0¢0 ‚ % ©¡ R0¤2 repeat [s] ‘— ¡ a \" – X ‘ ˆ ” ’ ‘ ˆ ˆ ‡ … ƒ H¤')# P‚ §)s“•“)sbH‰1†„% ‚ for each in do £ \"¡¥¥ 3 §1¤0¤00¢0  if is empty then return , y ¡2£43 6$¤G   §$§0¤§2R2 £ \"¡¥¥ 3 E XPAND( , ) T¤¡¤'¦  ')#  \"£ ¡ a \" c§$¤0§§0¢0 % £ \"¡¥¥ 3 if G OAL -T EST[ ]( ) then return¡ a \" ')b# ¡© © $Q0 ¤¤'¦  T ¡  \" £ ‚ function RBFS( , , ) returns a solution, or failure and a new -cost limit © T Hp6  G ')b# ¤¤'¦  ¡ a \" T ¡  \" £ RBFS( y , M AKE -N ODE(I NITIAL -S TATE[ T ¡  \" £ §(§'¦  ]), ) ¤¤'¦  T ¡  \" £ function R ECURSIVE -B EST-F IRST-S EARCH( ) returns a solution, or failure T ¡  \" £ §(§'¦  EXPLORATION 4 INFORMED SEARCH AND
    8. 8 Chapter 4. Informed Search and Exploration function S IMULATED -A NNEALING( , T ¡  \" £ §(§'¦  ¡ 3 a ¡ D ¥ I$2¢§¤ ) returns a solution state inputs: ¤¤'¦  T ¡  \" £ , a problem (I$¦¢¤¤ ¡ 3 a ¡ D ¥ , a mapping from time to “temperature” local variables: R§0§I¤¥ © #¡££ 3 , a node , a node 10b# © k¡ l , a “temperature” controlling the probability of downward steps M AKE -N ODE(I NITIAL -S TATE[ R¢¤2§I¥ % © #¡££ 3 ¤¤'¦  T ¡  \" £ ]) for 1 to do y R© % [ ] © 431a2¢¤§g% l ¡ ¡ D¥ R§2£§43¤¥ © #¡ £ l if = 0 then return R#§2§43¤¥ © ¡££ a randomly selected successor of 10b# % © k¡ ©R#§¡2£§£43¤¥ VALUE[ ] – VALUE[ 10¡b# © k ] % om n if 0 then©$k2¡‰#hR©R§¡0§£I¤¥ % # £ 3 ˜ gm n tsfrPip s q else $2‰#hRR§0§I¤¥ © k¡ only with probability % © #¡££ 3 Figure 4.17 function G ENETIC -A LGORITHM( $!!$I04  # \" ©  3   \" , F ITNESS -F N) returns an individual inputs: $!1I§4  # \" ©  3   \" , a set of individuals F ITNESS -F N, a function that measures the fitness of an individual repeat empty set &$!$@I§4  ¤b# % # \" ©  3   \" u ¡ $!!$I04  # \" ©  3   \" loop for from 1 to S IZE( ) do 1\"!©$@4R§4  #  3  \" R ANDOM -S ELECTION( vk % , F ITNESS -F N) #$!$@I§4  \" ©  3   \" R ANDOM -S ELECTION( w7 % , F ITNESS -F N) 7 k R EPRODUCE( , ) 6'§¥ % a D a D %v@6'¤¥ if (small random probability) then M UTATE( a D @H¤¥ ) add to $!$@I§4  ¤‰# # \" ©  3   \" u ¡ @6'¤¥ a D $!$@I§4  ¤bgx$!!$I04  # \" ©  3   \" u ¡ # % # \" ©  3   \" until some individual is fit enough, or enough time has elapsed return the best individual in $!!$I04  # \" ©  3   \" , according to F ITNESS -F N 7 k function R EPRODUCE( , ) returns an individual 7 k inputs: , , parent individuals % &# L ENGTH( ) k % `¥ random number from 1 to # k return A PPEND(S UBSTRING( , 1, ), S UBSTRING( , ¥ # {y¥ 7 z ’ , )) Figure 4.21
    9. 9 function O NLINE -DFS-AGENT( ) returns an action |  |  inputs: , a percept that identifies the current state static: © I0¤2£  3¡ , a table, indexed by action and state, initially empty a22£$@§2‰I3 ¡ \"  k¡ # , a table that lists, for each visited state, the actions not yet tried a2¡e9¤¦!1¤e2‰I3 ¥ £© 9 ¥  # , a table that lists, for each visited state, the backtracks not yet tried   , , the previous state and action, initially null |  if G OAL -T EST( ) then return §¨0  \"© |  if is a new state then % |  22$@00‰I3 a ¡ £ \"   k ¡ # [ ] ACTIONS( ) |  if is not null then do  [ , ] | h%   tI0§2£  © 3  ¡ |  2¡e¤¦!©19¤¥e2‰I3 a 9¥ £ add to the front of  # [ ]  if [ ] is empty then |  22$R§0bI3 a ¡ £ \"   k ¡ #  §\"¨©2 if |  2e¤¦!1¤e2‰I3 a¡ 9 ¥ £© 9 ¥  # [ ] is empty then return else 3 |   © I0¤¡2£ an action such that  [ , ] = P OP( % w |  2e¤¦!1¤e2‰I3 a¡ 9 ¥ £© 9 ¥  # [ ]) else P OP( [ ]) ¡ \"  k¡ # |  a22£$@§2‰I3 v % | h`  % return  Figure 4.25 function LRTA*-AGENT( ) returns an action |  |  inputs: , a percept that identifies the current state static: © I0¤2£  3¡ , a table, indexed by action and state, initially empty } , a table of cost estimates indexed by state, initially empty   , , the previous state and action, initially null |  if G OAL -T EST( ) then return §¨0  \"© |  } } |  ~% |  ” if is a new state (not in ) then [ ] ( ) unless is null  | h%   tI0§2£ [ , ] © 3¡ h [ ] foƒ %  } LRTA*-C OST( , ,  3¡   © 42¤2£   [ , ], } ) ƒs ‚ ¦ € ACTIONS  v % |  }   © I0¤2£   |  3¡ | an action in ACTIONS( ) that minimizes LRTA*-C OST( , , [ , ], ) | h`  % return  } |    function LRTA*-C OST( , , , ) returns a cost estimate |  iQc” ‘ „ˆ if is undefined then return else return — | „ – ˆg‘ | 02eQˆ … ‡ ’ „X †X „ Figure 4.29
    10. CONSTRAINT 5 SATISFACTION PROBLEMS ¥   function BACKTRACKING -S EARCH( ) returns a solution, or failure return R ECURSIVE -BACKTRACKING( , ) ¥ W‰   Š function R ECURSIVE -BACKTRACKING( ,  Q¥ ©R§¡gTRe@02$ # # C  ) returns a solution, or failure if is complete then return R¤g¢e@001 © #¡ T # C  ©R§¡gRe@02$ # T # C  S ELECT-U NASSIGNED -VARIABLE(VARIABLES[ ],   © #¡ T # C  ¥ R¤g¢e@001 Q¤¥ , )  % £  V$$d for each in O RDER -D OMAIN -VALUES( , , ) do   © #¡ T # C  £  ¥ R§gR$20$ $1d 3  ¡Rt1$d if is consistent with R#§gR$20$ © ¡ T # C  Q¥   according to C ONSTRAINTS[ ] then ¡ 3  Rt1$d add = to #¡ T C  ©¢¤g¢#e@00$ Š R3 $$d £$1d ‰ ¡  C   Q¤¥ ©¢#¤¡gT¢#e@00$ R ECURSIVE -BACKTRACKING( , ) RtI0§2£ % © 3  ¡ if © I30¤2£  ¡ then return 2£It6$¤G uvtI0§0£ ¡ 3 w © 3  ¡ remove = T # C  ©¢#¤¡gR$@00$ from  £ Š ¡R3 $$d $$d ‰ return 2It6$¤G ¡ £ 3  Figure 5.4 10
    11. 11 function AC-3( Q¥   ) returns the CSP, possibly with reduced domains inputs:   Q¥ , a binary CSP with variables X    Ž Š‘o‹ X g‹ X i‰ Œ ‹ local variables: R¤R¤S ¡ 3¡ 3 , a queue of arcs, initially all the arcs in Q¥   while §RS ¡ 3¡ 3 is not empty do % “ R‘ p‹ X o‹ ˆ ’ R EMOVE -F IRST( ) ¡ 3¡ 3 R¤RS if R EMOVE -I NCONSISTENT-VALUES( “ ‹ X’ ‹ ) then for each in N EIGHBORS[ ] do ” †‹ ’ o‹ add ( ’ ‹ X ™‹ ) to” R¤RS ¡ 3¡ 3 function R EMOVE -I NCONSISTENT-VALUES( “ ‹ X’ ‹ ) returns true iff we remove a value  $¤•v2$$o¤2£ ¡  G % a¡ d \" T¡ k for each in D OMAIN[ ] do ’ ‹ if no value in D OMAIN[ ] allows ( , ) to satisfy the constraint between – “ ‹ 7 k ’ ‹ and “ ‹ k then delete from D OMAIN[ ]; ’ ‹ ¡R3§£©h%va2¡$d$\"o¤2£ T¡ return 2$$o¤2£ a¡ d \" T¡ Figure 5.9 function M IN -C ONFLICTS( , ¨0 ioT ¥   ¡© k    ) returns a solution or failure inputs: Q¥   , a constraint satisfaction problem ¨0 ioT   ¡© k  , the number of steps allowed before giving up R¢¤2§I¥ % © #¡££ 3 an initial complete assignment for ¥   for = 1 to ¨0 ioT   ¡© k  do  ¥ if is a solution for © #¡££ 3 ¢¤2§I¥ then return © #¡££ 3 R§0§I¤¥ V$1d % £  a randomly chosen, conflicted variable from VARIABLES[ ]¥   £ $1d d the value for `3 $1d % ¡   that minimizes C ONFLICTS( , , 3, £   Q¤¥ ©R#¤¡2£§£I¥ d 1$d ) set R§¡2£§£43¤¥ © # in Rt1$d w 1$d ¡ 3  £  return 2It6$¤G ¡ £ 3  Figure 5.11
    12. 6 ADVERSARIAL SEARCH function M INIMAX -D ECISION( 1¨0 ¡© © ) returns $!¤—$ # \" ©¥  # inputs: ¨$¨0 ¡© © , current state in game % wd M AX -VALUE(state) return the # \" ©¥ $!¤ in S UCCESSORS( $Q0 ¡© © ) with value d function M AX -VALUE( 1¨0 ¡© © ) returns Rt1$˜!6t6Ip ¡ 3  d 7©  © 3 if T ERMINAL -T EST( 1¨0 ¡© © ¡© © ¨$¨2 ) then return U TILITY( ) y gwd ™ %  X R for in S UCCESSORS( ) do¡© © $Q0 % wd M AX(v, M IN -VALUE( ))  return d function M IN -VALUE( $Q0 ¡© © ) returns Rt$1˜!H 6Ix ¡ 3  d 7©  © 3 if T ERMINAL -T EST( ¡© © 1¨0 ) then return U TILITY( ¡© © ¨$¨2 ) y wd %  X R for in S UCCESSORS( ) do¡© © $Q0 % wd M IN(v, M AX -VALUE( ))  return d Figure 6.4 12
    13. 13 function A LPHA -B ETA -S EARCH( ) returns an action ¨$¨2 ¡© © inputs: ¨$¨0 ¡© © , current state in game % wd M AX -VALUE( , , ) ¡© © y ™ ¨$¨0 y ’ return the # \" ©¥ $!¤ in S UCCESSORS( $Q0 ¡© © ) with value d function M AX -VALUE( › š 1¨0 ¡© © , , ) returns R3 $$p6t6!4x ¡   d 7©  © 3 inputs: ¨$¨0 ¡© © , current state in game , the value of the best alternative for š MAX 1¨0 ¡© © along the path to , the value of the best alternative for › MIN along the path to ¨$¨2 ¡© © if T ERMINAL -T EST( ¡© © 1¨0 ) then return U TILITY( ¡© © ¨$¨2 ) y gwd ™ % for  X R in S UCCESSORS( ) do ¡© © $Q0 wd % M AX(v, M IN -VALUE( , , )) › š  ›Ÿžœ if then return d % šM AX( , v) š d return function M IN -VALUE( › š $Q0 ¡© © , , ) returns 3 $1˜6 6Ip ¡   d 7©  © 3 inputs: ¨$¨0 ¡© © , current state in game , the value of the best alternative for š MAX 1¨0 ¡© © along the path to , the value of the best alternative for › MIN along the path to ¨$¨2 ¡© © if T ERMINAL -T EST( ¡© © 1¨0 ) then return U TILITY( ¡© © ¨$¨2 ) y ~wd ’ % for  X R in S UCCESSORS( ) do ¡© © $Q0 wd % M IN(v, M AX -VALUE( , , )) › š  š jžœif then return d › % › M IN( , v) d return Figure 6.9
    14. 7 LOGICAL AGENTS function KB-AGENT( §¦§¢  ©  ¡¥£¡ ) returns an $!! # \" © ¥ static: E, a knowledge base ¢¡ © , a counter, initially 0, indicating time T ELL( E ¢¡ , M AKE -P ERCEPT-S ENTENCE( , )) © ¨§¦¤¢  ©  ¡¥£¡ &$!! % # \" © ¥A SK( E , M AKE -ACTION -Q UERY( )) ¢¡ © T ELL( E¢¡ , M AKE -ACTION -S ENTENCE( , )) © 1! # \" © ¥ +1 h© © % #$!©¤¥ \" return Figure 7.2 function TT-E NTAILS ?( , ) returns E ¢¡ or š ¡ 3£ R§© ¡   t1G inputs: , the knowledge base, a sentence in propositional logic E ¢¡ š , the query, a sentence in propositional logic  \" T 7 %P $2g10a list of the proposition symbols in E ¢¡ and š return TT-C HECK -A LL( , , , )E x¡  \" T 7 — –  $2g10 š function TT-C HECK -A LL( , , , E ¢¡ ¤')oT  $2g10 š ¡ a \"  \" T 7 ) returns ¡ 3£ R§© or  $¤G ¡   if E MPTY ?(  $2g10  \" T 7 ) then if PL-T RUE ?( E , x¡ ¡ a \" ¤)oT ) then return PL-T RUE ?( , ¡ a \" §')oT š ) else return R§© ¡ 3£ else do % £ F IRST(  $2g10 );  \" T 7 R EST( ) % ©¡ R0§2£  \" T 7  $2g10 return TT-C HECK -A LL( , , , E XTEND( 0¤2£ 𠢡 ©¡ E ¤')o§eR§§X £ ¡ a \" TX ¡ 3£© ) and TT-C HECK -A LL( , , ©0¤2£ 𠢡 , E XTEND(¡ E ¤¡')o§¤t$¤HX £ a \" T X ¡   G ) Figure 7.12 14
    15. 15 function PL-R ESOLUTION( , ) returns E ¢¡or š ¡ 3£ R§© ¡    $¤G inputs: , the knowledge base, a sentence in propositional logic E ¢¡ š , the query, a sentence in propositional logic %f¤I$@¥  ¡  3  the set of clauses in the CNF representation of W€•¢¡ š ¥ ¤ E ŠW‰ ¦§‰# % u¡ loop do for each , in  ¡  3  §I$@¥do “ § ’ § f!R¤$t1¤¤2£ % © # ¡ d \"  ¡ PL-R ESOLVE( , ) “ § ’ § if R§ed $¤§0£ © #¡  \"¡ contains the empty clause then return R§© ¡ 3£ ©¢#¤¡ed $¤§¡2£©¨—§‰h¦§‰# \" u¡ # % u¡ ¡ $¤G if §I$@•«§‰#  ¡  3  ¥ ª u ¡ then return §‰#™c§I$@¬`¤¤41¤¥ u ¡ ¨  ¡  3  ¥ %  ¡  3  Figure 7.15 function PL-FC-E NTAILS ?( , ) returns E ¢¡ or S R§!© ¡ 3£  $¤G ¡   inputs: E, the knowledge base, a set of propositional Horn clauses ¢¡ S , the query, a proposition symbol local variables: RI$2¥ © # 3 \" , a table, indexed by clause, initially the number of premises 22§§)6 a¡££¡ G # , a table, indexed by symbol, each entry initially t1G ¡   ¤I  a #¡ C , a list of symbols, initially the symbols known to be true in E ¢¡ while eb¤')  a #¡ C is not empty do P OP(b§I)  a #¡ C ) % ­  unless   22§¤H a¡££¡ G # [ ] do ¡R3§£©g%   22§¤)6 [ ]a¡££¡ G # for each Horn clause in whose premise ¥   appears do decrement ¥ RI$0¥ [ ] © # 3 \" if ¥ ¢410¥ © # 3 \" [ ] = 0 then do ¥ if H EAD[ ] = then return S R§!© ¡ 3£ P USH(H EAD[ ], ) ¥ b§I)  a #¡ C return  $¤G ¡   Figure 7.18
    16. 16 Chapter 7. Logical Agents function DPLL-S ATISFIABLE ?( ) returns  ¡ 3£ R§!© or  $¤G ¡    inputs: , a sentence in propositional logic f¤I$@¥ %  ¡  3  the set of clauses in the CNF representation of  P $2g10 %  \" T 7 a list of the proposition symbols in  return DPLL( , , ) — – t12g$2 §I$¤¥  \"  T 7  ¡  3  function DPLL( §')oT  $2g10 §I$@¥ ¡ a \"  \"  T 7  ¡  3  , , ) returns ¡ 3£ §!© or ¡   ¤t$¤G if every clause in is true in  ¡  3  ¤I$@¥ then return ¡ 3£ R§© ¡ a \" §')oT if some clause in is false in  ¡  3  §I$¤¥ then return ¡   ¤t$¤G ¡ a \" §')oT ® PRt1$d % ¡ 3  ¤')oT ¤¤41¤¥ t$¦g$0 ¡ a \"  ¡  3   \"  T 7 , F IND -P URE -S YMBOL( , , ) ® ® t12g$2 ¤I$@¥  \"  T 7  ¡  3  ¤)o§Rt$1§X £  ¡ a \" T X ¡ 3  d if is non-null then return DPLL( , – , E XTEND( ) ® PRt1$d % ¡ 3  §')oT §I$@¥ ¡ a \"  ¡  3  , F IND -U NIT-C LAUSE( , ) ® ® t12g$2 ¤I$@¥  \"  T 7  ¡  3  ¤¡a)\"oT§X¡Rt$1d§X £ 3 if is non-null then return DPLL( , – , E XTEND( ) % ® F IRST( ); % ©¡ R0¤2£  $2g10 R EST(  \" T 7 )  \"  T 7 t$¦g$0 return DPLL( , 0§2£ §I$¤¥ ©  ¡  ¡  3  , E XTEND( , , )) or §')oT R§© ® ¡ a \" ¡ 3£ DPLL( , 0§2£ §I$¤¥ ©  ¡  ¡  3  , E XTEND( , , )) ¤')oT  $¤G ® ¡ a \" ¡   Figure 7.21 function WALK SAT( , ,  k   ¡  3    y¯ ioT   §I$@¥ ) returns a satisfying model or ¡ £ 3  2It6$¤G inputs: ¤I$@¥  ¡  3  , a set of clauses in propositional logic   , the probability of choosing to do a “random walk” move, typically around 0.5    y¯ ioT k  , number of flips allowed before giving up a random assignment of % ¡ a \" e¤')oT / to the symbols in ¡   ¡ 3£  $¤G R§!©  ¡  3  ¤I$@¥ for to  k  R  y¯ ioT do z w §¡I3$¤¥ if  satisfies ¡ a \" §')oT then return ¡ a \" ¤)oT % ¡  3  P¤41¤¥ a randomly selected clause from that is false in  ¡  3  ¤I$@¥ ¤')oT ¡ a \"   with probability flip the value in of a randomly selected symbol from ¡ a \" §')oT I$@¥ ¡  3  else flip whichever symbol in I$¤¥ ¡  3  maximizes the number of satisfied clauses return 2It6$¤G ¡ £ 3  Figure 7.23
    17. 17 function PL-W UMPUS -AGENT( 02§¢  ©  ¡¥£¡ ) returns an $!¤ # \" ©¥ inputs: ©  ¡¥£¡ R§¦¤¢  , a list, [ , £¡©©  ¡ °¡¡£ D¥ #¡© ¤¨6 eC i020§ ¤b§0 , ] static: , a knowledge base, initially containing the “physics” of the wumpus world E ¢¡ , , \" £ #$!©$Q©R#§¡Q§1\" 7 k , the agent’s position (initially 1,1) and orientation (initially © D C $@§£ ) 2¨606id a¡©  , an array indicating which squares have been visited, initially  $¤G ¡   $!¤ # \" ©¥ , the agent’s most recent action, initially null $@  #  , an action sequence, initially empty update , , a¡©  # \" © © #¡ £ 2¨606id $!1¨R§§$\" 7 k , based on # \" © ¥ $!e if then T ELL( ´ $c± ¢¡ ³ ² E, ) else T ELL( , )¤¤2 D¥ #¡© ´ $²“—¥ ¢¡ ³ ± E if then T ELL( ´ $xµ ¢¡ ³ ² , E ) else T ELL( , ) i002§ ¡ °¡¡£ ´ ³$¢µ—¥ ¢¡ ² E if then '¦$~­$!¤  £ C % # \" ©¥ ¤!6t$C £ ¡©©  %&#1\"!©¥ else if is nonempty then P OP( #  $R  ) #  $@  else if for some fringe square [ , ], A SK( ¶ , ) is or ‘ ³“ ’ —„¤ ³“ ’ £ ¥ ˆ ¢¡ · ¥ ¡ 3£ R§!© E for some fringe square [ , ], A SK( ¶ , ) is ¡t1G then do ‘ ³“ ’ ·  ³“ ’ £ ˆ ¢¡ ¸ E % #  &$R  A*-G RAPH -S EARCH(ROUTE -P ROBLEM([ , ], #$!$Q©R§Q§1\" 7 k \" ©  #¡ £ , [ , ], ¶ a¡©  ¦606id )) P OP( ) $@  #  ­$!e % # \" © ¥ else a randomly chosen move &$!! % # \" © ¥ return $!¤ # \" ©¥ Figure 7.26
    18. 8 FIRST-ORDER LOGIC 18
    19. 9 INFERENCE IN FIRST-ORDER LOGIC ¹ 7 k function U NIFY( , , ) returns a substitution to make and identical k 7 k inputs: , a variable, constant, list, or compound 7 , a variable, constant, list, or compound , the substitution built up so far (optional, defaults to empty) ¹ if = failure then return failure ¹ k else if = then return 7 ¹ k else if VARIABLE ?( ) then return U NIFY-VAR( , , ) ¹ 7 k 7 else if VARIABLE ?( ) then return U NIFY-VAR( , , ) ¹ k 7 else if C OMPOUND ?( ) and C OMPOUND ?( ) then k 7 return U NIFY(A RGS[ ], A RGS[ ], U NIFY(O P[ ], O P[ ], ))k 7 k 7 ¹ k else if L IST ?( ) and L IST ?( ) then 7 k return U NIFY(R EST[ ], R EST[ ], U NIFY(F IRST[ ], F IRST[ ], )) 7 k 7 ¹ else return failure function U NIFY-VAR( , , ) returns a substitution ¹ k $1d £  inputs: $$d £  , a variable k , any expression , the substitution built up so far ¹ if ¹ U»¦Š   d º £  $$I$$1d ‰ then return U NIFY( , , ) ¹ k $$d   ¹U»¦Š $14º )‰ else if  d ¼ then return U NIFY( , , ) ¹    $1d £$$d else if O CCUR -C HECK ?( k $$d £  , ) then return failure else return add / to ¹ Š k $$d ‰ £  Figure 9.2 19
    20. 20 Chapter 9. Inference in First-Order Logic function FOL-FC-A SK( , ) returns a substitution or E x¡ š ¡   t1G inputs: , the knowledge base, a set of first-order definite clauses E ¢¡ , the query, an atomic sentence š local variables: ¤b# u¡ , the new sentences inferred on each iteration repeat until §‰# u¡ is empty Š W‰ —¤b# % u¡ for each sentence Ex¡ £ in do %R$S ‘ ½•‘   ¤  `Œ §ˆ   ¤   S TANDARDIZE -A PART( ) £ ¤  ¤ Œ   ¹ for each such that S UBST( ,¹ ) = S UBST( , ‘   ¤ |Œ   ¹   | ‘   ¤ ) ) Ex¡ | ‘ sXX |Œ      for some in S ¹ S UBST( , ) % | S | S if is not a renaming of some sentence already in or E ¢¡ u¡ ¤b# then do add to §‰# | S u¡ š | S U NIFY( , ) % ¾ ¾ 6$¤G   ¾ if is not then return add to ¢¡ E ¤‰# u¡ return  $¤G ¡   Figure 9.5 function FOL-BC-A SK( , , ) returns a set of substitutions E ¢¡   \" ¹ t$)C inputs: , a knowledge base E ¢¡  $)'C   \" , a list of conjuncts forming a query ( already applied) ¹ , the current substitution, initially the empty substitution ¹ Š W‰ local variables: §¤y0R1 £¡ u # , a set of substitutions, initially empty  $)C if  \" is empty then return '1‰ Š ¹ % | S S UBST( , F IRST( )) ¹  $)C   \" for each sentence in where S TANDARDIZE -A PART( ) = E ¢¡ £ £ €Œ §ˆ ¤   ‘ Àž‘   ¤ ) ¿ ½   % | ¹ and U NIFY( , ) succeeds | S S %   \" u ¡ ft1)'C ¤b# R EST( ) Á  X    f‘ sX Œ   – —  $)'C   \" % £¡ u # f§¤y0R1 FOL-BC-A SK( , , C OMPOSE( , )) E ¢¡  $)\"C §‰#u¡ ¹ | ¹ £¡ u #  §§y0R$¨ return §¤y0¢$ £¡ u # Figure 9.9 procedure A PPEND( # \" ©  3 # © # \" ° k $!$¢R6!R$0¥ i 7 ) , , , ) 6$¦© %  £ G LOBAL -T RAIL -P OINTER() if k ) —– = and U NIFY( , ) then C ALL( ) ° i 7 # \" ©  3 # © # \" $!1R¢6R10¥ R ESET-T RAIL( ) 6$¦©  £ % v N EW-VARIABLE(); N EW-VARIABLE(); N EW-VARIABLE() % Ãk % y° k i  k if U NIFY( , [ — ]) and U NIFY( , [ — ]) then A PPEND( , , , ° i  ° $!!$¢R6¢$0¥ ° 7 k # \" ©  3 # © # \" ) Figure 9.12
    21. 21 procedure OTTER( , ) ¤'§43 $¤ ¡     \" inputs: $¤  \" , a set of support—clauses defining the problem (a global variable) ¤'§43 ¡    , background knowledge potentially relevant to the problem repeat % clause the lightest member of $§  \" move from ¡  3  I$@¥ to ¡    ¤¤I3  \" $¤ P ROCESS(I NFER( , ), $\"¤ ¤'§43 I$@¥ ) ¡    ¡  3  until $¤  \" —– = or a refutation has been found function I NFER( (§'¤I3 I$@¥ ¡    ¡  3  , ) returns clauses resolve I$@¥ ¡  3  with each member of ¤'§43 ¡    return the resulting clauses after applying F ILTER procedure P ROCESS( $¤ ¤I$@¥  \"  ¡  3  , ) ¡  3  I$@¥ for each in do  ¡  3  ¤I$@¥ P¤41¤¥ % ¡  3  S IMPLIFY( I$@¥ ¡  3  ) merge identical literals discard clause if it is a tautology [%  \" `$§ — I$@¥ ¡  3  ]  \" $§ I$@¥ ¡  3  if has no literals then a refutation has been found ¡I$@¥ if  3 has one literal then look for unit refutation Figure 9.19
    22. 10 KNOWLEDGE REPRESENTATION 22
    23. 23 Figure 11.3 ‘ ‘ \"© X ̈ A ¦'Qy“@¤© ɤ †$¦0b“@¤© ¦¥ E FFECT: ‘ T \" £ G X ̈ A ‘ \"©ˆ©£ \"  £ A ‘ T \" £ Gˆ © £ \"   £ A ¨s¤§$4¨6 Ǥ †$¦§@¤§$4¨6 Ǥ @'b$@ ® ¤ ™120c@¤© A ‘ ̈ ¡ #  ‘ T \" £ G X ̈ P RECOND : §'Qy€$¦0b“@b7  Å P$!¤¥ A X ‘ \"© X T \" £ G X ̈ ˆ # \" © ‘‘ Ì ˆ ¥ ¦X … P# Ä „¤ 4PX … ¤© A E FFECT: ‘ † ˆ ‘ †ˆ©£ \"  £ A ‘ ̈ ¡ #  ˆ \" C£ Ê 4¤§$4¨6 Ǥ b@‰$@ ® ¤ ‘ … ¢'$ ˆ¤ I`“@¤© Ǥ bX … P# Ä ‘ † X ̈ A ‘ Ì ˆP RECOND : §4P“X … “)@Rf$P$!¤¥ A X ‘ † X Ì ˆ a  \" # Í ˆ # \" © ‘‘ Ì ˆ ¦X … P# Ä ¤ 4PX … ¤© ¦¥ E FFECT: ‘ † ˆ A £ \"  £ A ‘ ̈ ¡ #  ˆ \" C£ Ê ‘4†ˆ¤©§$4¨6 Ǥ @'b$@ ® ¤ ‘ … ¢'$ ˆ¤ 4`“@¤© Ǥ IPX … ¤© A ‘ † X ̈ A ‘ † ˆ P RECOND : X‘ † X Ì ˆ a  ˆ # \" © §4`“bX … “e)\" F P$!¤¥ A ‘ Æ Å Ž ˆ A ¡ È Œ ˆ ˆ  ¦‘ vI8 X v§ ¤© ɤ ‘ PÅ yX v§ ¤© A 1)\" Ë ‘ Æ Å ˆ ©£ \"  £ A ¦‘ w48 §14¨H ɤ ‘ PÅ ¦¤§$4¨6 ¦¤ ¡ Ȉ©£ \"  £ A ˆ ¡ #  ˆ ¡ #  Ž ‘ Ž £ ‰$@ ® ¤ ‘ Œ £ ‰1 ® ¤ ‘ v§ ¢Q1 Ÿ¤ ‘ v§ R$ •¤ˆ \" C£ Ê Œ ˆ \" C£ Ê ¡ È ˆ A Æ Å ˆ A ¡ È ˆ A ‘ PÅ yX Ž £ ¤© ɤ ‘ w48 X Œ £ ¤© Ǥ ‘ PÅ yX Ž § ¤© Ǥ ‘ v48 X Œ § ¤© A 6¢# Ä Æ Å ˆ ˆ © PLANNING 11
    24. Figure 11.7 ‘ Æ ˆ £ ¡ Ê ¦‘ ¼ XiÑQˆ`# •¥„¤ ‘ ¼ I$2 Ÿ¤ 1¤ l iQ`# Æ ‘ ¡  X ш E FFECT: , ‘ ¼ u{Qˆ ¤ ¤Qˆb¤)@ Eɤ ¤ÑQI$2 Ÿ¤ ‘ ¼ iQP# Æ w Ñ ‘Ñ 9¥ \" ‘ ˆ £ ¡ Ê X ш P RECOND : X X ш ¡  §‘ ¼ iQ(§' l \" l e1ШP$!¤¥ A ¡ d \" ψ # \" © ¥ ‘ ˆ £ ¡ ¦‘ – I$2 ʕɤ ‘ ¼ iÑQP# •¥„¤ ‘ ¼ ˆ412( ˆ¤ ‘ – iQ`# Æ X ˆ Æ £ ¡ Ê X ш E FFECT: ,‘ – u w ¼ ˆ ¤ ‘ – &Qˆ ¤ ‘ ¼ {Qˆ uw Ñ uw Ñ ¤ ‘¤Qb9§) Eɤ ‘ – 4$¦( ˆ¤ ‘¤QˆI$2¡ Ÿ¤ ‘ ¼ iQP# Æ Ñˆ ¥ \" ˆ £ ¡ Ê Ñ £  Ê X ш P RECOND : X §‘ – X ¼ iQe1ШP$!¤¥ A X ш ¡ d \" ψ # \" © ‘ ¦‘ § X µ `# ˆ¤ ‘ µ &P# Æ 1)\" ˆ Æ X Έ ˆ  ‘ ˆ £ ¡ Ê ¦‘ § 4$¦( ˆ¤ ‘ µ I$2 Ÿ¤ x4$¦( ˆ¤ Ë ˆ £ ¡ Ê ‘ Έ £ ¡ Ê ‘ § b¤)@ ɤ ‘ ˆ 9¥ \" E µ ˆ 9¥ \" E b¤)@ ɤ xb¤)@ ɤ ‘ Έ 9¥ \" E ‘ ¡  ˆ Æ ‘ ¡  i(§' l X § P# ˆ¤ i¤' l X ˆ Æ µ P# ˆ¤ 1¤ &`# Æ 6¢# ‘ ¡  l X Έ ˆ © Ä Figure 11.5 ‘ ‘ ¡ X ©  ¦i(1k A §1 Å ˆ A ¥ ¤© ¦„¤ R412£ §$ Å ¤© ¦Y¤ ‘ a # 3 \" X©  ˆ A ¥ ‘ 9 # 3 X ¡£  ˆ A ¥ ‘ ¡ X ¡ £  444§£ l 2$4  8 ¤© ¦„¤ i$k A 2$4  8 ¤© ¦„¤ R412£ Ë 2$4  8 ¤© ¦¥ ˆ A ¥ ‘ a # 3 \" Ë X ¡£  ˆ A E FFECT: P RECOND : , © D C #£¡ '1@R§¤$d Æ $$2¡ F P$!¤¥ A ¡ d  ˆ # \" © ‘ ¡ X ¡ £  ˆ A ‘ a # 3 \" X ¡£  ˆ A ¦‘)(1k A e2$4  8 ¤© ɤ R412£ Ë 2$4  8 ¤© ¦¥ E FFECT: ‘  X©  ˆ A ¥ ‘ a # 3 \" X ¡£  ˆ )¡(1k A §$@ Å ¤© ¦É¤ RbI$¦£ Ë 2$4  8 ¤© A P RECOND : ‘ ¡, X ¡£  ˆ © ˆ # \" © i$k A 2$4  8 P# Æ I3 ® P$!¤¥ A ‘‘ # \" X©  ˆ A ‘ ¡ X ©  ˆ A ¦¢abI3$¦£ Ë §$@ Å ¤© Ǥ )(1k A §$@ Å ¤© ¦¥ E FFECT: ‘ ¡ X ©  ˆ i$k A ¤1 Å ¤© A P RECOND : , ‘ ¡ X ©  ˆ ¡ d \" T ˆ # \" © 1$k A §$ Å ee$o§¡ B P$!¤¥ A a \" ˆ A ‘ 9 # 3 X ¡£  ˆ A ‘¦‘¢b#I3$¦£ Ë X¡2£$4  8 ¤© Ǥ ¢4I§£ l e2$4  8 ¤© ¦¥ E FFECT: ‘ 9 # 3 X ¡£  ˆ 4¢I§£ l 2$4  8 ¤© A P RECOND : , ‘ 9 # 3 X ¡£  ˆ ¡ d \" T ˆ # \" © 444§£ l 2$4  8 ee$o§¡ B P$!¤¥ A ‘ ‘ ¡ X ¡ £  ˆ ˆ  ¦)(1k A e014  8 ¤© A s1)\" Ë ‘‘ 9 # 3 X ¡£  ˆ A ‘ ¡ X ©  ˆ ˆ © ¦4¢I§£ l 2$4  8 ¤© ɤ i$k A §$@ Å ¤© A 6¢# Ä Planning 11. Chapter 24
    25. Figure 11.19 ) E XPAND -G RAPH( T ¡  \" £ D    £ ¤¤'¦  R02$C , ÃR§¦$C % D  £ 0I3 6$¤G ¡£   ) then return D  £ R02$Celse if N O -S OLUTION -P OSSIBLE( $!It1¤ # \" © 3 \" if then return w \" ©  \" ¡0£I3 6$¤G uÐ#$!!43 $¤  )) ¢§¦eC D  £ , , L ENGTH(  $)C R§¦eC   \" D  £ E XTRACT-S OLUTION( &$!I3 $¤ % # \" ©  \" then do D  £ R02$C all non-mutex in last level of   \" t1)'C if loop do G OALS[ ] ¤¤2R  T ¡  \" £ %   \" ` $)'C ) T ¡  \" £ §(§'¦  I NITIAL -P LANNING -G RAPH( % D  £ vR§¦eC ) returns solution or failure ¤¤'¦  T ¡  \" £ function G RAPHPLAN( Figure 11.16 ‘ ¡ 9 ˆ ¡ d ie1 Ê e$ } E FFECT: ¡ d ‘)¡91 Ê ˆ$$ } ¥ P RECOND : )1 Ê i E P$!¤¥ A ‘ ¡ 9 ˆ ¡ 9 ˆ # \" © ) ‘ 9 ˆ ¡ d ‘1¡e91 Ê ˆP#§¡©$ n ¤ i¡e1 Ê e$ } ¥ E FFECT: ‘ ¡ )91 Ê ˆ$$ } ¡ d P RECOND : ¡ 9 ˆ © ˆ # \" © ‘ii Ê $ n P$!¤¥ A ‘‘ ¡ 9 ˆ #¡© ¦ii Ê P¤¨$ n ¤ ‘ ¡ 9 ˆ ¡ d ˆ  )1 Ê $$ } 1)\" Ë ‘‘ ¡ 9 ˆ ¡ d ˆ © ¦i1 Ê ee$ } 6¢# Ä Figure 11.11 ‘ ‘ ¡ X ©  ¦i(1k A §$@ Å ˆ A ¥ ¤© ¦„¤ R412£ §$ Å ¤© ¦Y¤ ‘ a # 3 \" X©  ˆ A ¥ ‘ 9 # 3 X ¡£  ˆ A ¥ ‘ ¡ X ¡ £  444§£ l 2$4  8 ¤© ¦„¤ i$k A 2$4  8 ¤© ¦É¤ R412£ Ë 2$4  8 ¤© ¦¥ ˆ A ¥ ‘ a # 3 \" Ë X ¡£  ˆ A E FFECT: P RECOND : , '1@R§¤$d Æ $$2¡ F P$!¤¥ A © D C #£¡ ¡ d  ˆ # \" © ‘ ¡ X ¡ £  ˆ A ‘ a # 3 \" X ¡£  ˆ A ¦‘i$k A e2$4  8 ¤© Ǥ R412£ Ë 2$4  8 ¤© ¦¥ E FFECT: ‘  X©  ˆ A ¥ ‘ a # 3 \" X ¡£  ˆ )¡(1k A §$@ Å ¤© ¦É¤ RbI$¦£ Ë 2$4  8 ¤© A P RECOND : , ‘ ¡ X ¡£  ˆ © ˆ # \" © i$k A 2$4  8 P# Æ I3 ® P$!¤¥ A ‘‘ # \" X©  ˆ A ‘ ¡ X ©  ˆ A ¦¢abI3$¦£ Ë §$@ Å ¤© Ǥ )(1k A §$@ Å ¤© ¦¥ E FFECT: ‘ ¡ X ©  ˆ i$k A ¤1 Å ¤© A P RECOND : ,‘ ¡ X ©  ˆ ¡ d \" T ˆ # \" © 1$k A §$ Å ee$o§¡ B P$!¤¥ A a \" ˆ A ‘ 9 # 3 X ¡£  ˆ A ‘¦‘¢b#I3$¦£ Ë X¡2£$4  8 ¤© Ǥ ¢4I§£ l e2$4  8 ¤© ¦¥ E FFECT: ‘ 9 # 3 X ¡£  ˆ 4¢I§£ l 2$4  8 ¤© A P RECOND : , ‘ 9 # 3 X ¡£  ˆ ¡ d \" T ˆ # \" © 444§£ l 2$4  8 ee$o§¡ B P$!¤¥ A ‘ ‘ ¡ X ¡ £  ˆ ˆ  ¦)(1k A e014  8 ¤© A s1)\" Ë ‘‘ 9 # 3 X ¡£  ˆ A ‘ ¡ X ©  ˆ ˆ © ¦4¢I§£ l 2$4  8 ¤© ɤ i$k A §$@ Å ¤© A 6¢# Ä 25
    26. 26 Chapter 11. Planning §(§'¦  T ¡  \" £ ¦P˜l ÔÓ Ò function SAT PLAN( , ) returns solution or failure inputs: ¤¤'¦  T ¡  \" £ , a planning problem ¦P˜l ÔÓ Ò , an upper limit for plan length ¦P˜l ÔÓ Ò l for = 0 to do ÃI60oT ¥ % C #     G # §(§'¦  T ¡  \" £ l , T RANSLATE -T O -SAT( , ) R¢¤gR$@00$ % © #¡ T # C  SAT-S OLVER( ) ¥ G # if R§gR$20$ © #¡ T # C  is not null then return E XTRACT-S OLUTION( '6§oT R§gRe@02$ C #     © #¡ T # C  , ) return 2It6$¤G ¡ £ 3  Figure 11.22
    27. 27 Figure 12.2 E FFECT: àà ë òÙ §¢$0vÖ × Ø Ü ¢   ö á à û Ù ç õ QI£¡ÂP$R`Ö õ ö P RECOND : Ý Ý Ý Û á à Ù Ö Ýð ç Û í à ûÙ ÖÕ ç Ö× æ Ö éà1ûÙ¢!×'ÜbyÚâW1ûvæ§tiçbЄáP1¤fIRxä é à ûÙ ç ¨Ý Ö ÕÙ 1iØ ø “©‰svÖ õ QØ x÷ × ø E FFECT: à þÙ §àb¨wÖ × Ø Ü ¢   ö á à û Ù Ö ¦ Ý ð ç ç Û õ QI¤£¡ÂW1vçtibÐí P RECOND : à û Ý×Ý Ü Û é1Ù¢¤Ý'bwÚ«Wàb¤e)ég¥RtðibÛÐí á þé û ¤Ù Ý ç ç 1†¥¢tibÐí ¢x÷ vÖ é à û é ¤ Ù Ýð ç ç Û ù ù Ù õ QØ x÷ × ø E FFECT: àà þ §¨ÙvÖ õ ×QI£¡åW1v¤`'xä Ø Ü ¢   ö á à ûÙ Ö Õç Ö× æ Ö P RECOND : é à Ù Ö Õ Ö× Ö ä 1ûv¤ç`'æxÿåW1û¢!'ÜbyÚâáPàb¤e)I`!Ixä á à Ù Ý× Ý Ý Û þ é û é úÙ ç Ö× æ Ö é à üé û é úÙ ç Ö× æ Ö ù ù Ù ý¤eIR`'xä ¢x÷ vÖ õ QØ x÷ × ø àà ã ÞÙ ç ö á à ß ÞÙ ç §$­fÖ õ ÂW)xR`Ö õ s2IÜ &ô öÙð õ à§à¢e$'¢)•s¢@ibÐîWRI1p$Us¢t1bïîá ó ò é ã Þ é ã ñ Ù Ýð ç ç Û í á à ë ê é ß Þ é ß ñ Ù Ýð ç ç Û í à ë ì é ã Þ é ã èÙ ç Ö× æ Ö ä á à ë ê é ß Þ é ß èÙ ç Ö× æ Ö ä RI­p¨`!IÃÂWR')1p1g¨fIRxåá à ã ÞÙ Ý× Ý Ý Ü Û Ú á à ß ÞÙ Ý× Ý Ý Ü Û Ú Ù Ø× Ö $­4!'byâW)p4¤'bw1iQ“¤Õ IN THE REAL WORLD 12 PLANNING AND ACTING
    28. Figure 12.9 ‘ D # 3 ¦‘ Š ¦H¢6 Å C20 d4 ™ ± ‰26R6 Å 7 b©5 ™ \"± 8 7 5  c ! X D  # X W U ! 3 X 3 X ! ± EaG W 97\"™ ©5 V ± X  ± CTRQP0 ™ 5 IŽ ± X  ± G FC\"7 ™ AŒ ± ` 3 YW U G S ( B G\" H E D 3 CB @ ! 5 X ± 90 £™ '§$¨© 8 X f± 2©\"™ '§1¨© 'e 8 7 3 64 © £  Œ 1 0 3 )& © £  8 ‰ ( L INKS Š  X i± $ Ž “±  ! $¡©§£$Q© 8 X‰D26R6# Å $ ± $ ± f± %§1¨© 'e  Œ $ ©£ 8‰ O RDERINGS Š £ ¡ a ! $ §'@HI3 E 7$ ® #\"± f$!¥¢§!0R$\" † ± X # \" © 3 £© # Ê  I¤6I3 E ¡26 “± 06pT§¤¡ © X £¡ a £ Ž X© £  Œ ±‰ `$e S TEPS ˆ #  } ® ¤¡ Ë P$@ ® 5 X ¡ 3 a I$\" } @643 E '$4Ã$22¡ ˆ ¡  \"   T \"¥ ‘©¥  © # 2¤¦£¢$\" ʕ„¤ I3$\" } ¤ ¤‰1ÐÏ ¥ ¥ ¡ 7¡ # \" E FFECT: X  ¡ 3 ¤© 643 E I$\" } ¤ ¤b$\"ÐÏ 7¡ # P RECOND : X £ ¡ a 7 ˆ # \" © 4§'@HI3 E $ ® P$!¤¥ A ‘© £ ¦6pT§¤¡ ® ¥„¤ © HI3 E I$\" } E FFECT: ¡  3 X© ¥ £© # Ê §¦!R$\" ˆ¤ Hp§§¡ ® © T£ P RECOND : X`#$!¤¥¢§©0¢$\" \" © 3£  # Ê P$!¤¥ˆ # \" © A E FFECT: ¦¤¦¢$\" Ê ‘©¥ £© # X ¡ a I£§'6I3 E 06 ¡£ ˆ # \" © A E FFECT: P RECOND : } P$!¤¥ A © ‘¦6pT§£¤¡ ® ‰b$ F X a # X© T 0Hp§£§¡ ® ¤¡ © Ë P$!¤¥ ˆ # \" © ‘ ¡  3 iI$\" } E FFECT: X a # ‰b1 F P RECOND : 3 X¡¤41\" }  a@6I3 E P$!¤¥ ˆ # \" © A ‘ ¡ C  C© £ \" )I)6§$ÐÏ ¤ ¤‰1ÐÏ 7¡ # \" E FFECT: X© a¡ a \" ¤6$22£ Ê ))\" Ë P RECOND : X #  `$)\" F ¤¡ © ˆ # \" © A ¥ I¤‰1ÐÏ €¤ b$ F ‘ 7¡ # \" a # E FFECT: X 7¡ # \" §‰$ïÏ P RECOND : “$ X a # F I3 7 Ë E P$!¤¥ ˆ # \" © P$!¤¥ A Figure 12.5 R ESOURCE : àà òÙ Ý §04)¢ õ Ø ø “©“¤Õ ç ¨Ý Ö E FFECT: é à ë òÙ ×Ø Ü ¢   ö á à ûÙ ç ¢$0vÖ õ QI£¡ÂP$R`Ö õ ö P RECOND : 1vçt1bï„W1v¤`!Ixä é à û Ù Ö ¦ Ýð ç ç Û í á à û Ù Ö Õ ç Ö× æ Ö é à ûÙ ç ¨Ý Ö ÕÙ × ø $iØ ø “©‰swÖ õ QØ x÷ R ESOURCE : àà òÙ Ý ×Ø ÜØ ð çç Û §0R‰Ö õ QIsf 1¤bÐí E FFECT: é à þ Ù × Ø Ü ¢   ö á à û Ù Ö ¦ Ýð ç ç Û b¨wÖ õ QI¤£¡ÂP1Ã§tibÐí P RECOND : 1¢!'byâWe†¥¢@ibÐí é à û Ù Ý× Ý Ý Ü Û Ú á à þ é û é ¤Ù Ýð ç ç Û é à û é ¤ Ù Ýð ç ç Û ù ù Ù × ø 1†¥¢tibÐí ¢x÷ wÖ õ QØ x÷ R ESOURCE : àà òÙ ÝØ Ý §0RQ× õ `'xä ç Ö× æ Ö E FFECT: é à þÙ ×Ø Ü ¢   ö á à ûÙ Ö Õç Ö× æ Ö ¨vÖ õ QI£¡åW1v¤`'xä P RECOND : é à ûÙ Ö Õ ç Ö× æ Ö ä ÿ á à ûÙ Ý× Ý Ý Ü Û Ú á à þ é û é úÙ ç Ö× æ Ö 1v¤`'xåW14¤'bwâPb¤e)I`!Ixä é üé û é úÙ ç Ö× æ Ö ù ù Ù × ø à §e)IR`'xä ¢x÷ wÖ õ QØ x÷ àà ã ÞÙ ç ö á à ß ÞÙ ç §$­R`Ö õ ÂPixR`Ö õ s2IÜ &ô öÙð õ ÖÕ á à òÙ Ý ×Ø ÜØ ð ç ç Û í á à òÙ ÝØ Ý à§à¢©Ù¢Ý)¢ õ Ø ø 瓨©Ý“¤åW0¢“Ö õ QIsf ibЄP0RQ)!× õ fIRxåá  ç Ö× æ Ö ä à¢e$'¢)•s¢@ibÐîWRI1p$Us¢t1bïîá ó ò é ã Þ é ã ñ Ù Ýð ç ç Û í á à ë ê é ß Þ é ß ñ Ù Ýð ç ç Û í à ë ì é ã Þ é ã èÙ ç Ö× æ Ö ä á à ë ê é ß Þ é ß èÙ ç Ö× æ Ö ä RI­p¨`!IÃÂWR')1p1g¨fIRxåá à ã ÞÙ Ý× Ý Ý Ü Û Ú á à ß ÞÙ Ý× Ý Ý Ü Û Ú Ù Ø× Ö e¢¢!'byâW)p4!'by11“Õ Planning and Acting in the Real World 12. Chapter 28
    29. Figure 12.18 return P OP( ) $@  #  A PPEND( #1\"!$¢3R6©¢$\"0¥ 6$4¨¡0£ ©  # # £    , ) % #    % #  ¡ \" D &1î&$@  (14Pu „ the tail of $@  $4Pu #  ¡ \" D starting at &$!$¢¢H!R$2¥ % # \" ©  3 # © # \" E¢¡ P LANNER( „ ©R§¡0£§£I¤¥ # 3 , , ) % £    ¡ uw ¡ £ 3   V6$42£ x2It6$¤G find state in such that ¡©  a a #  §$!$$0¥ „ ) candidates S ORT( © #¡££ 3 ¢¤2§I¥ , ordered by distance to $@  $4Pu #  ¡ \" D % E ¢¡ if P RECONDITIONS( F IRST( )) not currently true in #  $R  then P LANNER( x¡ $)'C ¢¤2§I¥ E   \" © #¡££ 3 , , ) %&#1 î%&#$@  ¡(14Pu    \" D if then — – w $R  #  S TATE -D ESCRIPTION( , ) © E ¢¡ R¢¤2§I¥ % © #¡££ 3 , M AKE -P ERCEPT-S ENTENCE( © ¨§¦¤¢  ©  ¡¥£¡ , )) E ¢¡ T ELL( , a goal 1)'C   \" , a plan, initially —– #1  $4Pu  ¡ \" D , a plan, initially —– $@  #  static: , a knowledge base (includes action descriptions) E ¢¡ function R EPLANNING -AGENT( # \" © ¥ $!! ) returns an §¦§¢  ©  ¡¥£¡ Figure 12.14 ‘ else Œ e cf‘ then Œ e if else Ž Ž return if then Œ Œ else if then — #  $@  #  1  cf‘     #$@    $@  #   – ¡ £ 3  2It6$¤G if = then return 243 6$¤G ¡£   $@  #  ) H©$4  ¤¤'¦  ’  D T ¡  \" £ O R -S EARCH( , ,% ’ $R #  for each in do § ¨$¨0 ©¡ ¡© © ’ ¡ £   G £ \" X #      # \" © a # \" ¥ 2I3 H1P$v`$@¢1b$!6$$0˜ ) returns D©  !14  , function A ND -S EARCH( §(§'¦  § ¨$¨0 T ¡  \" £ © ¡ ¡© © , return 2It6$¤G ¡ £ 3  if then return #  —b$@  Á #$!¤ – \" ©¥ 243 6$¤G Ð$@  ¡ £   uw #   A ND -S EARCH( , —4!14  Á ¡©$Q0 – T¤¤'¦£  ¤¤ $Q0 D©  © ¡ \" ©¡ ¡© © , ) &$R  % #  for each ¡© © , $Q0 ¤¡¤'\"¦  T  £ in S UCCESSORS[ ]( ) do ©¡ ¡© © # \" ©¥ ¤¤ $Q0 $!¤ if is on then return 3  ¡2£It6$¤G !$4  D©  ¡© © ¨$¨2 if G OAL -T EST[ ]( ) then return the empty plan $Q0 §(§'¦  ¡© © T ¡  \" £ 2It6$¤W$vf$R¢$$!6$$0o function O R -S EARCH( ¡ £ 3  G £ \" X #      # \" © a # \" ¥ , , D©  !$4  ) returns §(§'¦  ¨$¨0 T ¡  \" £ ¡© © —– , )T ¡  \" £ ], ¤¤'¦  ¤¤'¦  O R -S EARCH(I NITIAL -S TATE[ T ¡  \" £ 243 6$¤W$v`$@4$b1!6$b$2o ¡ £   G £ \" X #      # \" © a # \" ¥ ) returns T ¡  \" £ §(§'¦  function A ND -O R -G RAPH -S EARCH( 29
    30. Figure 12.30 ‘‘— Ñ X X © # ¡ C  ˆ A ¥ ¦62WR† – 0R§I)2¤© ¦„¤ 6— – X –¼ §¢¤I2¤© A ‘ E FFECT: X© #¡ C ˆ X ‘—Ñ X X © # ¡ C ˆ §H¦WR† – 0R§I)2¤© A P RECOND : X‘ X© #¡ C ˆ ˆ # \" © §H— – X –¼ 0R¤')2R\" Ë P$!¤¥ A ‘‘ ˆ a ¡ # £ 3© ¦!6$ E ‰2‰§I!¤¡ B E FFECT: ‘ X £ ¡ #© £   ˆ A ¥ ‘ £ ¡ #© £   X © # ¡ C ˆ £ ¡ #© £ H— – X –¼ '¤b§$4H¤© ¦„¤ $¤‰!§$4s§¢¤I2I¤‰!§$ ® ¤ ‘ H— – X –¼ §R§I)2¤© ɤ H— – X –¼ ¨6$ E ‰'6'¤)¦e  A X ˆ C # D ¥  \"£   X© #¡ C ˆ A ‘ P RECOND : X ‘ X© #¡ C ˆ© ˆ # \" © §!6$ E §R§I)2¤6 } P$!¤¥ A ‘‘—© ¡ g X© #¡ C ˆ A ‘ ˆ a ¡ # £ 3© ˆ  ¦H¨§xiX –¼ §R§I)2¤© ɤ !6$ E b2‰§I§¡ B 1)\" Ë # ˆ #©£ ‘‘— ¡ #  ¡  X© D C ‘xÎ2X µ ˆ4£§¡‰!©§£$ ® ¤ ‘ µ X&ÎI£¤¡‰!§$ ® ¤ ¦H¤bH ¤¤$ E 0'1 B – ¨6$ E ‰I6'§)¦  A X ˆ C # D ¥  \"£   ¤ ‘—© ¡ g X © D C ˆ A ‘— ¡ #  ¡  H¨¤&'0'$@ B – X µ ¤© Ǥ H¤bH ¤¤$ E §0H¡ F – &¤© A 6¢# Ä X©G X Έ ˆ © ‘ µ &e!R¤'C A X Έ © # ¡ Figure 12.28 return # \" ©¥ $!¤ # \" ©¥R EMOVE -F LAW( $!¤ ) // possibly updating #  1  ) E FFECTS[ §¦§¢  §$Q© 8 ©  ¡¥£¡ ©£  ] = U PDATE(E FFECTS[ ], ©£  §$¨© 8 (the default)   Æ ­h&$!! \" g % # \" © ¥ D # , 26¢H Å §1¨© 8 ©£  static: , a plan, initially with just $@  #  # \" © ¥ 1! ) returns an ©  ¡¥£¡ 02§¢  function C ONTINUOUS -POP-AGENT( Planning and Acting in the Real World 12. Chapter 30
    31. 13 UNCERTAINTY function DT-AGENT( R§¦¤¢  ©  ¡¥£¡ ) returns an $!¤ # \" ©¥ static: $Q0 !t§0 ¡© © G¡  ¡ , probabilistic beliefs about the current state of the world $!¤ # \" ©¥ , the agent’s action update ¡© © G¡  ¡ $Q0 Ht§0 based on and # \" © ¥ $!! ©  ¡¥£¡ §¦§¢  calculate outcome probabilities for actions, given action descriptions and current $Q0 HQ ¤2 ¡© © G¡  ¡ select $!¤ # \" ©¥ with highest expected utility given probabilities of outcomes and utility information return $!¤ # \" ©¥ Figure 13.2 function E NUMERATE -J OINT-A SK( , e, P) returns a distribution overp p inputs: , the query variable p e, observed values for variables E P, a joint distribution on variables E ¨ ïi‰ Y /* Y = hidden variables */ Š ‹ ¨ Q pˆ % R‘ a distribution over , initially empty p for each value of do ’ ¼ p Q % R‘ ’ ¼ ˆ E NUMERATE -J OINT( , e, Y, , P) ’ ¼ —– return N ORMALIZE(Q ) ‘ ‹ˆ function E NUMERATE -J OINT( , e, , §Rt$1d §1$d  ¡ 3   £  , P) returns a real number ¼ if E MPTY ?( §1$d £  ) then return P e )¤R3 $$X X ¼ ˆ ‘ ¡   d q % F IRST( ) §$$d £  return E NUMERATE -J OINT( , e, R EST( r ), , P) ¼ £  §$1d —¡   Á §¤R3 $$d “ –– ´ Figure 13.6 31
    32. PROBABILISTIC 14 REASONING function E NUMERATION -A SK( , e, ) returns a distribution over p # ¤ p inputs: , the query variable p e, observed values for variables E # ¤ , a Bayes net with variables E Y /* Y = hidden variables */ ¨ Ði‰ Š ‹ ¨ Q pˆ % R‘ a distribution over , initially empty p for each value of do ’ ¼ p extend e with value for ’ ¼ p Q % R‘ ’ ¼ ˆ E NUMERATE -A LL(VARS[ ], e) # ¤ return N ORMALIZE(Q ) ‘ ‹ˆ function E NUMERATE -A LL( §$$d £  , e) returns a real number if E MPTY ?( ) then return 1.0 §1$d £  s % F IRST( ) §$$d £  s if has value in e 7 then return €¦‘ q „ xp uRÌ Á™– ˆ £ y ‘ ˆ wv t† E NUMERATE -A LL(R EST( ), e) £  §$$d else return y€‘¦‘ q '„ wp uÌ g– ˆ £ ´ r ˆ v t † Á E NUMERATE -A LL(R EST( ), e ) §$1d £  ´ where e is e extended with – w q ´ Figure 14.10 function E LIMINATION -A SK( , e, ) returns a distribution over p # ¤ p inputs: , the query variable p e, evidence specified as an event # ¤ , a Bayesian network specifying joint distribution P ‘ o‹ X ™‹ ˆ ‘ X    Œ % £  % £ \"© ¥  f§$$d — – `§$Q¤G ; R EVERSE(VARS[ ]) # ¤ £  §$$d for each 1$d £  in do % £ \"©¥  – f§$¨¤¤G M AKE -FACTOR e —£ \"© ¥  X £  d §§1¨eG Á ‘ '1$sˆ if 1$d £  is a hidden variable then S UM -O UT( % £ \"© ¥  f§$Q¤G £ \"© ¥  £  §$Q¤G $1d , ) return N ORMALIZE(P OINTWISE -P RODUCT( )) §£$\"Q©¤G ¥  Figure 14.12 32
    33. 33 # ¤ function P RIOR -S AMPLE( ) returns an event sampled from the prior specified by # § # ¤ inputs: , a Bayesian network specifying joint distribution P ‘ o‹ X ™‹ ˆ ‘ X    Œ % x an event with elements v for to do w z v % ’ ¼ a random sample from P ’ ‹ˆ xp §RÌ Á wv t† ‘ ˆ ¦‘ ’ ‹ „ return x Figure 14.15 function R EJECTION -S AMPLING( , e, , ) returns an estimate of p # ¤ g ‘ Á ‹ˆ £ e inputs: , the query variable p e, evidence specified as an event , a Bayesian network # ¤ g , the total number of samples to be generated local variables: N, a vector of counts over , initially zero p for = 1 to do ¶ ‚ % x P RIOR -S AMPLE( ) # § if x is consistent with e then % k N[ ] N[ ]+1 where is the value of k k p in x return N ORMALIZE(N[ ]) p Figure 14.17 function L IKELIHOOD -W EIGHTING( , e, , ) returns an estimate of p # ¤ g ‘ Á ‹ˆ £e inputs: , the query variable p e, evidence specified as an event , a Bayesian network # ¤ g , the total number of samples to be generated local variables: W, a vector of weighted counts over , initially zero p for = 1 to do ¶ ‚ x, % —u W EIGHTED -S AMPLE( ) # ¤ W W %$4k – — where is the value of u ’ — U'4k – k p in x return N ORMALIZE(W ) — p– function W EIGHTED -S AMPLE( # ¤ , e) returns an event and a weight % x an event with elements; 1 v % —u for = 1 to do v if has a value in e ’ ‹ ’ ¼ then w ’o‹ ˆ £ ƒg—u y u % ¦‘ o‹ „ xp §RÌ W¼ ‘ ’ ˆ w v t † Á ’ else a random sample from P % ’ ¼ ‘ ¦‘ ’ ‹ '„ wvp uÌ Á ’ ‹ ˆ ˆ t† return x, u Figure 14.19
    34. 34 Chapter 14. Probabilistic Reasoning p— # ¤ function MCMC-A SK( , e, , ) returns an estimate of g e ‘ Á ‹ˆ £ local variables: N , a vector of counts over , initially zero p– p Z, the nonevidence variables in # § x, the current state of the network, initially copied from e initialize x with random values for the variables in Z for = 1 to do ¶ ‚ N % — 14k – N U'4k – z ’ — where is the value of in x k p for each in Z do „ ’ sample the value of in x from P „— ’ ‘ ¦‘ ’ „ 1Ñ … Á ’ „ ˆ ˆ given the values of ‘ ’ „ ˆ ↠µ in x return N ORMALIZE(N ) p– Figure 14.21
    35. PROBABILISTIC 15 REASONING OVER TIME function F ORWARD -BACKWARD(ev, $!§  £ \" £ ) returns a vector of probability distributions inputs: ev, a vector of evidence values for steps ¤)¤z X  X w $!§  £ \" £ , the prior distribution on the initial state, P X ‘ ‡ ˆ local variables: fv, a vector of forward messages for steps X)¤X ˆ w b, a representation of the backward message, initially all 1s sv, a vector of smoothed estimates for steps w ¤ez X   X fv $!§„1— ˆ – £ \" £   % for w 1z% — w  to do ˆ Q¤•™  – X—z ‘ H—  – fv F ORWARD fv – ev for w$— w  downto 1 do % – ˆ y £—  – ‘ sv N ORMALIZE fv b % b BACKWARD b ev X ˆ ‘ H—  – return sv Figure 15.5 35
    36. 36 Chapter 15. Probabilistic Reasoning over Time function F IXED -L AG -S MOOTHING( , , ) returns a distribution over X ‰ p p'D T T a ‰ ‘e inputs: , the current evidence for time step ‰ p , a hidden Markov model with p'D T T transition matrix T y w± ± , the length of the lag for smoothing a © static: , the current time, initially 1 f, a probability distribution, the forward message P , initially P RIOR ‘ ‰ ”$p ’‹ ˆ “Œ Á‰ op'D – — T T B, the -step backward transformation matrix, initially the identity matrix • , double-ended list of evidence from ‰ P‰ p “‘ e to , initially empty • ™w w local variables: O ‰ X ©‰ O , diagonal matrices containing the sensor model information ‘e add to the end of ‰p% ‰ P©‰ p “‘ e O ‰diagonal matrix containing P ˜ ’‹ )p ˆ ‰ Á‰ ‘ if then w • f F ORWARD f % ‘ p X ˆ ‰ remove from the beginning of “2\"©‰ p Œ e ‘ e ‰ P©‰ p “‘ e O diagonal matrix containing P ‘ \"©%e ‰ % ©‰ Á‹ \"©‰ p ˆ ‘e ‘e ‘ B O T BTO Œ ce Œ ce ‰ % ©‰ ‘e else B BTO ‰ {ch© z ’ © % if • ˜ w then return N ORMALIZE f ˆ y ‘ B1 else return null Figure 15.8 function PARTICLE -F ILTERING(e, , ) returns a set of samples for the next time step g §'a # inputs: e, the new incoming evidence g , the number of samples to be maintained ¤'a # , a DBN with prior P X , transition model P X X , and sensor model P E X ˆ ‘ ÁeŒ ˆ ‘ ‘ Œ $Œ ˆ static: , a vector of samples of size , initially generated from P X 8 g‡ ‡ ˆ ‡ ‘ Á local variables: , a vector of weights of size – g for = 1 to do g [ ] sample from P X X 8 % Á Œ ˆ ‡ w ‘— – H y8 [ ] P eX – % w Œ Á ˆ 6—  v± ‘ – % 8 W EIGHTED -S AMPLE -W ITH -R EPLACEMENT( , , g 8 – ) return 8 Figure 15.18
    37. 16 MAKING SIMPLE DECISIONS function I NFORMATION -G ATHERING -AGENT( 02§¢  ©  ¡¥£¡ ) returns an $!¤ # \" ©¥ static: , a decision network 5 integrate ¨§¦¤¢  ©  ¡¥£¡ into 5 % ¶ the value that maximizes — ™ ˜ Ä ‘ “ 9ˆ V® ˜ˆ© ‘ “ 9¤0$\" Ê if — ˜ ˜ Ä Ð‘ “ 9ˆ V® ˜ˆ© ‘ “ 9¤0$\" Ê then return R EQUEST( ) ˜ “ else return the best action from 5 Figure 16.9 37
    38. 17 MAKING COMPLEX DECISIONS function VALUE -I TERATION( , ) returns a utility function §oT  a ™ §oT  a l inputs: , an MDP with states , transition model , reward function , discount 8 B d , the maximum error allowed in the utility of any state ™ Í | Í local variables: , , vectors of utilities for states in , initially zero 8 e , the maximum change in the utility of any state in an iteration repeat % ïÍ ; 0 | Í e % for each state in 8  do 1§ – vÍ % — | ’¢—§ –xB j h†ƒ d g 1… f ‡ ti„ – ¢6)0¦eQˆ —| Í ‘| „ X † X „ if p§ – | Í Á ™ — Í e i©‚ e ˜ Á ¤„ – —then % ™ — x§ – | Í Á Á ¤„ – Í — until k le d sˆ ™ ™ z º ¦‘ d return Í Figure 17.5 38
    39. 39 function P OLICY-I TERATION( §oT  a ) returns a policy §oT  a l inputs: , an MDP with states , transition model8 Í | Í local variables: , , vectors of utilities for states in , initially zero 8 m , a policy vector indexed by state, initially random repeat % ïÍ P OLICY-E VALUATION( , m Í , §oT  a ) W42I'$4¤I3 % r a¡ C #  D¥ #true for each state in do  if j r ™t—)„ – ¢6‘)0¦eQ8„ ˆ j r f 1†ƒ ˜ | Í | „X †X ‡ … t)„ – ¢6)0„ – m eQˆ —| Í ‘| „ X— X „ then ”‘i ‚ | 22eQˆ j ”‚ 1§ m iÇ% — —| „– ¢ „ X † X „ Í r f 1†eTo… – ‡ … ƒ pn ”‚ P¢2'I$4§bI3 i % r a¡C # D¥ # false until ¢¦II14¤43 r a¡ C #  D¥ # ® return Figure 17.9
    40. 18 LEARNING FROM OBSERVATIONS function D ECISION -T REE -L EARNING( , © I$¤!'a ¤§!$ ¤Ã$e0¡  3  G¡   £©©  ¡   T  k , ) returns a decision tree inputs: §(Ã10¡  ¡   T  k , set of examples §Q§!$   £©© , set of attributes © I$¤!'a  3  G¡ , default value for the goal predicate if §(RÃ$2¡  ¡   T  k is empty then return © I$¤!'a  3  G¡ ¤Ã$e0¡  ¡   T  k else if all have the same classification then return the classification else if  £©© §§1 is empty then return M AJORITY-VALUE( )  ¡   T  k §(Ã10¡ else % ©¡ R0¤2 C HOOSE -ATTRIBUTE( ,  ¡   T  k   £©© §(Ã10¡ ¤§!$ ) `02!© % ¡¡£ a new decision tree with root test 0§0 ©¡ % {T M AJORITY-VALUE( ) ’ §(RÃ$2¡  ¡   T  k for each value of ’ d do 0§0 ©¡  ¡   T  k % ’ §(RÃ$2¡ elements of ‰ with  ¡   T  k §(Ã10¡ Š ’ œ w 2¤0 ©¡ f02§2 % ¡¡£© 3 D ECISION -T REE -L EARNING( £ © T ©0§¡0ý™P¤§!©$X ’ §¡(RÃ$2¡    T  k , ) add a branch to 02© ¡¡£ with label and subtree ’d 0¡2§R0 ¡ £© 3 return 02© ¡¡£ Figure 18.6 40
    41. 41 function A DA B OOST( Ï F ¤Ã$2¡  ¡   T  k , , ) returns a weighted-majority hypothesis inputs: §(Ã10¡  ¡   T  k , set of labelled examples g ˆ X  X Œ Œ q\"¼ )¤)¤§‘ 4– X “¼ ˆ qu– X ‘ , a learning algorithm F Ï , the number of hypotheses in the ensemble local variables: w, a vector of example weights, initially g uiz gº h, a vector of hypotheses Ï z, a vector of hypothesis weights Ï for T = 1 to do Ï h (% — e˜T – , w)  ¡   T  k ¤Ã$2¡ F 0%V$¦§§¡ £ \"££ for = 1 to do ¶ g if h then uw ˆ— Ñ “ ¼ ¨˜T – “ – ’ £ \"££¡ % £ \"££ å$¦§¤iV$¦§§¡ w — r– for = 1 to do¶ g if h then w“ – w ‘ “ ¼ ¨˜T – w ˆ— % 1— r – e12§§{s4$$¦§§­t— r – ‘ £ \"££¡ ™ zˆ º £ \"££¡ s w N ORMALIZE(w) % z 12§§R¦$$¦§¤{vs˜yxv$˜T – £ \" £ £ ¡ º ‘ £ \" £ £ ¡ ™ z ˆ p wu % — return W EIGHTED -M AJORITY(h, z) Figure 18.12 function D ECISION -L IST-L EARNING( §(RÃ$2¡  ¡   T  k ) returns a decision list, or 2It6$¤G ¡ £ 3  if §(RÃ$2¡  ¡   T  k is empty then return the trivial decision list \" ­g % © a test that matches a nonempty subset of  ¡   T  k §(Ã10¡ ¤Ã$e0¡  ¡   T  k §(RÃ$2¡  ¡   T  k ‰ such that the members of are all positive or all negative ‰ if there is no such then return © 2It6$¤G ¡ £ 3  if the examples in §(Ã10¡  ¡   T  k are positive then ‰ else % y\" s  ¤¡ \" g % ­zy\" return a decision list with initial test and outcome and remaining tests given by © \" D ECISION -L IST-L EARNING( ) ¡ ™Ð¤ ÃT$2¡ k ¡  k ¤ ÃT$2¡ ‰ Figure 18.17
    42. 19 KNOWLEDGE IN LEARNING function C URRENT-B EST-L EARNING( §(RÃ$2¡  ¡   T  k ) returns a hypothesis % } any hypothesis consistent with the first example in ¤Ã$e0¡  ¡   T  k for each remaining example in do ¤Ã$2¡  ¡   T  k ¡ } if is false positive for then % } choose a specialization of consistent with } ¤Ã$e0¡  ¡   T  k ¡ } else if is false negative for then % } choose a generalization of consistent with } ¤Ã$e0¡  ¡   T  k if no consistent specialization/generalization can be found then fail } return Figure 19.3 function V ERSION -S PACE -L EARNING( ) returns a version space §(RÃ$2¡  ¡   T  k local variables: , the version space: the set of all hypotheses — — % the set of all hypotheses for each example in ¡ §(Ã10¡  ¡   T  k do if is not empty then — % — V ERSION -S PACE -U PDATE( , ) — ¡ return — function V ERSION -S PACE -U PDATE( , ) returns an updated version space — ¡ — % ” ‰  — |{» ” is consistent with Š ¡ Figure 19.5 42
    43. 43 n function M INIMAL -C ONSISTENT-D ET( , ) returns a set of attributes A n inputs: , a set of examples , a set of attributes, of size A # for % 4 ˆ # X    g†X do for each subset of of size do ’ vA A n if C ONSISTENT-D ET ?( , ) then return ’ A ’ A n function C ONSISTENT-D ET ?( , ) returns a truth-value A inputs: , a set of attributes An , a set of examples } local variables: , a hash table ¡ n for each example in do } ¡ if some example in has the same values as for the attributes A but a different classification then return ¡¤t$¤G   ¡ } ¡ store the class of in , indexed by the values for attributes of the example A return R§© ¡ 3£ Figure 19.11
    44. 44 Chapter 19. Knowledge in Learning ¤'Q1¨© ¤Ã$2¡ © ¡ C£   ¡   T  k function F OIL( , ) returns a set of Horn clauses inputs: §(Ã10¡  ¡   T  k , set of examples §I$¨© ©¡ C£  , a literal for the goal predicate local variables: ¤¤41¤¥  ¡  3  , set of clauses, initially empty while ¤Ã$e0¡  ¡   T  k contains positive examples do % ¡  3  P¤41¤¥ N EW-C LAUSE( , ) © ¡ C£   ¡   T  k §I$Q© ¤Ã$2¡ remove examples covered by from ¤ ÃT$ek0¡ ¡ I$@¥ ¡  3  add I$@¥ ¡  3  to ¤¤41¤¥  ¡  3  return §I$@¥  ¡  3  function N EW-C LAUSE( , §I$Q© §(Ã10¡ © ¡ C£   ¡   T  k ) returns a Horn clause local variables: ¤I$Q© ©¡ C£  , a clause with ¤41¤¥ ¡  3  as head and an empty body  , a literal to be added to the clause §(Ã10¡ 2b¤¨$2¡  ¡   T  k a ¡ a # ¡© k , a set of examples with values for new variables ¤Ã$2ˆf¤Ã$e0¡ 2'¤10¡  ¡   T  k ¡ %  ¡   T  k a ¡ a # ¡ © k while ¤Ã$2¡ 2'b§10¡  ¡   T  k a ¡ a # ¡ © k contains negative examples do ¡I3$@¥  C HOOSE -L ITERAL(N EW-L ITERALS( ), % e )  ¡   T  k a ¡ a # ¡ © k ¤Ã$e0¡ ¦'b§$2¡ append to the body of ¡I$@¥  3   `§(Ã10¡ 2b¤¨$2¡ %  ¡   T  k a ¡ a # ¡© k set of examples created by applying E XTEND -E XAMPLE §(R ÃT$k2¡ a¦¡'b§$2¡ ¡ to each example in a #¡© k return I$@¥ ¡  3  function E XTEND -E XAMPLE( , $¦¤¨6t (Ã10¡   £ ¡© ¡   T  k ) returns if (RÃ$2¡ ¡   T  k satisfies $¦§6t  £¡© then return the set of examples created by extending Ã$2¡ ¡   T  k with each possible constant value for each new variable in 12§6   £¡© else return the empty set Figure 19.16
    45. 20 STATISTICAL LEARNING METHODS function P ERCEPTRON -L EARNING( 0$!¤‰# ¤Ã$e0¡ 9 £ \" u© ¡  ¡   T  k , ) returns a perceptron hypothesis inputs:  ¡   T  k §(Ã10¡, a set of examples, each with input x ‘ §¤)X Œ k w kX   and output 7 0$!¤‰# 9£ \" u© ¡ , a perceptron with weights X “ ·, and activation function r w ˆ   v ¤ C repeat for each in do ¤Ã$e0¡  ¡   T  k ¡ ‘ — ¡ – “ k “ · ‘ # ˆ C ™ ‡ ~“ 7 r % &6# % } “6s‰¬p— p – h§£ n £ —¡ – “ kžy€‘“6sˆ | Cžy£§£ n y š ’ “ · % “ · # until some stopping criterion is satisfied return N EURAL -N ET-H YPOTHESIS( 0$§‰# 9£ \" u©¡ ) Figure 20.22 45
    46. 46 Chapter 20. Statistical Learning Methods function BACK -P ROP -L EARNING( 0$!¤‰# ¤Ã$e0¡ 9 £ \" u© ¡  ¡   T  k , ) returns a neural network inputs: §(Ã10¡  ¡   T  k , a set of examples, each with input vector x and output vector y 0$!¤‰# 9£ \" u© ¡ , a multilayer network with layers, weights F , activation function ³’ “ · C repeat for each in¡ ¤Ã$e0¡  ¡   T  k do for each node in the input layer do r ¤¡ “ ~% “  — – k for = 2 to do Ï   ³’ “ · % ’ 6 # “ “ r ‘ ’ 6sb~% ’  # ˆ C for each node in the output layer do # C ‘ ’ gp¤¡ – ’ – ɂ‘ ’ Hsˆ | Ç% ’ m † ™ — ˆ y for = to 1 do z ™ Ï  for each node in layer do r# C m  m ’ ³’ “ · ’ r ‘ “ 6sˆ | ~% “ z{’  for each node in layer  do m “ Éy š ’ ³’ “ · % ³’ “ · † y ’ until some stopping criterion is satisfied return N EURAL -N ET-H YPOTHESIS( 0$§‰# 9£ \" u©¡ ) Figure 20.27
    47. REINFORCEMENT 21 LEARNING function PASSIVE -ADP-AGENT( §¦§¢  ©  ¡¥£¡ ) returns an action inputs: R§¦¤¢  ©  ¡¥£¡ , a percept indicating the current state and reward signal |  | £ m static: , a fixed policy §oT  a , an MDP with model , rewards , discount j ƒ d Í , a table of utilities, initially empty ( X gg , a table of frequencies for state-action pairs, initially zero , a table of frequencies for state-action-state triples, initially zero i X ( X  , , the previous state and action, initially null if |  is new then do [ ] ; [ ]Í | B $h%  | £ | £ $h%  | if  is not null then do   (X g increment [ , ] and © iX(X g [ , , ] ©   ( g |    for each such that [ , , ] is nonzero do iX X g [ , , ]   l  ( X g ©   ( h% © [ , , ]/ [ , ]  % ÐÍ 0aoT Í m   iX X VALUE -D ETERMINATION( , , ) if T ERMINAL ?[ ] then , |  % null else , w  ,  % | gv  m —| – return  Figure 21.3 47
    48. 48 Chapter 21. Reinforcement Learning function PASSIVE -TD-AGENT( R§¦¤¢  ©  ¡¥£¡ ) returns an action inputs: R§¦¤¢  ©  ¡¥£¡ , a percept indicating the current state and reward signal |  | £ m static: , a fixed policy Í , a table of utilities, initially empty ‚ g , a table of frequencies for states, initially zero £   , , , the previous state, action, and reward, initially null if |  is new then [ ] Í | h% |  £ if  is not null then do increment [ ]  ‚ g [ ] Í %  ­§ – Í ’ — ås¤6§ – ‚ ˆ š ’ £ˆ ‘— g d H§ – Í p— |  – Í ‘— ™ if T ERMINAL ?[ ] then , , |  % £   null else , , h£   |  % , m | —| $£ @ – , return  Figure 21.6 function Q-L EARNING -AGENT( ) returns an action 02§¢  ©  ¡¥£¡ inputs: R§¦¤¢  ©  ¡¥£¡ , a percept indicating the current state and reward signal |  | £ static: , a table of action values index by state and action „ (  X g , a table of frequencies for state-action pairs £ , , , the previous state, action, and reward, initially null  if is not null then do increment [ , ]   (X g ™x— | ¤X | † –p„ f 1…gƒ d ’Âs¤‘6eiX$ – ( X ˆ š ’¢§§R p„ 1§§R p„ ‡ £ˆ — g —X – % —X – H§§R p„ ‘—  X – i %£   |  if T ERMINAL ?[ ] then , , null | £ H— | )X | † – ( X bXQ— | X | † –p„ ˆ ‚ f ‡$geTo… | h£   else , , , ‘  g  i … ƒpn  %  , return Figure 21.11
    49. 22 COMMUNICATION function NAIVE -C OMMUNICATING -AGENT( ¨§¦¤¢  ©  ¡¥£¡ ) returns 1! # \" © ¥ static: , a knowledge base E ¢¡ $Q0 ¡© © , the current state of the environment #$\"!¤ ©¥ , the most recent action, initially none P1¨0 % ¡© © U PDATE -S TATE( , ©  ¡¥£¡ # \" ©¥ ¡© © 02§¢  $!¤ 1¨0 , ) `$¦$u %  a£ \" S PEECH -PART( ) ¨§¦¤¢  ©  ¡¥£¡ %`¤!©R1o¤ ¥ #  T¡ D ISAMBIGUATE(P RAGMATICS(S EMANTICS(PARSE( )))) $¦$u  a£ \" ¡‰#$\"­g $¦$u if = a£ \" and $!e # \" © ¥ is not a S AY then /* Describe the state */ return S AY(G ENERATE -D ESCRIPTION( )) ¨$¨2 ¡© © else if T YPE[ ¤!R1o¤ ¥ © #  T¡ ] = Command then /* Obey the command */ return C ONTENTS[ ¤!R1o¤ ¥ © #  T¡ ] ¤!R1o¤ ¥ © #  T¡ else if T YPE[ ] = Question then /* Answer the question */ E ¢¡ V¤y0R1 % £¡ u # A SK( , ¥ © #  T¡ ¤!R$o§ ) return S AY(G ENERATE -D ESCRIPTION( )) ¤y0R1 £¡ u # else if T YPE[ ¤!R1o¤ ¥ © #  T¡ ] = Statement then /* Believe the statement */ T ELL( , C ONTENTS[ E x¡ ]) ¥ © #  T¡ ¤!R$o§ /* If we fall through to here, do a “regular” action */ return F IRST(P LANNER( , E)) ¢¡ ¡© © $Q0 Figure 22.3 49
    50. 50 Chapter 22. Communication function C HART-PARSE( £  T T £  a£ \" $op$¦eC $¦$u , ) returns ©£  D §$4§¥ §14¤¥ % ©£  D array[0. . . L ENGTH( )] of empty lists $¦$u  a£ \" A DD -E DGE( | ± X ˆ X ˆ– ) 3 — ± … for % 4 from 0 to L ENGTH( ) do  a£ \" $¦$u S CANNER( , [ ]) 121yu  a£ \" return §$I¤¥ ©£  D procedure A DD -E DGE( ) ')2¡ ¡ C a /* Add edge to chart, and see if it extends or predicts another edge. */ if ¡ C a I)¦¡ not in [E ND( ©£  D §$4§¥ )] then ¡ C a ')2¡ append to [E ND( ¡ C a ')2¡)] ©£  D §$I¤¥ ¡ C a I2¡ if ¡ C a ')2¡ has nothing after the dot then E XTENDER( ) ¡ C a I)2¡ else P REDICTOR( ) I)¦¡ ¡ C a procedure S CANNER( , ) a¦$u ¶ £ \" /* For each edge expecting a word of this category here, extend the edge. */ for each A X r X – in 3 [ ] do š … — › E ©£  D ¶ §$4§¥ if ¦$u a£ \" is of category then A DD -E DGE( 3 Î X zE hVep’ r X  – ) µ š … — › procedure P REDICTOR( )3 A X ¶ 0– X š … — •E › /* Add to chart any rules for that could help extend this edge */ E for each Eˆ 3 in R EWRITES -F OR( , ‘ d ) do E £  T T £ 1op$¦eC A DD -E DGE( ) E X r X r– 3 d … — procedure E XTENDER( E X9§X –¶ ) 3 d — I… /* See what edges can be extended by this edge */ † )p % the edge that is the input to this procedure for each 3 Î ‡`X r X  – in [ ] do š … — › | µ ©£  D ¶ §$4¤¥ if µ then | µ w A DD -E DGE( 3 Î Xˆ hïYX  – ) … † Yš p — › Figure 22.9
    51. 23 PROBABILISTIC LANGUAGE PROCESSING ® $0¨© © k¡ function V ITERBI -S EGMENTATION( , ) returns best words and their probabilities inputs: 10© © k¡ , a string of characters with spaces removed ® , a unigram probability distribution over words L ENGTH(% &# ) $0¨© © k¡ `$¦$u %  a£ \" empty vector of length v z {’ % ©¡ R2¤0 vector of length , initially all 0.0 v z {’ % [0] 1.02¤0 ©¡ /* Fill in the vectors best, words via dynamic programming */ for = 0 to do v for = 0 to do z •™  ¶ a \" [ :] ¦£$  u r $2hv¦$—uu © k¡© % a£  % \" L ENGTH( ) if [ ] 0¤¡0 y 21yu ® © [ - ] a£ \" [ ] then ©¡ 0§0  u []a¦$\"u ® %  0§0 £ [ ] [ ©¡ ] 2¤0ýy ©¡ ‰ Š™  []¦$g%  $¦$u a£ \" u  a£ \" /* Now recover the sequence of best words */ sequence the empty list %  % v while do  ˆ ˜ $a¦£$\"u §b§R2 ¡¥ #¡ 3 S¡ push [ ] onto front of   % L ENGTH( ™ [ ])  a£ \" $¦$u  /* Return sequence of best words and overall probability of sequence */ return , 0¤0 0b¤R¤2 ©¡ ¡¥ #¡ 3S¡ []  Figure 23.2 51
    52. 24 PERCEPTION function A LIGN( ¤')oT I)o6 ¡ a \" , ¡ C  T ) returns a solution or failure inputs: IoH ¡ C  T , a list of image feature points ¤')oT ¡ a \" , a list of model feature points for each Ì Ì  bX Ž X Œ Ì X Y… X ¦… in T RIPLETS( ) do §')oT ¡ a \" ¡ C  T ')o6 for each Ž Œ in T RIPLETS(  ‚… ) do „ % F IND -T RANSFORM( X ŽY… X Œ¦…  bX Ž bX Œ Ì , Ì Ì  ‚… ) if projection according to explains image then „ return „ return failure Figure 24.22 52
    53. 25 ROBOTICS function M ONTE -C ARLO -L OCALIZATION( , , , , ) returns a set of samples °  g   ¡ a \" §oT §')oT  inputs: , the previous robot motion command z, a range scan with readings Ï Y0X Œ ° ‹°X g , the number of samples to be maintained ¤')oT ¡ a \" , a probabilistic environment model with pose prior P X , ˆ ‘ ‡ motion model P X X , and range sensor noise model Á $Œ ˆ Î ‡ 2X ‡ ‘ ‘vbÁ ”ˆ £ Œ Œ §oT   , a 2D map of the environment static: , a vector of samples of size , initially generated from P X 8 g ˆ ‡ ‘ local variables: , a vector of weights of size – g for = 1 to do g [ ] sample from P X X 8 % ÁeŒ ˆ ‡ w Î X— – `Q y8 ‡ w ‘ I [ ] 1 – % for =1 to do ¶ Ï % y° E XACT-R ANGE( , [ ],   §oT 8 ¶ )  Ž •– s —– ‘° w YÁ “ ° w ”ˆ £ Œ % 8 – 1Q – % —  Œ g W EIGHTED -S AMPLE -W ITH -R EPLACEMENT( , , 8 – ) return 8 Figure 25.8 53
    54. 26 PHILOSOPHICAL FOUNDATIONS 54
    55. 27 AI: PRESENT AND FUTURE 55

    + benjaminlawbenjaminlaw, 2 years ago

    custom

    591 views, 0 favs, 0 embeds more stats

    This is Pusdo Code for AI logic

    More info about this document

    © All Rights Reserved

    Go to text version

    • Total Views 591
      • 591 on SlideShare
      • 0 from embeds
    • Comments 0
    • Favorites 0
    • Downloads 5
    Most viewed embeds

    more

    All embeds

    less

    Flagged as inappropriate Flag as inappropriate
    Flag as inappropriate

    Select your reason for flagging this presentation as inappropriate. If needed, use the feedback form to let us know more details.

    Cancel
    File a copyright complaint
    Having problems? Go to our helpdesk?

    Categories