You are on page 1of 55

|  

|  

   

    



   
  
    
   
    
      !   
      !   "  #   $
    p
£ %  

   $  u     


  


 $     
   
    
      !   
      !   "  #   $
    Œ
! %  

 |     &  * !

 & & 
  '  

    (  )*  
    
   
     +

    !   


 ÿ
 $%  

   $)   


    &     * !

  $ , $


 
   
    

    !   

‰
 £

 ·  
* !&    )  )  ) 
 
 & 
   
    
   
 

 V
 £
  
  |
 !  % 
  ü )ü - )   
 
  

 
      

Î
 |  . 

 m 
  
 ) /)$0
  1 ) ) 
      
   
 ·  
* !&    )  )  ) 
 
 & 
  $  &  
 $
  
    
  
 

]
 |  .   

  %  


 !  2  
  1 ) ) 
 
 *


ë
 |  .   

   
 

r
%   

 &  
 
3  
 % 3  
  |  

 
!!

rr
%   

 &  
 
3  
 % 3  
  |  
  & 



2  


2 4!

rp
%   

m   


* ÿ +

 6 5 4 7  6 

5 6 5 4 7 
BFS, UCS,
IDS
4 5 4 7 

DFS

£  |

 m 
          
& )   


3$  & $      & )
 &  &
    
 
   $  
 
 ·  
* 3    
 
  $&    )  )
 ) 
  & 
 
    
  
 2   $
& $    $  

rÿ
£  |

  

           )
 )    )     
 & 
 !  
          
   & 
  
    & *

*    
 
 
 
8 


£  |
Œ,Œ,r ; , ,

p,p, ; r,r,r Œ,r, ; ,p,r Œ,p, ; ,r,r

Œ,p,r ; ,r,
.$$


Œ, , ; ,Œ,r
&    &
Œ,r,r ; ,p,
 
## )& 
r,r, ; p,p,r   
   
,Œ,r ; Œ, ,
p,p,r ; r,r,
,r, ; Œ,p,r
,p, ; Œ,r,r
,p,r ; Œ,r,

, , ; Œ,Œ,r rV
ë
 m

7 2 4 1 2

5 6 3 4 5

8 3 1 6 7 8

Start State Goal State

Y  
1 4  
  Y  
$  
Y  
!          $6 
 
)) )
  
      
 
2   



 m 3  

Y  
 4'   
  Y  
2'   
Y  
' 
$

  
4'  )  
 

( $     6+957:+**6 r]



 m 3  

Y  
 '     4) 
  
      )'   
  Y  
2'   
Y  
' $
  '     
$
     $ ' 
  
4'  )  
2    
 57ü      $

( & )*'   
&    :*5  
 Exampl

p
   

 &  
 % 3  
 ; 

 
!!

pr
   

% 3  

Expnd. nd pn li

S:pV

S n gal Np:rV.ÿ, Nr:p‰.r

Np n gal NV:].‰, N‰:].], Nr:p‰.r

NV n gal Nr :V.‰, N‰:].], Nr:p‰.r

Nr n gal N‰:].], Nr:p‰.r

N‰ n gal G: , Në:r , Nr:p‰.r

G i gal Në:r , Nr:p‰.r

pp
   

; 

Expnd. nd pn li

S:pV

S n gal Np:pÎ, Nr:Œ‰

Np n gal N‰:p].‰, NV:Œr.ë, Nr:Œ‰

N‰ n gal G:p].‰, NV:Œr.ë, Nr:Œ‰,


Në:Œ].Œ
G i gal NV:Œr.ë, Nr:Œ‰, Në:Œ].Œ


;  

 · 
  %  ;     
%    
  pÿ
% 3   


;  

Expnd. nd pn li

ad:ŒVV

ad n gal Sibiu:ŒëŒ, Timiaa:ÿÿÎ, Zind:ÿÿë

Sibiu n gal Rimnicu:ÿrŒ, Faaga:ÿr‰, Timiaa:ÿÿÎ, Zind:ÿÿë, ad:VÿV,


ada:VÎr
Rimnicu n gal Faaga:ÿr‰, Pii:ÿrÎ, Timiaa:ÿÿÎ, Zind:ÿÿë, Cai a:‰pV,
Sibiu:‰ŒŒ, ad:VÿV, ada:VÎr
Faaga n gal Pii:ÿrÎ, Timiaa:ÿÿÎ, Zind:ÿÿë, Bucha:ÿ‰ ,
Cai a:‰pV, Sibiu:‰ŒŒ, Sibiu:‰ër, ad:VÿV, ada:VÎr
Pii n gal Bucha:ÿr], Timiaa:ÿÿÎ, Zind:ÿÿë, Bucha:ÿ‰ ,
Cai a:‰pV, Sibiu:‰ŒŒ, Rimnicu:V Î, Cai a:Vr‰, ad:VÿV,
ada:VÎr
Bucha i gal Timiaa:ÿÿÎ, Zind:ÿÿë, Cai a:‰pV, Sibiu:‰ŒŒ, Rimnicu:V Î,
ad:VÿV, ada:VÎr
pV
;  



% m<*

 

 % | ë

3 ! (  = > 1 £ 2
+ *6 ?   ? * 5 *

p]

% m<*  

 B+


 % §B+ | §B ë §B*

3 ! (  = > 1 £ 2
+ *6 ?   ? * 5 *

Rul: ch m  B



% m<

 

 % | ë

3 ! (  = > 1 £ 2
+ *6 ?   ? * *5 ?

Œ

% m
  

 B+


 % §B+ | §B ë §B*

3 ! (  = > 1 £ 2
+ *6 ?   ? * *5 ?

Rul: ch m  B
Th numb  pund nd dpnd n h d  nd.

Œr

% m<+




 % |

 ë 3 !

(  = > 1 £ 2 8

5  6 7 7  * ? *   6 6 *  +

Œp

% m<+  

 B5


 % | §B
§B5

B5 B B
 ë 3 !

§B5 §B6 §B §B §B


(  = > 1 £ 2 8

5  6 7 7  * ? *   6 6 *  +

Rul: ch m  B ŒŒ

% m
6

r. Daw h gam   Tic-ac- up  dph p (n X


and n  n h bad), aking  mm in accun.
p. E alua h  aluain alu  all nd a dph p,
uing h llwing SBE uncin:
E al(n) = Œ.Xp(n) + Xr(n) ± ( Œ.p(n) + r(n) )
wh,
Xn i h numb  w, clumn,  diagnal wih
xacl @ X¶ and n ¶. Similal , n i h numb 
w, clumn,  diagnal wih ju @ ¶.
Œ. Calcula h minimax alu  h ab  gam .
ÿ. R-d h gam   ha h alpha-ba algihm
can pun awa a much nd a pibl.
Œÿ

% m
6



X X
 X

X  X X  X X X  X X X X
   
  

 
X X

Th gam  up  dph p, aking  mm in accun. Œ‰



% m
6


h=r

X X
 X

h=-r h=r h=-p

X  X X  X X X  X X X X
   
  
h=r h=-r h= h=r h= h=-r h=-p h= h=-r h=

 
X X

h=r h=p

inimax alu. ŒV

% m
6


h=r

X X
 X

h=r h=-r h=-p

 
X X  X X X
X X
 
 
h=r h=p
h=-p h=-r h= h=-r h=

X X  X  X X
 

h=-r h=r h= h=r h=

pimal ding  nd. ŒÎ



% m
5
Cnid h p-pla  gam blw. Th igu hw h aing
piin.

Pla   m  i. Th w pla  m  in un, and ach


pla  mu m  hi kn  an pn adjacn pac in ih
dicin. I h ppnn ccupi an adjacn pac, hn a pla 
ma jump   h ppnn  h nx pn pac i an . E.g. i 
i n Πand B i n p, hn  ma m  back  r.

Th gam nd whn n pla  ach h ppi nd  h
bad. I pla   ach pac ÿ i, h alu  h gam  
i +r; i pla  B ach pac r i, hn h alu  h gam 
 i -r.

 B
r p Œ ÿ Œ]

% m
5
r. Daw h cmpl gam , uing h llwing cn nin:
± Wi ach a a (, B), wh , B dn h kn lcain.
± Pu ach minal a in a ua bx and wi i alu in a cicl.
± Pu lp a in dubl ua bx. Sinc i i n cla hw 
aign alu  lp a, anna ach wih a ³?´ in a cicl.

p. Nw mak ach nd wih i minimax alu. Explain hw u
handld h ³?´ alu and wh .

Œ. Explain wh h andad minimax algihm will ail n hi gam


 and bi l xplain hw u migh ix i. D u mdi id
algihm gi  pimal dciin  all gam wih lp?

 B
r p Œ ÿ Œë

% m
5
r. Th cmpl gam .
ax (r,ÿ)

(p,ÿ)  B
r p Œ ÿ
(p,Œ)

+r (ÿ,Œ) (r,Œ)

(r,p) (r,ÿ) ?

(Œ,p)

-r (Œ,r) (Œ,ÿ)

(p,ÿ) ?
ÿ

% m
5
p. Th cmpl gam  wih minimax alu.
+r (r,ÿ)
umpin: an agn wih h
+r (p,ÿ)
chic  ih winning h
gam  ning a ³?´ a, will
+r (p,Œ) alwa  ch h win.
(ÿ,Œ) (r,Œ) -r S, min(-r,?) i -r and max(r,?)
+r
i r.
-r (r,p) (r,ÿ) ? I all ucc a ³?´, h
backd-up i ³?´.
-r (Œ,p)

-r (Œ,r) (Œ,ÿ) ?

 B
(p,ÿ) ?
r p Œ ÿ ÿr

% m
5
Œ. Sandad minimax i bad n dph- i ach, hu
wuld g in in ini lp. I can b ixd b
mmbing a ha ha  bn xpandd,  i
pad will un a ³?´ alu.
Hw , i d n wk all ca bcau i i n
cla hw  cmpa ³?´ wih a dawn piin. In
gam wih chanc nd, i i uncla  cmpu h
a ag  a numb and a ³?´.
N ha i i n cc  a pad a a
dawn piin. E.g. bh (r,ÿ) and (p,ÿ) pa in h
 bu h a wn piin.

 B
r p Œ ÿ ÿp
m
     ë 
@ 1  B( %>%B( | %( |
@    >%A
@ |  
          & >%  

 % | ( | %( | >% >%


3 3 3
3 3 
3  3
3  
 3 3
 3 
  3
     
ÿŒ
m
       
@ 1  B( %>%B( | %( |
@    >%A
@ |  
          & >%  

 % | ( | %( | >% >%


3 3 3 3   3 3 
3 3   3 3 3 
3  3 3  3  
3       
 3 3     
 3   3  3   
  3     
             
ÿÿ
|&    |23

Cn  hi nnc in CNF:


± B › (P ( Q)

ÿ‰
|&    |23

B › (P ( Q)
Elimina ›
(B  (P ( Q))  (P ( Q)  B)
Elimina 
( B ( (P ( Q))   (P ( Q) ( B)
  inwad
( B ( (P ( Q))   P  Q) ( B)
ppl diibui i law
( B ( P ( Q)   P ( B)  ( Q ( B)
Th iginal nnc i nw in CNF, a a cnjuncin 
h clau.
ÿV
 2     >%m1

Gi n h llwing, can u p  ha h unicn


i m hical? Hw abu magical? Hnd?

³I h unicn i m hical, hn i i immal, bu i


i i n m hical, hn i i a mal mammal. I
h unicn i ih immal  a mammal, hn
i i hnd. Th unicn i magical i i i
hnd.´

ÿÎ
 2     >%m1

³I h unicn i m hical, hn i i immal, bu i i i n


m hical, hn i i a mal mammal. I h unicn i
ih immal  a mammal, hn i i hnd. Th
unicn i magical i i i hnd.´

Eui aln PL nnc:


r. m hical  immal
p. m hical  immal  mammal
Œ. immal ( mammal  hnd
ÿ. hnd  magical

ÿ]
 2     >%m1

Tanlaing in CNF:


r. m hical  immal
Ruling clau Pan clau
m hical ( immal
p. m hical  immal  mammal ‰. immal ( mammal r & pb
pa. m hical ( immal V. mammal ( hnd ‰ and Œa
pb. m hical ( mammal
Î. hnd V and Œb
Œ. immal ( mammal  hnd
Œa. immal ( hnd ] magical Î and ÿ

Œb. mammal ( hnd


ÿ. hnd  magical
Cncluin:
hnd ( magical
Th unicn i hnd and magical.
 hical cann b p d.
ÿë
8 %3  
Y













 digial cicui Cr



‰
ë  B | 
Th a i  hu, ach  a di n cl and inhibid b a man  a
di n nainali , wih a di n p, dink, and band  ciga.

a) Th Englihman li  in h d hu.


b) Th Spaniad wn h dg.
c) C  i dunk in h gn hu.
d) Th Ukainian dink a.
) Th gn hu i immdial  h igh  h i  hu.
) Th Winn mk wn nail.
g) Kl a mkd in h llw hu.
h) ilk i dunk in h middl hu.
i) Th Nwgian li  in h i hu n h l .
j) Th man wh mk Ch ild li  in h hu nx  h man wih h x.
k) Kl a mkd in h hu nx  h hu w h h i kp.
l) Th Luck Sik mk dink ang juic.
m) Th Japan mk Paliamn.
n) Th Nwgian li  nx  h blu hu.

Wh wn h Zba? Wh dink wa?


‰r
3 8 1<*

Tanla in FL:

r. Sm udn k Fnch in Sping p r


p. E  udn wh ak Fnch pa i
Œ. nl n udn k Gk in Sping p r
ÿ. Th b c in Gk i alwa  high han h b c
in Fnch

U h llwing cabula :


- ak(x,c,) : udn x ak cu c in m 
- pa(x,c,) : udn x pa cu c in m 
- c(x,c,) : c  udn x in cu c in m 
‰p
3 8 1<*  

r. Sm udn k Fnch in Sping p r


àx udn(x)  ak(x, F, Spingp r)

p. E  udn wh ak Fnch pa i


x, udn(x)  ak(x, F, )  pa(x, F, )

Œ. nl n udn k Gk in Sping p r


àx udn(x)  ak(x, G, Spingp r) 
  x  ak( , G, Spingp r)

ÿ. Th b c in Gk i alwa  high han h b c
in Fnch
 àx  c(x, G, ) > c( , F, )
‰Œ
 

@ 3 £!  


 
     
m)%)%m)$)#

·$)!)%·!))$

8  3 $)$8  3 )=

> 3 $)$)> )

‰ÿ
  

@ 3 £!  


 
     
m)%)%m)$)#
C)$C%)#C%D
·$)!)%·!))$
2 %
8  3 $)$8  3 )=
$C)C=D
> 3 $)$)> )
2  
 &  $
3 $
‰‰