admisible

download admisible

of 4

Transcript of admisible

  • 7/23/2019 admisible

    1/4

    T h e A d m i s s i b i l i t y o f A

    H e r e I w a n t t o p r o v e t h a t , i n f a c t , a l g o r i t h m A

    i s a d m i s s i b l e . T h a t i s , i t w i l l t e r m i n a t e i n

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

    G i v e n : a g r a p h s e a r c h w h i c h d o e s a l g o r i t h m A s e a r c h i f I c a n g u a r a n t e e t h a t t h e h e u r i s t i c f u n c t i o n

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

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

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

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

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

    1 . T h e h e u r i s t i c f u n c t i o n t h a t w e u s e e s t i m a t e s : f 0 n = t h e a c t u a l c o s t o f a n o p t i m a l p a t h a

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

    n . W e s a w t h a t t h i s f u n c t i o n w a s c o m p o s e d o f t w o p a r t s : f 0 n = g 0 n + h 0 n = t h e a c t u a l

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

    n o d e .

    W e e s t i m a t e f 0 w i t h t h e f u n c t i o n f :

    f n = g n + h n

    w h e r e :

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

    a l w a y s b e t h e c a s e t h a t g 0 n g n , a n d

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

    d o m a i n .

    2 . T h e a l g o r i t h m i t s e l f :

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

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

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

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

    N o w , A l g o r i t h m A

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

    p a r t i c u l a r , a l g o r i t h m A

    r e q u i r e s :

    h n h 0 n

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

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

    i s

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

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

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

    1

  • 7/23/2019 admisible

    2/4

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

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

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

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

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

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

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

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

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

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

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

    o o f t h e o p e n f o r e x p a n s i o n .

    P r o v e A l g o r i t h m A

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

    t e r m i n a t e s b y

    n d i n g a n o p t i m a l p a t h .

    F i r s t : A

    c a n e i t h e r t e r m i n a t e b y n d i n g a g o a l o r d e p l e t i n g O P E N . B u t O P E N c a n n e v e r b e c o m e

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

    a l o n g t h e p a t h w i l l a l w a y s b e o n o p e n . N o t e : s u p p o s e t h i s i s t h e o p t i m a l p a t h t o t h e g o a l

    n o d e n

    k

    , o p t i m a l - p a t h = S t a r t = n

    0

    ; n

    1

    ; : : : ; n

    k

    = G o a l . N o t i c e t h a t S s t a r t s o u t o n o p e n

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

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

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

    k

    w e r e a l r e a d y o n c l o s e d . B u t s i n c e n

    k

    i s a g o a l n o d e , t h e

    a l g o r i t h m w o u l d h a v e t e r m i n a t e d a t t h a t p o i n t !

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

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

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

    T h e n i t m u s t b e t h e c a s e t h a t :

    f t = g t f 0 s t a r t

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

    0 .

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

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

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

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

    t h i s f u n c t i o n .

    2

  • 7/23/2019 admisible

    3/4

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

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

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

    t h e o p e n l i s t a t t h e t i m e t i s c h o s e n . L e t ' s c a l l t h a t n o d e n

    i

    . N o w , s i n c e n

    i

    w a s n o t c h o s e n

    f r o m t h e o p e n l i s t w h e n t w a s , w e k n o w t h a t n

    i

    m u s t h a v e a g r e a t e r f v a l u e . T h u s i t m u s t

    b e t h e c a s e t h a t :

    f n

    i

    f t = g t f 0 s t a r t

    I t i s t h i s s t a t e m e n t t h a t I w i l l n d a c o n t r a d i c t i o n w i t h . I w i l l s h o w t h a t t h i s s t a t e m e n t

    c a n n o t h o l d b e c a u s e t h e r e m u s t 9 o n o p e n a n o d e n

    i

    t h a t i s o n a n o p t i m a l p a t h f r o m s t a r t t o

    a g o a l w i t h f n

    i

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

    b e w r o n g .

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

    o p t i m a l - p a t h = S t a r t = n

    0

    ; n

    1

    ; : : : ; n

    k

    = G o a l .

    F o r a n y t i m e b e f o r e t e r m i n a t i o n , l e t n

    i

    b e t h e l o w e s t e l e m e n t i n t h i s s e q u e n c e o n t h e o p e n

    l i s t . T h u s w e k n o w t h a t :

    f n

    i

    = g n

    i

    + h n

    i

    B u t w e k n o w t h a t t h e a l g o r i t h m h a s a l r e a d y f o u n d a n o p t i m a l p a t h t o n

    i

    s i n c e n

    i

    i s o n a n

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

    i

    i s t h e l o w e s t e l e m e n t o f t h e p a t h s t i l l o n o p e n .

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

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

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

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

    i

    h a v e a l r e a d y b e e n e x p l o r e d m a d e E x p l

    t h a t m e a n s t h a t t h e o p t i m a l p a t h t o n

    i

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

    T h e r e f o r e w e k n o w t h a t :

    g n

    i

    = g 0 n

    i

    a n d t h u s

    f n

    i

    = g 0 n

    i

    + h n

    i

    B u t n o t i c e t h a t s i n c e w e k n o w t h a t h n

    i

    h 0 n

    i

    , w e h a v e :

    f n

    i

    g 0 n

    i

    + h 0 n

    i

    = f 0 n

    i

    3

  • 7/23/2019 admisible

    4/4

    B u t n o t e t h a t t h e f 0 v a l u e f o r a n y n o d e a l o n g t h e o p t i m a l p a t h i s e q u a l t o f 0 s t a r t . T h i s

    m e a n s t h a t :

    f n

    i

    f 0 s t a r t

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

    i

    m u s t h a v e b e e n c h o s e n o o f t h e o p e n

    l i s t b e f o r e t !

    4