28194936 artificial intelligence search algorithms

Upload: 11strings222

Post on 07-Apr-2018

221 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/6/2019 28194936 Artificial Intelligence Search Algorithms

    1/40

    A r t i c i a l I n t e l l i g e n c e S e a r c h A l g o r i t h m s

    R i c h a r d E . K o r f

    C o m p u t e r S c i e n c e D e p a r t m e n t

    U n i v e r s i t y o f C a l i f o r n i a , L o s A n g e l e s

    L o s A n g e l e s , C a . 9 0 0 9 5

    J u l y 5 , 1 9 9 6

    1 I n t r o d u c t i o n

    S e a r c h i s a u n i v e r s a l p r o b l e m - s o l v i n g m e c h a n i s m i n a r t i c i a l i n t e l l i g e n c e ( A I ) . I n A I p r o b l e m s ,

    t h e s e q u e n c e o f s t e p s r e q u i r e d f o r s o l u t i o n o f a p r o b l e m a r e n o t k n o w n a p r i o r i , b u t o f t e n m u s t

    b e d e t e r m i n e d b y a s y s t e m a t i c t r i a l - a n d - e r r o r e x p l o r a t i o n o f a l t e r n a t i v e s . T h e p r o b l e m s t h a t h a v e

    b e e n a d d r e s s e d b y A I s e a r c h a l g o r i t h m s f a l l i n t o t h r e e g e n e r a l c l a s s e s : s i n g l e - a g e n t p a t h n d i n g

    p r o b l e m s , t w o - p l a y e r g a m e s , a n d c o n s t r a i n t - s a t i s f a c t i o n p r o b l e m s

    C l a s s i c e x a m p l e s i n t h e A I l i t e r a t u r e o f p a t h n d i n g p r o b l e m s a r e t h e s l i d i n g - t i l e p u z z l e s , i n c l u d -

    i n g t h e 3 3 E i g h t P u z z l e ( s e e F i g . 1 ) a n d i t s l a r g e r r e l a t i v e s t h e 4 4 F i f t e e n P u z z l e , a n d 5 5

    T w e n t y - F o u r P u z z l e . T h e E i g h t P u z z l e c o n s i s t s o f a 3 3 s q u a r e f r a m e c o n t a i n i n g e i g h t n u m b e r e d

    s q u a r e t i l e s , a n d a n e m p t y p o s i t i o n c a l l e d t h e b l a n k . T h e l e g a l o p e r a t o r s a r e t o s l i d e a n y t i l e t h a t i s

    h o r i z o n t a l l y o r v e r t i c a l l y a d j a c e n t t o t h e b l a n k i n t o t h e b l a n k p o s i t i o n . T h e p r o b l e m i s t o r e a r r a n g e

    t h e t i l e s f r o m s o m e r a n d o m i n i t i a l c o n g u r a t i o n i n t o a p a r t i c u l a r d e s i r e d g o a l c o n g u r a t i o n . T h e

    T h i s w o r k w a s s u p p o r t e d i n p a r t b y N S F G r a n t I R I - 9 1 1 9 8 2 5 , a n d a g r a n t f r o m R o c k w e l l I n t e r n a t i o n a l .

    1

  • 8/6/2019 28194936 Artificial Intelligence Search Algorithms

    2/40

    s l i d i n g - t i l e p u z z l e s a r e c o m m o n t e s t b e d s f o r r e s e a r c h i n A I s e a r c h a l g o r i t h m s b e c a u s e t h e y a r e v e r y

    s i m p l e t o r e p r e s e n t a n d m a n i p u l a t e , y e t n d i n g o p t i m a l s o l u t i o n s t o t h e N N g e n e r a l i z a t i o n o f

    t h e s l i d i n g - t i l e p u z z l e s i s N P - c o m p l e t e 4 0 ] . O t h e r w e l l - k n o w n e x a m p l e s o f s i n g l e - a g e n t p a t h n d i n g

    p r o b l e m s i n c l u d e R u b i k ' s C u b e , t h e t r a v e l l i n g s a l e s m a n p r o b l e m , a n d t h e o r e m p r o v i n g . I n e a c h

    c a s e , t h e t a s k i s t o n d a s e q u e n c e o f o p e r a t i o n s t h a t m a p a n i n i t i a l s t a t e t o a g o a l s t a t e .

    A s e c o n d c l a s s o f s e a r c h p r o b l e m s i n c l u d e t w o - p l a y e r p e r f e c t - i n f o r m a t i o n g a m e s , s u c h a s C h e s s ,

    C h e c k e r s , a n d O t h e l l o . T h e t h i r d c a t e g o r y i s c o n s t r a i n t - s a t i s f a c t i o n p r o b l e m s , s u c h a s t h e E i g h t

    Q u e e n s P r o b l e m . T h e t a s k i s t o p l a c e e i g h t q u e e n s o n a n 8 8 c h e s s b o a r d , s u c h t h a t n o t w o q u e e n s

    a r e o n t h e s a m e r o w , c o l u m n o r d i a g o n a l .

    W e b e g i n b y d e s c r i b i n g t h e p r o b l e m - s p a c e m o d e l o n w h i c h s e a r c h a l g o r i t h m s a r e b a s e d . B r u t e -

    f o r c e s e a r c h e s a r e t h e n c o n s i d e r e d i n c l u d i n g b r e a d t h - r s t , u n i f o r m - c o s t , d e p t h - r s t , d e p t h - r s t

    i t e r a t i v e - d e e p e n i n g , a n d b i d i r e c t i o n a l s e a r c h . N e x t , v a r i o u s h e u r i s t i c s e a r c h e s a r e e x a m i n e d i n c l u d -

    i n g p u r e h e u r i s t i c s e a r c h , t h e A * a l g o r i t h m , i t e r a t i v e - d e e p e n i n g - A * , d e p t h - r s t b r a n c h - a n d - b o u n d ,

    t h e h e u r i s t i c p a t h a l g o r i t h m , a n d r e c u r s i v e b e s t - r s t s e a r c h . W e t h e n c o n s i d e r s i n g l e - a g e n t a l -

    g o r i t h m s t h a t i n t e r l e a v e s e a r c h a n d e x e c u t i o n , i n c l u d i n g m i n i m i n l o o k a h e a d s e a r c h , r e a l - t i m e - A * ,

    a n d l e a r n i n g - r e a l - t i m e - A * . N e x t , w e c o n s i d e r t w o - p l a y e r g a m e s e a r c h e s , i n c l u d i n g m i n i m a x a n d

    a l p h a - b e t a p r u n i n g . F i n a l l y , w e e x a m i n e c o n s t r a i n t - s a t i s f a c t i o n a l g o r i t h m s , s u c h a s b a c k t r a c k i n g ,

    c o n s t r a i n t r e c o r d i n g , a n d h e u r i s t i c r e p a i r . T h e e c i e n c y o f t h e s e a l g o r i t h m s , i n t e r m s o f t h e c o s t s

    o f t h e s o l u t i o n s t h e y g e n e r a t e , t h e a m o u n t o f t i m e t h e a l g o r i t h m s t a k e t o e x e c u t e , a n d t h e a m o u n t

    o f c o m p u t e r m e m o r y t h e y r e q u i r e a r e o f c e n t r a l c o n c e r n t h r o u g h o u t . S i n c e s e a r c h i s a u n i v e r -

    s a l p r o b l e m - s o l v i n g m e t h o d , w h a t l i m i t s i t s a p p l i c a b i l i t y i s t h e e c i e n c y w i t h w h i c h i t c a n b e

    p e r f o r m e d .

    2

  • 8/6/2019 28194936 Artificial Intelligence Search Algorithms

    3/40

    2 P r o b l e m S p a c e M o d e l

    A p r o b l e m s p a c e i s t h e e n v i r o n m e n t i n w h i c h a s e a r c h t a k e s p l a c e 3 1 ] . A p r o b l e m s p a c e c o n s i s t s

    o f a s e t o f s t a t e s o f t h e p r o b l e m , a n d a s e t o f o p e r a t o r s t h a t c h a n g e t h e s t a t e . F o r e x a m p l e , i n

    t h e E i g h t P u z z l e , t h e s t a t e s a r e t h e d i e r e n t p o s s i b l e p e r m u t a t i o n s o f t h e t i l e s , a n d t h e o p e r a t o r s

    s l i d e a t i l e i n t o t h e b l a n k p o s i t i o n . A p r o b l e m i n s t a n c e i s a p r o b l e m s p a c e t o g e t h e r w i t h a n i n i t i a l

    s t a t e a n d a g o a l s t a t e . I n t h e c a s e o f t h e E i g h t P u z z l e , t h e i n i t i a l s t a t e w o u l d b e w h a t e v e r i n i t i a l

    p e r m u t a t i o n t h e p u z z l e s t a r t s o u t i n , a n d t h e g o a l s t a t e i s a p a r t i c u l a r d e s i r e d p e r m u t a t i o n . T h e

    p r o b l e m - s o l v i n g t a s k i s t o n d a s e q u e n c e o f o p e r a t o r s t h a t m a p t h e i n i t i a l s t a t e t o a g o a l s t a t e .

    I n t h e E i g h t P u z z l e t h e g o a l s t a t e i s g i v e n e x p l i c i t l y . I n o t h e r p r o b l e m s , s u c h a s t h e E i g h t Q u e e n s

    P r o b l e m , t h e g o a l s t a t e i s n o t g i v e n e x p l i c i t l y , b u t r a t h e r i m p l i c i t l y s p e c i e d b y c e r t a i n p r o p e r t i e s

    t h a t m u s t b e s a t i s e d b y a g o a l s t a t e .

    A p r o b l e m - s p a c e g r a p h i s o f t e n u s e d t o r e p r e s e n t a p r o b l e m s p a c e . T h e s t a t e s o f t h e s p a c e

    a r e r e p r e s e n t e d b y n o d e s o f t h e g r a p h , a n d t h e o p e r a t o r s b y e d g e s b e t w e e n n o d e s . E d g e s m a y b e

    u n d i r e c t e d o r d i r e c t e d , d e p e n d i n g o n w h e t h e r t h e i r c o r r e s p o n d i n g o p e r a t o r s a r e i n v e r t i b l e o r n o t .

    T h e t a s k i s a s i n g l e - a g e n t p a t h - n d n g p r o b l e m i s t o n d a p a t h i n t h e g r a p h f r o m t h e i n i t i a l n o d e

    t o a g o a l n o d e . F i g u r e 1 s h o w s a s m a l l p a r t o f t h e E i g h t P u z z l e p r o b l e m - s p a c e g r a p h .

    A l t h o u g h m o s t p r o b l e m s p a c e s c o r r e s p o n d t o g r a p h s w i t h m o r e t h a n o n e p a t h b e t w e e n a p a i r

    o f n o d e s , f o r s i m p l i c i t y t h e y a r e o f t e n r e p r e s e n t e d a s t r e e s , w h e r e t h e i n i t i a l s t a t e i s t h e r o o t o f t h e

    t r e e . T h e c o s t o f t h i s s i m p l i c a t i o n i s t h a t a n y s t a t e t h a t c a n b e r e a c h e d b y t w o d i e r e n t p a t h s

    w i l l b e r e p r e s e n t e d b y d u p l i c a t e n o d e s , i n c r e a s i n g t h e s i z e o f t h e t r e e . T h e b e n e t o f a t r e e i s t h a t

    t h e a b s e n c e o f c y c l e s g r e a t l y s i m p l i e s m a n y s e a r c h a l g o r i t h m s . I n t h i s s u r v e y , w e w i l l r e s t r i c t o u r

    a t t e n t i o n t o t r e e s , b u t t h e r e e x i s t g r a p h v e r s i o n s o f m o s t o f t h e a l g o r i t h m s w e d e s c r i b e a s w e l l .

    O n e f e a t u r e t h a t d i s t i n g u i s h e s A I s e a r c h a l g o r i t h m s f r o m o t h e r g r a p h - s e a r c h i n g a l g o r i t h m s i s

    t h e s i z e o f t h e g r a p h s i n v o l v e d . F o r e x a m p l e , t h e e n t i r e c h e s s g r a p h i s e s t i m a t e d t o c o n t a i n o v e r

    3

  • 8/6/2019 28194936 Artificial Intelligence Search Algorithms

    4/40

    1

    2

    3

    4567

    1

    2

    3 4

    567

    1 2

    34567

    1 2 3

    4 567

    1 2 3

    45

    67

    1 2 3

    456

    71

    2 3

    4567

    1 2 3

    456

    7

    1

    2

    3

    4

    567

    1

    2

    3

    4

    567

    1 2

    34

    567

    1 2 3

    4 5

    67

    1 2 3

    4

    5

    6

    7

    1 2 3

    4

    5

    6

    7

    1

    2 3

    4

    567

    1 2 3

    4

    56

    7

    1

    2

    3

    4

    567

    1 2 3

    4

    567

    1 2 3

    4

    5

    6

    7

    1 2 3

    4

    567

    1 2 3

    4

    567

    8

    8 8 8 8

    8 8 8 8 8 8 8 8

    8

    8 8 88

    8 8 8

    F i g u r e 1 : E i g h t P u z z l e S e a r c h T r e e F r a g m e n t

    1 0

    4 0

    n o d e s . E v e n a s i m p l e p r o b l e m l i k e t h e T w e n t y - F o u r P u z z l e c o n t a i n s a l m o s t 1 0

    2 5

    n o d e s . A s

    a r e s u l t , t h e p r o b l e m - s p a c e g r a p h s o f A I p r o b l e m s a r e n e v e r r e p r e s e n t e d e x p l i c i t l y b y l i s t i n g e a c h

    s t a t e , b u t r a t h e r a r e i m p l i c i t l y r e p r e s e n t e d b y s p e c i f y i n g a n i n i t i a l s t a t e a n d a s e t o f o p e r a t o r s t o

    g e n e r a t e n e w s t a t e s f r o m e x i s t i n g s t a t e s . F u r t h e r m o r e , t h e s i z e o f a n A I p r o b l e m i s r a r e l y e x p r e s s e d

    a s t h e n u m b e r o f n o d e s i n i t s p r o b l e m - s p a c e g r a p h . R a t h e r , t h e t w o p a r a m e t e r s o f a s e a r c h t r e e

    t h a t d e t e r m i n e t h e e c i e n c y o f v a r i o u s s e a r c h a l g o r i t h m s a r e i t s b r a n c h i n g f a c t o r a n d i t s s o l u t i o n

    d e p t h . T h e b r a n c h i n g f a c t o r i s t h e a v e r a g e n u m b e r o f c h i l d r e n o f a g i v e n n o d e . F o r e x a m p l e , i n t h e

    E i g h t P u z z l e t h e a v e r a g e b r a n c h i n g f a c t o r i s

    p

    3 , o r a b o u t 1 . 7 3 2 . T h e s o l u t i o n d e p t h o f a p r o b l e m

    i n s t a n c e i s t h e l e n g t h o f a s h o r t e s t p a t h f r o m t h e i n i t i a l s t a t e t o a g o a l s t a t e , o r t h e l e n g t h o f

    4

  • 8/6/2019 28194936 Artificial Intelligence Search Algorithms

    5/40

    a s h o r t e s t s e q u e n c e o f o p e r a t o r s t h a t s o l v e s t h e p r o b l e m . I f t h e g o a l w e r e i n t h e b o t t o m r o w o f

    g u r e 1 , t h e d e p t h o f t h e p r o b l e m i n s t a n c e r e p r e s e n t e d b y t h e i n i t i a l s t a t e a t t h e r o o t w o u l d b e

    t h r e e m o v e s .

    3 B r u t e - F o r c e S e a r c h

    T h e m o s t g e n e r a l s e a r c h a l g o r i t h m s a r e b r u t e - f o r c e s e a r c h e s , s i n c e t h e y d o n o t r e q u i r e a n y d o m a i n -

    s p e c i c k n o w l e d g e . A l l t h a t i s r e q u i r e d f o r a b r u t e - f o r c e s e a r c h i s a s t a t e d e s c r i p t i o n , a s e t o f

    l e g a l o p e r a t o r s , a n i n i t i a l s t a t e , a n d a d e s c r i p t i o n o f t h e g o a l s t a t e . T h e m o s t i m p o r t a n t b r u t e -

    f o r c e t e c h n i q u e s a r e b r e a d t h - r s t , u n i f o r m - c o s t , d e p t h - r s t , d e p t h - r s t i t e r a t i v e - d e e p e n i n g , a n d

    b i d i r e c t i o n a l s e a r c h . I n t h e d e s c r i p t i o n s o f t h e a l g o r i t h m s b e l o w , t o g e n e r a t e a n o d e m e a n s t o

    c r e a t e t h e d a t a s t r u c t u r e c o r r e s p o n d i n g t o t h a t n o d e , w h e r e a s t o e x p a n d a n o d e m e a n s t o g e n e r a t e

    a l l t h e c h i l d r e n o f t h a t n o d e .

    3 . 1 B r e a d t h - F i r s t S e a r c h

    B r e a d t h - r s t s e a r c h e x p a n d s n o d e s i n o r d e r o f t h e i r d i s t a n c e f r o m t h e r o o t , g e n e r a t i n g o n e l e v e l

    o f t h e t r e e a t a t i m e u n t i l a s o l u t i o n i s f o u n d ( s e e F i g u r e 2 ) . I t i s m o s t e a s i l y i m p l e m e n t e d b y

    m a i n t a i n i n g a q u e u e o f n o d e s , i n i t i a l l y c o n t a i n i n g j u s t t h e r o o t , a n d a l w a y s r e m o v i n g t h e n o d e a t

    t h e h e a d o f t h e q u e u e , e x p a n d i n g i t , a n d a d d i n g i t s c h i l d r e n t o t h e t a i l o f t h e q u e u e .

    S i n c e i t n e v e r g e n e r a t e s a n o d e i n t h e t r e e u n t i l a l l t h e n o d e s a t s h a l l o w e r l e v e l s h a v e b e e n

    g e n e r a t e d , b r e a d t h - r s t s e a r c h a l w a y s n d s a s h o r t e s t p a t h t o a g o a l . T h e a m o u n t o f t i m e u s e d

    b y b r e a d t h - r s t s e a r c h i s p r o p o r t i o n a l t o t h e n u m b e r o f n o d e s g e n e r a t e d , s i n c e e a c h n o d e c a n b e

    g e n e r a t e d i n c o n s t a n t t i m e , a n d i s a f u n c t i o n o f t h e b r a n c h i n g f a c t o r b a n d t h e s o l u t i o n d e p t h d

    S i n c e t h e n u m b e r o f n o d e s a t l e v e l d i s b

    d

    , t h e t o t a l n u m b e r o f n o d e s g e n e r a t e d i n t h e w o r s t c a s e

    i s b + b

    2

    + b

    3

    + + b

    d

    , w h i c h i s O ( b

    d

    ) , t h e a s y m p t o t i c t i m e c o m p l e x i t y o f b r e a d t h - r s t s e a r c h .

    5

  • 8/6/2019 28194936 Artificial Intelligence Search Algorithms

    6/40

    0

    1 2

    3 4 5 6

    7 8 9 10 11 12 13 14

    F i g u r e 2 : O r d e r o f N o d e G e n e r a t i o n f o r B r e a d t h - F i r s t S e a r c h

    T h e m a i n d r a w b a c k o f b r e a d t h - r s t s e a r c h i s i t s m e m o r y r e q u i r e m e n t . S i n c e e a c h l e v e l o f t h e

    t r e e m u s t b e s a v e d i n o r d e r t o g e n e r a t e t h e n e x t l e v e l , a n d t h e a m o u n t o f m e m o r y i s p r o p o r t i o n a l t o

    t h e n u m b e r o f n o d e s s t o r e d , t h e s p a c e c o m p l e x i t y o f b r e a d t h - r s t s e a r c h i s a l s o O ( b

    d

    ) . A s a r e s u l t ,

    b r e a d t h - r s t s e a r c h i s s e v e r e l y s p a c e - b o u n d i n p r a c t i c e , a n d w i l l e x h a u s t t h e m e m o r y a v a i l a b l e o n

    t y p i c a l c o m p u t e r s i n a m a t t e r o f m i n u t e s .

    3 . 2 U n i f o r m - C o s t S e a r c h

    I f a l l e d g e s d o n o t h a v e t h e s a m e c o s t , t h e n b r e a d t h - r s t s e a r c h g e n e r a l i z e s t o u n i f o r m - c o s t s e a r c h

    I n s t e a d o f e x p a n d i n g n o d e s i n o r d e r o f t h e i r d e p t h f r o m t h e r o o t , u n i f o r m - c o s t s e a r c h e x p a n d s n o d e s

    i n o r d e r o f t h e i r c o s t f r o m t h e r o o t . A t e a c h s t e p , t h e n e x t n o d e n t o b e e x p a n d e d i s o n e w h o s e

    c o s t g ( n ) i s l o w e s t , w h e r e g ( n ) i s t h e s u m o f t h e e d g e c o s t s f r o m t h e r o o t t o n o d e n . T h e n o d e s a r e

    s t o r e d i n a p r i o r i t y q u e u e . T h i s a l g o r i t h m i s a l s o k n o w n a s D i j k s t r a ' s s i n g l e - s o u r c e s h o r t e s t - p a t h

    a l g o r i t h m 6 ] .

    6

  • 8/6/2019 28194936 Artificial Intelligence Search Algorithms

    7/40

  • 8/6/2019 28194936 Artificial Intelligence Search Algorithms

    8/40

    d e p t h , a s o p p o s e d t o e x p o n e n t i a l f o r b r e a d t h - r s t s e a r c h . T h e r e a s o n i s t h a t t h e a l g o r i t h m o n l y

    n e e d s t o s t o r e a s t a c k o f n o d e s o n t h e p a t h f r o m t h e r o o t t o t h e c u r r e n t n o d e . T h e t i m e c o m p l e x i t y

    o f a d e p t h - r s t s e a r c h t o d e p t h d i s O ( b

    d

    ) , s i n c e i t g e n e r a t e s t h e s a m e s e t o f n o d e s a s b r e a d t h - r s t

    s e a r c h , b u t s i m p l y i n a d i e r e n t o r d e r . T h u s , a s a p r a c t i c a l m a t t e r , d e p t h - r s t s e a r c h i s t i m e - l i m i t e d

    r a t h e r t h a n s p a c e - l i m i t e d .

    T h e d i s a d v a n t a g e o f d e p t h - r s t s e a r c h i s t h a t i t m a y n o t t e r m i n a t e o n a n i n n i t e t r e e , b u t

    s i m p l y g o d o w n t h e l e f t - m o s t p a t h f o r e v e r . E v e n a n i t e g r a p h c a n g e n e r a t e a n i n n i t e t r e e . T h e

    u s u a l s o l u t i o n t o t h i s p r o b l e m i s t o i m p o s e a c u t o d e p t h o n t h e s e a r c h . A l t h o u g h t h e i d e a l c u t o

    i s t h e s o l u t i o n d e p t h d , t h i s v a l u e i s r a r e l y k n o w n i n a d v a n c e o f a c t u a l l y s o l v i n g t h e p r o b l e m . I f

    t h e c h o s e n c u t o d e p t h i s l e s s t h a n d , t h e a l g o r i t h m w i l l f a i l t o n d a s o l u t i o n , w h e r e a s i f t h e c u t o

    d e p t h i s g r e a t e r t h a n d , a l a r g e p r i c e i s p a i d i n e x e c u t i o n t i m e , a n d t h e r s t s o l u t i o n f o u n d m a y

    n o t b e a n o p t i m a l o n e .

    3 . 4 D e p t h - F i r s t I t e r a t i v e - D e e p e n i n g

    D e p t h - r s t i t e r a t i v e - d e e p e n i n g ( D F I D ) c o m b i n e s t h e b e s t f e a t u r e s o f b r e a d t h - r s t a n d d e p t h - r s t

    s e a r c h 4 5 , 1 8 ] . D F I D r s t p e r f o r m s a d e p t h - r s t s e a r c h t o d e p t h o n e , t h e n s t a r t s o v e r , e x e c u t i n g a

    c o m p l e t e d e p t h - r s t s e a r c h t o d e p t h t w o , a n d c o n t i n u e s t o r u n d e p t h - r s t s e a r c h e s t o s u c c e s s i v e l y

    g r e a t e r d e p t h s , u n t i l a s o l u t i o n i s f o u n d ( s e e F i g u r e 4 ) .

    S i n c e i t n e v e r g e n e r a t e s a n o d e u n t i l a l l s h a l l o w e r n o d e s h a v e b e e n g e n e r a t e d , t h e r s t s o l u t i o n

    f o u n d b y D F I D i s g u a r a n t e e d t o b e a l o n g a s h o r t e s t p a t h . F u r t h e r m o r e , s i n c e a t a n y g i v e n p o i n t i t

    i s e x e c u t i n g a d e p t h - r s t s e a r c h , s a v i n g o n l y a s t a c k o f n o d e s , a n d t h e a l g o r i t h m t e r m i n a t e s w h e n

    i t n d s a s o l u t i o n a t d e p t h d , t h e s p a c e c o m p l e x i t y o f D F I D i s o n l y O ( d )

    A l t h o u g h i t a p p e a r s t h a t D F I D w a s t e s a g r e a t d e a l o f t i m e i n t h e i t e r a t i o n s p r i o r t o t h e o n e

    t h a t n d s a s o l u t i o n , t h i s e x t r a w o r k i s u s u a l l y i n s i g n i c a n t . T o s e e t h i s , n o t e t h a t t h e n u m b e r o f

    8

  • 8/6/2019 28194936 Artificial Intelligence Search Algorithms

    9/40

    0

    3,1,

    4, 5,

    2, 6,

    7, 8,

    9

    10

    11 12

    13

    14 15

    16

    17

    18 19

    20

    21 22

    F i g u r e 4 : O r d e r o f N o d e G e n e r a t i o n f o r D e p t h - F i r s t I t e r a t i v e - D e e p e n i n g S e a r c h

    n o d e s a t d e p t h d i s b

    d

    , a n d e a c h o f t h e s e n o d e s a r e g e n e r a t e d o n c e , d u r i n g t h e n a l i t e r a t i o n . T h e

    n u m b e r o f n o d e s a t d e p t h d 1 i s b

    d 1

    , a n d e a c h o f t h e s e a r e g e n e r a t e d t w i c e , o n c e d u r i n g t h e n a l

    i t e r a t i o n , a n d o n c e d u r i n g t h e p e n u l t i m a t e i t e r a t i o n . I n g e n e r a l , t h e n u m b e r o f n o d e s g e n e r a t e d b y

    D F I D i s b

    d

    + 2 b

    d 1

    + 3 b

    d 2

    + + d b . T h i s i s a s y m p t o t i c a l l y O ( b

    d

    ) i f b i s s t r i c t l y g r e a t e r t h a n o n e ,

    s i n c e f o r l a r g e v a l u e s o f d t h e l o w e r o r d e r t e r m s b e c o m e i n s i g n i c a n t . I n o t h e r w o r d s , m o s t o f t h e

    w o r k g o e s i n t o t h e n a l i t e r a t i o n , a n d t h e c o s t o f t h e p r e v i o u s i t e r a t i o n s i s r e l a t i v e l y s m a l l . T h e

    r a t i o o f t h e n u m b e r o f n o d e s g e n e r a t e d b y D F I D t o t h o s e g e n e r a t e d b y b r e a d t h - r s t s e a r c h o n a

    t r e e i s a p p r o x i m a t e l y b = ( b 1 ) . I n f a c t , D F I D i s a s y m p t o t i c a l l y o p t i m a l i n t e r m s o f t i m e a n d s p a c e

    a m o n g a l l b r u t e - f o r c e s h o r t e s t - p a t h a l g o r i t h m s o n a t r e e 1 8 ] .

    I f t h e e d g e c o s t s d i e r f r o m o n e a n o t h e r , t h e n o n e c a n r u n a n i t e r a t i v e d e e p e n i n g v e r s i o n o f

    u n i f o r m - c o s t s e a r c h , w h e r e t h e d e p t h c u t o i s r e p l a c e d b y a c u t o o n t h e g ( n ) c o s t o f a n o d e . A t

    t h e e n d o f e a c h i t e r a t i o n , t h e n e w t h r e s h o l d i s t h e m i n i m u m c o s t o f a l l n o d e s g e n e r a t e d b u t p r u n e d

    9

  • 8/6/2019 28194936 Artificial Intelligence Search Algorithms

    10/40

    o n t h e p r e v i o u s i t e r a t i o n .

    O n a g r a p h w i t h c y c l e s , h o w e v e r , b r e a d t h - r s t s e a r c h m a y b e m u c h m o r e e c i e n t t h a n a n y

    d e p t h - r s t s e a r c h . T h e r e a s o n i s t h a t a b r e a d t h - r s t s e a r c h c a n c h e c k f o r d u p l i c a t e n o d e s w h e r e a s

    a d e p t h - r s t s e a r c h c a n n o t . T h u s , t h e c o m p l e x i t y o f b r e a d t h - r s t s e a r c h g r o w s o n l y a s t h e n u m b e r

    o f n o d e s a t a g i v e n d e p t h , w h i l e t h e c o m p l e x i t y o f d e p t h - r s t s e a r c h d e p e n d s o n t h e n u m b e r o f

    p a t h s o f a g i v e n l e n g t h . F o r e x a m p l e , i n a s q u a r e g r i d , t h e n u m b e r o f n o d e s w i t h i n a r a d i u s r o f

    t h e o r i g i n i s O ( r

    2

    ) , w h e r e a s t h e n u m b e r o f p a t h s o f l e n g t h r i s O ( 3

    r

    ) , s i n c e t h e r e a r e t h r e e c h i l d r e n

    o f e v e r y n o d e , n o t c o u n t i n g i t s p a r e n t . T h u s , i n a g r a p h w i t h a l a r g e n u m b e r o f v e r y s h o r t c y c l e s ,

    b r e a d t h - r s t s e a r c h i s p r e f e r a b l e t o d e p t h - r s t s e a r c h , i f s u c i e n t m e m o r y i s a v a i l a b l e . F o r o n e

    a p p r o a c h t o t h e p r o b l e m o f d u p l i c a t e n o d e s i n d e p t h - r s t s e a r c h , s e e 4 6 ] .

    3 . 5 B i d i r e c t i o n a l S e a r c h

    B i d i r e c t i o n a l s e a r c h i s a b r u t e - f o r c e a l g o r i t h m t h a t r e q u i r e s a n e x p l i c i t g o a l s t a t e i n a d d i t i o n t o t h e

    b a s i c p r o b l e m s p a c e 3 7 ] . T h e m a i n i d e a i s t o s i m u l t a n e o u s l y s e a r c h f o r w a r d f r o m t h e i n i t i a l s t a t e ,

    a n d b a c k w a r d f r o m t h e g o a l s t a t e u n t i l t h e t w o s e a r c h f r o n t i e r s m e e t . T h e p a t h f r o m t h e i n i t i a l

    s t a t e i s t h e n c o n c a t e n a t e d w i t h t h e i n v e r s e o f t h e p a t h f r o m t h e g o a l s t a t e t o f o r m t h e c o m p l e t e

    s o l u t i o n p a t h .

    B i d i r e c t i o n a l s e a r c h s t i l l g u a r a n t e e s o p t i m a l s o l u t i o n s . A s s u m i n g t h a t t h e c o m p a r i s o n s f o r

    i d e n t i f y i n g a c o m m o n s t a t e b e t w e e n t h e t w o f r o n t i e r s c a n b e d o n e i n c o n s t a n t t i m e p e r n o d e , b y

    h a s h i n g f o r e x a m p l e , t h e t i m e c o m p l e x i t y o f b i d i r e c t i o n a l s e a r c h i s O ( b

    d = 2

    ) s i n c e e a c h s e a r c h n e e d

    o n l y p r o c e e d t o h a l f t h e s o l u t i o n d e p t h . S i n c e a t l e a s t o n e o f t h e s e a r c h e s m u s t b e b r e a d t h - r s t

    i n o r d e r t o n d a c o m m o n s t a t e , t h e s p a c e c o m p l e x i t y o f b i d i r e c t i o n a l s e a r c h i s a l s o O ( b

    d = 2

    ) . A s a

    r e s u l t , b i d i r e c t i o n a l s e a r c h i s s p a c e b o u n d i n p r a c t i c e .

    1 0

  • 8/6/2019 28194936 Artificial Intelligence Search Algorithms

    11/40

    3 . 6 C o m b i n a t o r i a l E x p l o s i o n

    T h e p r o b l e m w i t h a l l b r u t e - f o r c e s e a r c h a l g o r i t h m s i s t h a t t h e i r t i m e c o m p l e x i t i e s g r o w e x p o n e n -

    t i a l l y w i t h p r o b l e m s i z e . T h i s i s c a l l e d c o m b i n a t o r i a l e x p l o s i o n , a n d a s a r e s u l t , t h e s i z e o f p r o b l e m s

    t h a t c a n b e s o l v e d w i t h t h e s e t e c h n i q u e s i s q u i t e l i m i t e d . F o r e x a m p l e , w h i l e t h e E i g h t P u z z l e , w i t h

    a b o u t 1 0

    5

    s t a t e s , i s e a s i l y s o l v e d b y b r u t e - f o r c e s e a r c h , t h e F i f t e e n P u z z l e c o n t a i n s o v e r 1 0

    1 3

    s t a t e s ,

    a n d h e n c e c a n n o t b e s o l v e d w i t h b r u t e - f o r c e t e c h n i q u e s o n c u r r e n t m a c h i n e s . F a s t e r m a c h i n e s w i l l

    n o t h a v e a s i g n i c a n t i m p a c t o n t h i s p r o b l e m . F o r e x a m p l e , t h e 5 5 T w e n t y - F o u r P u z z l e c o n t a i n s

    a l m o s t 1 0

    2 5

    s t a t e s .

    4 H e u r i s t i c S e a r c h

    I n o r d e r t o s o l v e l a r g e r p r o b l e m s , d o m a i n - s p e c i c k n o w l e d g e m u s t b e a d d e d t o i m p r o v e s e a r c h e -

    c i e n c y . I n A I , h e u r i s t i c s e a r c h h a s a g e n e r a l m e a n i n g , a n d a m o r e s p e c i a l i z e d t e c h n i c a l m e a n i n g . I n

    a g e n e r a l s e n s e , t h e t e r m h e u r i s t i c i s u s e d f o r a n y a d v i c e t h a t i s o f t e n e e c t i v e , b u t i s n ' t g u a r a n t e e d

    t o w o r k i n e v e r y c a s e . W i t h i n t h e h e u r i s t i c s e a r c h l i t e r a t u r e , h o w e v e r , t h e t e r m h e u r i s t i c u s u a l l y

    r e f e r s t o t h e s p e c i a l c a s e o f a h e u r i s t i c e v a l u a t i o n f u n c t i o n

    4 . 1 H e u r i s t i c E v a l u a t i o n F u n c t i o n s

    I n a s i n g l e - a g e n t p a t h - n d i n g p r o b l e m , a h e u r i s t i c e v a l u a t i o n f u n c t i o n e s t i m a t e s t h e c o s t o f a n

    o p t i m a l p a t h b e t w e e n a p a i r o f s t a t e s . F o r e x a m p l e , E u c l i d e a n o r a i r l i n e d i s t a n c e i s a n e s t i m a t e o f

    t h e h i g h w a y d i s t a n c e b e t w e e n a p a i r o f l o c a t i o n s . A c o m m o n h e u r i s t i c f u n c t i o n f o r t h e s l i d i n g - t i l e

    p u z z l e s i s c a l l e d m a n h a t t a n d i s t a n c e . I t i s c o m p u t e d b y c o u n t i n g t h e n u m b e r o f m o v e s a l o n g t h e

    g r i d t h a t e a c h t i l e i s d i s p l a c e d f r o m i t s g o a l p o s i t i o n , a n d s u m m i n g t h e s e v a l u e s o v e r a l l t i l e s . F o r

    a x e d g o a l s t a t e , a h e u r i s t i c e v a l u a t i o n i s a f u n c t i o n o f a n o d e , h ( n ) , t h a t e s t i m a t e s t h e d i s t a n c e

    f r o m n o d e n t o t h e g i v e n g o a l s t a t e .

    1 1

  • 8/6/2019 28194936 Artificial Intelligence Search Algorithms

    12/40

    T h e k e y p r o p e r t i e s o f a h e u r i s t i c e v a l u a t i o n f u n c t i o n a r e t h a t i t e s t i m a t e a c t u a l c o s t , a n d t h a t

    i t b e i n e x p e n s i v e t o c o m p u t e . F o r e x a m p l e , t h e E u c l i d e a n d i s t a n c e b e t w e e n a p a i r o f p o i n t s c a n b e

    c o m p u t e d i n c o n s t a n t t i m e . T h e m a n h a t t a n d i s t a n c e b e t w e e n a p a i r o f s t a t e s c a n b e c o m p u t e d i n

    t i m e p r o p o r t i o n a l t o t h e n u m b e r o f t i l e s . I n a d d i t i o n , m o s t n a t u r a l l y o c c u r r i n g h e u r i s t i c f u n c t i o n s

    a r e l o w e r b o u n d s o n a c t u a l c o s t , a n d t h i s p r o p e r t y i s r e f e r r e d t o a s a d m i s s i b i l i t y . F o r e x a m p l e ,

    a i r l i n e d i s t a n c e i s a l o w e r b o u n d o n r o a d d i s t a n c e b e t w e e n t w o p o i n t s , s i n c e t h e s h o r t e s t p a t h

    b e t w e e n a p a i r o f p o i n t s i s a s t r a i g h t l i n e . S i m i l a r l y , m a n h a t t a n d i s t a n c e i s a l o w e r b o u n d o n t h e

    a c t u a l n u m b e r o f m o v e s n e c e s s a r y t o s o l v e a n i n s t a n c e o f a s l i d i n g - t i l e p u z z l e , s i n c e e v e r y t i l e m u s t

    m o v e a t l e a s t a s m a n y t i m e s a s i t s d i s t a n c e i n g r i d u n i t s f r o m i t s g o a l p o s i t i o n .

    A n u m b e r o f a l g o r i t h m s m a k e u s e o f h e u r i s t i c f u n c t i o n s , i n c l u d i n g p u r e h e u r i s t i c s e a r c h , t h e A *

    a l g o r i t h m , i t e r a t i v e - d e e p e n i n g - A * , d e p t h - r s t b r a n c h - a n d - b o u n d , a n d t h e h e u r i s t i c p a t h a l g o r i t h m .

    I n a d d i t i o n , h e u r i s t i c i n f o r m a t i o n c a n b e e m p l o y e d i n b i d i r e c t i o n a l s e a r c h a s w e l l .

    4 . 2 P u r e H e u r i s t i c S e a r c h

    T h e s i m p l e s t o f t h e s e a l g o r i t h m s , p u r e h e u r i s t i c s e a r c h , e x p a n d s n o d e s i n o r d e r o f t h e i r h e u r i s t i c

    v a l u e s h ( n ) 8 ] . I t m a i n t a i n s a C l o s e d l i s t o f t h o s e n o d e s t h a t h a v e a l r e a d y b e e n e x p a n d e d , a n d a n

    O p e n l i s t o f t h o s e n o d e s t h a t h a v e b e e n g e n e r a t e d b u t n o t y e t e x p a n d e d . T h e a l g o r i t h m b e g i n s w i t h

    j u s t t h e i n i t i a l s t a t e o n t h e O p e n l i s t . A t e a c h c y c l e , a n o d e o n t h e O p e n l i s t w i t h t h e m i n i m u m

    h ( n ) v a l u e i s e x p a n d e d , g e n e r a t i n g a l l o f i t s c h i l d r e n , a n d i s p l a c e d o n t h e C l o s e d l i s t . T h e h e u r i s t i c

    f u n c t i o n i s a p p l i e d t o t h e c h i l d r e n , a n d t h e y a r e p l a c e d o n t h e O p e n l i s t i n o r d e r o f t h e i r h e u r i s t i c

    v a l u e s . T h e a l g o r i t h m c o n t i n u e s u n t i l a g o a l s t a t e i s c h o s e n f o r e x p a n s i o n .

    I n a g r a p h w i t h c y c l e s , m u l t i p l e p a t h s w i l l b e f o u n d t o t h e s a m e n o d e , a n d t h e r s t p a t h f o u n d

    m a y n o t b e t h e s h o r t e s t . W h e n a s h o r t e r p a t h i s f o u n d t o a n O p e n n o d e , t h e s h o r t e r p a t h i s s a v e d

    a n d t h e l o n g e r o n e d i s c a r d e d . W h e n a s h o r t e r p a t h t o a C l o s e d n o d e i s f o u n d , t h e n o d e i s m o v e d

    1 2

  • 8/6/2019 28194936 Artificial Intelligence Search Algorithms

    13/40

    t o O p e n , a n d t h e s h o r t e r p a t h i s a s s o c i a t e d w i t h i t . T h e m a i n d r a w b a c k o f p u r e h e u r i s t i c s e a r c h i s

    t h a t s i n c e i t i g n o r e s t h e c o s t o f t h e p a t h s o f a r t o n o d e n , i t d o e s n o t n d o p t i m a l s o l u t i o n s .

    B r e a d t h - r s t s e a r c h , u n i f o r m - c o s t s e a r c h , a n d p u r e h e u r i s t i c s e a r c h a r e a l l s p e c i a l c a s e s o f a

    m o r e g e n e r a l a l g o r i t h m c a l l e d b e s t - r s t s e a r c h . T h e y d i e r o n l y i n t h e i r c o s t f u n c t i o n s : t h e d e p t h

    o f n o d e n f o r b r e a d t h - r s t s e a r c h , g ( n ) f o r u n i f o r m - c o s t s e a r c h , a n d h ( n ) f o r p u r e h e u r i s t i c s e a r c h .

    4 . 3 A * A l g o r i t h m

    T h e A * a l g o r i t h m 1 3 ] c o m b i n e s f e a t u r e s o f u n i f o r m - c o s t s e a r c h a n d p u r e h e u r i s t i c s e a r c h t o e -

    c i e n t l y c o m p u t e o p t i m a l s o l u t i o n s . A * i s a b e s t - r s t s e a r c h i n w h i c h t h e c o s t a s s o c i a t e d w i t h a

    n o d e i s f ( n ) = g ( n ) + h ( n ) , w h e r e g ( n ) i s t h e c o s t o f t h e p a t h f r o m t h e i n i t i a l s t a t e t o n o d e n , a n d

    h ( n ) i s t h e h e u r i s t i c e s t i m a t e o f t h e c o s t o f a p a t h f r o m n o d e n t o a g o a l . T h u s , f ( n ) e s t i m a t e s

    t h e l o w e s t t o t a l c o s t o f a n y s o l u t i o n p a t h g o i n g t h r o u g h n o d e n . A t e a c h p o i n t a n o d e w i t h l o w e s t

    f v a l u e i s c h o s e n f o r e x p a n s i o n . T i e s a m o n g n o d e s o f e q u a l f v a l u e s h o u l d b e b r o k e n i n f a v o r o f

    n o d e s w i t h l o w e r h v a l u e s . T h e a l g o r i t h m t e r m i n a t e s w h e n a g o a l n o d e i s c h o s e n f o r e x p a n s i o n .

    A * n d s a n o p t i m a l p a t h t o a g o a l i f t h e h e u r i s t i c f u n c t i o n h ( n ) i s a d m i s s i b l e , m e a n i n g i t

    n e v e r o v e r e s t i m a t e s a c t u a l c o s t 1 3 ] . F o r e x a m p l e , s i n c e a i r l i n e d i s t a n c e n e v e r o v e r e s t i m a t e s a c t u a l

    h i g h w a y d i s t a n c e , a n d m a n h a t t a n d i s t a n c e n e v e r o v e r e s t i m a t e s a c t u a l m o v e s i n t h e s l i d i n g - t i l e

    p u z z l e s , A * u s i n g t h e s e e v a l u a t i o n f u n c t i o n s w i l l n d o p t i m a l s o l u t i o n s t o t h e s e p r o b l e m s . I n

    a d d i t i o n , A * m a k e s t h e m o s t e c i e n t u s e o f a g i v e n h e u r i s t i c f u n c t i o n i n t h e f o l l o w i n g s e n s e :

    a m o n g a l l s h o r t e s t - p a t h a l g o r i t h m s u s i n g a g i v e n h e u r i s t i c f u n c t i o n h ( n ) , A * e x p a n d s t h e f e w e s t

    n u m b e r o f n o d e s 4 ] .

    T h e m a i n d r a w b a c k o f A * , a n d i n d e e d o f a n y b e s t - r s t s e a r c h , i s i t s m e m o r y r e q u i r e m e n t .

    S i n c e a t l e a s t t h e e n t i r e O p e n l i s t m u s t b e s a v e d , A * i s s e v e r e l y s p a c e - l i m i t e d i n p r a c t i c e , a n d i s

    n o m o r e p r a c t i c a l t h a n b r e a d t h - r s t s e a r c h o n c u r r e n t m a c h i n e s . F o r e x a m p l e , w h i l e i t c a n b e

    1 3

  • 8/6/2019 28194936 Artificial Intelligence Search Algorithms

    14/40

  • 8/6/2019 28194936 Artificial Intelligence Search Algorithms

    15/40

    4 . 5 D e p t h - F i r s t B r a n c h - a n d - B o u n d

    F o r m a n y p r o b l e m s , t h e m a x i m u m s e a r c h d e p t h i s k n o w n i n a d v a n c e , o r t h e s e a r c h t r e e i s n i t e .

    F o r e x a m p l e , c o n s i d e r t h e t r a v e l l i n g s a l e s m a n p r o b l e m ( T S P ) o f v i s i t i n g e a c h o f a s e t o f c i t i e s a n d

    r e t u r n i n g t o t h e s t a r t i n g c i t y i n a t o u r o f s h o r t e s t t o t a l d i s t a n c e . T h e m o s t n a t u r a l p r o b l e m s p a c e

    f o r t h i s p r o b l e m c o n s i s t s o f a t r e e w h e r e t h e r o o t n o d e r e p r e s e n t s t h e s t a r t i n g c i t y , t h e n o d e s a t

    l e v e l o n e r e p r e s e n t a l l t h e c i t i e s t h a t c o u l d b e v i s i t e d r s t , t h e n o d e s a t l e v e l t w o r e p r e s e n t a l l t h e

    c i t e s t h a t c o u l d b e v i s i t e d s e c o n d , e t c . I n t h i s t r e e , t h e m a x i m u m d e p t h i s t h e n u m b e r o f c i t i e s , a n d

    a l l c a n d i d a t e s o l u t i o n s o c c u r a t t h i s d e p t h . I n s u c h a s p a c e , a s i m p l e d e p t h - r s t s e a r c h g u a r a n t e e s

    n d i n g a n o p t i m a l s o l u t i o n u s i n g s p a c e t h a t i s o n l y l i n e a r i n t h e n u m b e r o f c i t i e s .

    T h e i d e a o f d e p t h - r s t b r a n c h - a n d - b o u n d ( D F B n B ) i s t o m a k e t h i s s e a r c h m o r e e c i e n t b y

    k e e p i n g t r a c k o f t h e l o w e s t - c o s t s o l u t i o n f o u n d s o f a r . S i n c e t h e c o s t o f a p a r t i a l t o u r i s t h e s u m o f

    t h e c o s t s o f t h e e d g e s t r a v e l l e d s o f a r , w h e n e v e r a p a r t i a l t o u r i s f o u n d w h o s e c o s t e q u a l s o r e x c e e d s

    t h e c o s t o f t h e b e s t c o m p l e t e t o u r f o u n d s o f a r , t h e b r a n c h r e p r e s e n t i n g t h e p a r t i a l t o u r c a n b e

    p r u n e d , s i n c e a l l i t s d e s c e n d e n t s m u s t h a v e e q u a l o r g r e a t e r c o s t . W h e n e v e r a l o w e r - c o s t c o m p l e t e

    t o u r i s f o u n d , t h e c o s t o f t h e b e s t t o u r i s u p d a t e d t o t h i s l o w e r c o s t . I n a d d i t i o n , a n a d m i s s i b l e

    h e u r i s t i c f u n c t i o n , s u c h a s t h e c o s t o f t h e m i n i m u m s p a n n i n g t r e e o f t h e r e m a i n i n g u n v i s i t e d c i t i e s ,

    c a n b e a d d e d t o t h e c o s t s o f a r o f a p a r t i a l t o u r t o i n c r e a s e t h e a m o u n t o f p r u n i n g . F i n a l l y , b y

    c a r e f u l l y o r d e r i n g t h e c h i l d r e n o f a g i v e n n o d e f r o m s m a l l e s t t o l a r g e s t e s t i m a t e d t o t a l c o s t , a l o w e r

    c o s t s o l u t i o n c a n b e f o u n d m o r e q u i c k l y , f u r t h e r i m p r o v i n g t h e p r u n i n g e c i e n c y .

    I n t e r e s t i n g l y , I D A * a n d D F B n B e x h i b i t c o m p l e m e n t a r y b e h a v i o r . B o t h a r e g u a r a n t e e d t o r e t u r n

    a n o p t i m a l s o l u t i o n u s i n g o n l y l i n e a r s p a c e , a s s u m i n g t h a t t h e i r c o s t f u n c t i o n s a r e a d m i s s i b l e . I n

    I D A * , t h e c o s t t h r e s h o l d i s a l w a y s a l o w e r b o u n d o n t h e o p t i m a l s o l u t i o n c o s t , a n d i n c r e a s e s i n e a c h

    i t e r a t i o n u n t i l i t r e a c h e s t h e o p t i m a l c o s t . I n D F B n B , t h e c o s t o f t h e b e s t s o l u t i o n f o u n d s o f a r i s

    a l w a y s a n u p p e r b o u n d o n t h e o p t i m a l s o l u t i o n c o s t , a n d d e c r e a s e s u n t i l i t r e a c h e s t h e o p t i m a l c o s t .

    1 5

  • 8/6/2019 28194936 Artificial Intelligence Search Algorithms

    16/40

    W h i l e I D A * n e v e r e x p a n d s a n y n o d e s w h o s e c o s t e x c e e d s t h e o p t i m a l c o s t , i t s o v e r h e a d c o n s i s t s o f

    e x p a n d i n g s o m e n o d e s m o r e t h a n o n c e . W h i l e D F B n B n e v e r e x p a n d s a n y n o d e m o r e t h a n o n c e ,

    i t s o v e r h e a d c o n s i s t s o f e x p a n d i n g s o m e n o d e s w h o s e c o s t s e x c e e d t h e o p t i m a l c o s t . F o r p r o b l e m s

    w h o s e s e a r c h t r e e s a r e o f b o u n d e d d e p t h o r f o r w h i c h i t i s e a s y t o c o n s t r u c t a g o o d s o l u t i o n , s u c h

    a s t h e T S P , D F B n B i s u s u a l l y t h e a l g o r i t h m o f c h o i c e f o r n d i n g a n o p t i m a l s o l u t i o n . F o r p r o b l e m s

    w i t h i n n i t e s e a r c h t r e e s o r f o r w h i c h i t i s d i c u l t t o c o n s t r u c t a l o w - c o s t s o l u t i o n , s u c h a s t h e

    s l i d i n g - t i l e p u z z l e s o r R u b i k ' s C u b e , I D A * i s u s u a l l y t h e b e s t c h o i c e .

    4 . 6 C o m p l e x i t y o f F i n d i n g O p t i m a l S o l u t i o n s

    T h e t i m e c o m p l e x i t y o f a h e u r i s t i c s e a r c h a l g o r i t h m d e p e n d s o n t h e a c c u r a c y o f t h e h e u r i s t i c

    f u n c t i o n . F o r e x a m p l e , i f t h e h e u r i s t i c e v a l u a t i o n f u n c t i o n i s a n e x a c t e s t i m a t o r , t h e n A * r u n s i n

    l i n e a r t i m e , e x p a n d i n g o n l y t h o s e n o d e s o n a n o p t i m a l s o l u t i o n p a t h . C o n v e r s e l y , w i t h a h e u r i s t i c

    t h a t r e t u r n s z e r o e v e r y w h e r e , A * b e c o m e s u n i f o r m - c o s t s e a r c h , w h i c h h a s e x p o n e n t i a l c o m p l e x i t y .

    I n g e n e r a l , t h e t i m e c o m p l e x i t y o f A * a n d I D A * i s a n e x p o n e n t i a l f u n c t i o n o f t h e e r r o r i n t h e

    h e u r i s t i c f u n c t i o n 3 3 ] . F o r e x a m p l e , i f t h e h e u r i s t i c h a s c o n s t a n t a b s o l u t e e r r o r , m e a n i n g t h a t i t

    n e v e r u n d e r e s t i m a t e s b y m o r e t h a n a c o n s t a n t a m o u n t r e g a r d l e s s o f t h e m a g n i t u d e o f t h e e s t i m a t e ,

    t h e n t h e r u n n i n g t i m e o f A * i s l i n e a r i n t h e s o l u t i o n c o s t 1 0 ] . A m o r e r e a l i s t i c a s s u m p t i o n i s c o n s t a n t

    r e l a t i v e e r r o r , w h i c h m e a n s t h a t t h e e r r o r i s a x e d p e r c e n t a g e o f t h e q u a n t i t y b e i n g e s t i m a t e d .

    I n t h a t c a s e , t h e r u n n i n g t i m e s o f A * a n d I D A * a r e e x p o n e n t i a l 3 5 ] . T h e b a s e o f t h e e x p o n e n t ,

    h o w e v e r , i s s m a l l e r t h a n t h e b r u t e - f o r c e b r a n c h i n g f a c t o r , r e d u c i n g t h e a s y m p t o t i c c o m p l e x i t y a n d

    a l l o w i n g s o m e w h a t l a r g e r p r o b l e m s t o b e s o l v e d . F o r e x a m p l e , u s i n g t h e M a n h a t t a n D i s t a n c e

    h e u r i s t i c , I D A * c a n o p t i m a l l y s o l v e r a n d o m i n s t a n c e s o f t h e F i f t e e n P u z z l e 1 8 ] .

    1 6

  • 8/6/2019 28194936 Artificial Intelligence Search Algorithms

    17/40

    4 . 7 H e u r i s t i c P a t h A l g o r i t h m

    S i n c e t h e c o m p l e x i t y o f n d i n g o p t i m a l s o l u t i o n s t o t h e s e p r o b l e m s i s g e n e r a l l y e x p o n e n t i a l i n

    p r a c t i c e , i n o r d e r t o s o l v e s i g n i c a n t l y l a r g e r p r o b l e m s , t h e o p t i m a l i t y r e q u i r e m e n t m u s t b e r e l a x e d .

    A n e a r l y a p p r o a c h t o t h i s p r o b l e m i s t h e h e u r i s t i c p a t h a l g o r i t h m ( H P A ) 3 6 ] . H P A i s a b e s t - r s t

    s e a r c h a l g o r i t h m s , w h e r e t h e g u r e o f m e r i t o f a n o d e n i s f ( n ) = ( 1 w ) g ( n ) + w h ( n ) . V a r y i n g

    w p r o d u c e s a r a n g e o f a l g o r i t h m s f r o m u n i f o r m - c o s t s e a r c h ( w = 0 ) , t h r o u g h A * ( w = 1 = 2 ) , t o p u r e

    h e u r i s t i c s e a r c h ( w = 1 ) . I n c r e a s i n g w b e y o n d 1 = 2 g e n e r a l l y d e c r e a s e s t h e a m o u n t o f c o m p u t a t i o n ,

    w h i l e i n c r e a s i n g t h e c o s t o f t h e s o l u t i o n g e n e r a t e d . T h i s t r a d e o i s o f t e n q u i t e f a v o r a b l e , w i t h s m a l l

    i n c r e a s e s i n s o l u t i o n c o s t y i e l d i n g h u g e s a v i n g s i n c o m p u t a t i o n 2 2 ] . F u r t h e r m o r e , i t c a n b e s h o w n

    t h a t t h e s o l u t i o n s f o u n d b y t h i s a l g o r i t h m a r e g u a r a n t e e d t o b e n o m o r e t h a n a f a c t o r o f w = ( 1 w )

    g r e a t e r t h a n o p t i m a l 3 ] , b u t o f t e n a r e s i g n i c a n t l y b e t t e r .

    4 . 8 R e c u r s i v e B e s t - F i r s t S e a r c h

    T h e m e m o r y l i m i t a t i o n o f t h e H e u r i s t i c P a t h A l g o r i t h m c a n b e o v e r c o m e s i m p l y b y r e p l a c i n g t h e

    b e s t - r s t s e a r c h w i t h I D A * u s i n g t h e s a m e w e i g h t e d e v a l u a t i o n f u n c t i o n . H o w e v e r , w i t h w 1 = 2 ,

    I D A * i s n o l o n g e r a b e s t - r s t s e a r c h , s i n c e t h e t o t a l c o s t o f a c h i l d c a n b e l e s s t h a n t h a t o f i t s

    p a r e n t , a n d t h u s n o d e s a r e n o t n e c e s s a r i l y e x p a n d e d i n b e s t - r s t o r d e r . A n a l t e r n a t i v e a l g o r i t h m

    i s R e c u r s i v e B e s t - F i r s t S e a r c h ( R B F S ) 2 2 ] . R B F S i s a b e s t - r s t s e a r c h t h a t r u n s i n s p a c e t h a t i s

    l i n e a r i n t h e m a x i m u m s e a r c h d e p t h , r e g a r d l e s s o f t h e c o s t f u n c t i o n u s e d . E v e n w i t h a n a d m i s s i b l e

    c o s t f u n c t i o n , R B F S g e n e r a t e s f e w e r n o d e s t h a n I D A * , a n d i s g e n e r a l l y s u p e r i o r t o I D A * , e x c e p t

    f o r a s m a l l i n c r e a s e i n t h e c o s t p e r n o d e g e n e r a t i o n .

    I t w o r k s b y m a i n t a i n i n g o n t h e r e c u r s i o n s t a c k t h e c o m p l e t e p a t h t o t h e c u r r e n t n o d e b e i n g

    e x p a n d e d , a s w e l l a s a l l i m m e d i a t e s i b l i n g s o f n o d e s o n t h a t p a t h , a l o n g w i t h t h e c o s t o f t h e b e s t

    n o d e i n t h e s u b t r e e e x p l o r e d b e l o w e a c h s i b l i n g . W h e n e v e r t h e c o s t o f t h e c u r r e n t n o d e e x c e e d s

    1 7

  • 8/6/2019 28194936 Artificial Intelligence Search Algorithms

    18/40

    t h a t o f s o m e o t h e r n o d e i n t h e p r e v i o u s l y e x p a n d e d p o r t i o n o f t h e t r e e , t h e a l g o r i t h m b a c k s u p

    t o t h e i r d e e p e s t c o m m o n a n c e s t o r , a n d c o n t i n u e s t h e s e a r c h d o w n t h e n e w p a t h . I n e e c t , t h e

    a l g o r i t h m m a i n t a i n s a s e p a r a t e t h r e s h o l d f o r e a c h s u b t r e e d i v e r g i n g f r o m t h e c u r r e n t s e a r c h p a t h .

    S e e 2 2 ] f o r f u l l d e t a i l s o n R B F S .

    5 I n t e r l e a v i n g S e a r c h a n d E x e c u t i o n

    I n t h e d i s c u s s i o n a b o v e , i t i s a s s u m e d t h a t a c o m p l e t e s o l u t i o n c a n b e c o m p u t e d , b e f o r e e v e n t h e

    r s t s t e p o f t h e s o l u t i o n n e e d b e e x e c u t e d . T h i s i s i n c o n t r a s t t o t h e s i t u a t i o n i n t w o - p l a y e r g a m e s ,

    d i s c u s s e d b e l o w , w h e r e b e c a u s e o f c o m p u t a t i o n a l l i m i t s a n d u n c e r t a i n t y d u e t o t h e o p p o n e n t ' s

    m o v e s , s e a r c h a n d e x e c u t i o n a r e i n t e r l e a v e d , w i t h e a c h s e a r c h d e t e r m i n i n g o n l y t h e n e x t m o v e t o

    b e m a d e . T h i s p a r a d i g m i s a l s o a p p l i c a b l e t o s i n g l e - a g e n t p r o b l e m s . I n t h e c a s e o f a u t o n o m o u s

    v e h i c l e n a v i g a t i o n , f o r e x a m p l e , i n f o r m a t i o n i s l i m i t e d b y t h e h o r i z o n o f t h e v e h i c l e ' s s e n s o r s , a n d

    i t m u s t p h y s i c a l l y m o v e t o a c q u i r e m o r e i n f o r m a t i o n . T h u s , o n e m o v e m u s t b e c o m p u t e d a t a t i m e ,

    a n d t h a t m o v e e x e c u t e d b e f o r e c o m p u t i n g t h e n e x t . B e l o w w e c o n s i d e r a l g o r i t h m s d e s i g n e d f o r

    t h i s s c e n a r i o .

    5 . 1 M i n i m i n S e a r c h

    M i n i m i n s e a r c h d e t e r m i n e s i n d i v i d u a l s i n g l e - a g e n t m o v e s i n c o n s t a n t t i m e p e r m o v e 2 0 ] . T h e

    a l g o r i t h m s e a r c h e s f o r w a r d f r o m t h e c u r r e n t s t a t e t o a x e d d e p t h d e t e r m i n e d b y t h e i n f o r m a t i o n a l

    o r c o m p u t a t i o n a l r e s o u r c e s a v a i l a b l e . A t t h e s e a r c h h o r i z o n , t h e A * e v a l u a t i o n f u n c t i o n f ( n ) =

    g ( n ) + h ( n ) i s a p p l i e d t o t h e f r o n t i e r n o d e s . S i n c e a l l d e c i s i o n s a r e m a d e b y a s i n g l e a g e n t , t h e

    v a l u e o f a n i n t e r i o r n o d e i s t h e m i n i m u m o f t h e f r o n t i e r v a l u e s i n t h e s u b t r e e b e l o w t h e n o d e . A

    s i n g l e m o v e i s t h e n m a d e t o t h e n e i g h b o r o f t h e c u r r e n t s t a t e w i t h t h e m i n i m u m v a l u e .

    M o s t h e u r i s t i c f u n c t i o n s o b e y t h e t r i a n g l e i n e q u a l i t y c h a r a c t e r i s t i c o f d i s t a n c e m e a s u r e s . A s a

    1 8

  • 8/6/2019 28194936 Artificial Intelligence Search Algorithms

    19/40

    r e s u l t , f ( n ) = g ( n ) + h ( n ) i s g u a r a n t e e d t o b e m o n o t o n i c a l l y n o n d e c r e a s i n g a l o n g a p a t h . F u r t h e r -

    m o r e , s i n c e m i n i m i n s e a r c h h a s a x e d d e p t h l i m i t , w e c a n a p p l y d e p t h - r s t b r a n c h - a n d - b o u n d t o

    p r u n e t h e s e a r c h t r e e . T h e p e r f o r m a n c e i m p r o v e m e n t d u e t o b r a n c h - a n d - b o u n d i s q u i t e d r a m a t i c ,

    i n s o m e c a s e s e x t e n d i n g t h e a c h i e v a b l e s e a r c h h o r i z o n b y a f a c t o r o f v e r e l a t i v e t o b r u t e - f o r c e

    m i n i m i n s e a r c h o n s l i d i n g - t i l e p u z z l e s 2 0 ] .

    M i n i m i n s e a r c h w i t h b r a n c h - a n d - b o u n d i s a n a l g o r i t h m f o r e v a l u a t i n g t h e i m m e d i a t e n e i g h b o r s

    o f t h e c u r r e n t n o d e . A s s u c h , i t i s r u n u n t i l t h e b e s t c h i l d i s i d e n t i e d , a t w h i c h p o i n t t h e c h o s e n

    m o v e i s e x e c u t e d i n t h e r e a l w o r l d . W e c a n v i e w t h e s t a t i c e v a l u a t i o n f u n c t i o n c o m b i n e d w i t h

    l o o k a h e a d s e a r c h a s s i m p l y a m o r e a c c u r a t e , b u t c o m p u t a t i o n a l l y e x p e n s i v e , h e u r i s t i c f u n c t i o n . I n

    f a c t , i t p r o v i d e s a n e n t i r e s p e c t r u m o f h e u r i s t i c f u n c t i o n s t r a d i n g o a c c u r a c y f o r c o s t , d e p e n d i n g

    o n t h e s e a r c h h o r i z o n .

    5 . 2 R e a l - T i m e - A *

    S i m p l y r e p e a t i n g m i n i m i n s e a r c h f o r e a c h m o v e i g n o r e s i n f o r m a t i o n f r o m p r e v i o u s s e a r c h e s a n d

    r e s u l t s i n i n n i t e l o o p s . I n a d d i t i o n , s i n c e a c t i o n s a r e c o m m i t t e d b a s e d o n l i m i t e d i n f o r m a t i o n ,

    o f t e n t h e b e s t m o v e m a y b e t o u n d o t h e p r e v i o u s m o v e . T h e p r i n c i p l e o f r a t i o n a l i t y i s t h a t

    b a c k t r a c k i n g s h o u l d o c c u r w h e n t h e e s t i m a t e d c o s t o f c o n t i n u i n g t h e c u r r e n t p a t h e x c e e d s t h e c o s t

    o f g o i n g b a c k t o a p r e v i o u s s t a t e , p l u s t h e e s t i m a t e d c o s t o f r e a c h i n g t h e g o a l f r o m t h a t s t a t e .

    R e a l - t i m e - A * ( R T A * ) i m p l e m e n t s t h i s p o l i c y i n c o n s t a n t t i m e p e r m o v e 2 0 ] .

    F o r e a c h m o v e , t h e f ( n ) = g ( n ) + h ( n ) v a l u e o f e a c h n e i g h b o r o f t h e c u r r e n t s t a t e i s c o m p u t e d ,

    w h e r e g ( n ) i s n o w t h e c o s t o f t h e e d g e f r o m t h e c u r r e n t s t a t e t o t h e n e i g h b o r , i n s t e a d o f f r o m t h e

    i n i t i a l s t a t e . T h e p r o b l e m s o l v e r m o v e s t o t h e n e i g h b o r w i t h t h e m i n i m u m f ( n ) v a l u e , a n d s t o r e s

    w i t h t h e p r e v i o u s s t a t e t h e b e s t f ( n ) v a l u e a m o n g t h e r e m a i n i n g n e i g h b o r s . T h i s r e p r e s e n t s t h e

    h ( n ) v a l u e o f t h e p r e v i o u s s t a t e f r o m t h e p e r s p e c t i v e o f t h e n e w c u r r e n t s t a t e . T h i s i s r e p e a t e d

    1 9

  • 8/6/2019 28194936 Artificial Intelligence Search Algorithms

    20/40

    u n t i l a g o a l i s r e a c h e d . T o d e t e r m i n e t h e h ( n ) v a l u e o f a p r e v i o u s l y v i s i t e d s t a t e , t h e s t o r e d v a l u e

    i s u s e d , w h i l e f o r a n e w s t a t e t h e h e u r i s t i c e v a l u a t o r i s c a l l e d . N o t e t h a t t h e h e u r i s t i c e v a l u a t o r

    m a y e m p l o y m i n i m i n l o o k a h e a d s e a r c h w i t h b r a n c h - a n d - b o u n d a s w e l l .

    I n a n i t e p r o b l e m s p a c e i n w h i c h t h e r e e x i s t s a p a t h t o a g o a l f r o m e v e r y s t a t e , R T A * i s

    g u a r a n t e e d t o e v e n t u a l l y t o n d a s o l u t i o n , r e g a r d l e s s o f t h e h e u r i s t i c e v a l u a t i o n f u n c t i o n 2 0 ] .

    F u r t h e r m o r e , o n a t r e e , R T A * m a k e s l o c a l l y - o p t i m a l d e c i s i o n s g i v e n t h e i n f o r m a t i o n i t h a s s e e n s o

    f a r .

    5 . 3 L e a r n i n g - R e a l - T i m e - A *

    I f a p r o b l e m i s t o b e s o l v e d r e p e a t e d l y w i t h t h e s a m e g o a l s t a t e b u t d i e r e n t i n i t i a l s t a t e s , o n e

    w o u l d l i k e a n a l g o r i t h m t h a t i m p r o v e s i t s p e r f o r m a n c e o v e r t i m e . L e a r n i n g - r e a l - t i m e - A * ( L R T A * )

    i s s u c h a n a l g o r i t h m . I t b e h a v e s a l m o s t i d e n t i c a l l y t o R T A * , e x c e p t t h a t i n s t e a d o f s t o r i n g t h e

    s e c o n d - b e s t f v a l u e o f a n o d e a s i t s n e w h e u r i s t i c v a l u e , i t s t o r e s t h e b e s t v a l u e i n s t e a d . O n c e o n e

    p r o b l e m i n s t a n c e i s s o l v e d , t h e s t o r e d h e u r i s t i c v a l u e s a r e s a v e d a n d b e c o m e t h e i n i t i a l v a l u e s f o r

    t h e n e x t p r o b l e m i n s t a n c e . W h i l e L R T A * i s l e s s e c i e n t t h a n R T A * f o r s o l v i n g a s i n g l e p r o b l e m

    i n s t a n c e , a s s u m i n g i t s t a r t s w i t h a d m i s s i b l e i n i t i a l h e u r i s t i c v a l u e s , o v e r r e p e a t e d t r i a l s i t s h e u r i s t i c

    v a l u e s w i l l e v e n t u a l l y c o n v e r g e t o t h e i r e x a c t v a l u e s . a t w h i c h p o i n t t h e a l g o r i t h m r e t u r n s o p t i m a l

    s o l u t i o n s .

    6 T w o - P l a y e r G a m e s

    T h e s e c o n d m a j o r a p p l i c a t i o n o f h e u r i s t i c s e a r c h a l g o r i t h m s i n A I i s t w o - p l a y e r g a m e s . O n e o f t h e

    o r i g i n a l c h a l l e n g e s o f A I , w h i c h i n f a c t p r e d a t e s t h e t e r m \ a r t i c i a l i n t e l l i g e n c e " , w a s t o b u i l d a

    p r o g r a m t h a t c o u l d p l a y c h e s s a t t h e l e v e l o f t h e b e s t h u m a n p l a y e r s 4 7 ] .

    2 0

  • 8/6/2019 28194936 Artificial Intelligence Search Algorithms

    21/40

    6 . 1 M i n i m a x S e a r c h

    T h e s t a n d a r d a l g o r i t h m f o r t w o - p l a y e r g a m e s i s m i n i m a x s e a r c h w i t h h e u r i s t i c s t a t i c e v a l u a t i o n 4 3 ] .

    T h e a l g o r i t h m s e a r c h e s f o r w a r d t o a x e d d e p t h i n t h e g a m e t r e e , l i m i t e d b y t h e a m o u n t o f t i m e

    a v a i l a b l e p e r m o v e . A t t h i s s e a r c h h o r i z o n , a h e u r i s t i c f u n c t i o n i s a p p l i e d t o t h e f r o n t i e r n o d e s .

    I n t h i s c a s e , a h e u r i s t i c e v a l u a t i o n i s a f u n c t i o n t h a t t a k e s a b o a r d p o s i t i o n a n d r e t u r n s a n u m b e r

    t h a t i n d i c a t e s h o w f a v o r a b l e t h a t p o s i t i o n i s f o r o n e p l a y e r r e l a t i v e t o t h e o t h e r . F o r e x a m p l e , a

    v e r y s i m p l e h e u r i s t i c e v a l u a t o r f o r c h e s s w o u l d c o u n t t h e t o t a l n u m b e r o f p i e c e s o n t h e b o a r d f o r

    o n e p l a y e r , a p p r o p r i a t e l y w e i g h t e d b y t h e i r r e l a t i v e s t r e n g t h , a n d s u b t r a c t t h e w e i g h t e d s u m o f

    t h e o p p o n e n t ' s p i e c e s . T h u s , l a r g e p o s i t i v e v a l u e s w o u l d c o r r e s p o n d t o s t r o n g p o s i t i o n s f o r o n e

    p l a y e r , c a l l e d M A X , w h e r e a s l a r g e n e g a t i v e v a l u e s w o u l d r e p r e s e n t a d v a n t a g e o u s s i t u a t i o n s f o r t h e

    o p p o n e n t , c a l l e d M I N .

    G i v e n t h e h e u r i s t i c e v a l u a t i o n s o f t h e f r o n t i e r n o d e s , v a l u e s f o r t h e i n t e r i o r n o d e s i n t h e t r e e

    a r e r e c u r s i v e l y c o m p u t e d a c c o r d i n g t o t h e m i n i m a x r u l e . T h e v a l u e o f a n o d e w h e r e i t i s M A X ' s

    t u r n t o m o v e i s t h e m a x i m u m o f t h e v a l u e s o f i t s c h i l d r e n , w h i l e t h e v a l u e o f a n o d e w h e r e M I N

    i s t o m o v e i s t h e m i n i m u m o f t h e v a l u e s o f i t s c h i l d r e n . T h u s , a t a l t e r n a t e l e v e l s o f t h e t r e e , t h e

    m i n i m u m o r t h e m a x i m u m v a l u e s o f t h e c h i l d r e n a r e b a c k e d u p . T h i s c o n t i n u e s u n t i l t h e v a l u e s o f

    t h e i m m e d i a t e c h i l d r e n o f t h e c u r r e n t p o s i t i o n a r e c o m p u t e d , a t w h i c h p o i n t o n e m o v e t o t h e c h i l d

    w i t h t h e m a x i m u m o r m i n i m u m v a l u e i s m a d e , d e p e n d i n g o n w h o s e t u r n i t i s t o m o v e .

    6 . 2 A l p h a - B e t a P r u n i n g

    O n e o f t h e m o s t e l e g a n t o f a l l A I s e a r c h a l g o r i t h m s i s a l p h a - b e t a p r u n i n g . A p p a r e n t l y J o h n

    M c C a r t h y c a m e u p w i t h t h e o r i g i n a l i d e a i n 1 9 5 6 , b u t d i d n ' t p u b l i s h i t . I t r s t a p p e a r e d i n p r i n t

    i n a n M I T t e c h r e p o r t 1 2 ] , a n d a t h o r o u g h t r e a t m e n t o f t h e a l g o r i t h m c a n b e f o u n d i n 2 6 ] . T h e

    i d e a , s i m i l a r t o b r a n c h - a n d - b o u n d , i s t h a t t h e m i n i m a x v a l u e o f t h e r o o t o f a g a m e t r e e c a n b e

    2 1

  • 8/6/2019 28194936 Artificial Intelligence Search Algorithms

    22/40

    d e t e r m i n e d w i t h o u t e x a m i n i n g a l l t h e n o d e s a t t h e s e a r c h f r o n t i e r .

    F i g u r e 5 s h o w s a n e x a m p l e o f a l p h a - b e t a p r u n i n g . O n l y t h e l a b e l l e d n o d e s a r e g e n e r a t e d b y

    t h e a l g o r i t h m , w i t h t h e h e a v y b l a c k l i n e s i n d i c a t i n g p r u n i n g . A t t h e s q u a r e n o d e s M A X i s t o

    m o v e , w h i l e a t t h e c i r c u l a r n o d e s i t i s M I N ' s t u r n . T h e s e a r c h p r o c e e d s d e p t h - r s t t o m i n i m i z e t h e

    m e m o r y r e q u i r e d , a n d o n l y e v a l u a t e s a n o d e w h e n n e c e s s a r y . F i r s t , n o d e s e a n d f a r e s t a t i c a l l y

    e v a l u a t e d a t 4 a n d 5 , r e s p e c t i v e l y , a n d t h e i r m i n i m u m v a l u e , 4 , i s b a c k e d u p t o t h e i r p a r e n t n o d e

    d . N o d e h i s t h e n e v a l u a t e d a t 3 , a n d h e n c e t h e v a l u e o f i t s p a r e n t n o d e g m u s t b e l e s s t h a n o r

    e q u a l t o 3 , s i n c e i t i s t h e m i n i m u m o f 3 a n d t h e u n k n o w n v a l u e o f i t s r i g h t c h i l d . T h u s , w e l a b e l

    n o d e g a s

  • 8/6/2019 28194936 Artificial Intelligence Search Algorithms

    23/40

    1 234 5 6 7

    4 6

    4

    4

    4

    =6

  • 8/6/2019 28194936 Artificial Intelligence Search Algorithms

    24/40

    d

    t h

    r o o t o f t h e n u m b e r o f f r o n t i e r n o d e s t h a t m u s t b e e v a l u a t e d i n a s e a r c h t o d e p t h d

    T h e e c i e n c y o f a l p h a - b e t a p r u n i n g d e p e n d s u p o n t h e o r d e r i n w h i c h n o d e s a r e e n c o u n t e r e d

    a t t h e s e a r c h f r o n t i e r . F o r a n y s e t o f f r o n t i e r n o d e v a l u e s , t h e r e e x i s t s s o m e o r d e r i n g o f t h e v a l u e s

    s u c h t h a t a l p h a - b e t a w i l l n o t p e r f o r m a n y c u t o s a t a l l . I n t h a t c a s e , a l l f r o n t i e r n o d e s m u s t b e

    e v a l u a t e d a n d t h e e e c t i v e b r a n c h i n g f a c t o r i s b , t h e b r u t e - f o r c e b r a n c h i n g f a c t o r .

    O n t h e o t h e r h a n d , t h e r e i s a n o p t i m a l o r p e r f e c t o r d e r i n g i n w h i c h e v e r y p o s s i b l e c u t o i s

    r e a l i z e d . I n t h a t c a s e , t h e e e c t i v e b r a n c h i n g f a c t o r i s r e d u c e d f r o m b t o b

    1 = 2

    , t h e s q u a r e r o o t o f

    t h e b r u t e - f o r c e b r a n c h i n g f a c t o r . A n o t h e r w a y o f v i e w i n g t h e p e r f e c t o r d e r i n g c a s e i s t h a t f o r t h e

    s a m e a m o u n t o f c o m p u t a t i o n , o n e c a n s e a r c h t w i c e a s d e e p w i t h a l p h a - b e t a p r u n i n g a s w i t h o u t .

    S i n c e t h e s e a r c h t r e e g r o w s e x p o n e n t i a l l y w i t h d e p t h , d o u b l i n g t h e s e a r c h h o r i z o n i s a d r a m a t i c

    i m p r o v e m e n t .

    I n b e t w e e n w o r s t - p o s s i b l e o r d e r i n g a n d p e r f e c t o r d e r i n g i s r a n d o m o r d e r i n g , w h i c h i s t h e a v -

    e r a g e c a s e . U n d e r r a n d o m o r d e r i n g o f t h e f r o n t i e r n o d e s , a l p h a - b e t a p r u n i n g r e d u c e s t h e e e c t i v e

    b r a n c h i n g f a c t o r t o a p p r o x i m a t e l y b

    3 = 4

    3 2 ] . T h i s m e a n s t h a t o n e c a n s e a r c h 4 = 3 a s d e e p w i t h

    a l p h a - b e t a , y i e l d i n g a 3 3 % i m p r o v e m e n t i n s e a r c h d e p t h .

    6 . 3 N o d e O r d e r i n g , Q u i e s c e n c e , I t e r a t i v e - D e e p e n i n g , a n d T r a n s p o s i t i o n T a b l e s

    I n p r a c t i c e , h o w e v e r , t h e e e c t i v e b r a n c h i n g f a c t o r o f a l p h a - b e t a i s c l o s e r t o t h e b e s t c a s e o f b

    1 = 2

    d u e

    t o n o d e o r d e r i n g . T h e i d e a o f n o d e o r d e r i n g i s t h a t i n s t e a d o f g e n e r a t i n g t h e t r e e l e f t - t o - r i g h t , w e

    c a n r e o r d e r t h e t r e e b a s e d o n s t a t i c e v a l u a t i o n s o f t h e i n t e r i o r n o d e s . I n o t h e r w o r d s , t h e c h i l d r e n

    o f M A X n o d e s a r e e x p a n d e d i n d e c r e a s i n g o r d e r o f t h e i r s t a t i c v a l u e s , w h i l e t h e c h i l d r e n o f M I N

    n o d e s a r e e x p a n d e d i n i n c r e a s i n g o r d e r o f t h e i r s t a t i c v a l u e s .

    T w o o t h e r i m p o r t a n t i d e a s a r e q u i e s c e n c e a n d i t e r a t i v e - d e e p e n i n g . T h e i d e a o f q u i e s c e n c e i s

    t h a t t h e s t a t i c e v a l u a t o r s h o u l d n o t b e a p p l i e d t o p o s i t i o n s w h o s e v a l u e s a r e u n s t a b l e , s u c h a s

    2 4

  • 8/6/2019 28194936 Artificial Intelligence Search Algorithms

    25/40

    t h o s e o c c u r r i n g i n t h e m i d d l e o f a p i e c e t r a d e . I n t h o s e p o s i t i o n s , a s m a l l s e c o n d a r y s e a r c h i s

    c o n d u c t e d u n t i l t h e s t a t i c e v a l u a t i o n b e c o m e s m o r e s t a b l e . I n p r a c t i c e , t h i s c a n b e a c h i e v e d b y

    a l w a y s e x p l o r i n g a n y c a p t u r e m o v e s o n e l e v e l d e e p e r .

    I t e r a t i v e - d e e p e n i n g i s u s e d t o s o l v e t h e p r o b l e m o f w h e r e t o s e t t h e s e a r c h h o r i z o n 4 4 ] , a n d i n

    f a c t p r e d a t e d i t s u s e a s a m e m o r y - s a v i n g d e v i c e i n s i n g l e - a g e n t s e a r c h . I n a t o u r n a m e n t g a m e ,

    t h e r e i s a l i m i t e d a m o u n t o f t i m e a l l o w e d f o r m o v e s . U n f o r t u n a t e l y , i t i s v e r y d i c u l t t o a c c u r a t e l y

    p r e d i c t h o w l o n g i t w i l l t a k e t o p e r f o r m a n a l p h a - b e t a s e a r c h t o a g i v e n d e p t h . T h e s o l u t i o n i s

    t o p e r f o r m a s e r i e s o f s e a r c h e s t o s u c c e s s i v e l y g r e a t e r d e p t h s . W h e n t i m e r u n s o u t , t h e m o v e

    r e c o m m e n d e d b y t h e l a s t c o m p l e t e d s e a r c h i s m a d e .

    T h e s e a r c h g r a p h s o f m o s t g a m e s , s u c h a s c h e s s , c o n t a i n m u l t i p l e p a t h s t o t h e s a m e n o d e , o f t e n

    r e a c h e d b y m a k i n g t h e s a m e m o v e s i n a d i e r e n t o r d e r , r e f e r r e d t o a s a t r a n s p o s i t i o n o f t h e m o v e s .

    S i n c e a l p h a - b e t a i s a d e p t h - r s t s e a r c h , i t i s i m p o r t a n t t o d e t e c t w h e n a n o d e h a s a l r e a d y b e e n

    s e a r c h e d , i n o r d e r t o a v o i d r e s e a r c h i n g i t . A t r a n s p o s i t i o n t a b l e i s a t a b l e o f p r e v i o u s l y e n c o u n t e r e d

    g a m e s t a t e s , t o g e t h e r w i t h t h e i r b a c k e d - u p m i n i m a x v a l u e s . W h e n e v e r a n e w s t a t e i s g e n e r a t e d , i f

    i t i s s t o r e d i n t h e t r a n s p o s i t i o n t a b l e , i t s v a l u e t h e r e i s u s e d i n s t e a d o f s e a r c h i n g t h e t r e e b e l o w t h e

    n o d e .

    V i r t u a l l y a l l t w o - p l a y e r g a m e p r o g r a m s u s e f u l l - w i d t h , x e d - d e p t h , a l p h a - b e t a m i n i m a x s e a r c h

    w i t h n o d e o r d e r i n g , q u i e s c e n c e , i t e r a t i v e - d e e p e n i n g , a n d t r a n s p o s i t i o n t a b l e s , a m o n g o t h e r t e c h -

    n i q u e s .

    6 . 4 S p e c i a l P u r p o s e H a r d w a r e

    W h i l e t h e b a s i c a l g o r i t h m s a r e d e s c r i b e d a b o v e , m u c h o f t h e p e r f o r m a n c e a d v a n c e s i n c o m p u t e r

    c h e s s h a v e c o m e f r o m f a s t e r h a r d w a r e . T h e f a s t e r t h e m a c h i n e , t h e d e e p e r i t c a n s e a r c h i n t h e

    t i m e a v a i l a b l e , a n d t h e b e t t e r i t p l a y s . D e s p i t e t h e r a p i d l y a d v a n c i n g s p e e d o f g e n e r a l - p u r p o s e

    2 5

  • 8/6/2019 28194936 Artificial Intelligence Search Algorithms

    26/40

    c o m p u t e r s , t h e b e s t m a c h i n e s t o d a y a r e b a s e d o n s p e c i a l - p u r p o s e h a r d w a r e d e s i g n e d a n d b u i l t

    o n l y t o p l a y c h e s s . F o r e x a m p l e , D e e p B l u e i s a c h e s s m a c h i n e t h a t c a n e v a l u a t e a b o u t 1 0 0 m i l l i o n

    c h e s s p o s i t i o n s p e r s e c o n d 1 7 ] . I t r e c e n t l y l o s t a s i x - g a m e t o u r n a m e n t t o G a r y K a s p a r o v , t h e w o r l d

    c h a m p i o n , b u t d i d w i n o n e g a m e a n d d r a w s e v e r a l o t h e r s .

    7 C o n s t r a i n t - S a t i s f a c t i o n P r o b l e m s

    I n a d d i t i o n t o s i n g l e - a g e n t p a t h - n d i n g p r o b l e m s a n d t w o - p l a y e r g a m e s , t h e t h i r d m a j o r a p p l i c a -

    t i o n o f h e u r i s t i c s e a r c h i s c o n s t r a i n t - s a t i s f a c t i o n p r o b l e m s . T h e E i g h t Q u e e n s P r o b l e m m e n t i o n e d

    p r e v i o u s l y i s a c l a s s i c e x a m p l e . O t h e r e x a m p l e s i n c l u d e g r a p h c o l o r i n g , b o o l e a n s a t i s a b i l i t y , a n d

    s c h e d u l i n g p r o b l e m s .

    C o n s t r a i n t - s a t i s f a c t i o n p r o b l e m s a r e m o d e l l e d a s f o l l o w s : T h e r e i s a s e t o f v a r i a b l e s , a s e t o f

    v a l u e s f o r e a c h v a r i a b l e , a n d a s e t o f c o n s t r a i n t s o n t h e v a l u e s t h a t t h e v a r i a b l e s c a n b e a s s i g n e d .

    A u n a r y c o n s t r a i n t o n a v a r i a b l e s p e c i e s a s u b s e t o f a l l p o s s i b l e v a l u e s t h a t c a n b e a s s i g n e d t o

    t h a t v a r i a b l e . A b i n a r y c o n s t r a i n t b e t w e e n t w o v a r i a b l e s s p e c i e s w h i c h p o s s i b l e c o m b i n a t i o n s o f

    a s s i g n m e n t s t o t h e p a i r o f v a r i a b l e s s a t i s f y t h e c o n s t r a i n t . F o r e x a m p l e , i n a m a p o r g r a p h c o l o r i n g

    p r o b l e m , t h e v a r i a b l e s w o u l d r e p r e s e n t r e g i o n s o r n o d e s , a n d t h e v a l u e s w o u l d r e p r e s e n t c o l o r s .

    T h e c o n s t r a i n t s a r e b i n a r y c o n s t r a i n t s o n e a c h p a i r o f a d j a c e n t r e g i o n s o r n o d e s t h a t p r o h i b i t t h e m

    f r o m b e i n g a s s i g n e d t h e s a m e c o l o r .

    7 . 1 B r u t e - F o r c e B a c k t r a c k i n g

    T h e b r u t e - f o r c e a p p r o a c h t o c o n s t r a i n t s a t i s f a c t i o n i s c a l l e d b a c k t r a c k i n g . O n e s e l e c t s a n o r d e r f o r

    t h e v a r i a b l e s , a n d a n o r d e r f o r t h e v a l u e s , a n d s t a r t s a s s i g n i n g v a l u e s t o t h e v a r i a b l e s o n e a t a t i m e .

    E a c h a s s i g n m e n t i s m a d e s o t h a t a l l c o n s t r a i n t s i n v o l v i n g a n y o f t h e v a r i a b l e s t h a t h a v e a l r e a d y

    b e e n a s s i g n e d a r e s a t i s e d . T h e r e a s o n f o r t h i s i s t h a t o n c e a c o n s t r a i n t i s v i o l a t e d , n o a s s i g n m e n t

    2 6

  • 8/6/2019 28194936 Artificial Intelligence Search Algorithms

    27/40

    t o t h e r e m a i n i n g v a r i a b l e s c a n p o s s i b l y r e s a t i s f y t h a t c o n s t r a i n t . O n c e a v a r i a b l e i s r e a c h e d w h i c h

    h a s n o r e m a i n i n g l e g a l a s s i g n m e n t s , t h e n t h e l a s t v a r i a b l e t h a t w a s a s s i g n e d i s r e a s s i g n e d t o t h e

    n e x t l e g a l v a l u e . T h e a l g o r i t h m c o n t i n u e s u n t i l e i t h e r a c o m p l e t e , c o n s i s t e n t a s s i g n m e n t i s f o u n d ,

    r e s u l t i n g i n s u c c e s s , o r a l l p o s s i b l e a s s i g n m e n t s a r e s h o w n t o v i o l a t e s o m e c o n s t r a i n t , r e s u l t i n g i n

    f a i l u r e . F i g u r e 6 s h o w s t h e t r e e g e n e r a t e d b y b r u t e - f o r c e b a c k t r a c k i n g t o n d a l l s o l u t i o n s t o t h e

    F o u r Q u e e n s p r o b l e m . T h e t r e e i s s e a r c h e d d e p t h - r s t t o m i n i m i z e m e m o r y r e q u i r e m e n t s .

    7 . 2 L i m i t e d D i s c r e p a n c y S e a r c h

    L i m i t e d d i s c r e p a n c y s e a r c h ( L D S ) 1 4 , 2 5 ] i s a c o m p l e t e l y g e n e r a l t r e e - s e a r c h a l g o r i t h m , b u t i s m o s t

    u s e f u l i n t h e c o n t e x t o f c o n s t r a i n t - s a t i s f a c t i o n p r o b l e m s i n w h i c h t h e e n t i r e t r e e i s t o o l a r g e t o

    s e a r c h e x h a u s t i v e l y . I n t h a t c a s e , w e w o u l d l i k e t o s e a r c h t h a t s u b s e t o f t h e t r e e t h a t i s m o s t l i k e l y

    t o y i e l d a s o l u t i o n i n t h e t i m e a v a i l a b l e . A s s u m e t h a t w e c a n h e u r i s t i c a l l y o r d e r a b i n a r y t r e e s o

    t h a t a t a n y n o d e , t h e l e f t b r a n c h i s m o r e l i k e l y t o l e a d t o a s o l u t i o n t h a n t h e r i g h t b r a n c h . L D S

    t h e n p r o c e e d s i n a s e r i e s o f d e p t h - r s t i t e r a t i o n s . T h e r s t i t e r a t i o n e x p l o r e s j u s t t h e l e f t - m o s t p a t h

    i n t h e t r e e . T h e s e c o n d i t e r a t i o n e x p l o r e s t h o s e r o o t - t o - l e a f p a t h s w i t h e x a c t l y o n e r i g h t b r a n c h , o r

    d i s c r e p a n c y , i n t h e m . I n g e n e r a l , e a c h i t e r a t i o n e x p l o r e s t h o s e p a t h s w i t h e x a c t l y k d i s c r e p a n c i e s ,

    w i t h k r a n g i n g f r o m z e r o t o t h e d e p t h o f t h e t r e e . T h e l a s t i t e r a t i o n e x p l o r e s j u s t t h e r i g h t m o s t

    b r a n c h . U n d e r c e r t a i n a s s u m p t i o n s , o n e c a n s h o w t h a t L D S i s l i k e l y t o n d a s o l u t i o n s o o n e r t h a n

    a s t r i c t l e f t - t o - r i g h t d e p t h - r s t s e a r c h .

    7 . 3 I n t e l l i g e n t B a c k t r a c k i n g

    O n e c a n i m p r o v e t h e p e r f o r m a n c e o f b r u t e - f o r c e b a c k t r a c k i n g u s i n g a n u m b e r o f t e c h n i q u e s , s u c h

    a s v a r i a b l e o r d e r i n g , v a l u e o r d e r i n g , b a c k j u m p i n g , a n d f o r w a r d c h e c k i n g .

    T h e o r d e r i n w h i c h v a r i a b l e s a r e i n s t a n t i a t e d c a n h a v e a l a r g e e e c t o n t h e s i z e o f t h e s e a r c h t r e e .

    2 7

  • 8/6/2019 28194936 Artificial Intelligence Search Algorithms

    28/40

    Q Q QQ

    Q

    Q

    Q

    Q

    Q

    Q

    Q

    Q

    Q Q

    Q Q

    Q

    Q

    Q

    Q

    Q

    Q

    Q

    Q

    Q

    Q

    Q

    Q

    Q

    Q

    Q

    Q

    Q

    Q

    Q

    Q

    F i g u r e 6 : T r e e G e n e r a t e d t o S o l v e F o u r Q u e e n s P r o b l e m

    2 8

  • 8/6/2019 28194936 Artificial Intelligence Search Algorithms

    29/40

    T h e i d e a o f v a r i a b l e o r d e r i n g i s t o o r d e r t h e v a r i a b l e s f r o m m o s t c o n s t r a i n e d t o l e a s t c o n s t r a i n e d 9 ,

    3 9 ] . F o r e x a m p l e , i f a v a r i a b l e h a s o n l y a s i n g l e v a l u e r e m a i n i n g t h a t i s c o n s i s t e n t w i t h t h e p r e v i o u s l y

    i n s t a n t i a t e d v a r i a b l e s , i t s h o u l d b e a s s i g n e d t h a t v a l u e i m m e d i a t e l y . I n g e n e r a l , t h e v a r i a b l e s s h o u l d

    b e i n s t a n t i a t e d i n i n c r e a s i n g o r d e r o f t h e s i z e o f t h e i r r e m a i n i n g d o m a i n s . T h i s c a n e i t h e r b e d o n e

    s t a t i c a l l y a t t h e b e g i n n i n g o f t h e s e a r c h , o r d y n a m i c a l l y , r e o r d e r i n g t h e r e m a i n i n g v a r i a b l e s e a c h

    t i m e a v a r i a b l e i s a s s i g n e d a n e w v a l u e .

    T h e o r d e r i n w h i c h t h e v a l u e s o f a g i v e n v a r i a b l e a r e c h o s e n d e t e r m i n e s t h e o r d e r i n w h i c h t h e

    t r e e i s s e a r c h e d . S i n c e i t d o e s n ' t e e c t t h e s i z e o f t h e t r e e , i t m a k e s n o d i e r e n c e i f a l l s o l u t i o n s

    a r e t o b e f o u n d . I f o n l y a s i n g l e s o l u t i o n i s r e q u i r e d , h o w e v e r , v a l u e o r d e r i n g c a n d e c r e a s e t h e t i m e

    r e q u i r e d t o n d a s o l u t i o n . I n g e n e r a l , o n e s h o u l d o r d e r t h e v a l u e s f r o m l e a s t c o n s t r a i n i n g t o m o s t

    c o n s t r a i n i n g , i n o r d e r t o m i n i m i z e t h e t i m e r e q u i r e d t o n d a r s t s o l u t i o n 5 , 1 1 ] .

    A n i m p o r t a n t i d e a , o r i g i n a l l y c a l l e d b a c k j u m p i n g , i s t h a t w h e n a n i m p a s s i s r e a c h e d , i n s t e a d

    o f s i m p l y u n d o i n g t h e l a s t d e c i s i o n m a d e , t h e d e c i s i o n t h a t a c t u a l l y c a u s e d t h e f a i l u r e s h o u l d b e

    m o d i e d 1 0 ] . F o r e x a m p l e , c o n s i d e r a t h r e e - v a r i a b l e p r o b l e m w h e r e t h e v a r i a b l e s a r e i n s t a n t i a t e d

    i n t h e o r d e r x ; y ; z . A s s u m e t h a t v a l u e s h a v e b e e n c h o s e n f o r b o t h x a n d y , b u t t h a t a l l p o s s i b l e

    v a l u e s f o r z c o n i c t w i t h t h e v a l u e c h o s e n f o r x . I n p u r e b a c k t r a c k i n g , t h e v a l u e c h o s e n f o r y w o u l d

    b e c h a n g e d , a n d t h e n a l l t h e p o s s i b l e v a l u e s f o r z w o u l d b e t e s t e d a g a i n , t o n o a v a i l . A b e t t e r

    s t r a t e g y i n t h i s c a s e i s t o g o b a c k t o t h e s o u r c e o f t h e f a i l u r e , a n d c h a n g e t h e v a l u e o f x , b e f o r e

    t r y i n g d i e r e n t v a l u e s f o r y

    W h e n a v a r i a b l e i s a s s i g n e d a v a l u e , t h e i d e a o f f o r w a r d c h e c k i n g i s t o c h e c k e a c h r e m a i n i n g

    u n i n s t a n t i a t e d v a r i a b l e t o m a k e s u r e t h a t t h e r e i s a t l e a s t o n e a s s i g n m e n t f o r e a c h o f t h e m t h a t i s

    c o n s i s t e n t w i t h t h e p r e v i o u s a s s i g n m e n t s . I f n o t , t h e o r i g i n a l v a r i a b l e i s a s s i g n e d i t s n e x t v a l u e .

    2 9

  • 8/6/2019 28194936 Artificial Intelligence Search Algorithms

    30/40

    7 . 4 C o n s t r a i n t R e c o r d i n g

    I n a c o n s t r a i n t - s a t i s f a c t i o n p r o b l e m , s o m e c o n s t r a i n t s a r e e x p l i c i t l y s p e c i e d , a n d o t h e r s a r e i m p l i e d

    b y t h e e x p l i c i t c o n s t r a i n t s . I m p l i c i t c o n s t r a i n t s m a y b e d i s c o v e r e d e i t h e r d u r i n g b a c k t r a c k i n g

    s e a r c h , o r i n a d v a n c e i n a p r e p r o c e s s i n g p h a s e . T h e i d e a o f c o n s t r a i n t r e c o r d i n g i s t h a t o n c e t h e s e

    i m p l i c i t c o n s t r a i n t s a r e d i s c o v e r e d , t h e y s h o u l d b e s a v e d e x p l i c i t l y s o t h a t t h e y d o n ' t h a v e t o b e

    r e d i s c o v e r e d .

    A s i m p l e e x a m p l e o f c o n s t r a i n t r e c o r d i n g i n a p r e p r o c e s s i n g p h a s e i s c a l l e d a r c c o n s i s t e n c y 9 , 2 7 ,

    3 0 ] . F o r e a c h p a i r o f v a r i a b l e s x a n d y t h a t a r e r e l a t e d b y a b i n a r y c o n s t r a i n t , w e r e m o v e f r o m t h e

    d o m a i n o f x a n y v a l u e s t h a t d o n o t h a v e a t l e a s t o n e c o r r e s p o n d i n g c o n s i s t e n t a s s i g n m e n t t o y , a n d

    v i c e v e r s a . I n g e n e r a l , s e v e r a l i t e r a t i o n s m a y b e r e q u i r e d t o a c h i e v e c o m p l e t e a r c c o n s i s t e n c y . P a t h

    c o n s i s t e n c y i s a g e n e r a l i z a t i o n o f a r c c o n s i s t e n c y w h e r e i n s t e a d o f c o n s i d e r i n g p a i r s o f v a r i a b l e s , w e

    e x a m i n e t r i p l e s o f c o n s t r a i n e d v a r i a b l e s . T h e e e c t o f p e r f o r m i n g a r c o r p a t h c o n s i s t e n c y b e f o r e

    b a c k t r a c k i n g i s t h a t t h e r e s u l t i n g s e a r c h s p a c e c a n b e d r a m a t i c a l l y r e d u c e d . I n s o m e c a s e s , t h i s

    p r e p r o c e s s i n g o f t h e c o n s t r a i n t s c a n e l i m i n a t e t h e n e e d f o r s e a r c h e n t i r e l y .

    7 . 5 H e u r i s t i c R e p a i r

    B a c k t r a c k i n g s e a r c h e s a s p a c e o f c o n s i s t e n t p a r t i a l a s s i g n m e n t s t o v a r i a b l e s , i n t h e s e n s e t h a t a l l

    c o n s t r a i n t s a m o n g i n s t a n t i a t e d v a r i a b l e s a r e s a t i s e d , l o o k i n g f o r a c o m p l e t e c o n s i s t e n t a s s i g n m e n t

    t o t h e v a r i a b l e s , o r i n o t h e r w o r d s a s o l u t i o n . A n a l t e r n a t i v e a p p r o a c h i s t o s e a r c h a s p a c e o f

    i n c o n s i s t e n t b u t c o m p l e t e a s s i g n m e n t s t o t h e v a r i a b l e s , u n t i l a c o n s i s t e n t c o m p l e t e a s s i g n m e n t i s

    f o u n d . T h i s a p p r o a c h i s k n o w n a s h e u r i s t i c r e p a i r 2 9 ] . F o r e x a m p l e , i n t h e E i g h t Q u e e n s p r o b l e m ,

    t h i s a m o u n t s t o p l a c i n g a l l e i g h t q u e e n s o n t h e b o a r d a t t h e s a m e t i m e , a n d m o v i n g t h e q u e e n s o n e

    a t a t i m e u n t i l a s o l u t i o n i s f o u n d . T h e n a t u r a l h e u r i s t i c , c a l l e d m i n - c o n i c t s , i s t o m o v e a q u e e n

    t h a t i s i n c o n i c t w i t h t h e m o s t o t h e r q u e e n s , a n d m o v e i t t o a p o s i t i o n w h e r e i t c o n i c t s w i t h t h e

    3 0

  • 8/6/2019 28194936 Artificial Intelligence Search Algorithms

    31/40

  • 8/6/2019 28194936 Artificial Intelligence Search Algorithms

    32/40

    T h u s , t h e r e i s a c o n t i n u a l d e m a n d f o r f a s t e r a l g o r i t h m s .

    A r e l a t e d r e s e a r c h a r e a i s t h e d e v e l o p m e n t o f s p a c e - e c i e n t a l g o r i t h m s 2 3 ] . W h i l e t h e e x p o n e n t i a l -

    s p a c e a l g o r i t h m s a r e c l e a r l y i m p r a c t i c a l , t h e l i n e a r - s p a c e a l g o r i t h m s u s e v e r y l i t t l e o f t h e m e m o r y

    a v a i l a b l e o n c u r r e n t m a c h i n e s . T h e p r i m a r y i s s u e h e r e i s g i v e n a x e d a m o u n t o f m e m o r y , h o w t o

    m a k e t h e b e s t u s e o f i t t o s p e e d u p a s e a r c h a s m u c h a s p o s s i b l e . I n a t w o - p l a y e r g a m e s e a r c h , t h e

    e x t r a m e m o r y i s u s e d p r i m a r i l y i n t h e t r a n s p o s i t i o n t a b l e . I n s i n g l e - a g e n t p a t h - n d i n g p r o b l e m s ,

    o n e o f t h e m o s t e e c t i v e u s e s o f a d d i t i o n a l m e m o r y i s a f o r m o f b i d i r e c t i o n a l s e a r c h k n o w n a s

    p e r i m e t e r s e a r c h 7 , 2 8 , 1 5 ] . T h e i d e a i s t o s e a r c h b r e a d t h - r s t b a c k w a r d f r o m t h e g o a l s t a t e u n t i l

    m e m o r y i s n e a r l y e x h a u s t e d . T h e n , t h e f o r w a r d s e a r c h p r o c e e d s u n t i l i t e n c o u n t e r s a s t a t e o n t h e

    p e r i m e t e r o f t h e b a c k w a r d s e a r c h . T h e m a i n a d v a n t a g e t o t h i s a p p r o a c h i s t h a t t h e n o d e s o n t h e

    p e r i m e t e r c a n b e u s e d t o r e n e t h e h e u r i s t i c e s t i m a t e s i n t h e f o r w a r d s e a r c h .

    A n o t h e r r e s e a r c h a r e a i s t h e d e v e l o p m e n t o f p a r a l l e l s e a r c h a l g o r i t h m s . M o s t s e a r c h a l g o r i t h m s

    h a v e a t r e m e n d o u s a m o u n t o f p o t e n t i a l p a r a l l e l i s m , s i n c e t h e b a s i c s t e p o f n o d e g e n e r a t i o n a n d

    e v a l u a t i o n i s o f t e n p e r f o r m e d b i l l i o n s o f t i m e s . A s a r e s u l t , m a n y s u c h a l g o r i t h m s a r e r e a d i l y

    p a r a l l e l i z e d w i t h n e a r l y l i n e a r s p e e d u p s . T h e a l g o r i t h m s t h a t a r e d i c u l t t o p a r a l l e l i z e a r e b r a n c h -

    a n d - b o u n d a l g o r i t h m s , s u c h a s a l p h a - b e t a p r u n i n g , b e c a u s e t h e r e s u l t s o f s e a r c h i n g o n e p a r t o f t h e

    t r e e d e t e r m i n e w h e t h e r a n o t h e r p a r t o f t h e t r e e n e e d s t o b e e x a m i n e d a t a l l .

    S i n c e t h e p e r f o r m a n c e o f a s e a r c h a l g o r i t h m d e p e n d s c r i t i c a l l y o n t h e q u a l i t y o f t h e h e u r i s t i c

    e v a l u a t i o n f u n c t i o n , a n o t h e r i m p o r t a n t r e s e a r c h a r e a i s t h e a u t o m a t i c g e n e r a t i o n o f s u c h f u n c t i o n s .

    T h i s w a s p i o n e e r e d i n t h e a r e a o f t w o - p l a y e r g a m e s b y A r t h u r S a m u e l ' s l a n d m a r k c h e c k e r s p r o g r a m

    t h a t l e a r n e d t o i m p r o v e i t s e v a l u a t i o n f u n c t i o n t h r o u g h r e p e a t e d p l a y 4 1 ] . I n t h e a r e a o f s i n g l e -

    a g e n t p r o b l e m s , a d o m i n a n t t h e o r y i s t h a t t h e e x a c t c o s t o f a s o l u t i o n t o a s i m p l i e d v e r s i o n o f

    a p r o b l e m c a n b e u s e d a s a n a d m i s s i b l e h e u r i s t i c e v a l u a t i o n f u n c t i o n f o r t h e o r i g i n a l p r o b l e m 3 3 ] .

    F o r e x a m p l e , i n t h e s l i d i n g - t i l e p u z z l e s , i f w e r