A P aradigm f o r G e n era l S ce n e A n a ly sis. 1 s t O c t o b e r , 1985 D a v id A le x a n d e r F o r s y t h . DEDICATION DEDICATION. I d e c la re t h a t t h i s d is s e r ta tio n is t h e r e s u l t o f cay own u n a id e d w o rk , w h ic h h a s n o t b e f o r e b e e n s u b m i tte d t o a n y u n i v e r s i t y o r i n s t i t u t i o n f o r a n y d e g r e e o r d ip lo m a , s a v e t h a t w o rk c l e a r l y d e s c r i b e d h a s been in s e r te d f o r th e p u rp o se o f c o n tin u ity . and c o r r e c te d , and i s f r e e o f e r r o r s . SIGNED: Declaration. a s s u c h , w h ic h I t h as been p ro o frea d A d is s e rta tio n s u b m i tte d to th e U n iv e rs ity of th e W itw a te r s r a a d f u l f i l m e n t o f t h e r e q u i r e m e n t s f o r t h e d e g r e e o f M a s te r o f E l e c t r i c a l E n g in e e r in g . S c ie n c e in in A f a r m e r , w a n t in g a n a u to m a t ic c h ic k e n p l u c k i n g m a c h in e , s p o k e t o a n e n ­ g i n e e r , who sw o re t h a t i t c o u l d n 't b e b u i l t . w e n t t o a t h e o r e t i c i a n , who s a i d " i t ' s a r b i t r a r y d ia m e t e r d , ...” (M odern F o l k t a l e , o f unknow n o r i g i n . ) The d is a p p o in te d fa rm e r th e n e a s y ! A ssume a s p h e r i c a l c h i c k e n , ACKNOWLEDGEMENTS. T h e f o l l o w i n g p e o p le a n d c o m p a n ie s h a v e h e lp e d m e, a n d I th a n k th em f o r t h e i r tim e , p a tie n c e , and s u g g e s tio n s . A d v an c ed S e m ic o n d u c to r D e v ic e s l e n t me a n im a g e a c q u i s i t i o n and d is p l a y s y s te m , w i t h o u t w h ic h I c o u ld h a v e d o n e v e r y l i t t l e . T h e C o u n c il f o r M in e r a l T e c h n o lo g y p r o v id e d g e n e r o u s f i n a n c i a l s u p p o r t . H e w le tt- P a c k a r d (S .A .) l e n t me a m in ic o m p u te r s y s te m , o n w h ic h a l l t h e w o rk d e s c r i b e d h e r e , a n d a l o t m o re , w as d o n e . M i t s u i C o r p o r a t i o n p r o v i d e d an e x c e l l e n t s o f t w a r e p a c k a g e , SPIDER, im a g e p r o c e s s i n g fo r a p p l i c a t i o n s , w h ic h h e l p e d me o v e r a n im m ense l e a r n i n g T h e s t a f f a n d s t u d e n t s a t U w tech p r o v id e d a v e r y p l e a s a n t w o rk in g e n v i ­ r o n m e n t, w h ic h m ade my w o rk e a s i e r . G u n th e r Sommer a n d P r o f e s s o r B ru c e S t e w a r t o f t h e C o u n c il f o r M in e r a l T e c h n o lo g y g a v e me t h e i r s u p p o r t a n d i n t e r e s t , a n d w e re v e r y t o l e r a n t o f my w i l d e r i d e a s . D ave P e n c k l e r a n d A d ria n Solom on o f H e w le tt- P a c k a r d h e lp e d me t o u s e th e m in i c o m p u t e r , a n d r e s c u e d me o n a n u m b er o f o c c a s i o n s . G e r a l d B lo c h a n d S t e v e M eyer o f U w tech p r o v i d e d s t i m u l a t i n g d i s c u s s i o n , a n d much s u p p o r t . Acknowledgements. 1 ACKNOWLEDGEMENTS. T he f o l l o w i n g p e o p le a n d c o m p a n ie s h a v e h e lp e d m e, a n d I th a n k th e m fo r t h e i r tim e , p a tie n c s , and s u g g e s tio n s . A dvan c ed S e m ic o n d u c to r D e v ic e s l e n t me a n im a g e a c q u i s i t i o n and d is p la y s y s te m , w i t h o u t w h ic h I c o u ld h a v e d o n e v e r y l i t t l e . T he C o u n c il f o r M in e r a l T e c h n o lo g y p r o v id e d g e n e r o u s f i n a n c i a l s u p p o r t . H e w le tt- P a c k a r d (S .A .) l e n t me a m in ic o m p u te r s y s te m , o n w h ic h a l l t h e w o rk d e s c r i b e d h e r e , a n d a l o t m o re , w as d o n e . M i t s u i C o r p o r a t i o n p r o v i d e d a n e x c e l l e n t s o f t w a r e p a ck a g es, SPIDER, fo r im a g e p r o c e s s i n g a p p l i c a t i o n s , w h ic h h e lp e d me o v e r a n im m ense l e a r n i n g T h e s t a f f a n d s t u d e n t s a t U w tech p r o v id e d a v e r y p l e a s a n t w o rk in g e n v i ­ r o n m e n t, w h ic h made my w o rk e a s i e r . G u n th e r Sommer a n d P r o f e s s o r B ru c e S t e w a r t o f t h e C o u n c il f o r M in e r a l T e c h n o lo g y g a v e me t h e i r s u p p o r t a n d i n t e r e s t , a n d w e re v e r y t o l e r a n t o £ my w i l d e r i d e a s . D ave P e n c k l e r a n d A d r i a n Solom on o f H e w le tt- P a c k a r d h e lp e d me t o u se th e m in i c o m p u t e r , a n d r e s c u e d me o n a n u m b er o f o c c a s i o n s . G e r a l d B lo c h a n d S t e v e M eyer o f U w tech p r o v id e d s t i m u l a t i n g d i s c u s s i o n , a n d much s u p p o r t . Acknowledgements. ill D av e S m ith a n d G u n th e r B e r g e r , who w o rk e d w i t h me i n t h e im ag e p r o c e s s i n g g r o u p , g e n e r a t e d a s t i m u l a t i n g w o rk in g e n v iro n m e n t a n d a llo w e d me t o ma­ t u r e my i d e a s th r o u g h lo n g d i s c u s s i o n s . a s th e re a d e r w ill s e e , My d e b t t o G u n th e r i s v e r y l a r g e , an d h e h a s b e e n a c o n s i s t e n t l y stim u la tin g re ­ s e a r c h p a r t n e r s i n c e we s t a r t e d w o rk in g t o g e t h e r i n e a r l y 1 9 8 4 . M rs. S u e Rodd v e r y k i r d l y p r o o f r e a d t h i s w o rk i n a v e r y s h o r t t i m e , a n d d Id s o v e r y w e l l . Any e r r o r s w h ic h r e m a in i n t h e t e x t a r e my f a u l t e n - P r o f e s s o r M ike R o d d , my s u p e r v i s o r , h a s g iv e n me tr e m e n d o u s s u p p o r t a n d e n c o u r a g e m e n t, a lo n e rep ay , a n d I owe h im a d e b t t h a t i s fo r h is a d v ic e , d if f ic u lt to h is p a tie n c e , h is e x p re s s , le t e n c o u r a g e m e n t, a n d t h e s u p p o r t h e g a v e me. My f a m i ly h a s - t o l e r a t e d me w hen t h e w o rk made me i n t o l e r a b l e , an d I owe th e m g r e a t t h a n k s f o r t h i s . F i n a l l y , T e s s v o n W i l l i c h d rew t h e p i c t u r e s , made t h o s e c h a n g e s i n t h e t e x t t h a t I w as s u g g e s t e d , c o o k e d , k e p t h o u s e , r e m a in e d t o l e r a n t a n d g o od n a t u r e d , a n d b e l e i v e d I was d o in g w o r t h w h i le w o rk w hen I w as d o u b tin g i t . F o r t h i s h e l p , I owe h e r a tr e m e n d o u s am o u n t. Acknowledgements. a bstra ct A new p a ra d ig m is d e s c rib e d p a ra d ig m r e q u i r e s f i r s t l y fo r k n o w le d g e - b a s e d sc en e a n a ly s is . T he' t h a t im a g e s b e u n d e r s t o o d e s s e n t i a l l y i n te rm s o f tw o - d im e n s io n a l i n f o r m a t i o n a b o u t how o b j e c t s Jn p ic t u r e s s e c o n d ly t h a t f e a t u r e s b e c o n s i d e r e d a s c o l l e c t i o n s o f r e g i o n s . f o r th e a n a ly s i s o f g e n e r a l sc en e s i s lo o k , d e s c r ib e d and th e r e s u l t s a t t e m p t t o p r o t o t y p e t h i s s y s te m a r e g i v e n . and A s y s te m of en A lth o u g h t h e p r o t o t y p e i s a s i m p l i f i e d v e r s i o n o f t h e s y s te m d e s c r i b e d , i t a p p e a r s t o b e c a p a b l e o f g r e a t p o w er. T h e p a ra d ig m i s f u r t h e r s u p p o r te d b y p r o m is in g r e s u l t s o b ­ t a i n e d I n w o rk o n a n in s t r u m e n t t o a n a l y s e t h e s i z e d i s t r i b u t i o n o f p a r ­ t i c l e s on a c o n v e y o r b e l t . A b s tr a c t TABLE OF CONTENTS IN TRODUCTION...................................................................... : ........................................... BACKGROUND ...................... 1 3 T h e o rig in s o f t h i s w o rk ............................................................................................... 4 K n o w le d g e -b a se d s y s te m s .............................................................................................. 6 S c e n e -a n a ly s is p a r a d ig m s .............................................................................................. 10 Im age r e p r e s e n ta t i o n ............................................................................................... K now ledge r e p r e s e n ta tio n 13 .......................................................................................... 16 K now ledge m a n ip u la tio n ............................................................................................. . 18 R e a so n in g a b o u t c o n tr o l . 20 , . Im plem entation i s s u e s ............................................................................................................22 C o n c lu s io n .................................................................................................... 22 NEIGHBOUR CO D ES............................................................................................................... 23 P r o p e r tie s o f t h e n e ig h b o * C ode.................................................................................. 24 F orm ing t h e n e ig h b o u r c o d e ............................................................................. 25 C o n c lu sio n ........................................................................................... 31 32 THE PARADIGM AND ITS U SE.......................................................... G u id in g c o n c e p t? >’ t h e p a ra d ig m its e lf ........................... - ............................... 32 A sy ste m d e s ig n e d to a n a ly s e sc e n e s - - P o te n tia l p ro b le m s C o n clu sio n . . . . . '......................................................................................... THE DESIGN OF THE PROTOTYPE SYSTEM. T ab le o f C o n ten ts 35 ....................................................................... 40 41 T h e block d e s ig n of t h e p r o to ty p e sy stem . T h e d e sig n of th e d a ta s t r u c t u r e s . . . T h e s y n ta x a n d s t r u c t u r e o f th e know ledg E x am p les o f r u l e u s e ................................ T h e alg o rith m s u s e d w ith in t h e b lo c k s. How t h e p r o t o t y p e e v a l u a t e s a K S. How t h e p r o t o t y p e f a c t o r s a g o a l . How t h e s y s te m g e n e r a t e s a n d t e s t : F in d in g th e g o a l. C o n c lu sio n . . . . THE IMPLEMENTATION OF THE PROTOTYPE. E r r o r h a n d lin g ................................................... C o d in g te c h n iq u e s u s e d f o r b u ild in g RESU LTS." ................................................................... R e s u lts o b ta in e d w ith in t h e p a ra d ig m . . . R e s u lts o b ta in e d b y p ro to ty p in g th e sy ste m . CONCLUSION REFERENCES. , R E A D IN G S ............................................................................................................................................ 91 A P P E N D ,C E S .................................................................................................................................92 A P P E N D IX A . T H E S U B R O U T IN E S IN V O L V E D P ro g ra m RINT .................................................. 9 3 ............................................................................................................................ 93 P ro g ra m IN IT S ................................................................................................................. P ro g ra m START ........................................................... 94 94 P ro g ra m FGOAL .................................................................................................................. 95 P ro g ra m GTMER ....................... •...............................................................................................96 S u b r o u t i n e AGET ........................................................... 97 S u b r o u ti n e AHEAD ............................................................................................................ 97 S u b r o u ti n e ANDSTACK .................................................................................................. 98 S u b r o u t i n e APSETUP ....................................................................................................... 98 S u b r o u t i n e ASETUP ........................................................................................................ S u b r o u ti n e ATORSTACK ...................................................... 98 99 S u b r o u t i n e BACKE ............................................................................................................ S u b r o u t i n e B IS ....................................................................................................... 100 .............................................................................................. 100 S u b r o u t i n e CAN’DSTACK S u b r o u t i n e CHCTXT S u b r o u ti n e CLEAN ................................................................................................... ........................................................................................ 99 100 101 S u b r o u t i n e CLFIND ' . 101 S u b r o u t i n e CMERGE ................................................................................................... 101 .................................................................................... 102 S u b r o u ti n e CONHEAD S u b r o u ti n e COMPLIST .................................................................................................. . 102 103 S u b r o u ti n e CONMAT ...................................................... S u b r o u ti n e CSSETUP .......................................................................... . . . . . 103 S u b r o u ti n e CVARFCL .................................................................................................. 104 S u b r o u ti n e CVARPIX . . 105 Table of Contents . . . . . . . . . . * .......................................................... v S u b r o u ti n e S u b r o u ti n e QUALEVAL RQUEUE •' ‘ ■ S u b r o u t i n e SEGRT ....................................................................................................... 121 S u b r o u ti n e SIMGE ....................................................................................................... 121 S u b r o u ti n e SIMTE S u b r o u t i n e STRLIST S u b r o u t i n e TRUEB S u b r o u ti n e VECREVA1 APPENDIX B . ................................................................................... 122 .................................................................................................. 122 ....................................................................................................... 123 ............................................................................................. 123 THE BACKUS NAUR FORM SYNTAX OF THE KS’S . 125 APPENDIX C . A COMPLETE LISTING OF THE CODE............................... 126 • T a b l e o f C o n t e n ts LIST OF FIGURES. F ig u re 1 : T h e R i t e o f S p r in g . F ig u re 2: A N e ig h b o u r Code o f t h e Form F ig u re 3: T he R eason th e D ire c tio n 12 of 3 4 ,3 4 5 . P ix e l T ra v e rsa l in F o rm in g N e ig h b o u r C o d e s i s I m p o r t a n t . F ig u re 4 : & Code T h a t C o n t a c ts i n N + l P o i n t s E n c l o s e s N S e t s o f R e g io n s . F ig u re 5 : To I l l u s t r a t e M e rg in g R e g io n s F ig u re 6 ; T h e B lo c k D ia g ra m o f a S y stem D e s ig n e d U n d er t h e New P a r a d ig m . F ig u re 7: T h e B l o c k D ia g ra m o f t h e P r o t o t y p e S y s tem . F ig u re S: T o I l l u s t r a t e E v a l u a t i n g K S 's . fig u re 9: A P i c t u r e T a k e n a t D e e l k r a a l M in e , an d i t s S e g m e n ta t io n b y t h e F ig u re 10: T h e K n o w led g e B a se U sed i n t h e E x am p le. F ig u re 11: T h e P i c t u r e U sed i n t h e E x a m p le , a n d i t s R e p r e s e n t a t i o n . F ig u re 12: T h e O u tp u t o f t h e P r o t o t y p e S y stem f o r t h e E x am p le. List of figures. . 1 INTRODUCTION. T h is d i s s e r t a t i o n o ffe rs a new p a ra d ig m f o r sc en e a n a ly s is , th e b a s ic t e n e t s o f w h ic h a r e t h a t a s c e n e s h o u l d b e a n a ly s e d u s i n g e x p l i c i t know ­ le d g e , a n d t h a t t h e s c e n e s s h o u ld b e u n d e r s t o o d a n d r e p r e s e n t e d i n te rm s o f re g io n s . We w i l l d i s c u s s t h e o r i g i n s a nd im p lic a tio n s o f th e s e t e n e t s , som e r e s u l t s w h ic h i n d i c a t e t h a t t h e y a llo w c a n in d e e d a n a l y s e s c e n e s . a s y s te m t o a n d show b e b u i l t w h ic h T he a d v a n ta g e s o f t h e u s e o f r e g i o n s t o i n ­ t e r p r e t t h e s c e n e w i l l b e show n t o b e c o n s i d e r a b l e , le d g e t o b e a c t i v e l y d e p lo y e d . a s th e y a llo w know ­ We w i l l d i s c u s s a r e p r e s e n t a t i o n d e v e lo p e d t o h a n d le t h e p i c t u r e a s a s e t o f r e g i o n s , an d show how t h e - ’io n s may b e h a n d le d u s i n g t h i s re r e p r e s e n t a t i o n , w h ic h is .known as :; n e ig h b o u r c o d e . A s y s te m t h a t i s c a p a b le o f g e n e r a l s c e n e a n a l y s i s i s d e s c r i b e d , a n d we d i s c u s s t h e p r o t o t y p i n g o f a s im p le v e r s i o n o f s u c h a s y s te m , o f th e p ro to ty p e i s e x h a u s tiv e ly p r e s e n te d , an d its T he d e s ig n , i m p l e m e n ta tio n is d i s c u s s e d . T he c o d e o f t h e p r o t o t y p e s y s te m i s p r e s e n t e d a s a p p e n d ic e s . T h e a p p ro a c h p r o p o s e d c a n n o t b e show n t o b e th e b e s t o n e , n o t c a n i t y e t b e show n t h a t i t w i l l d e f i n i t e l y w o rk , b u t we h a v e m anaged t o show t h a t a s y s te m t h a t w o rk s c a n b e d e v e lo p e d w i t h i n t h e p a ra d ig m , a lth o u g h i t i s n o t y e t 'a n a l y s i n g h o w e v e r, t h a t i t re a l scen es. We w i l l p r o d u c e c o n v in c in g i s a g o o d a p p r o a c h , a n d t h a t i t c a n w o rk . a rg u m e n ts , R e s u l t s b o th o f t h e p r o t o t y p i n g o f a g e n e r a l s c e n e a n a l y s i s s y s te m a n d o f w o rk o n a n ­ INTRODUCTION. o th e r system which is claim ed t o have been developed w ith in t h i s paradigm , in d i c a t e t h a t w orking system s may be b u i l t w ith in th e s e t e n e t s . INTRODUCTION. BACKGROUND C o m p u te r v i s i o n p r e s e n t s a f a s c i n a t i n g p r o b le m , w i t h many p o t e n t i a l e n ­ g in e e r in g b e n e f its p r e s e n te d by even a p a r t i a l s o lu t io n . t h e p r o b le m t h a t we s h a l l a d d r e s s i s T he a s p e c t o f t h a t o f s c e n e a n a l y s i s , w h ic h c a n f a i r l y b e d e s c r i b e d a s a t t e m p t i n g t o s o l v e t h e p r o b le m : '.'G iv en a p i c t u r e , d e s c r i b e w h a t i s h a p p e n in g i n i t . " o r th e r a t h e r s im p le r v e rs i o n : " G iv e n a p i c t u r e , f i n d t h e ------ i n i t . " T h e s e c a n b e s e e n t o b e s u b t l e p r o b le m s . as i t We s h a l l a d d r e s s t h e l a t t e r , i s a s im p le r v e r s i o n o f t h e fo rm e r, a n d h a s n o t y e t b e en s o lv e d w ith a n y d e g r e e o r p r o m is e o f g e n e r a l i t y . Many t e c h n i q u e s h a v e b e e n p r o p o s e d t o s o l v e t h i s m o st s o l u t i o n s b e i n g t h e f i n d i n g o f a p p r o p r i a t e p a r t s o f t h e p i t h e n h o p e f u l l y e x p l o i t i n g som e in f o r m a t i o n t o p ie c e s a s th e o b je c t s o u g h t. c la s s ify th e r i| We do n o t d e p a r t i n a n y gi t h i s s t r a t e g y , s a v e t o i n s i s t t h a t t h e i n f o r m a t i o n ex p lc e x p lic itly r a th e r th a n in t h e s t r u c t u r e o f th e T h i s d o e s n o t s o u n d u n r e a s o n a b l e : we i n t e n d t o i t in f a c t i s . show j u s t how THE ORIG IN S OF TH IS WORK. T he w o rk t h a t i s d e s c r i b e d i n t h i s d i s s e r t a t i o n o r i g i n a t e d i n a n i n s t r u ­ m e n ta t io n p r o b le m . A p o p u la r m illin g te c h n i q u e on many m in e s is r u n - o f - o i n e m i l l i n g , w h e re o r e is m i l l e d a s i t a r r i v e s fro m u n d e r g r o u n d , w ith o u t b e in g c ru s h e d . I t i s d e s i r a b l e t o m i l l t h i s o r e a u to g e n o u s l y .a n d i t i s b e c o m in g m o re a n d m o re d e s i r a b l e t o I n s t r u m e n t t h e p r o c e s s (Som m er, 1 9 8 5 ). W ork i s b e i n g d o n e o n i n s t r u m e n t i n g t h e p r o c e s s e s o c c u r r i n g w i t h i n t h e m i l l d u r i n g m i l l i n g , a n d i t w as f e l t i m p o r t a n t t h a t a n a t t e m p t b e made t o in s tru m e n t th e s i z e d i s t r i b u t i o n o f th e o r e o f f e r e d t o th e m i l l . s tr u m e n t s a r e p r im itiv e a v a ila b le a t th is s ta g e to p e rfo rm (see th is a p a rtic le -s iz e a re In ­ e x tr e m e ly T h is in v e s tig a te th e f e a s i b i l i t y o f d is trib u tio n t e c h n i q u e s , a n d m an ag ed t o but t h e A rm co A u to m e tr ic s m a n u a l,1 9 8 4 ) . a u th o r a n d B e rg e r (1 9 3 4 ) w ere r e q u ir e d t o b u ild in g f u n c tio n , a n a ly s e r u s in g - im a g e p r o d u c e a d e s i g n , w h ic h i s a n a ly s is a t p r e s e n t b e in g im p le m e n te d b y B e r g e r a n d a t h i r d w o r k e r , S m ith . T he r e s e a r c h r a i s e d many i s s u e s , of p rese n t im a g e - p r o c e s s i n g s o l u t i o n te c h n i q u e s a b l e t o ta k e n a n i m p o r t a n t o n e b e in g t h e r o b u s t n e s s m e th o d s , u n d er ad v erse c o n d itio n s . c lu e s t o fin d n o t h e lp fu l ro c k s in ( i.e . a p ic tu re , c a llin g as t h e p r o b le m r e q u i r e s h a n d l e c o m p le x p i c t u r e s o f s im p le a ll It is fo r i ts o b je c ts , n o t p o s s ib le to u se s t r u c t u r a l a n d s im p ly b i n a r i s i n g t h e p i c t u r e g re y a re a s ro ck s, is a l l b la i.it, b a c k g r o u n d ) a s a l l r o c k s i n t h e p i c t u r e a r e c o v e r e d w ith , a t h i n l a y e r o f a d s o r b e d f i n e p a r t i c l e s , a s i s t h e b e l t t o a l a r g e e x t e n t : , an d i t i s q u i t e p o s s i b l e t o c l a s s i f y w h o le p i c t u r e s i n c o r r e c t l y T he te c h n iq u e d e v e lo p e d , as r e p r e s e n tin g s in g l e a nd u se d w ith la rg e ro c k s. some c o n s i d e r a b l e s u c c e s s , was s e g m e n t in g t h e p i c t u r e i n t o r e g i o n s , c l a s s i f y i n g t h o s e r e g i o n s , a n d th e n BACKGROUND m e rg in g th a m o n t h e b a s i s o £ m e rg in g r u l e s , w h ic h w e re d o vr-Jo p o d ad h o c . T h e m e rg e r u l e s w e r e b a s e d l a r g e l y o n k n o w le d g e a c q u i r e d b y l o o k in g f it a ru rm in C " 'c o n v e y o r b e l t w i t h o r e on if. f o r e x a m p le , i t w as r e a l i s e d a t en e a r ly s ta g e t h a t , a s a r e s u l t o f th e p r o c e s s e s a c tin g to p ro d u ce th e o r e , few r o c k s w o u ld a p p e a r w i t h h o l e s i n th e m , an d t h a t t h e h o l e s w e r e u n im ­ p o r ta n t. T h u s, a r e g io n , w h a te v e r i t s su rro u n d e d b y j u s t c l a s s i f i c a t i o n , t h a t w as e n t i r e l y o n e r o c k r e g i o n c o u ld b e m e rg e d t o t h a t ro c k re g io n a n d f o r g o t t e n a s a n e n t i t y cm i t s ow n. T h is t e c h n i q u e w as b a s e d o n a num b er o f a s s u m p tio n s , t h e n s j o r o n e s b e in g t h a t t h e r o c k s o n t h e b e l t w o u ld b e n i c e o n e s ( i . e . i s n o t e x t r a o r d i n a r i l y lo n g e n d t h i n o r u n r e a s o n a b l y c u r v e d ) , t h a t a tw o - d im e n s io n a l p i c t u r e o f a ro ck ly in g o n a v i b r a t i n g s u r f a c e w o u ld g i v e a g o o d i d e a o f i t s s i z e (We d o n o t e v e n c o n s i d e r t h e r e a l m e an in g o f s i z e f o r a ro c k , becom e e x a m p le , M a n d e lb r o t, e m b ro ile d i n u n p le a s a n t is s u e s - See, fo r le s t we 1 9 8 2 .) a n d t h a t s u f f i c i e n t m e rg e r u l e s o f t h e ty p e d e s c r i b e d e x i s t t o f i n d a re a so n a b le in te r p r e ta t io n o f th e p ic tu r e . s u m p tio n s c o u l d b e d e b a t e d : w h a t i s c e r t a i n i s t h a t t h e s y s te m b a s e d o n T ie v a l i d i t y o f th e se a s ­ th e m se em s t o w o rk v e r y w e l l . From t h i s w o rk so m e im p o r t a n t i d e a s o r i g i n a t e d . • F irs tly , i t w as s e e n t h a t r e g i o n s a r e a n e x tr e m e ly u s e f u l f e a t u r e t o e x t r a c t a n d w o rk w i t h , p a r t i c u l a r l y fo r r e a l-w o rld p ic tu r e s ta k e n u n d er p o o r c o n d itio n s . • S e c o n d ly , i t w as i n f e r r e d t h a t o n e c o u ld w o rk v e r y w e l l w i t h p i c t u r e s i n tw o d im e n s io n s o n l y . BACKGROUND • T h ird ly , it bticamt- a p p a r e n t i h a t when o n e i b d e a l i n g w ith a r e g i o n , t h e m o st im p o r t a n t i n f o r m ' ^ io n a v a i l a b l e i s th e n a tu re o f i t s imme­ d i a t e n e i g h b o u r s , a n d t h a t p p i f t u r e r e p r e s e n t a t i o n t h a t w o u ld c a r r y t h i s i n f o r m a t i o n c o u ld b e m o st u s e f u l . a p ic tu r e p r o p e r ly in th is w ay , r e g i o n ’s n e i g h b o u r s 1 n e i g h b o u r s , if ( N o t ic e t h a t i f we r e p r e s e n t we r e q u i r e i n f o r m a t i o n a b o u t a th is is a ls o o b ta in a b le . We w i l l e x p an d on t h i s p o i n t l a t e r . , ) • F o u r t h l y a n d f i n a l l y , i t w as s o o n s e e n t h a t a s y s te m t h a t a llo w s e x ­ p e r i m e n t a t i o n w i t h e x p l i c i t k n o w le d g e w o u ld b e m o st d e s i r a b l e , a s i f t h e k n o w le d g e u s e d b y t h e s y s te m w e r e i m p l i c i t , s y s te m m o d i f i c a t i o n s o r u p d a t e s w o u ld b e c o m p le x . b e c o m m itte d t o o n e t a s k . As a r e s u l t t h e s y s te m w o u ld h a v e t o W ith, a s y s te m w h e r e t h e k n o w le d g e i s ex­ p l i c i t , h o w e v e r , we may c h a n g e t h e t a r g e t i n g o f t h e s y s te m b y c h a n g in g t h e k n o w le d g e a v a i l a b l e t o i t . T h i s w o rk e r t h e n s t a r t e d t o u s e t h e a b o v e r e s u l t s a n d i d e a s fro m t h e w o rk on p a r t i c l e s iz e d is tr ib u tio n s y s te m a b l e t o h a n d le a l a r g e a n a ly s is , i n an a tte m p t t o b u ild a v is i o n c l a s s o f s c e n e s u s i n g k n o w le d g e s u p p l i e d e x p lic itly to i t . KNOWLEDGE-BASED,SYSTEM S. I n a s e n s e , a l l s o f t w a r e s y s te m s t h a t s o l v e p r o b le m s a r e k n o w le d g e - b a s e d ; we u s e t h i s te r m t o r e f e r t o s y s te m s t h a t u s e e x p l i c i t k n o w le d g e i n some f o rm . T h i s ty p e o f s y s te m h a s t h e BACKGROUND a d v a n ta g e t h a t o n e may im p ro v e t h e 6 p e rf o rm a n c e o f t h e s y s tw o r c h a n g e t h e p r o b le m i t can s o lv e , up t o a p o i n t , b y im p r o v in g t h e q u a l i t y , o r b y c h a n g in g t h e s u b j e c t o f t h e know ­ le d g e a v a i l a b l e t o it. hand , w ill r e q u ir e th e S y s te m s b a s e d o n i m p l i c i t k n o w le d g e , o n t h e o t h e r o v e r h e a d o f s y s te m c h a n g e s t o im p ro v e t h e i r p e r ­ fo rm a n c e o r c h a n g e t h e p r o b le m t h a t " t h e y s o l v e . I m p l i c i t k n o w le d g e s y s ­ te m s make u p f o r t h e i r i n f l e x i b i l i t y b y t h e i r e f f i c i e n c y , a s t h e y d o n o t r e q u ire t h e h u g e o v e r h e a d o f k n o w le d g e m an ag e m en t, e n g i n e e r i n g im a g e p r o c e s s i n g a p p l i c a t i o n s and a re as a r e s u l t. p o p u la r in G e n e ra lity w ill h o w ev e r b e d i f f i c u l t t o a c h i e v e w ith a n i m p l i c i t k n o w le d g e s y s te m . We c a n s e e t h a t , w h en we h a v e t o a n a l y s e a s c e n e i n a p u r e l y e n g i n e e r i n g c o n t e x t , i t i s d e s i r a b l e t o em bed t h e d e s c r i p t i o n o f t h e o b j e c t s we a r e se e k in g as s y s te m i s e f f i c i e n t l y a s p o s s ib le in lik e ly to t h e s y s te m . W hen, h o w e v e r, o u r b e f a c e d w i t h a l a r g e nu m b er o f d i f f e r e n t o b j e c t s , i t becom es d e s i r a b l e t o b e a b l e t o p r o v i d e t h e s y s te m w i t h a d e s c r i p t i o n of e a c h o b j e c t , w i t h o u t h a v in g t o c h a n g e t h e s y s te m s o f t w a r e . f i n d e r c a n t h e n , a t a p i n c h , beco m e a n e l e p h a n t - f i n d e r . t h e h a rd w a r e t e c h n o l o g y may beco m e s u c h t h a t t h i s A ro ck A t som e s t a g e , may w e l l b e t h e b e s t a p p r o a c h , fro m a n e n g i n e e r i n g p o i n t o f v ie w : a t p r e s e n t , t h e a p p r o a c h d o e s n o t p r o m is e r e s u l t s , s a v e a s a t r a i n i n g , d e v e lo p m e n t a n d r e s e a r c h t o o l . T he b e s t- k n o w n c l a s s o f k n o w le d g e - b a s e d s y s te m i s t h e e x p e r t s y s te m . B rachm an ( 1 9 8 3 ) p o i n t s o u t , i t As i s n o t c o r r e c t t o c a l l a s y s te m t h a t a n a - ly iA s s c e n e s , a n e x p e r t s y s te m , k n o w le d g e - b a s e d o r r u l e - d r i v e n th o u g h i t may b e .T h e t a s k i t s e l f d o e s n o t r e q u i r e e x p e r tis e . c o n s i s t e n t i n t h i s n o m e n c la tu r e . The l i t e r a t u r e is not We u s e t h e te r m k n o w le d g e - b a s e d s y s te m i n s t e a d , b u t r e g a r d t h e e x p e r t - s y s t e m l i t e r a t u r e a s b e in g r e l e v a n t . is b y n o m eans m e r e ly a s e m a n t ic q u i b b l e ; e a s ily d e s c r ib e d , BACKGROUND a n d t h e p r o b le m is , e x p e rtis e in v is io n is T h is not n o t o n e o f s ., . , p ly d e te r m i n i n g t h e 7 r ig h t r u le s s o lv e s an s p e c ifi fo r an e x p c r t - s y s t e m k e rn e l. e x p e r t p r o b le m , t h a t i s , k n o w le d g e , w h ic h is An g e n e ra lly used in r e q u i r e o u r s y s te m t o u s e p o o r k n o w led g " w h ic h e v e r w ay it 'c h o o s e s , ex p ert a co m p lex p r o b le m to s y s te m ty p ic a lly r e q u ir in g h ig h ly a s p e c if ic fa sh io n . We n a p o o rly -d e fin e d f i e l d , s o lv e a p r o b le m in th e lite ra tu re th a t is not in w e ll u n d e r s t o o d - b y hum an e x p e r t s . T he e x p e r t, s y s te m as d e s c rib e d k n o w le d g e b a s e a n d a n i n f e r e n c e e n g i n e . h a s tw o s e g m e n ts : a T h e k n o w le d g e b a s e c o n t a i n s o n ly k n o w le d g e th r o u g h w h ic h t h e .p r o b le m s p o s e d t o may b e s o l v e d . T h e i n f e r e n c e e n g in e t h e n e x p l o i t s t h i s k n o w le d g e t o s o l v e t h e s e p r o b le m s . our p u rp o ses. ty p ic a lly t h e sy s te m T h ere a t e v i s i b l e d is a d v a n ta g e s to The p r o b le m ; t h e s t r a t e g y s y s te m is cannot th is s tr u c tu re rea so n o u t a s tr a te g y to t h a t o f t h e s y s t e m 's a u t h o r . fo r s o lv e i t s T y p ic a lly , th e d o m a in o f e x p e r t i s e o f an e x p e r t s y s te m i s l i m i t e d , g e n e r a l l y b y t h e s h e e r lo g is tic s o f m a r s h a l l i n g a l a r g e q u a n t i t y o f k n o w le d g e . i s o f t e n r e s t r i c t e d t o h a v in g i n i t s i s c o n s i s t e n t w i t h t h e k n o w le d g e b a s e a s a w h o le . to o e a s i l y b e c o n s id e re d p u r e ly s ig n e r to S u c h a s y s te m k n o w le d g e b a s e o n l y k n o w le d g e t h a t T h e k n o w le d g e b a s e c a n a s a r u l e b a s e , w h ic h c a n c a u s e t h e d e ­ r e s t r i c t t h e p o w e r o f t h e k n o w le d g e . (One o f t e n s e e s s y s te m s d e s c r i b e d a s " f o r w a r d c h a i n i n g " - f o r a p o w e r f u l s y s te m , s u r e l y t h e s y s te m i t s e l f s h o u l d d e c i d e i n w h ic h d i r e c t i o n i t s h o u ld c h a i n ? ) f o llo w D a v is (1 9 8 0 ) in re fe rrin g to We t h e r e f o r e t h e k n o w le d g e b a s e a s c o n t a i n i n g k n o w le d g e s o u r c e s ( K S 's ) : i n t h i s c a s e e a c h KS w i l l b e o f a s i m i l a r f o rm a t t o a n d d i s c h a r g e t h e sam e f u n c t i o n a s , a r u l e i n t h e c o n v e n t i o n a l e x p e r t s y s te m . We r e q u i r e o f a k n o w le d g e - b a s e d s y s te m t h a t i t how i t s h o u ld m an ag e k n o w le d g e , BACKGROUND th a t i t b e a b le to b e a b le t o rea so n about c h o o s e b e tw e e n c o n - B t r a d i c t o r y K S 's o n t h e g r o u n d s o f o t h e r e v i d e n c e , an d t h a t i t b e l i m i t e d as l i t t l e to add a s p o s s i b l e i n t h e w ays t h a t i t t h a t th e p re s e n te d by s id e s te p p e d p ro to ty p e d e s c rib e d such have r e q u ir e m e n ts : been, to h a n d l e s k n o w le d g e . ra th e r, a llo w We h a s t e n b e lo w h a s n o t s o lv e d t h e as many is s u e s as p r o b le m s can t h e d e v e lo p m e n t o f a p r o t o t y p e . be The p r o t o t y p e h a s n o t b e e n d e v e lo p e d a s y e t a n o t h e r e x p e r t system, i t i s i n ­ te n d e d t o d e m o n s tr a te t h e f e a s i b i l i t y o f k n o w le d g e b a s e d s c e n e a n a l y s i s a n d o f a new p a ra d ig m w i t h w h ic h we h a v e a t t e m p te d t o s i m p l i f y t h e p r o b le m o f a n a ly s in g r e a l s c e n e s . K n o w le d g e -b a se d s y s te m s lite ra tu re , o f w o rk . a r e b e g i n n i n g t o p e n e t r a t e t h e i m a g e - p r o c e s s in g an d p r e c e d e n t s d o e x i s t f o r u s i n g t h e s e s y s te m s f o r t h i s ty p e Nazif a n d L e v i n e ( 2 9 8 4 ) d e s c r i b e a n e x p e r t ( s i c ) s y s te m f o r low le v e l - i m e g e s e g m e n t a ti o n , w h ic h a p p e a r s t o a c c o rd in g s y s te m . to th e p o in t ra is e d above, i t g iv e good r e s u l t s , is in a lth o u g h f a c t a k n o w le d g e - b a s e d N iem ann a n d h i s g r o u p ( 1 9 8 5 ) d e s c r i b e a n o t h e r s y s te m w h ic h u s e s k n o w le d g e t o in te rp re t r e s u lts h o w ev o r, t h a t i t u ses fro m a s e g m e n te d p ic tu re : it a p p e a rs, i m p l i c i t k n o w le d g e t o se g m e n t t h e p i c t u r e an d e x ­ t r a c t t h e in f o r m a t i o n i t n e e d s f o r i t s a n a l y s i s . t o u s e k n o w le d g e a t a l l le v e ls , so th a t We w o u ld l i k e o u r s y s te m h ig h -le v e l k n o w le d g e may a id lo w - le v e l a c tio n s . O ur s y s te m is th o u g h t o f in a f a s h i o n d i f f e r e n t fro m t h e c o n v e n t i o n a l " i n f e r e n c e e n g in e - k n o w le d g e b a s e " d e v e lo p e d r e p re s e n ta tio n ; r a th e r , it a s a n i n t e r p r e t e r o p e r a t i n g o n a p i c t u r e - k n o w le d g e has been la n g u a g e . le te rm " i n t e r p r e t e r " i s u s e d a d v i s e d l y ; d i f f e r e n t r e a s o n i n g f a c i l i t i e s a re a v a ila b le to c ility it d iffe re n t b its o f in s tru c tin g o f k n o w le d g e , a s a t t h i s s h o u ld m anage k n o w le d g e h a s n o t b e e n BACKGROUND s ta g e th e fa ­ t h e s y s te m , th r o u g h t h e k n o w le d g e b a s e , a s t o how im p le m e n te d . T h is in te rp re te r' m odel i s to a v o id t h e i m p l i c i t a s s u m p tio n o f a u th o r - im b e d d e d r e a s o n in g te c h n i q u e s i n t h e k n o w le d g e -m a n a g e m e n t s e c t i o n . SCENE-ANALYSIS PARADIGMS. T y p i c a l o f t h e s t a t e o f s c e n e a n a l y s i s a t p r e s e n t i s t h e s y s te m p r o p o s e d by t h i s a u th o r ( F o r s y th , 1984) t o s o lv e th e i n s t r u m e n t a t i o n p r o b le m d e ­ s c r i b e d a b o v e , w h ic h e x p l o i t s a s m any p r o b le m c o n s t r a i n t s a s p o s s i b l e t o p r o d u c e e w o r k a b le d e s i g n . In its e lf, th is a p p ro a c h i s n o t in c o rr e c t, b u t t h e i n v e s tm e n t i n u s i n g a s y s te m b u i l t t o t h i s ty p e o f d e s i g n t o s o l v e a p r o b le m d i f f e r i n g even s l i g h t l y c o n s i d e r a b l e . We w o u ld l i k e fro m t h e p r o b le m th e re fo re f irs t e n v is a g e d , is to b u ild a sc en e a n a ly s e r t h a t is a s g e n e r a l a s p o s s i b l e - how d o we d o t h i s ? We m u st f i r s t d e c i d e i n w h a t fo rm we w is h t o h a n d l e t h e s c e n e . I t i s o b ­ v io u s ly im p o r ta n t t o be a b le to e x p lo it th e s t r u c t u r e o f t h e o b j e c t we s e e k , y e t we m u s t a l s o d e c i d e how t o h a n d le t h e a p p e a r a n c e o f i t s p a r t s in th e p ic tu r e . We may h a n d l e t h e p i c t u r e i n te rm s o f i t s e d g e s , o r o f i t s edges w i l l ta tio n : its le a d u s t o re g io n s , a fo rm o f l i n e to We h a v e c h o s e n t h e l a t t e r , r e g io n s . d r a w in g , o r w ir e - f r a m e a re p r e s e n ta tio n and w i l l e x p la in in te r m s o f p i c t u r e and j u s t i f y Its rep rese n ­ s u b s e ts . t h e c h o ic e b o t h b y r e f e r e n c e t o w o rk i n te r m s o f t h e l i n e - d r a w i n g r e p r e s e n t a t i o n , a n d b y e x p e r im e n ta l r e s u l t s . BACKGROUND T he m a jo r l i n e - d r a w i n g - t y p e p a ra d ig m a p p e a rs t o b e t h a t o f H arr ( 1 9 7 9 ), a lth o u g h much o t h e r w o rk h a s b e e n d o n e i n t h i s f i e l d , w h e re p i c t u r e s h a v e b e e n i n t e r p r e t e d i n te r m s o f - t h e i r e d g e s . d r a w in g " r a t h e r lo o s e ly h e re : w o rk in g i n t h i s t y p e o f p a ra d ig m . c y lin d e r r e p r e s e n ta tio n s p a ra d ig m i s t h a t o n e i s m o d e ls and if (We a r e u s i n g t h e te r m T h u s , t h e te r r a i n c l u d e s g e n e r a l i s e d th e lik e .) r e q u ire d t o th a t one has b u i l t o f i t . T h e g r e a t p r o b le m w i t h t h i s u n d e rs ta n d th e p i c t u r e i n te r m s , o f K n o w led g e , n o t o f w h at o b j e c t s l i k e , b u t o f w h a t t h e y s h o u l d lo o k l i k e i n p i c t u r e s , f i c u l t q u e s tio n " lin e o n e e x a m in e s a p i c t u r e ' s e d g e s , o n e i s o f s h a p e c a n b e a v o id e d i n t h i s d e s c r i b i n g a r o c k e t a s lo o k i n g l i k e i s used. lo o k T he d i f ­ f a s h i o n , f o r e x am p le b y a cone on to p o f a c y lin d e r , b u t a s y s te m d e s i g n e d l i k e t h i s i s a t t h e m e rc y o f i t s own m o d e llin g t e c h n i q u e s . T oo much k n o w le d g e i s d e p lo y e d i n m o d e llin g t h e s c e n e , a n d n o t en o u g h i n h a n d lin g it. T h u s, k n o w le d g e t o f i n d a s y s te m b u i l t u n d e r t h i s p a ra d ig m c a n n o t d e p lo y t h e m o st l i k e l y p o s itio n o f a n o b j e c t w h ic h i t s h o u ld b e t h e r e , b u t w h ic h i t c a n n o t f i n d f o r sh a d o w s . p ro p o se h e re i s in te n d e d t o a llo w know s T he p a ra d ig m we m a r s h a l l i n g o f k n o w le d g e t o make it e ff e c tiv e a t a l l le v e ls . A n o th e r f e a t u r e w i t h p r e s e n t l i n e - d r a w i n g v i s i o n p a ra d ig m s i s t h e e f f o r t p u t in to te c h n i q u e s t o i n t e r p r e t a tw o - d im e n s io n a l im ag e b y u s i n g c l u e s t o i t s s h a p e i n t h r e e 1 d im e n s io n s c o n t a i n e d , o f th e p i c t u r e . f o r e x a m p le , i n t h e s h a d in g I t i s f e l t t h a t t h e s e te c h n i q u e s a r e l i k e l y t o p r o d u c e m i s l e a d i n g r e s u l t s w hen a p p l i e d t o a r e a l p i c t u r e , p a r t i c u l a r l y on e t a k e n u nder poo r lig h tin g c o n d itio n s . i n o n e 's k n o w le d g e b a s e a s t o sc rib e d , I t i s s u r e l y b e t t e r t o h o ld i n f o r m a ti o n th e lik e ly in a p ic tu r e , th a n t o t r y m odel o f t h e p i c t u r e i n t h r e e d im e n s io n s , p r o b a b ly d e f e c t i v e m o d e l. BACKGROUND a p p e a ra n c e o f t h e o b je c ts d e ­ t o obtain a potentially m i s le a d in g and th e n to in te rp re t th is H a r r 's p a ra d ig m lim its under i t . l a b o r i o u s f o r s u c h a s y s te m t o f i n d , a s F r e u d e r ' s ( 1 9 7 6 ) I t is t h e p ow er o f t h e k n o w le d g e u s e d i n s y s te m s b u i l t s y s te m c a n , a n o b j e c t i t knows s h o u l d b e p r e s e n t by lenient classification o t r e g io n s in t h a t o b j e c t 's m o st l i k e l y lo c a tio n . If h a s b e en p o o rly p ro d u c e d a s a r e s u l t o f b ad l i g h t i n g , s y s te m w i l l h a v e d i f f i c u l t y i n m a k in g a n o t h e r t o of its h ig h -le v e l lo w - le v e l d e c is i o n s . k n o w le d g e to l i n e d r a w in g f o r e x a m p le , t h e c o n fo rm t o le d g e t h a t b eco m e s a v a i l a b l e a t som e l a t e r s t a g e . p lic a tio n s th e o t h e r know ­ I t c a n n o t u s e t h e im ­ im p ro v e its h a n d lin g of We a r e p r o p o s i n g , t h e n , t h a t p i c t u r e s b e u n d e r s t o o d i n te rm s o f p i c t u r e s . L ook a t f i g u r e 1 . M a rr ( M a r r ,1 9 7 9 ) c la im s t h a t t h i s p i c t u r e i s p e r c e i v e d " i n t e r n s of" v e r y p a r t i c u l a r t h r e e - d i m e n s i o n a l s h a p e s , som e f a m i l ­ i a r , som e l e s s s o . " This a u t h o r d i s p u t e s h i s to p ro v id e c lu e s a s t o c la i m ; s u r e l y t h e nam e of t h e p i c t u r e is u sed th e id e n t i t y o f th o s e o b je c ts n o t c le a r l y c l a s s ­ i f i a b l e , a n d th o s e t h a t a re u n d e rs to o d w ith o u t t h e s e c lu e s , a re u n d e rsto o d a s tw o - d im e n s io n a l b l o t c h e s . to rily c la s s ifie d , d im e n s io n s . a ll W h ile i t T h en , once e v e r y th in g h a s been o b je c ts s a tis fa c ­ i n h e r i t fro m t h e v ie w e r a s h a p e i n t h r e e u n f a ir to c ritic is e t h e p a ra d ig m o n t h e b a s i s o f a c o m p le x p i e c e o f a r t w o r k , w h e re b a c k g r o u n d k n o w le d g e b eco m es im p o r ­ t a n t b y t h e n a t u r e o f t h e p i c t u r e , t h e d a . ', , ) h o l d s t h a t t h r e e - d i m e n s i o n a l shape is o f l i t t l e im p o r ta n c e i n t h e e a r l y s t a g e s o f c l a s s i f y i n g a s c e n e . We c la im t h a t s h a p e i s o f t e n i n h e r i t e d b y o b j e c t s i n a p i c t u r e a f t e r th e y have been c la s s ifie d ; th is e ffe c t is c o n s id e r s p i c t u r e s o f p o o r q u a l i t y . p a rtic u la rly In th e ro ck n o t i c e a b l e when o n e p ic tu r e s sh o w n , th e 1 r e a d e r s h o u ld n o t i c e t h a t t h e r o c k s a c q u i r e s h a p e o n ly a f t e r h e h a s p u z - BACKGROUND T he rite of spring. z l e d o u t w h ere t h e y a r e , n o t w h ile h e is. d o in g s o ; th u s in f o r m a t i o n a b o u t t h e tw o - d im e n s io n a l a p p e a r a n c e o f o b j e c t s i s b e in g e x p l o i t e d . T he am o u n t o f i n f o r m a t i o n in v o lv e d l u s t r a t e d by t h e ro c k p i c t u r e s . in u n d e rs ta n d in g sc e n e s is w e ll i l ­ H o s t p e o p l e who h a v e s e e n t h e s e p i c t u r e s , d i d n o t know w h a t t h e y r e p r e s e n t e d u n t i l th e y w e r e t o l d . E v en t h e n th e y w e re n o t s u r e w h e r e a b o u ts i n t h e p i c t u r e s t h e r o c k s w e r e , a n d c o u ld I n ­ te rp re t th e p ic tu r e s p l a i n e d t o th e m . c o r r e c t l y o n ly a f t e r h a v in g s e v e r a l p i c t u r e s From t h i s s t a g e o n , t h e y w e r e a b l e t o p ic t u r e s f o r th e m s e lv e s . ex­ in te r p r e t th e se T h u s t h e p r o c e s s i s l e a r n t , an d i n s t a g e s . O n ly o n c e t h e s e s t a g e s h a v e b e e n t r a v e r s e d , :Ls t h e p i c t u r e u n d e r s t o o d i n te r m s o f th e th r e e - d im e n s io n a l sh a p e o f th e o b je c ts r e p r e s e n te d . We h a v e la b o u r e d th e r e l a t i v e u n im p o r ta n c e o f t h r e e - d i m e n s i o n a l s h a p e in f o r m a tio n in th e e a r l y s ta g e s o f sc e n e a n a ly s i s , b e c a u se d e s c rib e d h e re ig n o re s t h i s i n f o r m a t i o n c o m p le t e ly . th e s y s te m We f e e l t h a t t h e r e s u l t s o b t a i n e d i n t h e p a r t i c l e - s i z e d i s t r i b u t i o n a n a l y s i s w o rk j u s t i f y t h e tis e o f t h e te c h n i q u e s d e s c r i b e d , p lo ita tio n a lth o u g h t h e y make t h e o f t h r e e - d i m e n s i o n a l s h a p e in f o r m a t i o n d i f f i c u l t . la te r ex­ The r e l a ­ t i v e u n im p o r ta n c e o f t h i s i n f o r m a t i o n m ean s t h a t t h e i r i n a b i l i t y t o h a n d le t h i s in f o r m a t i o n d o e s n o t m i l i t a t e a g a i n s t th e m . IMAGE REPRESENTATION. I t i s i m p o r ta n t t o c o n s i d e r how im a g es may b e r e p r e s e n t e d , a s t h e c h o ic e o f im ag e r e p r e s e n t a t i o n w i l l o f t e n i n f l u e n c e t h e a b i l i t i e s o f t’h e s y s te m BACKGROUND in q u e s tio n . We. w is h t o re p re s e n t th e p o s s i b l e , w h ile c o n s e r v in g th e p ic tu r e in a fa sh io n im a g e i n a s p o w e r f u l a fo rm a s much s p a c e a s p o s s i b l e . c o m p a ti b le w i t h t h e as We w is h t o s t o r e s y s te m we a r e d e s c r i b i n g , t h a t i s , we w is h t o h o l d in f o r m a t i o n p e r t a i n i n g t o t h e r e g i o n s w i t h i n t h e p i c t u r e i n a s t r a c t a b l e a fo rm a s p o s s i b l e . For th is p u rp o se , it m u st be a ssu m ed t r u s t w o r t h y , t h a t i s , t h a t i t w i l l n o t b< to ask i t to re v is e i t s d e c is io n s . l a t e r s ta g e th a t each T h i s i s t h e saim p r im it iv e i s r e p re s e n te d by a t l e a s t one r e g io n in p ic tu re . a n d t h a t n o tw o p r i m i t i v e s s h a r e a r e g i o n , w h e re a p rim itiv e s u n d e rs to o d by a (T hat i s , s tr u c tu re to fin d a p r im itiv e : i t s own r i g h t . ) it is we d' in s p e c t a p ie c e o f p i c t u r e t h a t s ta n d s i n S o , o n c e we h a v e se g m e n te d a p i c t u r e , we may d i s c a r d t h e p i c t u r e i t s e l f i n f a v o u r o f a r e p r e s e n t a t i o n o f t h e se g m e n te d p i c t u r e t h a t is m o re c o m p a c t t h a n t h e p i c t u r e we r e q u i r e . its e lf, if it re ta in s t h e in f o r m a t i o n T h is i s s u e T h e q u e s t i o n i s , w h a t d o we w is h t o r e p r e s e n t ? is n o t y e t fu lly s e ttle d , a s th e s y s te m its e lf is s till a p r o t o t y p e ; h o w e v e r, we ^ h a l l d e s c r i b e w h at w as r e p r e s e n t e d a n d how , an d we c la im t h a t t h e s y s te m a llo w s e x p a n s io n o f t h e r e p r e s e n t a t i o n . As h a s b e e n s e e n a b o v e , t h e m o st i m p o r ta n t i n f o r m a t i o n t h a t o n e may h a v e a b o u t a r e g io n a p p e a rs t o We w is h a l s o to be th e lis t, h e ld i n som e f o rm , o f i t s n e i g h b o u r s , h o ld some r e p r e s e n t a t i o n l e v e l , i t s t e x t u r e , and i t s of its s iz e , its a v erag e g rey s h a p e i n tw o - d im e n s io n s . I t c a n b e s t a t e d c l e a r l y a t t h i s p o i n t t h a t t h e i s s u e o f tw o - d im e n s io n a l s h a p e h a s b e e n l a r g e l y a v o id e d ; i n i t s p r e s e n t s t a t e , t h e p r o t o t y p e sy ste m . n e ith e r needs n o r u se s th e in f o r m a tio n . becom e an i m p o r ta n t i s s u e , a n d t h a t i t o f p ic tu r e s a t a h ig h It is is a c c e p te d c r u c ia l to th a t th is w ill th e r e p re s e n ta tio n le v e l to fin d a r e p r e s e n ta tio n o f shape t h a t w i l l a llo w o n e t o d e c i d e w h a t t h e s h a p e w i l l b e o f a r e g i o n c r e a t e d b y m e rg in g tw o o t h e r r e g i o n s o f know n s h a p e , w i t h o u t r e f e r e n c e t o t h e p i c t u r e i t s e l f . T he i s s u e h a s s im p ly c a u s e d i n s u f f i c i e n t p r o b le m s u p t o w a r r a n t m o re t h a n b r i e f a t t e n t i o n ; ta tio n th is s ta g e to i t i s f e l t t h a t th e r e g io n r e p r e s e n ­ a d o p te d h a s s u f f i c i e n t p o w e r , w i t h some a tte n tio n , to a llo w a s o lu M o n o f t h i s p r o b le m w i t h o u t m o d i f i c a t i o n t o t h e r e p r e s e n t a t i o n . T he i s s u e o f r e p r e s e n t i n g t h e e v er, re c e iv e d p a rtic le -s iz e much r e g i o n s t r u c t u r e o f t h e p i c t u r e h a s , how ­ a tte n tio n , d is trib u tio n d a tin g fro m a n a l y s e r w o rk . th e e a r ly days At th a t s ta g e , t a t i o n w as r e q u i r e d t h a t i n d i c a t e d how a r e g i o n r e l a t e d to of th e a rep rese n ­ its o u ts id e n e i g h b o u r s , t h e i n s i d e n e ig h b o u r s b e in g ig n o r e d f o r r e a s o n s we s h a l l d e ­ ta il la te r . R o s e n f e ld The (1 9 8 2 ), in tra c ta b ility . c h a in - c o d e w as a p p ro a c h , u n a p p e a lin g In th e on ro ck p ic tu r e s as d e ta ile d th e g ro u n d s o b ta in e d , lo n g b o u n d a r i e s , w i t h many c h a n g e s o f d i r e c t i o n n e ig h b o u r s r e p r e s e n t e d . i n , f o r e x a m p le , of its p o te n tia l r e g i o n s te n d e d t o h a v e i n th e m , b u t w ith few T h u s , a v a s t c h a i n c o d e c o u ld b e o b t a i n e d w ith m uch l a r g e l y - r e d u n d a n t i n f o r m a t i o n . T h e n e ig h b o u r - c o d e r e p r e s e n ta tio n w as th e n s u g g e s te d b y B e r g e r (1 9 6 4 ( a ) ) a n d th e n r e f i n e d b y t h i s a u th o r. T h is r e p r e s e n ta tio n w i l l be d e s c r ib e d i n d e t a i l i n th e body o f th e d i s ­ s e rta tio n . T he s t a n d a r d d e v i a t i o n o f t h e g r e y l e v e l o v e r t h e r e g i o n h a s b e e n c h o sen , to re p re s e n t te x tu r e . T h is c h o ic e i s o p e n t o d i s c u s s i o n : n o t t h e o n l y way i n w h ic h o n e may r e p r e s e n t t e x t u r e . i t i s c e r ta in ly H o w ev er, we h a v e a g a i n n o t a d d r e s s e d t h i s i s s u e i n d e t a i l , a s t h e m a in t h r u s t o f t h e w o rk BACKGROUND 15 w as i n te n d e d t o e s ta b lis h th e f e a s i b i l i t y an d u s e f u l n e s s o f t h e ty p e o f s y s te m d e s c r i b e d . KNOWLEDGE REPRESENTATION R e p r e s e n t i n g k n o w le d g e i s n o t t h e sam e p r o b le m d a t a : h o w e v e r, we r e q u i r e fro m o u r s o l u t i o n t o sam e c h a r a c t e r i s t i c s a s we r e q u i r e s im p le , t r a c t a b l e te c h n iq u e s a c r if ic e d fo r s im p lic ity . is fro m t h e r e q u ire d as r e p r e s e n tin g p ic tu r e t h e f o r m e r p r o b le m , t h e s o lu tio n to th e la tte r. A a t t h i s s t a g e , an d p o w e r may b e T h u s , a lth o u g h t h e is s u e w i l l be d is c u s s e d , o u r k n o w le d g e f o r m a t w i l l n o t i n a n y way r e p r e s e n t t h e s t a t e o f t h e a r t . T h e r e a r e s e v e r a l k n o w le d g e r e p r e s e n t a t i o n s p r o p o s e d a t p r e s e n t : t h e m a in th e m e s seem t o b e s e m a n t ic n e t s , f r a m e s , r u l e s a n d t h e p r e d i c a t e c a l c u l u s , w h ile o th e r r e p r e s e n ta tio n s have been p ro p o se d . (S e e fo r e x a m p le , C h a r n ia k ( 1 9 8 1 ) , a p a p e r w h ic h p r o p o s e s a k n o w le d g e r e p r e s e n t a t i o n h a s t h e f l a v o u r b o t h o f f ra m e s a n d t h e p r e d i c a t e c a l c u l u s . ) th a t C o n s i d e r in g a p i e c e o f k n o w le d g e a s a r u l e , a n d t h i n k i n g o f i t s o l e l y i n t h o s e te rm s a p p e a rs t o r e s t r i c t o n e 's p e r c e p t i o n o f t h e p o t e n t i a l o f t h e k n o w le d g e , a s i t i s to o e a sy t o g e t d i s t r a c t e d b y th e im p lic a tio n s o f th e " i f - th e n " c o n s tr u c t. is T h u s , a l t h o u g h t h e k n o w le d g e r e p r e s e n t a t i o n we h a v e a d o p te d in a r u l e - l i k e f o r m a t, we h a v e a v o id e d s a y i n g " i f th is th e n t h a t" . T he r e p r e s e n t a t i o n i s r a t h e r a s a " t h i s r e l a t e s t o t h a t " fo rm . B a r r an d F e ig e n b a u m ( 1 9 6 1 ) p r e s e n t a d i s c u s s i o n o f t h e s e te c h n i q u e s w h ic h we s h a l l s u m m a rise h e r e . . L o g ic a l r e p r e s e n t a t i o n s BACKGROUND such as th e p r e d ic a te tu r a l re p r e s e n ta tio n fo r c e r ta i n n o tio n s . H o w ev e r, i t th a t lo g ic s need to th is • re n d e rs p u rp o se a t l e a s t , b e n o n - m o n o to n ic * 'a n d a s tr u c tu re i n w h ic h k n o w le d g e i s l i n k s o f d i f f e r e n t ty p e s b e tw e e n n o d e s . a tio n s , o b je c ts th e m , fo r our in tr a c ta b le . A s e m a n t ic n e tw o rk i s tw e e n th e m . i s o f t e n th e c ase N odes u s u a l l y r e p r e s e n te d by re p re se n t s it u ­ o r c o n c e p ts , and th e lin k s th e r e l a t i o n s t h a t e x i s t b e ­ S e m a n tic n e t w o r k s , a n d a n e l a b o r a t i o n o f t h e n e tw o r k i d e a i n t o a s t r u c t u r e , t h e f r a m e , a r e t h e s u b j e c t s o f much r e s e a r c h . T h e r e p r e s e n t a t i o n a l s t r u c t u r e w i t h w h ic h we a r e c o n c e r n e d , t h e r u l e , h a s b e e n m uch i n v o g u e r e c e n t l y , w i t h t h e s u c c e s s o f e x p e r t - s y s t e m t e c h n o lo g y in c o m m e r c ia l a p p l i c a t i o n s . The id e a a c t i n g h e re k n o w le d g e may b e e x p r e s s e d i n a n " I F T h is re p r e s e n ta tio n has k n o w le d g e , a n d se em s t o o f k n o w le d g e r e q u i r e d t o is been used v e ry s u c c e s s fu lly le n d i t s e l f s o lv e t h i s t a g e s : p r e s e n t e x p e r t s y s te m s th a t a p ie c e of ( c o n d i t i o n s ) THEN ( a c t i o n s ) " fo rm . f o r e x p e r t d o m a in v 'r y w e ll t o r e p r e s e n tin g k in d o f p r o b le m . th e ty p e I t h a s d is a d v a n ­ f a c e p o t e n t i a l p r o b le m s w i t h s a tu r a tio n , w h e re t h e r u l e b a s e b eco m e s s o l a r g e t h a t t h e s y s te m h a s r e a l d i f f i c u l t y g e t t i n g a n y th in g done. R ecent ru le s to 1 w o rk h a s show n t h a t s y s te m s may b e b u i l t t h a t c h a n g e o r u p d a te a llo w th e m t o h a n d l e s i t u a t i o n s t h a t t h e y h a v e n o t , p r e v i 6 u s ly A m o n o to n ic l o g i c i s a l o g i c a l s y s te m i n w h ic h , i f i t i s p o s s ib l e to d e d u c e a th e o re m w i t h a s e t o f a s s e r t i o n s , a d d i t i o n s t o t h a t s e t w i l l n o t l a t e r n e g a t e t h e th e o re m . BACKGROUND ' 17 e n c o u n te r e d ( L e n a t , 1 9 8 0 ) . B rachm an c t a l ( 3 9 8 3 J q u o te H a r t fls s a y in g in a 1980 p a p e r t h a t c u r r e n t e x p e r t s y s te m s t y p i c a l l y show u p b a d ly , a s th e y a r e u n a b le t o le d g e i s r e c o g n i s e o r d e a l w i t h p r o b le m s f o r w h ic h t h e i r own know ­ i n a p p l i c a b l e o r i n s u f f i c i e n t : t h i s s i t u a t i o n w o u ld a p p e a r t o b e c h a n g in g , b u t t h e c r i t i c i s m is s t i l l la rg e ly v a lid . T h e s e p r o b le m s a r e t o an e x t e n t i n h e r i t e d fro m t h e r u l e r e p r e s e n t a t i o n o f k n o w le d g e . We h a v e r e v ie w e d h e r e t h e m a jo r i d e a s i n k n o w le d g e r e p r e s e n t a t i o n . The c r i t e r i o n b y w h ic h a te c h n i q u e w as c h o s e n f o r t h e p r o t o t y p e s y s te m was a g a i n s i m p l i c i t y o f i m p l e m e n ta tio n , r e c a l l i n g t h a t a r e p r e s e n t a t i o n was d e s i r e d , l e s s f o r t h e m a in te n a n c e o f p r o b le m k n o w le d g e , th a n f o r p r o v i d i n g a s im p le e x p l i c i t k n o w le d g e f a c i l i t y s e n t a t i o n w as c h o s e n f o r i t s i n t h e s y s te m . A ru le -ty p e rep re­ p o t e n t i a l s i m p l i c i t y o f im p l e m e n ta tio n in FORTRAN ( w h ic h la n g u a g e c h o ic e w i l l b e e x p l a i n e d ) a n d b e c a u s e i t a p p e a r e d t h a t u p d a t i n g t h e t h e k n o w le d g e b a s e c o u ld b e s i m p l i f i e d b y u s i n g t h i s r e p r e s e n ta tio n . I t w i l l b e se e n l a t e r t h a t th e r u le s have been u se d in d i f f e r e n t w a y s , d e p e n d in g o n t h e i r te r m s o f r e f e r e n c e ; t h e r e i s a s t r o n g sim ila rity to an in te r p re te d la n g u a g e w h e re s t a t e m e n t o r d e r i s n o t im ­ p o r ta n t. KNOWLEDGE MANIPULATION. A n o th e r im p o r t a n t q u e s t i o n w h ic h a r i s e s i s , th a t is "How we m a n ip u la te k n o w le d g e i n a c c u r a t e : how d o we r e a c h a d e c i s i o n b a s e d o n p o o r e v id e n c e ? " T h is i s a g a i n a r e s e a r c h i s s u e i n i t s e l f , a n d t h e s y s te m we h a v e a d o p te d d o e s n o t c la im t o b e o p t i m a l . BACKGROUND As t h e te c h n i q u e s d e v e lo p e d s o f a r a p p e a r 18 t o b e i n s largo m e a s u r e o n i p i r j c a ] , a n d a s t l i o r e appears t o b o n o s t r o n g u n i f y i n g i d e a a t p r e s e n t i n t h i s f i e l d , we h a v e a g a i n c h o s e n t h e s i m p l e s t te c h n iq u e t h a t w i l l m eet o u r p r e s e n t n eed s in t h i s m a tte r. T he p r o b le m o f r e a c h i n g a d e c i s i o n b a s e d o n p o o r e v id e n c e i s a c o n s i d e r ­ a b l e o n e , a n d a l t h o u g h n o t a n im m e d ia te p r o b le m i n t h e c a s e o f t h e p r e s e n t p r o t o t y p e , w h ic h w i l l s im p ly make t h e w ro n g d e c i s i o n w hen f a c e d w i t h p o o r e v id e n c e , it is one t h a t r e q u i r e s a d d r e s s i n g , a s t h e s y s te m i s in t e n d e d t o b e a p r o to ty p e o f a d e v ic e t h a t w i l l o p e ra te on r e a l p i c t u r e s , h ence w i l l r e q u ir e a c e rta in and d e g r e e o f n o i s e im m u n ity .W e w i l l t h e r e f o r e b r i e f l y s u m m a rise t h e te c h n i q u e s a v a i l a b l e . One may u s e a B a y e s ia n t e c h n i q u e , w h e re a c o m b in a tio n o f a p r i o r i p r o b a ­ b ilitie s S h o rtliffe le a d s et to al a p ro b a b ility (1 9 8 4 ) q u o te on w h ic h a Duda as u s in g PROSPECTOR s y s te m , w i t h c o n s i d e r a b l e s u c c e s s . d e c is io n th e se may be m e th o d s b ased. in th e T h e p r o b le m w i t h B a 'y e sia n te c h n i q u e s if f t h a t t h e a, p r i o r i p r o b a b i l i t i e s a r e n o t a lw a y s e a s y t o f i n d , a n d t h e t e c h n i q u e se em s t o b e u n p o p u la r a s a r e s u l t . D uB ois e t a l ( 1 9 8 0 ) p r e s e n t Z a d e h 's c o n c e p t o f t h e s e t ’ s m em bers a r e fu zz y s e t , w h e re a a s s i g n e d a d e g r e e o f m e m b e rsh ip , an d w h e re f u n c t i o n s may b e d e f i n e d t o d e s c r i b e t h e d e g r e e o f m e m b ersh ip o f an o b j e c t i n t h e u n io n o r in te r s e c tio n o f th e s e t s . The t h e o ry i s de ep and r a t h e r a p ­ p e a l i n g , a s f u z z y f u n c t i o n s and f u z ^ y n u m bers may b e d e f i n e d . T h ere i s , h o w e v e r, fit l e a s t o n e c o n s i d e r a b l e p r o b le m t o b e c o n s id e r e d i n u s i n g t h i s t h e o r y i n an im p le m e n te d s y s te m . C o n s i d e r t h e s e t o f s t u d e n t s i n a c l a s s ; we w is h t o d e f i n e f o r e a c h s t u ­ d e n t h i s d e g r e e o f m e m b ersh ip i n t h e s e t o f t a l l BACKGROUND p e o p le . A se v e n -fo o t . 19 s t u d e n t i s a member t o d e g re ct 1 ( t h e s c a l e it. c o n v e n t i o n a l l y t o w h at d e g re e i s a s i x - f o o t s t u d e n t a member ? w h at t h e m e m b ersh ip f u n c t i o n s h o u ld lo o k l i k e . 0 - 1) ; b u t T h e p r o b le m i s s im p ly T h e r e a r e o t h e r p r o b le m s : g e n e r a l l y , w i t h t h e f u n c t i o n s d e s c r i b e d i n D u B o is e t a l ( 1 9 8 0 ) , t h e t r u t h v a l u e o f t h e p r o p o s i t i o n d o e s n o t n e c e s s a r i l y i n c r e a s e a s e v id e n c e m o u n ts , a nd a " s t r o n g " p i e c e o f e v id e n c e may b e o u tw e ig h e d b y a w eak o n e . does n o t e a s il y T h is l e a d t o a g o o d ,m o d e l o f human e v id e n c e c o m b in a t io n . F o r t h e MYCIN s y s te m , S h o s t l i f f e . t o w o rk r a t h e r w e l l . ( 1 9 6 3 ) d e v e lo p e d a s y s te m t h a t a p p e a r s I t d o e s h o w e v e r, a p p e a r t o have been d e v e lo p e d r a t h e r e m p i r i c a l l y w ith t h e MYCIN i s s u e s i n m in d , a n d a s s u c h w o u ld n o t s u i t o u r p u r p o s e , a s i t c a n n o t b e l i f t e d s t r a i g h t c u t o f t h e MYCIN c o n t e x t and u se d . ( S h o r t l i f f e ( 1 9 6 3 ) p o i n t s o u t w e a k n e s s e s i n t h e s y s te m , w i t h t h e p r o v i s o t h a t MYCIN i t s e l f w o rk e d v e r y w e l l . ) As i n a l l t h e o t h e r f i e l d s we h a v e d i s c u s s e d , we w is h e d f o r o u r p r o t o t y p e t h e s i m p l e s t p o s s i b l e t e c h n i q u e t h a t w o u ld s e r v e o u r p u r p o s e s . fu z z y s e t r e p r e s e n t a t i o n w as u s e d , T hus t h e b o th b e c a u s e i t d e f a u l t s i n t h e c a s e o f d e f i n i t e e v id e n c e t o t h e B o o le a n m o d e l, a n d b e c a u s e we d i d n o t r e q u i r e e x t e n s i v e w o rk w i t h p o o r e v id e n c e . REASONING ABOUT,'CONTROL. We h a v e s t a t e d how i m p o r ta n t i t i s t h a t a k n o w le d g e - b a s e d s y s te m b e a b l e t o r e a s o n a b o u t how i t w i l l u s e i t s seem s t o k n o w le d g e . r e f l e c t no c l e a r .tr e n d s a t t h i s BACKGROUND s ta g e , A lth o u g h t h e th is lite ra tu re a u th o r f e e l s t h a t t h e s o l u t i o n t o t h i s p r o b le m l i e s b o th i n u s i n g th r. te c h n i q u e o f d i v e r t i n g th e i n t e r p r e t e r 's a t te n t io n t o c e r t a i n K S 's a t t h e e x p e n s e o f o t h e r s , and i n p r o v i d i n g t h e i n t e r p r e t e r w i t h d i f f e r e n t te c h n i q u e s o f k n o w le d g e e x ­ p lo ita tio n , and a llo w in g t h e k n o w le d g e b a s e t o f o r c e s w itc h e s b e tw ee n th e m , g e n e r a l l y a s a r e s u l t o f t h e c o n t e x t i n w h ic h k n o w le d g e a p p e a r s . F o r e x a m p le , t h e f i r s t t e c h n i q u e w o u ld r e s u l t i n a s c e n e a n a l y s i s s y s te m w h ic h w hen a s k e d t o f i n d a n e l e p h a n t i n a s c e n e , w o u ld p r e v e n t k n o w le d g e a b o u t d i f f e r e n t a n im a l s fro m r e a c h i n g d is c u s s e s D a v is (1 9 8 0 ) e t e c h n i q u e w h e re p l a u s i b l y - u s e f u l k n o w le d g e s o u r c e s th e in te r p re te r . (P K S 's) a r e f o u n d , b y f i r s t r e j e c t i n g t h o s e K S 's w h ic h a r e d e f i n i t e l y n o t u s e f u l , and th e n o r d e r in g by u t i l i t y k n o w le d g e - d r i v e n . It th e r e s t . T h e s e p r o c e s s e s a r e th e m s e lv e s i s n o t e a s y , h o w e v e r, t o s e e a r e l i a b l e te c h n i q u e w h ereb y k n o w le d g e may b e s u p p r e s s e d w i t h o u t l o s i n g w hose r.e ’ - v m e e i s n o t im m e d ia te ly o b v io u s . r e le v a n t k n o w le d g e , I n o u r p r o t o t y p e s y s te m a l l p i e c e s o f k n o w le d g e a r e b r o u g h t t o t h e a t t e n t i o n o f t h e i n t e r p r e t e r , an d th o s e w h ic h d o n o t f u l f i l a r e l e v a n c e c r i t e r i o n a r e ig n o r e d . T h is i s a p r i m i t i v e i m p l e m e n ta tio n o f t h e a b o v e t e c h n i q u e . T he s e c o n d t e c h n i q u e i s i l l u s t r a t e d i n o u r p r o t o t y p e w hen we c o n s i d e r t h e k n o w le d g e t h a t d e s c r i b e s s t r u c t u r e . I f a KS r e l e v a n t t o th e s tr u c t u r a l d e s c r i p t i o n we a r e s e e k i n g i s lo a d e d i n t o t h e i n t e r p r e t e r , i t i s in s p e c t e d t o a s c e r t a i n w h a t o t h e r k n o w le d g e may b e r e l e v a n t , an d t h e n h e l d f o r f u tu r .P r e fe re n c e ; la te r , w hen we a r e a c t u a l l y l o o k in g fo r th a t s tr u c tu re i n t h e s c e n e , t h e k n o w le d g e w i l l b e e v a l u a t e d a s a r u l e t o i n d i c a t e w h at v a lu e we a s s o c i a t e w i t h a g iv e n s e t o f r e g i o n s b e lo n g in g t o BACKGROUND th a t s tr u c - IMPLEMENTATION ISSUES. T he s y s te m d e s c rib e d m i n i - c o m p u te r . fa m ilia rity a v a ila b le w as im p le m e n te d i n HP FORTRAN-77, on a n H P-1000 FORTRAN w as u s e d b e c a u s e o f t h e w ith w e re th e an la n g u a g e u n te s te d an d su b set because of a u t h o r 's th e L IS P , o n ly and c o n s id e ra b le o th e r PASCAL. la n g u a g e s To a v o id i n t e r p r e t e r - t e s t i n g i s s u e s , a n d b e c a u s e t h e PASCAL c o m p ile r a v a i l a b l e a t t h e tim e w as e x tr e m e ly s lo w , FORTRAN w as t h e o b v io u s c h o i c e . The code w as d e s i g n e d , w r i t t e n , a n d t e s t e d fro m May t o A u g u s t, 1 9 6 5 , i n c l u s i v e . As t h e H P -1000 u s e d h a s a maximum p a r t i t i o n - s i z e it becam e n e c e s s a r y t o (c o d e an d d a t a ) o f 32K se g m e n t t h e c o d e , w h ic h h a d n o t o r i g i n a l l y b e e n w r i t t e n w i t h t h i s i n m in d . T h e w o rd se g m e n t w i l l r e f e r b e lo w t o t h e c o d e s e g m e n t s , w h ic h u n f o r t u n a t e l y c o r r e s p o n d t o t h e s y s te m b l o c k , l e a d i n g t o p o t e n t i a l c o n f u s i o n u n l e s s o n e 's n o m e n c la tu r e i s c a r e f u l . CONCLUSION. We h a v e i n t r o d u c e d t h e i d e a s t h a t a p p e a r i n t h e r e s t o f t h i s d i s s e r t a t i o n and a tte m p te d t o d e p a rts show t h e i r o r i g i n s . T h e w o rk t h a t i s d e s c r i b e d b elo w i n many w ay s fro m t h e m a in s tr e a m o f c u r r e n t v i s i o n w o rk , b u t i s r o o te d in r e s p e c t a b le c o n c e p ts . T he p r o t o t y p e b u i l t is s till a f ra g ile c u r i o s i t y , r a t h s r th ,m an e n g i n e e r i n g s o l u t i o n , y e t i t r e p r e s e n t s a n a t ­ te m p t Vf' a n d tw o „ BACKGROUND ■ 5})? i d e a s p r e s e n t e d , w i t h te c h n i q u e s d e v e lo p e d b y t h i s a u th o r w o r k e r s , t o p r o d u c e a s y s te m t f i a t c a n s e e . NEIGHBOUR CODES. (Some o f t h e w o rk d e s c r i b e d h e r e w as s u b m i tte d in a re s e a rc h r e p o r t to t h e W its D e p a rtm e n t o f E l e c t r i c a l E n g in e e r in g f o r a B . S c . ( E l e c . E n g . ) , i n W hich t h e c o n c e p t o f n e ig h b o u r c o d e s , a n d t h e w ay th a t m e rg e d w h en n o e n c l o s e d r e g i o n s e x i s t e d , w e re d e s c r i b e d . th e y c o u ld be T h e a lg o r i t h m t o d e a l w i t h t h i s s i t u a t i o n w as d e v e lo p e d a f t e r t h i s r e p o r t w as s u b m i t t e d , and t h e m a t e r i a l i s p r e s e n t e d a s a w h o le f o r s i m p l i c i t y 's s o k e . ) We h a v e s a i d a b o v e t h a t w h en o n e c o n s i d e r s a p i c t u r e i n te r m s o f r e g i o n s , t h e i r n e i g h b o u r s ’ q u a l i t i e s b ecom e t h e m o st im p o r t a n t i n f o r m a t i o n we can p r o v id e .in its e lf . a r e p r e s e n ta tio n H o w ev e r, i t a t a h ig h e r le v e l a l s o b ecam e a p p a r e n t t h a t r e p r e s e n t a t i o n s th e c h a in co d e w ere n o t i d e a l . th a t -b an th e p ic tu r e su c h as T h e s e f a c t s s p u r r e d t h e d e v e lo p m e n t o f t h e i d e a o f t h e n e ig h b o u r c o d e , w h ic h h a s s o f a r p r o v e d i t s e l f u s e f u l a s a r e p r e s e n t a t i o n o f a se g m e n te d p i c t u r e . I f o n e m ay m e rg e a n d a n a l y s e r e g i o n s o n a b a s i s o f t h e i r n e i g h b o u r s , c a n we n o t th e n d e v e l o p a r e p r e s e n t a t i o n , l e s s b u lk y th a n t h a t o f t h e e n t i r e " p i c t u r e , t h a t w i l l h o ld t h i s i n f o r m a t i o n , a n d i n w h ic h o n e may r e p r e s e n t m e rg e s w i t h o u t r e v e r t i n g t o t h e o r i g i n a l p i c t u r e ? c a n in d e e d d o s o . The r e p r e s e n t a t i o n is I t t u r n s o u t t h a t we fo rm e d s im p ly b y l i s t i n g th e n e ig h b o u r s i n t h e o r d e r i n w h ic h t h e y o c c u r i n a t r a v e r s a l o f t h e o u t s i d e b o u n d a ry o f t h e r e g i o n , a n d i s c a l l e d t h e n e ig h b o u r c o d e . NEIGHBOUR CODES. PROPERTIES OF THE NEIGHBOUR CODE. T he f irs t q u e s tio n t h a t o c c u rs i s , "Why o n ly t h e o u t s i d e n e ig h b o u r s ? " T h e a n s w e r i s s im p l e : " i f a r e g i o n i s e n t i r e l y c o n t a i n e d b y a n o t h e r , t h e in f o r m a tio n i s p re s e rv e d in need n o t b e e n te re d in to t h e c o n t a i n e d r e g i o n ' s n e ig h b o u r c o d e , an d t h e o t h e r ' s c o d e , w h e re i t c o u ld c a u s e c o n s i d ­ e r a b l e b o o k - k e e p in g p r o b le m s a t some l a t e r s ta g e ." We i g n o r e i n t e r n a l r e g i o n s w hen f o rm in g t h e c o d e ; t h a t d o e s n o t m ean t h a t t h e r e g i o n s o n t h e in s i d e r e c e iv e no c o n s i d e r a t i o n , n o r t h a t t h e i r r e l a t i o n s h i p w ith t h e i r e n c l o s i n g n e ig h b o u r i s n o t r e c o r d e d , b u t t h a t s u c h c o n s i d e r a t i o n i s p e r ­ fo rm e d when we i n s p e c t t h e e n c l o s e d r e g i o n s ' o u t s i d e n e ig h b o u r s . c o n s i s t e n t r e p r e s e n ta tio n o f th e r e g io n s p a c e , i t For a i s , h o w e v e r, important t o t r a v e r s e e a c h r e g i o n ' s b o u n d a ry i n t h e sam e d i r e c t i o n ( i . e . e ith e r a ll c lo c k w is e o r a l l a n t i - c l o c k w i s e ) . T h e c o d e i s c y c l i c ; i t i s n o t i m p o r ta n t to s t a r t t h e t r a v e r s e w i t h a n y p a r t i c u l a r n e ig h b o u r . p i c t u r e m u st b e r e g a r d e d a s a r e g i o n th e p ic tu re , and i t s The edge o f th e t h a t s u r ro u n d s a l l th e r e g io n s in o c c u r r e n c e i n t h e n e ig h b o u r c o d e m u st b e r e c o r d e d ; i n t h i s w o rk , we h a v e a s s i g n e d t h e e d g e t h e r e g i o n n u m b er - 1 . t h e ed g e i s im p o r ta n t, a s we s h a l l s h o w .) The code i s o f t h e r e g i o n n u m b e rs o f n e ig h b o u r i n g r e g i o n s , fo rm e d o f t h e i r t y p e s , t e x t u r e s , e t c . (R e c o r d in g n o r m a l ly fo rm ed b u t may e q u a l l y w e l l b e I t a p p e a rs t o b e p o s s ib l e t o c o n ­ s t r u c t an u n a m b ig u o u s r e p r e s e n t a t i o n o f t h e s e g m e n te d p i c t u r e w i t h t h i s r e p r e s e n ta tio n , b u t I c an n o t p ro v e t h i s . NEIGHBOUR CODES. _ i.1 FORMING THE NEIGHBOUR CODE. We a s s i g n e a c h c o n n e c te d r e g i o n i n t h e se g m e n te d p i c t u r e a u n iq u e s y m b o l, c o n v e n t i o n a l l y a p o s i t i v e i n t e g e r , b y w h ic h we i d e n t i f y i t , w h ic h we u s e h e r e , we r e f e r t o th is sy m b o l a s t h e r e g i o n n u m b e r. The c o d e i s s t r u c ­ t u r e d a s f o l l o w s : a n e ig h b o u r t h a t a p p e a r s o n t h e b o u n d a ry o f .th e r e g i o n in q u e s tio n b e tw e e n i t is r e p re s e n te d once in t h e n e ig h b o u r c o d e f o r e a c h c o n t a c t an d t h e c e n t r a l r e g i o n , h o w ev er long th e b o u n d a ry on w hich th e y c o n ta c t . T h u s t h e f o l l o w i n g a r e n o t l e g a l n e ig h b o u r c o d e s : * 1 2 3 3 3 4 5 6 • 1 2 3 4 5 6 1 ( r e c a l l i n g t h a t th e code i s c y c lic • ). T he f o llo w i n g c o d e s a r e ,h o w e v e r . 1 2 3 4 3 5 6 1 2 3 4 1 5 6 7 I t s h o u ld b e n o t e d t h a t a c o d e o f t h e fo rm : 8 • is l e g a l , 1 2 3 4 3 4 5 b u t p o te n tia lly c o n fu sin g , a n d n o t m e a n in g f u l ( s e e f i g u r e 2 ) . T he i l l e g a l c o d e s o c c u r o c c a s i o n a l l y t h e m e rg in g p r o c e s s , an d r e q u i r e o n ly a s im p le c l e a n i n g - u p p r o c e s s : E NEIGHBOUR CODES. t h e a b o v e m e a n in g l e s s c o d e . m is r e p r e s e n t s Codes of th e form: I 2 3 4 3 4 5 a < .'"vl th e s p a c c , a n d co n a ri& c c o d e s c a n n o t , h o w e v e r, throi)f;l> i n c o r r e c t fo rrao L io n o f th o c o d c . a r i s e w hen t h e c o d e i s c o rr e c tly Such f o rm e d , o r t h e r e p r e s e n t a t i o n i t s e l f w o u ld n o t b e u s e f u l . We h a v e n o t s e e n b e f o r e t h e c o n fu sio n t h a t can a r is e o f w h e t h e r t h e se g m e n te d p i c t u r e i s w ill i l l u s t r a t e th e p o in t. as e ig h t- c o n n e c te d , its fro m t h e q u e s t i o n fo u r- o r e ig h t- c o n n e c te d . F ig u re 3 T h e p r o b le m i s s im p le ; i f we d e f i n e a r e g i o n n e ig h b o u r s m u st th e n b e f o u r - c o n n e c t e d . T he p r o b le m th e n a r i s e s t h a t i t i s n o t e a s y t o s a y i n c e r t a i n , c a s e s w h e th e r a p i x e l i s an o u t s i d e n e ig h b o u r o r a s m a ll e n c lo s e d r e g i o n . F o r tu n a te ly , we c a n s a y t h a t t h e i s s u e w i l l b e d e a l t w ith b y t h e l a b e l l e r , b y r e q u i r i n g th a t i t l a b e l c o n n e c te d r e g i o n s w i t h a s i n g l e l a b e l p e r r e g i o n ( a ll o w i n g i t t o d e c i d e w h e t h e r a p i x e l b e lo n g s o n i t s ow n, o r w i t h a c o n n e c te d r e ­ g io n ) a n d b y th e n in f o r m in g i t w h e t h e r i t s h o u ld d e f i n e e ig h t - c o n n e c t e d r e g io n s o r f o u r- c o n n e c te d r e g io n s . T h e l a t t e r d e c i s i o n we h a v e made a r ­ b i t r a r i l y : B e rg er ( 1 9 8 5 ) h a s b e e n a b l e t o p r o d u c e m e a n in g f u l c o d es se g m e n te d fro m th e (SP ID E R ,1 9 8 4 ) , a n d t h e r e p ic tu r e a p p e a rs to p ro d u ce d by a n e ig h b o u r package r o u tin e b e n o g o o d r e a s o n why h i s ro u tin e s s h o u ld n o t w o rk f o r f o u r - c o n n e c t e d r e g i o n s . I t w i l l b e s e e n when f i g u r e 3 i s c o n s u l t e d t h a t i t w h ic h d i r e c t i o n e a c h b o u n d a ry p i x e l ' s a r e f o rm in g t h e c o d e . g iv e n ( 'e r e c t i o n : i s a l s o im p o r t a n t i n n e ig h b o u r s a r e t r a v e r s e d when we We fo rm t h e c o d e b y t r a v e r s i n g t h e b o u n d a ry i n i f we h a v e d e f i n e d com p lem en t ( t h e r e s t o f t h e p i c t u r e ) th e re g io n as e ig h t- c o n n e c te d , a its i s t h e n f o u r - c o n n e c t e d , s o we m u st th e n i n s p e c t e a c h b o u n d a ry p i x e l ' s f o u r n e ig h b o u r s . T he t r a v e r s e o f t h e s e f o u r n e ig h b o u r s m u st b e p e rf o rm e d i n t h e c o r r e c t d i r e c t i o n , s t a r t i n g in t h e r e g i o n w hose n e ig h b o u r c o d e we a r e 'f o r m i n g , a s f a i l i n g t o d o t h i s w i l l l e a d t o s p u r io u s r e v e r s a l s i n t h e c o d e . NEIGHBOUR CODES. F o r e x am p le : • i n loimSr.g a c o d e , v c c a n jnc3u.dc> e a c h n c jg lib o u r p i x e l and tlio n c l e a n t h e c o d a u p , by c o m p re s s in g e a c h r u n c f r e g i o n n u m b e rs t o a s i n g l e m em ber, an d s u p p r e s s i n g t h e r e g i o n num ber a t t h e end o f t h e c o d e i f i t i s t h e same a s t h a t a t t h e b e g in n in g , s o t h a t - 1 1 1 2 2 1 33 3 4 4 4 5 5 5 6 6 6 1 1 1 b eco m es • h o w e v e r, i f we h a v e m i s t r a v e r s e d p i x e l s , we may g e t - 1 1 1 2 1 2 2 3 2 3 3 4 3 4 4 5 4 5 5 5 6 5 6 6 6 w h ic h i s u n m a n a g e a b le an d c e r t a i n l y e v e n w ith c l e a n i n g - u p c o u ld n o t r e p r e s e n t a s e t o f c o n n e c te d r e g i o n s o n a p l a n e . R e feren c e t o f i g u r e s 2 a n d 3 s h o u ld rem o ve a n y c o n f u s i o n . If, h o w e v e r, we c a n n o t m e rg e two regions using t h e i r n e ig h b o u r c o d e s a l o n e ' t o f i n d t h e c o d e f o r t h e c o m p o s ite r e g i o n , t h e r e p r e s e n t a t i o n is of little th e case, u se. F o r some tim e i t u n til a s u ffic ie n tly a p p e a r e d t h a t t h i s was in d e e d p o w erfu l a lg o r i t h m w as d e v e lo p e d .. T h e m e rg in g o f c o d e s i s n o t co m p lex u n l e s s t h e tw o c a n d i d a t e r e g i o n s i/ill fo rm a c o m p o s ite t h a t e n c l o s e s a n o th e r s e t o f r e g i o n s , w h ic h w e re n o t p r e v i o u s l y e n c l o s e d , i n w h ic h c a s e t h e p r o b le m a p p e a r s t h a t it i s n o t e a s y t o t e l l w h ic h o f t h e g r o u p s r e p r e s e n t e d i n t h e c o d es w i l l be e n c lo s e d . .NEIGHBOUR CODES. We s h a l l e x am in e t h e s im p le c a s e f i r s t . % % r A pixel's 4 " n e i g h b o u r s A pixels S - n & l^ h b o u r s A region -is n - c o n n z c t& d if one. m a y ra o c h a m j one. p o int in i t fro m a n y other; by a p a th w h o se next of th e c u r r e n t m e m b e r. m c rn b e r is ur, n - n e i a h b o u r If we t r a v e r s e pixels a s A . vnc will see. I f w e trav e rse pixels a s B, w e wi)l s e e If we Fie.3 -travarsfc pixels o s C, t h e o ^ d th e n 3 a < ja m . 5 , 2 a n d th e n 5 , 4 5 a g a i 'n . code, willbe c o r re c t. The importance o f the direction of pixel travarsal. • GJvcsi t l i e i we w ish t o m e rg e r e g i o n s 3 an d 2 w ith c o d e s 6 an d 7 8 1 9 c o m p o s ite 2 3 r e s p e c t i v e l y , an d t h a t 1 i s t h e s e n i o r r e g i o n w ill be c a lle d 1, an d we a r e m e rg in g 2 t o 4 5 ( th e 1) , bo p r o d u c e t h e c o d e f o r t h e c o m p o s ite , We r o t a t e e a c h r e g i o n ' s c o d e ‘ s u c h t h a t t h e o t h e r m e rg e c a n d i d a t e a p p e a r s i n t h e f r o n t o f t h e c o d e , s o t h a t we g e t • — fo r 1 : 2 3 4 5 6 - fo r 2 : 1 9 7 8 . We th e n rem o v e fro m e a c h c o d e t h e f i r s t m em ber, and w r i te one c o d e a f t e r t h e o t h e r ( i t i s n o t im p o r t a n t w h ic h c o d e i s w r i t t e n f irs t) an d t h i s b eco m e s t h e c o d e f o r t h e c o m p o s ite . So we g e t : 3 4 5 6 9 7 6 We now c o n s i d e r t h e m o re i n t e r e s t i n g c a s e w h e re t h e m erg e c a n d i d a t e s w ilt, e n c l o s e o n e o r m o re s e t s o f r e g i o n s w hen m e rg e d . On r e f l e c t i o n , o r o n c o n s u l t a t i o n o f f i g u r e 4 , i t w i l l b e s e e n t h a t when t h e r e g io n s w ill ti m e s . tim e s, e n c lo s e n s e t s o f r e g i o n s , th e y w i l l c o n t a c t e a c h o t h e r n +1 T h u s , e a c h c a n d i d a t e w i l l r e f e r t o t h e o t h e r i n i t s 'c o d e n+1 an d o n l y o n e o f t h e g r o u p s o f r e g io n s d e lim ite d by th e se r e f e r e n c e s w i l l r e f e r t o r e g io n s t h a t w i l l b e on th e o u ts id e o f th e c o m p o s ite r e g i o n : th e o th e r gro u p s r e f e r to e n c l o s e d a n d h e n c e s h o u ld n o t a p p e a r i n t h e f e r e n t i a t e b e tw e e n t h e s e g r o u p s ? NEIGHBOUR CODES. re g io n s t h a t w i l l be code. How d o we d i f ­ It is in f a c t f a i r l y s im p le t o f i n d w h ic h g r o u p s o f r e g i o n s a r e e n ­ c l o s e d when we n o t i c e e n c lo s e d in e ac h s e t . t h a t o n ly a f in ite n u m b er o f r e g i o n s c a n b e A lso i m p o r ta n t I s t h e f a c t c h a t we may 'c h a i n ' a c r o s s t h e r e p r e s e n t a t i o n t o f i n d a r e g i o n w h ic h h a s t h e e d g e o f t h e p ic tu r e a s a n e ig h b o u r, s im p ly b y r e c o r d i n g a ll t h e n e ig h b o u r s o f o u r g iv e n r e g i o n , a n d t h e i r n e ig h b o u r s , a n d s o o n , u n t i l we f i n d t h e edge. T he a l g o r i t h m t o m e rg e n e ig h b o u r c o d e s w i t h e n c lo s e d r e g i o n s c a n th e n be e x p re s s e d a s ; • R o t a t e b o th c o d e s s o t h a t t h e i r f i r s t member i s t h e o t h e r m erg e c a n d id a te . a g r o u p o f r e g i o n s b e tw e e n t h e f i r s t We t h e n h a v e an d t h e s e c o n d i n s t a n c e o f t h e c o d e s , w h ic h we r e c o r d s e p a r a t e l y f o r each code. • Now we w is h t o d e c i d e f o r e a c h c a n d i d a t e w h e th e r t h i s g r o u p r e ­ p r e s e n ts a n e n c lo s e d r e g io n o r n o t. b e c o n s id e re d s e p a r a t e ly N o tic e t h a t t h e g r o u p s m ust f o r e a c h c a n d i d a t e a s we h a v e n o way o f k n o w in g w h e t h e r t h e g r o u p s c o r r e s p o n d t o t h e s s v e s e t o f r e ­ g io n s . We t h e n , f o r e a c h g r o u p , lo o k f o r t h e e d g e o f t h e p i c t u r e i n t h e m a n n er d e s c r i b e d a b o v e : i f we f i n d i t , th e n t h e g r o u p m u st r e p r e s e n t a n o u t s i d e g ro u p ;, i f we d o n o t , b u t r a t h e r e n u m e r a te a f in ite s e t o f r e g io n s (w h e re no new r e g io n s a re found by lo o k i n g a t new r e g i o n s ' n e ig h b o u r c o d e s , a n d a f t e r a w h ile t h e r e a r e o n l y r e g i o n s w h o se n e ig h b o u r c o d e s h a v e b e e n in s p c J L) th e n we h a v e an i n s i d e g r o u p . • I f t h e g r o u p w as an i n s i d e g r o u p , we d i s c a r d j t b y r o t a t i n g t h e co d e so t h a t th e seco n d NEIGHBOUR CODES. in s ta n c e o f th e o th e r c a n d id a te i s in 2J .s id e group, wo di&card thi i f t h e c o d e , and t h a t c o d e i s r e a d y f o r m e rg in g . r e a d y f o r m e rg in g , ( e a c h w i l l h a v e O nly i n s t a n c e o f t h e o t h e r c a n d i d a t e 's r e g i o n n u m b e r) th e y way m erg ed is- s im p le c o d e s . F i g u r e s 4 a n d 5 may c l a r i f y t h i s e x p l a n a t i o n . Our p i c t u r e h a s p r o d u c e d t h e We g i v e a n e x am p le b e lo w . f o llo w i n g n e ig h b o u r c o d e s : (we in d ic a te th e edge) w is h t o m e rg e r e g i o n s 3 The f i r s t g r o u p f o r 4 i s 1 2 (3 i s n o t i n c lu d e d ; we a r e m e rg in g s a l l g r o u p s w o u ld th e n b e o u ts id e g r o u p s ) . Now f o r L n e ig h b o u r s - 1 3 an d 2 : i s a c a n d i d a t e , an d i s i g n o r e d ) t t -1 i n d i c a t e s t h e g ro u p i s 't h e w a n t, a n d t h e c o d e f o r 4 beco m es: (4 fig .4 "Iwo reg io n s c o n ta c tin g in n+1 p oin ts enclosing ■n se ts cf nzgions. The in s id e , g r o u p : o b ta in in g • n e w c o rito a rv rn fis.5 o n lu os we n e ig h b o u rs , 5 Q nd 6. Thz, n e ig h b o u r co d e example. m erg in g T he f i r s t g ro up f o r 3 i s 5 6 a n d n o ru-k" iv ig h b o u r.s arc: io u n d fro ir LhcbO r e g i o n s ' c o d e s , ( i g n o r i n g 3 a n d 4 f o r t h e sam e r e a s o n s a s a b o v e ) s o t h a t tK 'is g r o u p i s ail e n c lo s e d g r o u p an d we may rem ove i t fro m t h e c o d e and g e t f o r 3: Now we may m e rg e 4 a n d 3 c o n v e n t i o n a l l y . T h is r e p r e s e n ta tio n is im p le m e n te d f a i r l y s im p ly b y k e e p in g a t a b l e o f t h e c o d e s , a n d a c r o s s - r e f e r e n c e t a b l e i n w h ic h we may s t o r e i n f o r m a ti o n a s t o w h ic h r e g i o n h a s b e e n m e rg e d t o w h ic h . CONCLUSION. t h e p o w er o f t h e n e ig h b o u r c o d e r e p r e s e n t a t i o n is th e s im p lif ic a tio n p r o v i d e s i h t h e repres»!>V .»^*on o f t h e s e g m e n te d p i c t u r e . it T h e c o d e s form a r e p r e s e n t a t i o n i n w h ic i, f t I s s im p le t o m e rg e r e g i o n s , a n d w h ic h i s i n g e n eral b e tte r - s u ite d to t h e n e e d s o f a k n o w le d g e - in te n s iv e s y s te m th a n i s t h e c o n v e n t i o n a l r e p r e s e n t a t i o n o f t h e se g m e n te d p i c t u r e . NEIGHBOUR CODES. . 31 THE PARADIGM AND ITS USE. In th is a u t h o r 's o p in io n , liv i n g sy s te m s , and i s v is io n is a f u n c t i o n v e r y d e e p ly e m bedded i n n o t c o rre c tly d e s c rib e d a s an i n t e l l i g e n t T h e p r o b le m o f g e n e r a l s c e n e a n a l y s i s d o e s h o w e v e r seem t o re q u ire a c t. fo r i t s s o l u t i o n t h e e m p lo y m e n t o f some fo rm o f k n o w le d g e , w h ic h a p p e a r s i n ­ t r i n s i c t o m o st s e e in g I tf e - f o r m s . A lth o u g h we c la im t h a t k n o w le d g e w i l l h a v e t o b e e m p lo y e d t o p r o d u c e a g e n e r a l s c e n e - a n a l y s i s s y s te m , we c a n n o t c la im t h a t t h i s k n o w le d g e w i l l b e e a s y t o fin d , o r to e x p re ss. I t seem s l i k e l y t o o t h a t t h e K S 's w i l l p r o l i f e r a t e , a n d t h e r e se em s t o b e n o g o o d r e a s o n f o r e x p e c t i n g t h a t t h e k n o w le d g e b a s e w i l l n o t h o ld i n t e r n a l c o n ­ tra d ic tio n s . W ith t h i s i n m in d , we s t i l l f s e l i t p r o d u c tiv e t o p ro p o se a new p a r a d ig m , t h e m o t i v a t i o n f o r w h ic h h a s b e e n g iv e n a b o v e , i n w h ic h s c e n e s may b e a n a l y s e d i n a k n o w l e d g e - i n t e n s i v e f a s h i o n . GUIDING CO N C EPTS: THE PARADIGM ITSELF. T he m a jo r t e n e t , a n d t h e th e m e o f t h i s d i s s e r t a t i o n , i s t h e b e l i e f t h a t p i c t u r e s s h o u ld b e a n a ly s e d i n te rm s o f e x p l i c i t k n o w le d g e a b o u t p i c t u r e s , an d a b o u t w h at o b j e c t s lo o k m o d e ls made o f t h e p i c t u r e . l i k e on p i c t u r e s , r a t h e r th a n i n te r m s of A m o d el o f th e . w o r l d m u st b e u s e d , t o h a v e s u f f i c i e n t k n o w le d g e t o i n t e r p r e t t h e p i c t u r e , b u t th e p ic tu r e need n o t b e m o d e lle d , s c t h a t p i c t u r e - l e v e l o p e r a t i o n s may b e g u id e d b y k n o w le d g e b o th a b o u t t h e p i c t u r e a n d a b o u t t h e w o r l d . THE PARADIGM AND ITS USE. T he se c o n d t e n e t i s t h a t t h e p i c t u r e m u st b e h a n d le d i n te rm s o f r e g i o n s : th is is im p o r ta n t, as g ro w in g d o n o t e a s i l y th e p ro c e s s e s o f ed g e d e te c tio n and o f o u t l i n e a llo w b a c k t r a c k i n g t o i n c o r p o r a t e w o rld k n o w le d g e . T h is t e n e t a ssu m e s t h a t a s e g m e n t e r i s a v a i l a b l e , t h a t i s a b l e t o se g m e n t th e p ic tu r e such t h a t e ac h d e fin e d p r im it iv e o ne re g io n . is r e p r e s e n te d by a t le a s t We e n v i s a g e b a c k t r a c k i n g t o t h e l e v e l o f u n d o in g i n c o r r e c t m e rg e s ; we d o n o t a t p r e s e n t s e e b a c k t r a c k i n g t o t a t i o n o f th e p i c t u r e a le v e l o f a rese g m e n ­ ( a l t h o u g h t h i s c o u ld b e a c h i e v e d , m ore s im p ly t h a n b y t h e p r o c e s s w h ic h w o u ld a p p ly i f t h e p i c t u r e h a d b e e n i n t e r p r e t e d i n te rm s o f i t s e d g e s ) . T he em ploym ent o f k n o w le d g e s h o u ld o c c u r a t m any l e v e l s , fro m p l a n n i n g t h e p r o c e s s b y w h ic h p r i m i t i v e s a r e m e rg e d , t o u s i n g t h e c o n t e x t i n w h ic h t h e p i c t u r e i s p r e s e n t e d t o r e d u c e t h e q u a n t i t y o f k n o w le d g e r e q u i r e d t o in te r p re t i t . How th e n d o we i n t e n d a s y s te m t o f i n d a g iv e n o b j e c t i n a s c e n e ? it m u st red u c e th e d e s c r ip tio n of th e o b je c t u n d e r s t a n d s , u s i n g t h e k n o w le d g e a v a i l a b l e t o i t . I t m u st t h e n f i n d t h e s e p r i m i t i v e s , w i t h t h e r e l a t i o n s h i p s b e tw e e n p r i m i t i v e s If it F irs tly , ‘o p r i m i t i v e s w h i- , i t th a t i t r e q u ir e s . c a n n o t f i n d a l l o f t h e r e q u i r e d p r i m i t i v e s , i t s h o u ld i n s p e c t , t h e s e t w h ic h i t h as, a n d d e c i d e w h e th e r i t can s t i l l re a so n a b ly f in d o b j e c t b y l e n i e n t r e c l a s s i f i c a t i o n o f som e r e g i o n s . th e T h u s , t h e s y s te m h a s a d e f in e d g o a l s t r u c t u r e , w h ic h w i l l b e a s f o l l o w s : • F in d o u t w h a t s h o u ld b e f o u n d i n t h e p i c t u r e ( i . e . f i n d t h e m a in sy s te m g o a l ) . THE PARADIGM AND ITS USE. • F a c to r t h i s g o al i n to a l i s t o f p r im it iv e s and a d e s c r ip tio n o f s tru c tu re , u s in g a v a i l a b l e k n o w le d g e . t h e s y s te m i s e n t i t l e d t o f a i l . If th is is im p o s s ib le , (How -w ould a human r e s p o n d when a s k e d t o f i n d a n o b j e c t i n a s c e n e , w hen h e d o e s n o t know w h at t h a t o b j e c t lo o k s l i k e , a n d t h e r e a r e m o re t h a n o n e unknow n o b ­ j e c t s in th e sc en e ?) • Now f i n d a s m any o f t h e s e p r i m i t i v e s i n t h e s c e n e a s p o s s i b l e , b y u s i n g k n o w le d g e t o g e n e r a t e a n d t e s t m e rg e s o f p o s s i b l e c a n ­ d id a te r e g io n s , and t o c l a s s i f y th e s e r e g io n s o r g ro u p s o f r e - • F in a lly ^ , f in d a g ro u p o f p r im it iv e s th e resp o n d s to th e s tr u c tu r a l d e s c r ip tio n s t r u c t u r e o f w h ic h c o r ­ s to r e d ; if a p r o m is in g g r o u p i s m i s s i n g a p r i r . V t i v e , a t te m p t t o f i n d i t b y r e c l a s s i f y i n g r e g i o n s w h e re t h e p r im itiv e is s t r u c tu r e o f th e o b je c t lik e ly to o c cu r. in d ic a te s th a t th e I f t h i s g r o u p c a n b e f o u n d , th e s y s te m g o a l h a s b e e n f o u n d , a n d t h e n e x t g o a l w ay b e r e q u e s t e d . We h a v e s e e n t h a t t h e u s e o f r e g i o n s s h o u ld b a c k tr a c k in g i s s im p lif ie d , and th e b e e n p r o d u c e d u n d e r t h e new p a r a d ig m . a s y s te m ? THE PARADIGM AND ITS USE. s im p lify th e p ro ce ss, as s y s te m u s e s k n o w le d g e ; t h u s , i t h a s B u t w h a t i s t h e s t r u c t u r e o f su c h A SYSTEM DESIGNED TO ANALYSE SCENES T he t a s k o f t h i s s y s te m w i l l b e t o f i n d a g iv e n o b j e c t t o say t h a t th e o b je c t i s n o t in in a p ic tu re , or t h e p i c t u r e , b y e x a m in in g r e g i o n s a n d g ro u p s o f r e g io n s w ith th e in t e n t i o n o f f in d in g a g ro u p t h a t b e s t c o r r e ­ sp o n d s t o t h e o b j e c t r e q u i r e d . s y s te m g o a l . ) (We w i l l r e f e r t o t h i s o b j e c t a s t h e m ain T h e s y s te m s h o u ld b e a b l e t o e v a l u a t e i t s a t t e m p t s t o m erge r e g i o n s t o fo rm p r i m i t i v e s , a n d t o p l a n a b e s t c o u r s e o f a c t i o n b y w h ic h i t . s h o u l d b e a b l e t o f i n d t h e m a in s y s te m g o a l . To a c h ie v t h e s e a im s , t h e s y s te m w i l l u s e k n o w le d g e , T he s y s te m w i l l , th e n , have a 'l e d g e b a s e , w h ic h w i l l n e e d t o c o n t a i n b o th w o r l d k n o w le d g e e n d p i c t u r e - l e v e l " k n o w le d g e . T h e s y s te m w i l l c o n s i s t o f s e c t i o n s , w h ic h w i l l b e s e l f - c o n t a i n e d , e n d w h ic h we s h a l l c a l l K n o w le d g e -A p p lic a tio n B lo c k s o r K A B 's. d i f f e r e n t f o n a o f k n o w le d g e , t h e e n t i r e k n o w le d g e b a s e . E ac h KAB w i l l r e f e r t o a n d u s e a and w i l l n o t in g e n e r a l r e q u ir e acc ess to H ow ever t h e KAB w h ic h u s e s w o r l d k n o w le d g e t o f a c t o r t h e m a in s y s te m g o a l may n e e d a t some s t a g e t o h a v e a i o r c o f c o n t r o l e x e r c is e d on i t s k n o w le d g e b a s e , t o p r e v e n t i t And we h a v e d i s c u s s e d t h e a v a i l a b l e s t r a t e g i e s w o u ld a p p e a r t h a t t h e b e s t s t r a t e g y c o r d in g t o i t s is above; fro m s a t u r a t i n g . in t h i s case, it t o o r d e r t h e k n o w le d g e b a s e a c ­ r e l e v a n c e t o t h e m a in s y s te m g o a l . T h u s, in a s e a rc h f o r a t e l e p h o n e , k n o w le d g e a b o u t h a n d s e t s w i l l b e made m o re a c c e s s i b l e t h a n . ' kn o w le d g e a b o u t h a n d s . We r e f e r t o t h e k n o w le d g e c o n v e y e d b y t h i s ty p e o f s t r a t e g y a s " c o n t e x t u a l k n o w le d g e " , a s i t i s k n o w le d g e a b o u t t h e c o n ­ t e x t i n w h ic h t h e p i c t u r e a p p e a r s . As we h a v e s a i d , e a s y t o im p le m e n t t h i s fo rm o f k n o w le d g e m an ag e m en t. t h u s y s te m i s show n i n f i g u r e 6 . THE PARADIGM AND ITS USE. it d oes n o t appear A b lo c k d ia g ra m o f K n o w le d g e - a p p lic a t io n b l o c k s , w i t h t h e i r Fis, 6 A system designed undar the new paradigm . r e l e v a n t k n o w le d g e b a s e s , a r e shown a s c i r c l e s , a n d t h e flo w o f in f o r m a ­ t i o n i s shown b y a r r o w s . KAB co n tro l T h e d u t i e s o f e a c h KAB w i l l b e d e s c r i b e d b e lo w . DUTIES T h is b lo c k w i l l recom m end c h a n g e s o f c o n t e x t a n d w i l l m anage t h e p r o c e s s b y w h ic h c o n t r o l i s p a s s e d fro m KAB t o KAB. c o n te x t se le c t T h is b l o c k w i l l p r o v i d e c o n t e x t u a l i n f o r m a t i o n b y o r d e r i n g t h e k n o w le d g e b a s e . goal s t r u c t u r e s e tu p T h is b lo c k w i l l p u t to g e th e r a g o a l s t r u c t u r e t o a llo w t h e f i n d i n g o f c o m p le x s t r u c t u r e s b y f i n d i n g t h e i r c o m p o n e n ts , u s i n g a v a i l a b l e w o rld k n o w le d g e , an d w i l l in f o r m t h e a c t i o n e v a lu a to r a s to s t r u c t u r e s s h o u ld b e f o u n d w h e r e , w h ic h i f n e c e ssa ry by le n ie n t c la s s ific a tio n . actio n e v a lu a te T h i s b lo c k w i l l e v a l u a t e te r m s any m erge s u g g e s te d in o f t h e p r o p e r t i e s o f t h e m erg ed r e g i o n a n d o f w h a t i s b e in g s o u g h t. ac tio n p a th e v a lu a te T h is b lo c k w i l l e v a l u a t e a s e r i e s o f m e rg in g d e c i ­ s io n s in te rm s k n o w le d g e , of p ic tu re k n o w le d g e and p o s e d m e rg e i n te rm s o f t h e o t h e r m e rg e s fro m THE PARADIGM AND ITS USE. it. w o rld a n d w i l l recom m end o r p e n a l i z e a p r o ­ . It a ris in g s h o u ld b e a b l e t o d e c id e b e tw e e n tw o 5kV p o s s i b l e m e rg e d e c i s i o n s i n te rm s o f t h e i r o v e r a l l e ffe c t, an d th e n r e p o r t t o t h e p a t h p l a n n e r . G iv e n a r e g i o n w ith g i v e n p h y s i c a l p r o p e r t i e s , t h i s b lo c k w i l l d e c id e w h at i t T h is b lo c k w i l l a l s o is lik e ly a tte m p t t o to r e p re s e n t. la b e l s e ts o f r e ­ g i o n s , g iv e n a p p e a r a n c e a n d s t r u c t u r a l in f o r m a t i o n . T h i s b lo c k w i l l p r o v i d e a m e rg in g p l a n t o m e e t t h e g o al s tru c tu re , and w i l l o f f e r a lte r n a tiv e p a th s t o th e a c tio n p a th e v a lu a to r . m erg e T hus, i t w ill i n t e r a c t w ith th e a c tio n p a th e v a lu a to r t o p ro v id e an o v e r a ll s t r a t e g y . T h i s b lo c k w i l l t a k e t h s a c t i o n s recom m ended b y t h e p a th e v a lu a to r . A s y s te m s t r u c t u r e d a s d e s c r i b e d a b o v e s h o u ld b e a b l e t o a n a l y s e f a i r l y g e n e r a l s c e n e s ; h o w e v e r, it w ill c o n s t r u c t , a n d w o u ld a p p e a r t o n iq u e s d e s c r i b e d be >s % s o p h is tic a te d th e p r e s e n t l i t e r a t u r e . To i l l u s t r a t e f u n c tio n in g sc en e . • of th e th e in te n tio n of th is sys'.rftn w hen r e q u i r e d te c h n i q u e s to c a p a b i l i t i e s o f th e te c h ­ U s e f u l in f o r m a t i o n o b t a i n e d b y p r o t o t y p i n g a s y s te m w i t h som e o f t h e s y s te m . th e in re q u ir e b e bey o n d th e s h o u ld fe a tu re s o f th is d e s i g n , wo s h a l l d e s c r i b e to f in d a te le p h o n e in a We a ssu m e a b l a c k d i a l t e l e p h o n e f o r a r g u m e n t's s a k e . T he g o a l s t r u c t u r e se tu p 'K A B P i l l r e c e i v e t h e m a in s y s te m g o a l , an d f a c t o r it, f o r a r g u m e n t’s s a k e , " h a n d s e t " , a n d ’’h a n d s e t c o r d " . THE PARADIGM A N D ‘ITS USE. in to " b o d y " , '"b o d y "B o d y " w i l l b e f a c t o r e d c o rd " , a g a in i n t o " d i a l " an d "m ain b o d y " ; t h e o t h e r s u b - g o a ] s w i l l b e r e g a r d e d as p rim itiv e s . Thf, p r i m i t i v e s a re d e s c rib e d a s f o llo w s , fo r s im p lic ity : PRIMITIVE DESCRIPTION b od y co rd d a rk , lo n g a n d t h i n , s m a ll,- lew r e f l e c t a n c e , low te x tu re , h an d set d a rk , b a n a n a -sh a p e d , m e d iu m -siz e d , medium r e f l e c t a n c e , low t e x t u r e . h a n d se t c o rd d a r k , lo n g a n d c o i l e d , s m a l l , medium r e f l e c t a n c e , m edium t e x t u r e . d ia l light, round with holes, m e d iu m - s iz e d , medium r e f l e c t a n c e , low t e x t u r e . m a in b o d y The p i c t u r e d a r k , s q u a r e , l a r g e , low r e f l e c t a n c e , low t e x t u r e . is th e n s e g m e n te d , an d t h e c o n t r o l KAB w i l l pass c o n t r o l t o t h e p a t h p l a n n e r KAB, w h ic h w i l l p r o v i d e a p a t h o f . ( 'i i i s t y p e : f i n d a n y r e g i o n s w h ic h a r e p r i m i t i v e s i n th e m s e lv e s ; t h e n g e n a v s te m e rg e s b e tw e e n d a r k n e ig h b o u r i n g r e g i o n s . T est t h e s e m e rg e s w i t h t h e a c t i o n p a t h e v a l u a t e KAB, w h ic h w i l l te s 'c in d iv i d u a l c a s e s w ith th e a c tio n e v a l u a t e KAB. i s t o m e rg e to w a rd s a t l e a s t o d e p r i m i t i v e . THE PARADIGM AND ITS U M , T he in te n tio n - A ssu m in g t h a t a p r i m i t i v e h a s b e e n f o u n d , so y th e h a n d s e t c o r d , t h e p a t h p l a n n e r KAB w i l l p a s s t h e a c t i o n p a t h e v a l u a t e KAB t h i s i n f o r m a t i o n , b y in f o r m in g i t t h a t t h e h a n d s e t i t s e l f is lik e ly t o b e f o u n d a s a n e ig h b o u r , o r a s a g r o u p c o n t a i n i n g a n e ig h b o u r , of th is p r im itiv e . S im ila r in f o r m a tio n w i l l be p a s s e d f o r th e "m a in b o d y " p r i m i t i v e . A ssume t h a t w i t h t h i s new in f o r m a t i o n , t h e " m a in b o d y " p r i m i t i v e i s now f o u n d . T h e p a t h p l a n KAB now may p a s s t o t h e a c t i o n p a t h e v a l u a t e b lo c k a new s t r a t e g y , w h e re t h e l i k e l y p o s i t i o n o f t h e d i a l i s a ssu m e d , an d t h e l i k e l y p o s i t i o n o f t h e c o r d i s o f f e r e d . b o d y c o r d i s now f o u n d : t h e h a n d s e t i s s t i l l A ssume t h a t t h e la c k in g . T h e c o n t r o l KAB w i l l now p a s s c o n t r o l t o t h e g o a l s t r u c t u r e s e t u p KAB, w h ic h w i l l i n s p e c t i t s w o rld k n o w le d g e a n d in f o r m t h e p a t h p l a n n e r KAB, th r o u g h t h e c o n t r o l KAB, t h a t t h e h a n d s e t may b e e i t h e r o n t h e m a in b o d y , a t t h e o t h e r e n d o f t h e h a n d s e t c o r d , o r a b s e n t, w ith lik e lih o o d s f o r e a c h s i t u a t i o n . F in a lly , t h e p a t h p l a n n e r , h a v in g h a d a m erg e p a t h a c c e p te d b y t h e a c t i o n p a t h e v a l u a t e KAB, a n d w i t h t h e l a b e l e tte m p '; KAB n o t h a v in g f o u n d t h e h a n d s e t u s i n g t h i s p a th , w ill p a ss th e e n tir e s e t o f r e g i o n s t o t h e l a b e l a t te m p t KAB, a s i t know s t h a t i t n e e d not f in d a h a n d s e t. T h e l a b e l a t t e m p t KAB w i l l t h e n u s e know ­ le d g e l e f t t o i t b y t h e g o a l s t r u c t u r e s e t u p b lo c k KAB t o l a b e l t h e s e t o f r e g i o n s (w h ic h a r e a l s o p r i m i t i v e s : we m e rg e r e g io n s in t h e r e p r e s e n t a t i o n i n t h e p r o c e s s o f m e rg in g u p t o t h e p r im ­ itiv e fin d le v e l, a n d o n ly s tr u c tu re s ) THE PARADIGM AND ITS (JSE. as i n a s c r a t c h p a d fo rm w hen we a t te m p t t o a te le p h o n e . * I f th is la b e llin g a tte m p t fa ils , th » p ro c e ss s t a r t s a g a i n , w ith a d i f f e r e n t s e t o f d a rk re g io n s b e in g t r i e d a s a s t a r t to th e p r o c e s s . I t c a n b e s e e n t h a t t o a l a r g e e x t e n t t h e c o n t r o l KAB a c t s a s a s c h e d u l e r : in fa c t, in th e p r o to ty p e , th e c o n tro l KAB h a s b e e n im p le m e n te d b y s t r u c t u r i n g t h e w ay t h a t t h e KAB's a r e in v o k e d , r a t h e r th a n b y c o n f i g u r i n g e s e p a r a t e KAB. T he s y s te m a s d e s c r i b e d s h o u ld b e a b l e t o a n a l y s e s c e n e s w ith c o n s i d e r a b l e g e n e r a l i t y , i f i t c a n b e im p le m e n te d e f f e c t i v e l y . C e rta in ly , th e s tr u c ­ t u r e o f tbs» s y s te m i s s u c h t h a t i f i t i s a b l e t o a n a l y s e a s c e n e , i t w i l l b e a b le t o a n a ly s e a t l e a s t a c la s s o f s c e n e s . T h e r e a r e , h o w e v e r, p o ­ t e n t i a l p r o b le m s w i t h t h i s d e s i g n . P O T E N T I A L PROBLEMS It m u st b e r e a l i s e d a t o n c e t h a t t h e d e s i g n d e s c r i b e d i s p a p e r d e s ig n . a p e n c i l an d I t i s t h e p r o d u c t o f v e r y r e c e n t th o u g h t , an d h a s n o t b e e n ' p r o v e n , im p le m e n te d , o r d e e p ly t e s t e d , a n d a s s u c h s h o u ld b e e x p e c te d t o have e r r o r s in i t . A v e r y s im p le v e r s i o n o f t h i s sy s te m h a s b e e n p r o t o ­ t y p e d , b u t , a lth o u g h i t show s p r o m iu in g c h a r a c t e r i s t i c s , i t d o e s n o t p r o v e th e v a l i d i t y o f th e d e s ig n . f e e ls i t sc en e a n a ly s i s ; re s u lts . V is io n i s a co m p lex a c t i v i t y , a n d t h i s a u th o r u n l i k e l y t h a t t h e d e s ig n p r e s e n t e d h a s s o lv e d t h e it is p r e s e n te d p r o b le m of a s a new a p p r o a c h , w h ic h p r o m is e s good I am c o n f i d e n t t h a t t h e t e n e t s o f t h e p a ra d ig m p r e s e n t e d a r e s o u n d , h o w e v e r, a n d t h a t t h e y a r e p o t e n t i a l l y p r o d u c t i v e . THE PARADIGM AND ITS USE. 40 T h e k n o w le d g e b a s e i s lik e ly to i t s g ro w th may b e c o n t r o l l e d . s y s te m s i s be huge, and i t i s n o t e a s y t o s e e how T he k n o w le d g e w h ic h d r i v e s human v i s i o n n o t k n o w n , an d i t may b e s o d e e p ly 'e m b e d d ed t h a t t o d i s c o v e r i t a t a l l w i l l r e q u i r e a r o u n d a b o u t a p p r o a c h i n v o l v i n g an o p e r a t o r g r a d in g t h e r e s p o n s e o f t h e s y s te m t o s c e n e s . I t i s n o t a fo rg o n e c o n c lu s io n t h a t t h i s k n o w le d g e c a n b e d i s c o v e r e d a t a l l , a lth o u g h i t d o e s n o t a p p e a r im ­ p o s s ib le . T h e r e s u l t s o f t h e l^ . o t o t y p i n g e x e r c i s e a r e d e s c r i b e d b e lo w , a n d i t w i l l be sh o w n th e re th a t hope e x is ts fo r th e p r o d u c tio n of a .g e n e r a l s c e n e - a n a l y s i s s y s te m . CONCLUSION A p a ra d ig m f o r t h e a n a l y s i s o f g e n e r a l s c e n e s h a s b e e n d e s c r i b e d , a n d we h a v e show n t h e d e s i g n o f a s y s te m t h a t w i l l p e r f o r m t h i s t a s k u n d e r t h i s p a ra d ig m . C r i t i c i s m s o f t h e p a ra d ig m a n d o f t h e d e s ig n h a v e b e e n p r e ­ s e n te d , b u t i t is f e l t th a t fu rth e r w o r t h w h i le g o a l . THE PARADIGM AND ITS U S E . d e v e lo p m e n t o f th is s y s te m 'i s a THE DESIGN OF THE PROTOTYPE SYSTEM. T h e s y s te m d e s c r i b e d above h a s b e en p ro to ty p e d in a v e r y l i m i t e d fo rm , i n a n a tte m p t t o d e m o n s tr a te t h e v a l i d i t y o f t h e p a ra d ig m an d t o show t h a t u s e f u l s y s te m s may b e d e s i g n e d w i t h i n s tr u c t e d w ith e v e ry s i m p l i f i c a t i o n it. t h e r e a d e r w i l l h a v e g a t h e r e d fro m t h e is s u e s have been s id e s te p p e d . scen es, is a n d t h e n e ig h b o u r c o d e im p le m e n te d i n t h i s p r o to ty p e h e r e , and i t s t o a llo w i t s c o n s tru c tio n ; in tr o d u c tio n t h a t many co m p lex T h e p r o t o t y p e , a lth o u g h n o t y e t a n a l y s i n g s h o w in g some p r o m is e , has been e ff e c tiv e ly T he p r o t o t y p e h a s b e e n c o n ­ p o s s ib le , it. r e p re s e n ta tio n We w i l l d i s c u s s t h e d e s ig n o f im p l e m e n ta tio n a n d t h e r e s u l t s t h a t s u p p o r t t h e v a l i d i t y o f t h e p a ra d ig m i n a l a t e r c h a p t e r . T h e p r o t o t y p e w as i n t e n d e d , n o t t o d i s p l a y t h e m ore a d v a n c e d o f t h e c o n ­ c e p ts d is c u s s e d above, nor to t e s t t h e w h o le o f t h e s t r u c t u r e o f t h e s y s te m d e s c r i b e d a b o v e , b u t t o d e m o n s tr a te t h e d e s i r a b i l i t y o f c o n t i n u i n g w ith w o rk o f t h i s p a ra d ig m w ith s c rib e d above. th e ty p e i n th is in te n tio n fie ld and, in th is o f t h e d e s ig n d e ­ As a r e s u l t , n o t. a l l t h e KAB's w e r e im p le m e n te d , an d th o s e t h a t w e r e , w e re im p le m e n te d i n a l i m i t e d w ere: m o re p a r t i c u l a r l y , o f s h o w in g t h e v a l i d i t y g o a l s tr u c tu re s e tu p ( c a lle d fo rm . T h e KAB's im p le m e n te d f g o a l ) , a c tio n p a th e v a lu a te , a c tio n e v a l u a t e , a c t o r a n d a fo rm o f l a b e l a t te m p t ( g t m e r ) . T h , 'd e s i g n o f t h e p r o t o t y p e w i l l b e d i s c u s s e d u n d e r f o u r h e a d in g s : t h e b lo c k d e s i g n o f t h e s y s te m , t h e d e s i g n o f t h e d a t a s t r u c t u r e s , t h e d e s ig n o f t h e r u l e s , an d t h e a l g o r i t h m s u s e d i n t h e K A B 's. THE DESIGN OF THE PROTOTYPE SYSTEM. P ictu re dcdo. fis . 7 Block diagram of system. the prototype THE BLOCK DESIGN OF THE PROTOTYPE SYSTEM. We h a v e s i m p l i f i e d t h e c o n s t r u c t i o n o f t h e s y s te m d e s c r i b e d a b o v e b y d i ­ v id in g th e d u tie s r e s p e c tiv e ly : o f t h e KAB's i n t o tw o c l e a r b l o c k s , w h o se d u t i e s a r e f i n d t h e d e s c r i p t i o n o f t h e m ain s y s te m g o a l i n te rm s o f p r im it iv e s , ta d fin d th e g o a l d e s c rib e d in th e p ic tu r e . we c a l l f g o a l , t h e s e c o n d g tm e r . T h e f i r s t b lo c k We w i l l d e s c r i b e h e r e t h e d u t i e s an d t h e t e c h n i q u e s u s e d i n t h e s e b l o c k s , a s w e l l a s t h e tw o o t h e r b lo c k s t h e s y s te m has in h e rite d fro m its i m p l e m e n ta tio n : s ta r t, in its , a nd th e lo a d e r , m r in t. R e f e r t o f i g u r e 7 , w h ic h show s t h e b lo c k d ia g ra m o f t h e p r o t o t y p e s y s te m ; t h e im p l e m e n ta tio n h a s r e q u i r e d t h e i n t r o d u c t i o n o f a f u r t h e r b l o c k , n o t show n o n t h e f i g u r e , f o r i n i t i a l i s i n g d a t a s t r u c t u r e s . N o te t h a t we do n o t h a v e h e r e a s i t u a t i o n w h e re e a c h b l o c k a c t s o n d a t a , a n d t h e n p a s s e s t h i s d a t a t o a f u r t h e r b lo c k ( h e n c e t h e fo rm o f t h e b lo c k d i a g r a m ) . s te a d , th e l o a d e r , known a s m r i n t ( t h e p ro g ra m n a m e ), In ­ l o a d s e a c h b lo c k a s a s e g m e n t u n t i l t h e b lo c k t e r m i n a t e s , in f o r m in g t h e lo a d e r w h ic h b lo c k i s to be used n e x t. E ac h b l o c k m u st t h e n t e r m i n a t e , h a v in g c h a n g e d t h e sy s te m v a r i a b l e w h ic h in f o r m s m r i n t w h ic h b lo c k s h o u ld b e lo a d e d n e x t (we c a ll th is t h e s y s te m b l o c k c o n t e x t , " o r SB C ). T h us t h e o p e r a t i o n o f t h e s y s te m i s a s f o l l o w s : • To s t a r t t h e s y s te m , m r i n t i s in v o k e d . d is k , w ith o u t c o n s u ltin g In tu r n m rin t r e t r i e v e s t h e SBC, t h e p i c t u r e re p re s e n ta tio n from le ft t h e r e b y t h e r e p r e s e n t e r p r o g ra m , a n d th e n lo a d s t h e i n i t s b l c k ( n o t show n i n fig u re 7 ) , w h ic h i n i t i a l i s e s th e s y s te m d a t a s t r u c t u r e s . ‘ T h is b l o c k w i l l a lw a y s t e r m i n a t e " h a p p y " , u n l e s s t h e r e a r e h a rd w a r e THE DESIGN OF THE PROTOTYPE SYSTEM. e r r o r s , an d w i l l n o t f l f f e c l t h e SBC. T h e SBC is th e n s e t t o s ta rt by m r in t. • M r in t th e n r e tr ie v e s th e firs t KS fro m d i s k . E ach KS f i e l d , a n d i f t h i s f i e l d d o e s n o t a g r e e w ith t h e c u r r e n t i s d i s c a r d e d , a n d t h e n e x t KS r e t r i e v e d . h a s a n SBC SBC, t h e KS T he SBC a t t h i s s t a g e w i l l b e " s t o r k " , avid w h e n .a KS i s f o u n d w ith t h i s v a lu e i n i t s t h e s t a r t b l o c k i s in v o k e d , a n d t h e KS p a s s e d t o i t . h a s f i n i s h e d w i t h t h e K S, i t r e t u r n s c o n t r o l t o SBC f i e l d , When t h i s b lo c k m r in t. T he p ro c e s s c o n t i n u e s u n t i l t h e s t a r t b l o c k c h a n g e s t h e SBC, w h ic h i t w i l l a lw a y s change to " fg o a l" . • T h e SBC i s now " f g o a l " ; m r i n t w i l l c o n t i n u e t o in v o k e K S 's , d i s c a r d th e m i f t h e i r SBC f i e l d d o e s n o t a g r e e w i t h t h e c u r r e n t SBC, a n d lo a d t h e a p p r o p r i a t e b lo c k i f i t d o e s . A f t e r i t h a s b e e n p a s s e d a num ber o f K S 's , f g o a l w i l l t e r m i n a t e . I f i t h a s b e e n a b l e t o d i s c h a r g e i t s d u t i e s , i t w i l l c h a n g e t h e SBC t o " g tm e r " ; i f i t h a s n 't , i t w i l l n o t to u c h t h e SBC, b u t w i l l in f o r m m r i n t t h a t i t h a s f n i l e d . M r in t w i l l , in tu rn , f a i l . • I f t h e SBC i s now " g tm e r " , g tm e r w i l l b e lo a d e d an d w i l l r u n e a c h tim e a KS w i t h t h i s SBC field is loaded. When it i n its d u t i e s , g tm s r w i l l s e t t h e SBC t o h a lt. tu rn has d is c h a rg e d " f i n i s h " , a n d t h e s y s te m w i l l *'fJ T h u s , e a c h tim e a KS i s r e t r i e v e d w i t h i t s SBC f i e l d e q u a l t o t h e c u r r e n t SBC, t h e a p p r o p r i a t e b l o c k w i l l b e lo a d e d , w i l l o p e r a t e o n t h e KS, and w i l l t h e n t e r m i n a t e , c h a n g in g t h e c u r r e n t SBC i f KS i s th e n r e t r i e v e d .. THE DESIGN OF THE PROTOTYPE SYSTEM. a p p ro p ria te . T he n e x t I t can be se en t h a t t h i s s tr a te g y i s e q u i v a l e n t Vo u s i n g a num ber o f i n ­ d e p e n d e n t k n o w le d g e b a s e d s y s te m s w h ic h in te r c o m m u n ic a te . It is , how­ e v e r , s lo w e r a s , i f we u s e t h e l a t t e r s t r a t e g y b e c a u s e we r e q u i r e c e r t a i n o p e ra tio n s to b e p e r f o r m e d b e f o r e o t h e r s , we may p i p e l i n i n g t o i n c r e a s e t h e s y s te m ’ s s p e e d . c a tio n is s u e s a re s im p lif ie d ^ as a ll im p le m e n t a fo rm o' W ith t h i s s t r a t e g y , com m uni­ s y s te m d a ta b l o c k s , a n d a r e t h e n a v a i l a b l e t o a n y lo a d e d b l o c k . a re h e ld i n common N o te t h a t t h e lo a d e r a p p r o a c h i s n o t i d e a l l y s i m p l e ; t h e o r i g i n a l i n t e n t i o n w as t o c o n s tru c t a s i n g l e p r o g ra m , w i t h b lo c k s im p le m e n te d a s p r o c e d u r e s , a n d t h e p r e s e n t T h is w as n o t p o s s i b l e , a s i t le d t o code t h a t e x c e e d e d t h e a v a i l a b l e c o d a s p a c e i n t h e c o m p u te r u s e d . l o a d e r a *.>zm of case b l o c k . T he d u t i e s o f t h e b l o c k s w i l l now b e d e s c r i b e d . T he f i r s t b l o c k in v o k e d b y t h e m a in s y s te m i s t h e i n i t s b l o c k , w h ic h e x ­ is ts e n tire ly a s a r e s u l t o f th e im p l e m e n ta tio n of th e s y s te m . T he m in ic o m p u te r o n w h ic h t h e s y s te m w as im p le m e n te d h a s a n a d d r e s s r a n g e o f o n ly 32K w o r d s , w h ic h m eans t h a t a n y p ro g ra m t h a t c o m p ile s down t o g r e a t e r t h a n 3 2 k w o rd s ( p ro g ra m a n d d a t a ) c a n n o t b e r u n . T h e s y s te m w as im p le ­ m e n te d u s i n g a c t i v e d a t a s t r u c t u r e s , w h e re e a c h d a t a s t r u c t u r e i s im p le ­ m e n te d a s a p r o c e d u r e w i t h o p e r a t o r s d e fin e d as p a ra m e te rs; th e d a ta s t r u c t u r e s r e q u i r e i n i t i a l i s a t i o n , w h ic h w as im p le m e n te d a s an. o p e r a t o r , d e fin e d o n th e s t r u c t u r e . T o w ard s t h e e n d of t h e p r o t o t y p i n g p h a s e , t h e c o d e b e g a n t o c o m p ile down t o m o re t h a n 3 2 k , v i t h t h e r e s u l t t h a t t h e c o d e had t o b e s e g m e n te d , s o t h a t s e p a r a t e s e g a a n s s o f c o d e w e re lo a d e d i n t o th e co d e S pace b y m r in t, and r u n . I t w as f e l t t h a t i t w o u ld b e s im p le r t o c o l l e c t a l l t h e d a t a - s t r u c t u r e p r o c e d u r e s i n t o a se g m e n t w h ose s i n g l e d u ty w as t o in itia lis e th em ( t h e d a t a th e m s e lv e s b e in g k e p t i n common) t h a n t o ad d c o d e t h a t w o u ld i n i t i a l i s e t h e s t r u c t u r e s t o t h e m a in p ro g ra m . THE DESIGN OP THE PROTOTYPE SYSTEM. T h is se g m e n t i s i n i t s , w h ic h i s u s e d o n ly t o i n i t i a l i s e th o s e s y s te m d a ta s tr u c tu re s th a t re q u ir e i t . T h e s e c o n d b l o c k t h a t a r i s e s f r o a t h e im p l e m e n ta tio n o f t h e s y s te m i s t h e s t a r t b lo c k -, w h ic h w o u ld i n KAB, a l b e i t a m in o r o n e . f a c t be a p a r t o f th e g o a l s tr u c t u r e s e tu p A t t h i s s t a g e , t h e s t a r t b lo c k i s u s e d o n l y t o r e c o v e r t h e m a in s y s te m g o a l ; i t se em e d p o s s i b l e t h a t i t w o u ld b e r e q u i r e d fo r o th e r fu n c tio n s , a n d w as t h u s im p le m e n te d a s a c o m p le te k n o w le d g e b a sed b lo c k , a s th e i n f r a s t r u c t u r e e x is te d . T h u s t h e o n ly tw o r u l e s (in t h i s c a s e th e y a r e m o re l i k e r u l e s o r la n g u a g e s t a t e m e n t s th a n K S 's ) t h a t e x is t i n s t a r t a re : • A lw ays r e c o v e r t h e m a in s y s te m g o a l , and • a lw a y s c h a n g e SBC t o ( g o a l . I t w i l l b e se en t h a t , in t h i s c a s e , th e o rd e r o f t h e i r e x e c u tio n i s im ­ p o r ta n t. We h a v e d i s c u s s e d m r i n t a b o v e : t h e d u t i e s o f t h i s b lo c k a r e s im p le , b e in g a n o th e r b lo c k th a t has a ris e n fro m t h e im p l e m e n ta tio n o f t h e s y s te m . M r in t i s r e q u i r e d t o r e t r i e v e fro m d i s k t h e r e p r e s e n t a t i o n o f t h e p i c t u r e , a n d t o s e t u p t h e s y s te m d a t a s t r u c t u r e s t h a t c o n t a i n t h i s r e p r e s e n t a t i o n . It th e n p ro ce ss lo a d s i n i t s and, when o f l o a d i n g K S 's . l o a d s t h e b lo c k i n d i c a t e d b y * ' .■ M r in t s t e p s th r o u g h th e th a t b lo c k has .te ra itiite d , b e g in s th e I f a n SBC f i e l d m a tc h e s t h e c u r r e n t SBC, i t . SBC h a s c h a n g e d t o " f i n i s h • • - r e n t SBC a n d w a i t s f o r i t t o c o m p le t e , if, o n e , an d c o n tin u e s t o d o s o u n t i l t h e f h i s s t a g e , i t p r o c e e d s t o s t e p th r o u g h THE DESIGN OF THE PROTOTYPE SYSTEM. th e K S 's w i t h o u t l o a d in g an y b lo c k , b u t t h i s is as a re s u lt of m essy c o d in g - i t c o u ld a s e a s i l y t e r m i n a t e . We come now t o t h e i n t e r e s t i n g b l o c k s ; we w i l l d i s c u s s f g o a l f i r s t . T he d u ty o f t h i s b l o c k i s t o f a c t o r t h e m a in s y s te m g o a l i n t o p r i m i t i v e s ', an d t o k e e p a r e c o r d o f t h e s t r u c t u r e o f t h e m ain s y s te m g o a l i n te rm s o f t h e s e p r i m i t i v e s , u s i n g th e te c h n i q u e s we s h a l l d e s c r i b e b e lo w . and s t r u c t u r a l d e s c r i p t i o n s e r e n c e b y g tm e r . The p r im it iv e a r e k e p t i n s y s te m d a t a s t r u c t u r e s f o r r e f ­ T h e p r o c e s s b y w h ic h t h i s b lo c k i s in v o k e d m akes i t s e x e c u t i o n p a r t i c u l a r l y s lo w , a s i t i s u n a b le t o s e a r c h t h e k n o w le d g e b a s e a c t i v e l y , b u t m u st a c c e p t o r r e j e c t K S 's a s th e y a r e p a s s e d t o i t . i s u n f o r t u n a t e , b u t t h e se g m e n t w as s im p ly e a s i e r t o T h is im p lem e n t i n t h i s fa s h io n . T he s e c o n d m a jo r b l o c k , g tm e r , is re q u ire d to u se s c r i p t i o n s p r o v id e d b y f g o a l an d t o m erg e r e g i o n s t o th e p rim itiv e de­ fo rm t h e s e p r i m i ­ t i v e s , b y g e n e r a t i n g a n d t e s t i n g m e rg e s ( h e n c e i t s n a m e ) . T h is b l o c k w i l l th e n g e n e r a te g ro u p s o f r e g io n s a s c a n d id a te s f o r s t r u c t u r e , and w i l l t e s t th em a g a i n s t t h e s t r u c t u r a l d e s c r i p t i o n s s t o r e d b y f g o a l . te s t has been u sed e v a lu a te .s tru c tu re is h tr i n te n d e d t o u s e a fo rm o f t h a t t e c h n i q u e , w i t h g r e a t e r s o p h i s t i c a t i o n t h a n t h i s b lo c k . n e ig h b o u r code in fr a s tr u c tu re . G e n e r a te arid a s a t e c h n i q u e , a s t h e p a t h p l a n / a c t i o n p a th m e rg in g in f r a s tr u c tu re , _ as a lb e it T he b lo c k contains all t h e w e ll as th e KS e v a l u a t i o n -V By now t h e r e a d e r s h o u ld u n d e r s t a n d t h e h i g h - l e v e l d e s ig n o f t h e p r o t o ­ t y p e , a n d we s h a l l b e g in t o d i s c u s s th 6 m ore s o l i d d e s i g n i s s u e s . THE DESIGN OF THE PROTOTYPE SYSTEM. 4.7 THE DESIGN OF THE DATA STRU CTURES. In a s y s te m o f t h i s p lo y e d . k in d , it is im p o r t a n t t h a t d a t a o r e c o r r e c t l y em­ T he s y s te m r e q u i r e s tw o m a jo r c a t e g o r i e s o f d a t a : a r e em p lo y ed w i t h i n a b l o c k w h ile i t t h e n e x t tim e t h e b lo c k i s in v o k e d . S im p le d a t a i s ru n n in g , and w i l l n o t be needed S y stem d a t a a r e r e q u ir e d e i t h e r by m ore t h a n o n e b l o c k , o r b y o n e b l o c k o n m ore t h a n o n e o c c a s i o n . We w i l l d e s c r i b e o n ly t h e l a t t e r d a t a s t r u c t u r e s : t h e f o rm e r a r e d e s c r i b e d w h e re n e c e s s a r y w h e re t h e b l o c k s a r e d e s c r i b e d / We r e q u i r e t h e f o l l o w i n g s y s te m d a t a s t r u c t u r e s : • a s t r u c t u r e t o s t o r e a ctiuir _ . d e s c r ip tio n o f th e s tr u c t u r e o f t h e m a in s y s te m g o a l , • / / • a structure into which s u b - g o a l s t h a t h a v e b e en f o u n d may b e d e m o te d , a n d w h e re a r e c o r d o f s e t s o f r e g i o n s t h a t m a tc h th em may b e k e p t , a n d f i n a l l y , s t r u c t u r e s f o r t h e f g o a t b lo c k t o u s e a s a s c r a t c h p a d w h ile e x ­ p a n d in g a g o a l . We u s e t h e te r m " s y s te m s u b - i '- a l" t o re fe r to a name ( o f e i t h e r a com­ p o s i t e o r a p r i m i t i v e ) t h a t is? n ;> * st o f t h e s t r u c t u r e o f t h e m ain s y s te m g o a l , a n d h a s n o t b e e n e x p a n tir ^ . firs t, We w i l l d i s c u s s t h e la tte r s tru c tu re s a s th e y a r e im p o r t a n t t o t h e d i s c u s s i o n o f t h e o t h e r s . THE DESIGN OF THij PROTOTYPE SYSTEM. 48 T h e r e a r e tw o s t r u c t u r e s u se d by f g o e l a s a s c r a t c h p a d : th e f i r s t , s y s te m c o m p o s ite l i s t , u se d t o k e e p t r a c k o f th e . is th e sy s te m s u b - g o a l s ,and t h e s e c o n d , t h e s y s te m p r i m i t i v e 1 ' s t , i s u s e d t o k e e p t r a c k o f t h e s y s te m p rim itiv e s . lis t T he s y s te m fo rw a rd - lin k e d l i s t ; c o m p o s ite move a n e le m e n t fro m a l i s t i n in s p e c tio n of has been im p le m e n te d as a t h i s s t r u c t u r e h a s b e e n u s e d a s i t i s s im p le t o r e ­ f la g s ,, e way t h a t d o e s n o t o rre s h u f f lin g of re c o rd s, im p ed e is n e c e s s a r y .) s e a r c h i n g . (No T he s t r u c t u r e c o n t a i n s t h e n am es o f a l l u n e x p a n d e d n am es i n t h e f a c t o r i n g o f t h e m a in sy s te m g o a l . T h u s , i t c o n t a i n s a l i s t o f t h e o b j e c t s w h o se d e ­ f i n i t i o n s t h e s y s te m s t i l l r e q u i r e s , an d i f a name d o e s n o t a p p e a r i n t h i s lis t, a KS d e s c r i b i n g a n o b j e c t o f t h a t name i s n o t o f i n t e r e s t t o f g o a l . T he s y s te m p r i m i t i v e l i s t c o n t a i n s t h e d e s c r i p t i o n o f a l l p r i m i t i v e s w h ic h h a v e b e e n e n c o u n te r e d i n f a c t o r i n g t h e m a in s y s te m g o a l , a n d w h o se n am es w ere p a r t o f t h e s y s te m c o m p o s ite l i s t w hen th e y w e re e n c o u n te r e d l i s t i s n o t i n f a c t a lin k e d lis t, as i t is n o t se arch e d in t h i s T h is fo rm , b u t i s a s im p le ran d o m a c c e s s s t r u c t u r e . T he s t r u c t u r e o f t h e m a in s y s te m g o a l i s s t o r e d i n t h e s t r u c t u r a l l i s t . I t i s im p le m e n te d a s a f o r w a r d li n k e d l i s t , th r e e s t a c k s , a nd a lin k e d f o r t h e s y s te m p r i m i t i v e lis t. T h e e le m e n ts t a k e t h e fo rm d e s c r i b e d b e ­ c a u s e o f t h e s t r u c t u r e o f t h e K S 's , w h o se e v a lu a tio n i s e a c h e le m e n t b e in g a s e t o f l i s t b e in g c h o s e n t o r t h e same r e a s o n s g iv e n s i m p l i f i e d by th e u s e s y n ta x i s such o f s ta c k s .T h u s, t h a t h a s listen r e c o r d e d m u st b e e v a l u a t e d f o r a set th a t th e ir when a s t r u c t u r e o f r e g io n s , th e a p ­ p r o p r i a t e r e c o r d fro m t h e l i s t i s lo a d e d i n t o t h e e v a l u a t i n g p r o c e d u r e 's s t a c k s , and t h e KS may b e e v a l u a t e d . The n e e d f o r a s t r u c t u r e i n t o w h ic h s u b - g o a l s t h a t h a v e b e e n f o u n d may b e d e m o te d , a n d w h e re a r e c o r d o f s e t s o f r e g i o n s t h a t m atch th em 'm ay b e THE DESIGN OF THE PROTOTYPE SYSTEM. 49 k e p t w i l l becom e a p p a r e n t when t h e a l g o r i t h m s b y w h ic h t h e b lo c k s o p e r a t e a r e d e s c r i b e d ; we w i l l c a l l it th e s t r u c t u r a l p r im it iv e lis t. It is a s im p le a r r a y o f r e c o r d s , w i t h a . " n e x t r e c o r d " p o i n t e r b e in g m a in ta in e d , as re c o rd s a re n o t d e le te d , becom e a p p a r e n t . an d g a rb a g e c o l l e c t i o n o v e r h e a d s E ac h r e c o r d c o n t a i n s a f i e l d w ill not i n w h ic h t h e nam e o f th e new p r i m i t i v e ( t h a t i s , e i t h e r a t r u e p r i m i t i v e , o r a c o m p o s ite t o w h ic h a m a tc h h a s b e e r o b t a i n e d ) is s to r e d , an d a f i e l d i n w h ic h t h e n u m b ers o f t h e r e g i o n s w h ic h m a tc h t h i s new p r i m i t i v e ' s d e s c r i p t i o n , a r e s t o r e d . T he s y s te m d a t a s t r u c t u r e s a r e i m p o r ta n t t o t h e f u n c t i o n i n g o f t h e b lo c k a lg o rith m s . We h a v e d e s c r i b e d t h e s e s t r u c t u r e s , a lg o r i t h m s when we h a v e d i s c u s s e d a n o t h e r s u b j e c t and w i l l d e s c r ib e th e i m p o r ta n t to u n d e r­ s t a n d i n g t h e a l g o r i t h m s , t h e s y n t a x o f t h e K S 's . THE SYNTAX AND STRUCTURE OF THE KNOWLEDGE S b U R C E S . I t i s t r i t e t h a t a r e s t r i c t i v e a n d c a r e f u l l y - c h o s e n s y n ta x w i l l i n g e n e r a l le a d to a la n g u a g e w h ic h i s s im p le t o im p le m e n t. T h e k n o w le d g e s o u r c e s c a n b e t h o u g h t o f a s f o rm in g a s im p le la n g u a g e , b y w h ic h t h e a p p e a ra n c e o f o b j e c t s i n p i c t u r e s may b e d e s c r i b e d , s o we h a v e u s e d t h e a b o v e p r i n ­ c i p l e i n t h e i r d e s i g n t o s i m p l i f y t h e u s e o f t h e K S 's . T h e i r s y n ta x h a s b e e n d e s ig n e d w i t h s i m p l i c i t y o f im p l e m e n ta tio n b e in g t h e p r im e c o n s i d ­ e ra tio n . A KS c o n t a i n s f ie ld , an d fo u r f ie ld s : an a c tio n a n u m b er f i e l d , fie ld , in THE DESIGN OF THE PROTOTYPE SYSTEM. an SBC f i e l d , th a t * o rd er. We a have c o n d itio n used th e " c o n d i t i o n - a c t i o n " te r m in o lo g y h e r e f o r s i m p l i c i t y , an d a r e a w a re o f i t s i n c o n s i s t e n c y w i t h t h e d i s l i k e o f t h e r u l e s te r m in o lo g y e x p r e s s e d a b o v e . T he u s e o f t h e S»C f i e l d h a s b e en e x p l a i n e d a b o v e : t h e n u m b er f i e l d is u s e d t o make t h e s y s te m e r r o r m e ssa g e s m o re m e a n in g f u l, s o t h a t t h e u s e r knows i n w h ic h KS t h e s y s te m h a s f a i l e d . T h e u s e s o f t h e c o n d i t i o n and a c t i o n f i e l d s w i l l b e e x p l a i n e d b e lo w . T h e co n d itio n f ie ld . T he c o n d i t i o n f i e l d c o n s is ts o f a s e t o f c o n d itio n s lin k e d by lo g ic a l o p e r a t o r s , f o rm in g a l o g i c a l e x p r e s s i o n , w h ic h im p l i e s t h e a c t i o n f i e l d . '■Sti g e n e r a l , if b lo c k t h e r u l e th e c o n d itio n f ie ld i s t r u e , t h e n , d e p e n d in g o n i n w h ic h i s d e f in e d ,, e i t h e r t h e o b j e c t nam ed i n t h e a c t i o n f ie ld h a s b e e n f o u n d , o r t h e a c t i o n nam ed i n t h e a c t i o n f i e l d s h o u ld b e ta k e n . T he common e x p e r t s y s te m p r a c t i c e ( F o r e x a m p le , i n t h e MYCIN system d e ­ s c r i b e d b y B u c h an a n a n d S h o r t l i f f e ' ( 1 9 8 4 ) i s t o p r o v i d e o n l y t h e l o g i c a l o p e r a t o r AND i n t h e KS la n g u a g e . T h u s , i f we w is h t o e x p r e s s t h a t i t w i l l r a i n to m o rro w i f i t i s r a i n i n g t o d a y , o r i f i t i s o v e r c a s t t o d a y an d t h e b a r o m e te r i s f a llin g (1 d o n o t v o u c h f o r t h i s K S ), we w o u ld b e o b lig e d t o u s e tw o r u l e s , a n d s a y ; • • IF i t i s r a i n i n g t o d a y , THEN i t w i l l r a i n to m o rro w . IF i t i s o v e r c a s t t o d a y , AND t h e b a r o m e te r i s d r o p p in g , THEN i t w i l l ' r a i n to m o rro w . THE DESIGN OF THE PROTOTYPE SYSTEM. The OR o p e r a t o r i s th e n a c h ie v e d b e c a u s e e i t h e r o n e , o r b o t h , o f t h e K S 's may f i r e . We h a v e n o t u s e d t h i s t e c h n i q u e b e c a u s e o f t h e o p a c i t y i t le n d s t h e r u l e b a s e ( I t i s n o t e a s y t o s e e a t a. g la n c e j u s t w h at se g m e n t o f t h e ru le base r e la te s t o w h at c o n c lu s i o n .) , and b e c a u se p r o v is io n o f a f u l l s e t o f o p e r a t o r s i s n o t s im p le i n t h e r u l e s t r u c t u r e u s e d . We h a v e p r o v i d e d a s l o g i c a l o p e r a t o r s AND, OR, a n d NOT. e n title d to o n l y tw o o p e r a n d s , AND a n d OR a r e a n d NOT may h a v e o n ly o n e . n a y b e e x p r e s s i o n s , o r s im p le c o n d i t i o n s . T he o p e ra n d s The o p e r a to r s a r e e x p re s s e d i n p o s t - f i x n o t a t i o n , b e c a u s e i t i s e x tr e m e ly s im p le t o c o n s t r u c t a n i n ­ t e r p r e t e r f o r t h i s n o t a t i o n , o r i e n t e d a s i t i s to w a rd a s t a c k s t r u c t u r e . N e s t i n g i s a llo w e d t o a d e p th o f 2 0 , t h e l i m i t b e i n g im p o sed f o r p r a c t i c a l r e a s o n s o n ly . We h a v e m e n tio n e d a b o v e t h e i m p o r t a n t s i m p l i f i c a t i o n t h a t h a s b e e n u s e d in th e c o n s tr u c tio n o f th e c o n d itio n l i s t s y n ta x : We d o n o t a llo w a condition to be d e f i n e d b y t h e c o n d i t i o n l i s t o f o n e KS ( i . e . b y a p p e a r in g in its if t h e b lo c k t h a t u s e s t h e K S 's a t t e m p t s t o a c tio n fie ld ) and th e n t o b e u s e d b y a n o th e r KS a s a c o n d i t i o n , e v a l u a t e " them r a t h e r t h a n s t o r i n g th e m f o r s t r u c t u r a l i n f o r m a t i o n . to io m e d if - .'_ y T h is i s e q u i v a l e n t f o r b i d d i n g t h e u s e o f K S 's w h ic h r e q u i r e b a c k w a rd c h a i n i n g f o r t h v i r e v a l u a t i o n , i f t h e b lo c k - i n w h ic h t h e y a p p e a r e v a l u a t e s K S 's im m e d ia te ly , and i s a s i m p l i f i c a t i o n b e c a u s e w hen we e v a l u a t e K S 's , we m u st v a ria b le s f o r c o n d itio n e v a lu a tio n . k n o w le d g e base, d e fin e I f we th e n w is h t o c h a i n t h r o u g h t h e we m u st c a r r y t h e s e v a r i a b l e s . We w i l l t h u s i n c u r a c o n s id e r a b le o v e rh e a d t o no good p u r p o s e , a s , i f a c o n d i t i o n may b e d e ­ f i n e d i n t h e f a s h i o n we a r e f o r b i d d i n g , e i t h e r i t m u st b e c a p a b le O f b e in g re so lv e d ’in to an e x p re s s io n , o r, if it can n o t be re so lv e d , i t i s m ean­ i n g l e s s any h o w .■ T h u s we g a i n a t y p i n g o v e rh e a d i n e n t e r i n g K S 's b y lo s i n g THE DESIGN OF THE PROTOTYPE SYSTEM. a l a r g e c o d in g o v e r h e a d . An im p l e m e n ta tio n i n a la n g u a g e t h a t a llo w s r e c u r s io n w i l l n o t in c u r t h i s o v e rh e a d , as f a r as I can s e e . The s i t u a t i o n i s v e r y d i f f e r e n t when t h e b lo c k u s i n g t h e r u l e s u s e s them to re c o rd s tr u c tu re : in th is c a s e , t h e r u l e s a r e b e in g lo a d e d i n t o d a t a s t r u c t u r e s f o r f u t u r e r e f e r e n c e , a n d when th e y a r e b e in g e v a l u a t e d , th e y w i l l b e e v a l u a t e d i n a f o r w a r d - c h a i n i n g f a s h i o n , , t h e s y s te m h a v in g a l r e a d y d e c id e d w h at c o n d i t i o n s a r e p r i m i t i v e , s o t h e p r o b le m o f r e c o r d i n g v a r i ­ a b le s i s n o t a s s e v e re . A t t h e sam e ti m e , i n th is case i t is e s s e n tia l t o a llo w b a c k w a rd r e f e r e n c e s , a n d t h e o v e rh e a d i n c u r r e d i s m ore a c c e p t a - T h u s , f o r e x a m p le , t h e s y s te m o f K S 's show n b e lo w i s i l l e g a l (I do n o t v o u c h f o r t h e s e K S 's e i t h e r . ) : • I F i t i s o v e r c a s t AND t h e g a r d e n e r 's j o i n t s a r e aching,T H E N i t i s l i k e l y to rain. • IF it is lik e ly to r a i n AND t h e b a r o m e te r f a l l s , THEN i t is r a in in g . ■ B u t we may e a s i l y r e s o l v e t h e a b o v e s y s te m i n t o : e IF i t i s o v e r c a s t , AND t h e i g a r d e n e r 's j o i n t s a r e a c h in g AND t h e b a r o m e te r f a l l s , THEN i t i s r a i n i n g . C o n d i tio n s may h a v e u p t o s e v e n o p e ra n d s ( a r e s u l t o f t h e im p l e m e n ta tio n ; we h a v e n o t r e q u i r e d i n p r a c t i c e m ore th a n t h r e e ) , n o n e o f w h ic h may i t - THE DESIGN OF THE PROTOTYPE SYSTEM. . 53 s e l f be a c o n d itio n . T h is r e s u l t s i n a s i m p l i f i c a t i o n h a v e n o t im p lem e n te d v a r i a b l e - l e n g t h p a r a m e t e r l i s t s a g a in f o r t h e s a k e o f s i m p l i c i t y . of th t code. We f o r th e c o n d itio n s , New c o n d i t i o n s a r e e a s i l y d e f i n e d . T h e actio n fie ld . T he a c t i o n f i e l d ty p ic a lly c o n ta in s e i t h e r t h e name o f an a c t i o n ( w i th p a r a m e t e r s ) , t h a t m u st b e p e r f o r m e d , o r t h e name o f a n o b j e c t t h a t is b e i n g d e s c r i b e d b y t h e K S, w i t h a p a r a m e t e r t o s a y w h e th e r t h e o b j e c t i s c o m p o s ite o r p r i m i t i v e . M u l t i p l e a c t i o n n am es a r e n o t a llo w e d ( f o r im ­ p le m e n t a t i o n s i m p l i c i t y ) , a n d m u l t i p l e o h ' * n am es w o u ld b e m e a n in g l e s s . Exam ples o f ru le u s e . To t h i s p o i n t i t h a s b e e n i m p l ie d t h a t t h e to d e s c rib e o b je c ts an d t o same s t r u c t u r e h a s b e e n u s e d im p ly a c t i o n s ; t h i s f a c u l t y i s a c h ie v e d b y a s l i g h t l y d i f f e r e n t i n t e r p r e t a t i o n o f t h e s t a c k s g e n e r a te d b y t h e KS. ( n o tin g - th a t ttin d itio n and a c tio n f i e l d s a r e s e p a r a te d by a T hus and t h a t a c o n d i t i o n p a r a m e t e r l i s t i s e n c lo s e d i n d iam o n d b r a c k e t s , t o s i m p l i f y p a r s i n g t h e K S): ( ( ( ( (0N<LEG1, BODY> 0N<LEG2, B0DY>)A ON<LEG3,BODY>)A 0N<LEG4,B0DY>)A ON<BODY, IEAD>) A NEXT<HEAD,TRUNK>)A*ELEFNT<COMP> THE DESIGN OF THE PROTOTYPE SYSTEM. d e s c r i p t i o n o f an e l e p h a n t ; s a r e s u l t o f th e t h e name i s s p e lle d im p l e m e n ta tio n , nam es a r e e le f n t re q u ire d to n s ix le tte r s . T h e KS may b e d e s c r i b e d a s s a y i n g : a n o b j e c t , w i t h a s i n g l e b o d y s u p p o r te d b y f o u r d i s t i n c t l e g s , 'a n d w i t h a h e a d o n t h a t b o d y , a n d a t r u n k a t t a c h e d t o th e h e ad , i s an e le p h a n t. p o s ite : th a t i s , th e p a r ts I t s a y s a s w e l l t h a t a n e l e p h a n t i s a com­ i n te rm s o f w h ic h t h e e l e p h a n t i s d e s c r i b e d m u st th e m s e lv e s b e f a c t o r e d i n t o p r i m i t i v e s , w h ic h a r e d e s c r i b e d i n te rm s o f p ic tu re p ro p e rtie s . N o tic e t h a t t h e n u m e r i c a l t a g s appended t o nam es o f t h e e l e p h a n t p a r t s d e s c r i b e t h e s e p a r t s a s b e in g d i s t i n c t . e l e p h a n t m u st b y t h i s d e s c r i p t i o n h a v e f o u r l e g s . b e f o r e t h e k n o w le d g e b a s e i s th e The T he ta g s a re s tr ip p e d search e d fo r th e p a r t 's d e s c r ip tio n , as i t i s n o t a p p e a l i n g t o h a v e t o e n t e r K S 's d e s c r i b i n g I e g l , l e g 2 , l e g 3 , a n d s o K S 's t h a t d e s c r i b e p r i m i t i v e s , d e s c r i b e th e m i n te r m s o f p i c t u r e p ro p e rtie s . le v e l T h u s , a r o c k w o u ld b e d e s c r i b e d a s f o l l o w s : ((((SHAPE<DK> SIZE<DK>)A REFLEC<MEDIUM>)A TEXTUR<M£DIUM>)A CONCAV<HIGH>)A*ROCK<PRIM> T h is s a y s t h a t a r o c k h a s a n unknow n s h a p e a n d s i z e , a h i g h c o n c a v i t y (We use th is te r m to mean ti rag g e d o u tlin e .) r e f l e c t a n c e , and t h a t i t i s a p r im it iv e . lik e ly tiv e , it I t is an d a medium t e x t u r e and a c c e p te d t h a t t h e r e a r e t o b e p r o b le m s w i t h t h e in f o r m a t i o n g iv e n t o r e p r e s e n t t h e p r i m i ­ b u t a t th e p re se n t s ta te o f im p l e m e n ta tio n i t is s u f f i c i e n t , and i s o p e n t o e x p a n s io n . THE DESIGN OF THE PROTOTYPE SYSTEM. 55 T he f o llo w in g KS e x p r e s s e s an a c t i o n : (((((R0CK<R1,VERY> ROCK<CENTRE,Q+>)A (R0CK<R1,VERY> BACK<CENTRBvQ+>)A)0(. R0CK<S1,VE8Y> ROGK<CENTRE,DK>)0 RNN1«<CENTRE,1>>A*WERGE<C£OTRE,R1> n i l s r u l e s a y s t h a t i f t h e f i r s t r e g i o n i n a g iv e n r e g i o n ' s n e ig h b o u r c o d e b e lo n g s s t r o n g l y t o t h e r o c k c l a s s , an d t h e g iv e n r e g i o n i t s e l f b e lo n g s t o t h e r o c k c l a s s t o a d e g r e e o f q u i t e o r g r e a t e r , o r i f t h e g iv e n r e g i o n 's f i r s t n e ig h b o u r b e lo n g s s t r o n g l y t o t h e r o c k c l a s s , an d t h e r e g i o n i t s e l f b e lo n g s t o t h e b a c k g r o u n d c l a s s t o a d e g r e e o f q u i t e o r g r e a t e r , o r t h e g iv e n r e g i o n ' s f i r s t n e ig h b o u r b e lo n g s s t r o n g l y t o t h e ro c k c l a s s , and t h e g iv e n r e g i o n b e lo n g s t o t h e r o c k c l a s s t o a d e g re e o f d o n 't know , an d th e g iv e n r e g io n has o n ly n e ig h b o u r s h o u ld b e m e rg e d . one n e ig h b o u r , th e n th a t re g io n and its T h is i s t h e sam e a s s a y in g t h a t o n e may n o t h a v e r o c k s w i t h h o l e s i n th e m . An a l e r t r e a d e r w i l l h a v e n o t i c e d t h a t a s t h e n e ig h b o u r c o d e i s it- i s m e a n in g le s s t o r e f e r to th e f i r s t r e g io n in i t . c y c lic , W hat R1 i n f a c t r e f e r s t o i s a l l p o s s i b l e f i r s t re g io n s in th e c o d e : t h u s , by r e f e r r i n g t o R l a n d R3 re g io n . we may r e f e r t o a n y tw o r e g i o n s i n t h e c o d e o f f s e t b y o n e We w i l l d i s c u s s t h i s p o i n t i n g r e a t e r d e p th b e lo w . I t i s o b v io u s t h a t t h e KS f o r m a t i s e x tr e m e ly o p a q u e ; t h e s y s te m h a s n o t i n a n y way b e e n d e s ig n e d f o r a n u n s k i l l e d o p e r a t o r . It is of c o u rs e p o s s i b l e t o a t t a c h a n a t u r a l la n g u a g e i n t e r f a c e t o t h e p r e s e n t s im p le r u l e e d i t o r , b u t t h i s w as f e l t t o b e f a r b e y o n d t h e s c o p e o f t h i s p r o t o t y p e . THE DESIGN OF THE PROTOTYPE SYSTEM. We h a v e d i s c u s s e r t h e s y s te m b lo c k d ia g : an d t h e s y n t a x a n d s t r u c t u r e o f t h e K S 's r l t h m s u s e d b y t h e b lo c k s . THE ALGORITHMS USED W I T H I N T H E B L O C K S . T he a l g o r i t h m s u s e d b y t h e b l o c k s f g o a l a n d g tm e r t o d i s c h a r g e t h e i r d u ­ tie s w ill n o t b e p re s e n te d fo rm a lly , b u t w i l l be d e s c rib e d i n d e t a i l . T h ey a r e e s s e n t i a l l y f a i r l y s i m p l e , b u t a f o r m a l p r e s e n t a t i o n w o u ld i n ­ v o l v e a m ass o f u n im p o r ta n t d e t a i l , a n d .w o u ld c lo u d t h e i s s u e . d e s c r i b e how t h e s y s te m e v a l u a t e s a KS, how i t g o a l and s t o r e s its We w i l l f a c t o r s t h e m a in sy s te m s t r u c t u r a l d e s c r i p t i o n , how i t g e n e r a te s and t e s t s m e rg e s , an d how i t f o r w a r d c h a i n s t o t h e m a in s y s te m g o a l . T he l a s t a l ­ g o r ith m h a s n o t y e t b e e n im p le m e n te d , a n d a s s u c h i s n o t d e f i n i t e l y f r e e o f p r o b le m s . T h e b lo c k s b a s e d o n t h e o t h e r a lg o r i th m s w o rk , b u t t h i s d o e s n o t g u a ra n te e th e c o r r e c tn e s s o f th e a lg o rith m s . T h ese a lg o rith m s a r e n o t t r u l y f a i l - s a f e , im p le m e n te d code a re tr a p p e d and e r r o r - h a n d l i n g f a c i l i t i e s w hen we b u t e r r o r s e n c o u n te r e d b y t h e r e p o rte d ; d e s c rib e th e we w ill d e s c rib e im p l e m e n ta tio n of th e th e p ro to ty p e . THE DESIGN OF THE PROTOTYPE SYSTEM. i s , ■i ■ r.7 How th e p r o to ty p e e v a lu a te s a KS. We h a v e d i s c u s s e d a b o v e t h e s y n ta x a n d s t r u c t u r e o f t h e K S 's an d h a v e s a i d how t h e y h a v e b e e n o r d e a t e d t o s i m p l i f y e v a l u a t i o n o f t h e KS. We w i l l show h e r e j u s t how th e y s i m p l i f y t h i s p r o c e s s , an d how t h e s t a c k - o r i e n t e d s t r u c t u r e o f t h e K S 's s i m p l i f i e s t h e i r im p l e m e n ta tio n . T h e p r o c e s s o f KS e v a l u a t i o n b o i l s down t o f o u r s t e p s : • T h e K S 's m u st b e d e co m p o se d i n t o t h e i r s t a c k r e p r e s e n t a t i o n . • T h e c o n d i t i o n o p e r a n d s f o r e a c h c o n d i t i o n m u st b e f i x e d . • T h e c o n d i t i o n s th e m s e lv e s m u st b e e v a l u a t e d . • F in a lly , a l l t h e v a l u e s o f t h e c o n d i t i o n s m u st b e co m b in ed t o fo rm t h e v a l u e o f t h e KS. D e c o m p o s in g K S ’s : T he KS i s T h i s p r o c e s s i s im p le m e n te d b y a s im p le s t a t e m a c h in e . r e a d fro m b a c k t o fro n t ( th is le a d s t o t h e s t a c k s b e in g i n a m o re c o n v e n ie n t o r d e r , a n d t h e n am es a r e e a s i l y r e v e r s e d ) e ra to r ( " (" , o p e ra to r s ta c k . an d i f an o p ­ "A11, " 0 " o r "N ") i s e n c o u n te r e d , i t i s p u sh e d i n t o t h e T h e s t a r t o f a c o n d i t i o n f i d 'i d w i l l b e i n d i c a t e d by (rem em b er we a r e r e a d i n g t h e KS b a c k w a r d s , an d n o t i c e now t h e r e a s o n f o r u s i n g d iam o n d b r a c k e t s f o r d e l i m i t i n g c o n d i t i o n p a r a m e t e r l i s t s ) . ' A f t e r th is we le tte rs e x p ec t up t o s ix le tte rs , fo rm t h e name o f t h e r e v e rs e d and pu sh ed i n t o f o llo w e d b y a " , " or a th e s e l a s t o f t h e c o n d i t i o n o p e r a n d s , w h ic h t h e c o n d i t i o n o p e ra n d s t a c k . THE DESIGN OF THE PROTOTYPE SYSTEM. is I f th e d e lim ite r 38 e n c o u n tp ' i s a " , " th e n we c o n tin u e t o f i n d an d p u sh c o n d i t i o n o p e ra n d s u n t i l we e r u v n ' . e r a We d o n o t s t o r e th e d iam o n d b r a c k e t s o r th e com m as, n o r d o we d e l i m i t t h e o p e ra n d s i n t h e s t a c k a s b e lo n g in g t o s e p ­ a r a te c o n d itio n s . im p o s ed a t t h i s N e t s t h a t t h e l i m i t o f s e v e n c o n d i t i o n o p e ra n d s i s n o t p o in t. A KS e x c e e d in g t h i s lim it, t a i n i n g m ore o r f e w e r o p e r a n d s th a n a r e d e f i n e d o r a c o n d itio n con­ fo r i t , w ill cau se an e r r o r b a s e d o n t h e d i s a r r a y o f t h e c o n d i t i o n o p e ra n d s t a c k , a s t h e r e W ill be m o re , o r f e w e r o p e ra n d s th a n r e q u i r e d e n fo r c e s ty p in g on i t s in th e s ta c k . o p e r a n d s , t h e e r r o r s h o u ld be As t h e s y s te m re p o rte d w hen a c o n d i t i o n r e c e i v e s a n o p e ra n d n o t i n te n d e d f o r i t . When a "< " h a s b e e n e n c o u n te r e d , t h e f o llo w i n g c h a r a c t e r s , t o a maximum o f s i x , fo rm t h e c o n d i t i o n n am e, w h ic h i s t h e c o n d itio n s ta c k . fie ld h a s b e e n d e co m p o se d . not "<" n o r r e v e r s e d an d th e n p u s h e d o n to T h e p r o c e s s c o n tin u e s u n t i l t h e e n t i r e KS c o n d i t i o n We c a t c h u n m a tc h e d p a r e n t h e s e s ( " ( " o r w h ic h a r e u s e d o n ly t o d e lim it th e c o n d itio n p a ra m e te r a r e a ) b y s e t t i n g a c o u n t e r t o z e r o , in c r e m e n tin g i t e a c h tim e e left p a ­ r e n th e s is is e n c o u n te r e d , a n d d e c r e m e n tin g i t f o r a r ig h t p a re n th e s is . I f w hen t h e c o n d i t i o n f i e l d h a s b e e n f u l l y d eco m p o se d t h e c o u n te r i s n o t a g a i n z e r o , we h a v e a n e r r o r . E v a lu a tin g t h e c o n d itio n s . : The n e x t p r o c e s s i s t h a t o f e v a lu a tin g a l l t h e c o n d i t i o n s , w h ile r e t a i n i n g t h e i r o r d e r i n t h e s t a c k , We d o t h i s b y p o p p in g e a c h c o n d i t i o n fro m t h e c o n d i t i o n s t a c k u n t i l t h e s t a c k r e t u r n s a " fa il" s t a t u s , in d ic a t in g t h a t i s em pty ( t h e r e m u st b e a t l e a s t one c o n d i t i o n ) , e v a l u a t i n g e a c h c o n d i t i o n a s i t i s p o p p e d , and th e n e n q u e u e in g th e v a lu e s so t h a t th e o r d e r i s r e ta in e d . THE DESl'GN OF THE PROTOTYPE SYSTEM. Wlion a c o n d itio n is popped fro m t h e c o n d i t i o n s ta c k , th e a p p ro p ria te c o n d i t i o n e v a l u a t i o n p r o c e d u r e i s i n v o k e d , w h ic h th e n p o p s t h e num ber o f c o n d itio n o p e ra n d s s ta c k . fix e d f o r t h a t p r o c e d u r e fro m t h e c o n d i t i o n o p e ra n d T h e s e o p e r a n d s m u st t h e n b e f i x e d : t h e p r o c e s s i s d e s c r i b e d b e lo w . O nce t h e c o n d i t i o n o p e r a n d s h a v e b e e n p o p p e d a n d f i x e d , t h e c o n d i t i o n m u st b e e v a lu a te d . T h is i s a p r o c e s s t h a t r a t h e r d e p e n d s o n how t h e c o n d i t i o n i s d e f i n e d , b u t we w i l l re m a rk t h a t when a c o n d i t i o n f i x e s a n o p e ra n d an d r e c e iv e s a v e c t o r , i t w i l l t h e n u s e a n y s c a l a r o p e ra n d a s a v e c t o r , b y s im p ly f i l l i n g a v e c t o r o f t h e g iv e n l e n g t h w i t h t h e s c a l a r v a l u e , and r e t u r n a v e c t o r r e s u l t (w h ic h w i l l c o n t a i n a s i t s n ' t h e le m e n t t h e r e s u l t o f t h e c o n d itio n o p e r a tin g on t h e o p e ra n d s in th e n 't h p la c e o f th e op ­ e ra n d v e c t o r s ) . T he r e s u l t r e t u r n e d b y a c o n d i t i o n b e i n t h e r a n g e 0 - 1 ( to ta lly fa ls e to to ta lly tr u e , re s p e c tiv e ly ) . As t h e c o n d i t i o n s r e t u r n t h e i r r e s u l t s , th e r e s u l t s a re enqueued, rea d y f o r t h e KS evaluator, w h ic h u s e s only them a n d t h e c o n t e n t s o f t h e o p e r ­ a t o r s t a c k t o e v a l u a t e t h e KS. F ixing c o n d itio n o p e r a n d s .: v a lu e a n d a t y p e . n o t m e r e ly o f To f i x a n o p e r a n d , we a s s o c i a t e w ith i t a As t r u e v a r i a b l e s a r e n o t u s e d h e r e , i t i s a q u e s t i o n , " in d in g t h e a p p r o p r i a t e p a r t o f a v a r i a b l e sp a ce and r e ­ t r i e v i n g a v a l u e , b u t o f d e te r m in i n g t h e ty p e o f t h e o p e r a n d , a n d e i t h e r a s s o c i a tin g w ith i t th e f i x e d v a lu e a s s o c i a t e d w i t h t h a t name in th a t t y p e , o r r e t r i e v i n g t h e r e g i o n n u m b e r, s e t o f r e g i o n s o r num ber a s s o c i a t e d w ith it. We h a v e f o u r t y p e s a t p r e s e n t : n u m b e rs , a n d s y s te m p r i m i t i v e s . THE' DESIGN OF THE PROTOTYPE SYSTEM. q u a lifie rs , r e g i o n n u m b e rs , A q u a l i f i e r i s a member o f t h e s e t QN- 1 , and i s VERY, QUITE, DK, QUITEN, VERYN, Q+, a s s o c i a te d w ith a c o n s ta n t v a lu e o r ra n g e o f v a lu e s , d e ­ p e n d in g on w h a t <ji w ith in th e e o n d itio .i, tie r i t i s . f o r th e T h is v a lu e i s t h e n com pared t o a v a lfie c o n d itio n t o r e tu r n a one ( t o t a l l y tru e ) o r a z e r o ( t o t a l l y f a l s a ) v a lu e . A r e g i o n n u m b er i s d e f i n e d w i t h w h ic h t h e ' s y s te m i s e i t h e r a s CENTRE, w h ic h r e c o v e r s t h e r e g i o n d e a l i n g a t t h e tim e i t is e n c o u n te r e d , o r an i n t e g e r w i t h a n "R " p r e c e d i n g t h e f i r s t d i g i t , w h ic h w i l l r e c o v e r e i t h e r t h e e n t i r e c o d e , s t a r t i n g w i t h t h e r e g i o n o c c u p y in g t h e p l a c e i n t h e c o d e referred t o b y t h e n u m b e r, o r a f l a g t h a t w i l l f o r c e th e c o n d itio n to e v a l u a t e a s z e r o ( t o t a l l y f a l s e ) , if t h e n u m b er i s g r e a t e r th a n t h e le n g t h o f th e code. As t h e c o d e s t a r t s w i t h m e a n in g le s s t o r e f e r to an a rb itra ry n e ig h b o u r , it is t h e f i r s t r e g i o n i n t h e c o d e , b u t a s t h e s y s te m d o e s n o t t h e r e a f t e r r o t a t e t h e c o d e , we c a n , u s i n g t h i s sc h em e , r e f e r f o r e x am p le t o a ll p a irs of n e ig h b o u r s se p a ra te d n e ig h b o u r s , w h ic h we w o u ld e x p r e s s a s R1 a n d R 4. by at le a s t tw o o th e r T h is l e a d s t o t h e p o i n t t h a t c o n d i t i o n s o f t e n r e t u r n v e c t o r , r a t h e r t h a n s c a l a r v a l u e s , a s th e y QUITEN => q u i t e I QN- => q u i t e n o t o r l e s s THE DESIGN OF THE PROTOTYPE SYSTEM. a rc e v a lu a te d f o r a s e t o f r e g io n s fro m t h e n e ig h b o u r c o d e . At th is s t a g e , t h e v e c t o r s w i l l a lw a y s h a v e t h e same l e n g t h , a s we a r e d o n o t y e t ad low m o re, th a n o n e r e g i t n ' s n e ig h b o u r c o d e t o be r e f e r re d to i n a KS: t h e scalars a r e th e n e x p a n d e d t o a v e c t o r w ith t h i s l e n g t h , a n d t h e w h o le KS e v a l u a t e d f o r c o n d i t i o n s w h ic h a r e v e c t o r s . T h e KS e v a l u a t o r w ill r e t u r n e i t h e r t h e v e c t o r v a l u e o f t h e KS, o r t h e maximum s c a l a r v a l u e , d e p e n d in g o n how i t i s in v o k e d . T h e n u m b er ty p e c o n s i s t s o f i n t e g e r s w i t h o u t p r e f i x e s , w h ic h a r e e v a l u a t e d a s t h e i n t e g e r g i v e n ; t h e s e o p e ra n d s a llo w t h e i n s p e c t i o n o f , f o r e x a m p le , t h e n u m b er o f n e ig h b o u r s a g iv e n r e g i o n h a s . I t m u st b e s e e n t h a t a s y s te m p r i m i t i v e i s i n n o w ay t h e sam e a s a n a b ­ s o lu te p r im it iv e ( f o r w h ic h we h a v e u s e d t h e w o rd p r i m i t i v e ) , a s a n a b ­ s o l u t e p r i m i t i v e i s d e f i n e d b y t h e r u l e b a s e , a n d a s y s te m p r i m i t i v e may b e e i t h e r a n a b s o l u t e p r i m i t i v e , o r a c o m p o s ite f o r w h ic h a m a tc h h a s b e e n fo u n d . A s y s te m p r i m i t i v e o p e ra n d r e f e r s t o t h e s e t o f m a tc h e s t h a t h a v e b e e n f o u n d f o r t h e s y s te m p r i m i t i v e nam ed a s t h e o p e r a n d . a lg o r i t h m f o r c h a i n i n g f o r w a r d t o As t h e p r o p o s e d a c h ie v e t h e m a in s y s te m g o a l h a s n o t b e e n .im p le m e n te d , an d h e n c e n o c o n d i t i o n r e q u i r e s sy s te m p r i m i t i v e o p e r ­ a n d s, th e d e t a i l s o f t h e i r u se have n o t been f u l l y te s te d . T he i n t e n t i o n i s , h o w e v e r, a s f o l l o w s : S y stem p r i m i t i v e o p e ra n d s w i l l r e f e r t o s e t s o f r e g i o n s , a n d t h e c o n d i­ t i o n s u s i n g t h e s e o p e ra n d s w i l l h a v e t o b e h a n d le d a s s u c h . c o n d itio n w ill hove to th e o p e ra n d s s p e c if ie d . to t y p e s im p ly by b e e v a lu a te d fo r a l l a v a ila b le T hus th e a lte r n a tiv e s fo r I t w as i n te n d e d t o im p le m e n t t h i s s e ttin g f b r th e p ro ­ u p a s t r u c t u r e w h ic h w o u ld h o ld t h e c u r r e n t THE DESIGN OF THE PROTOTYPE SYSTEM. 62 c a n d i d a t e s f o r a l l s y s te m p r i m i t i v e s r e f e r r e d t o w i t h i n a KS, l o a d i n g t h a t KS fro m t h e s y s te m s t r u c t u r e l i s t , a n d e v a l u a t i n g t h e KS. T h is p r o c e s s w o u ld b e p e r f o r m e d f o r e a c h l e g a l s e t o f c u r r e n t c a n d td s . t e s . E v a lu a tin g th e r u l e . : The r u l e e v a lu a to r u s e s a te c h n iq u e t h a t i s v e s te d i n o u r i n s i s t e n c e o n p o s t - f i x n o t a t i o n an d a d e f i n e d n u m b er o f o p e ra n d s fo r each lo g ic a l o p e ra to r . We w i l l d i s c u s s t h i s i n te rm s o f s c a l a r s o n l y , a lth o u g h t h e t e c h n i q u e e x te n d s v e r y s im p ly t o f o rm in g o p e ra tio n s on th e v e c to rs r e t r i e v i n g th e m a s v e c t o r s . v e c t o r s , m e r e ly by p e r­ e le m e n t- b y - e le m e n t , a n d s t o r i n g a n d ( E le m e n ts i n v e c t o r s w i l l n o t h a v e t o be s t o r e d i n d i f f e r e n t p a r t s o f t h e te m p o r a r y d a t a s t r u c t u r e u s e d : t h a t i s , s t o r a g e an d r e t r i e v a l n e e d n o t b e p e rf o rm e d e le r a e n t - b y - e l e m e n t . ) We w i l l f i r s t d is c u s s th e o p e ra tio n s u se d . When t h e t r u t h v a l u e i s d e f i n e d a s a member o f a r a n g e o f n u m b e rs , r a t h e r th a n a s o n e o f tw o , we m u st d e f i n e f u n c t i o n s o n i t t o r e p r e s e n t t h e l o g ­ ic a l o p e ra to rs . A s we h a v e a c c e p te d D u b o is a n d P r u d e 's m u st a c c e p t t h e i r f u n c t i o n s . s y s te m ( ) , we T h u s , g iv e n tw o p r o p o s i t i o n s , T a n d R , we THE DESIGN OF THE PROTOTYPE SYSTEM. ( ( T R) OR) TRUTHVALUE = MAX((T)TRUTHVALUE,(R)T«UTHVALOE) T h e t r u t h v a l u e o f (T R)AND a s : ( ( T R)AND)TRUTHVALUE = MIN((T)TRUTHVALUE,(R)TRUTHVALUE) T h e t r u t h v a l u e o f (T)NOT a s : ( (T)NOT)TRUTHVAIAJE = 1 - (T)TRUTHVALUE And f o r a n y p r o p o s i t i o n S , 0 <= (S)TRUTHVALUE <= 1 u s in g p o s t- f ix n o ta tio n f o r ty p e s e t tin g s im p lic ity . (F o r f u r t h e r i n f o r ­ m a tio n , a n d a j u s t i f i c a t i o n o f t h e s e f u n c t i o n s , s e e t h e r e f e r e n c e . ) T he a l g o r i t h m u s e d t o on th e s ta c k o r d e r , e v a l u a t e t h e KS i s t h e n q u i t e s im p le , and r e l i e s a n d o n c a r e f u l u s e o f - a te m p o r a r y d a t d s t r u c t u r e . T h e d a t a s t r u c t u r e i s a tw o - d im e n S io n a l a r r a y , w h ic h i s tw o e le m e n ts w id e , a n d w h o se d e p th d e f i n e s t h e l i m i t t o w h ic h u n m a tc h e d l e f t p a r e n t h e s e s may b e e n c o u n te r e d i n t h e p r o c e s s o f e v a l u a t i o n . (T h at i s , i f we g n c o u n 'jd r 20 l e f t p a r e n t h e s e s d u r i n g o u r e v a l u a t i o n b e fo re we s e e a r i g h t p a r e n ­ t h e s i s , t h e s t r u c t u r e m u st b e 20 d e e p ) . THE DESIGN OF THE PROTOTYPE SYSTEM. The e v a lu a tio n p ro c e e d s a s f o l - • T h e te m p o r a r y d a t a s t r u c t u r e ( c a l l e d te m p ) i s i n i t i a l i s e d t o a l l dummy v a l u e s , a n d t h e b r a c k e t c o u n t e r i s s e t t o z e r o . T he f i r s t o c c u p a n t o f t h e o p e r a t o r s ta c k " " is now p o p p e d . • I f t h e o p e r a t o r s t a c k i s e m p ty , t h e r e c a n b e o n ly o n e c o n d i t i o n , and th e v a lu e o f th e c o n d itio n a t th e h e ad o f th e queue i s th e v a lu e o f th e r u l e . • I f a " ( " i s p o p p e d , t h e b r a c k e t c o u n t e r in c r e m e n ts , a n d t h e n e x t o p e ra to r i s popped. • I f f o llo w in g a a " ) " i s p o p p e d , a n d t h e n an o p e r a t o r to k e n ( e i t h e r " A " ," 0 " o r " N " ) , we know t h a t we may d e q u e u e e i t h e r o n e ( f o r "N ") o r tw o ( f o r "A" o r ”0 " ) v a l u e s , an d co m b in e th em a c ­ c o r d in g t o th e o p e ra to r popped. T he r e s u l t a n t v a l u e is th e n s to r e d . • To s t o r e a v a l u e , we i n s p e c t t h e f i r s t l o c a t i o n i n te m p a t t h e c u r r e n t b r a c k e t d e p th ; in s p e c t th e seco n d . i f th is c o n t a i n s a non-dummy v a l u e , we I f n e i t h e r c o n t a i n s a dummy v a l u e , s o m e th in g h a s g o n e w ro n g , a n d t h e te c h n i q u e f a i l s . I f th e f i r s t c o n ta in s a dummy, we s t o r e o u r v a l u e i n i t ; i f i t d o e s n ’t , a n d t h e se c o n d d o e s , we s t o r e o u r v a lu e i n t h e s e c o n d . • I f i n s t e a d o f p o p p in g t h e se q u e r .. s o n ly " ) " " < o p e ra to r> " , " < o p e r a t o r > " , we p o p im p l y in g t h a t a t l e a s t o n e o p e r a t o r h a s b e e n e v a l u a t e d , we m u st i n s p e c t tem p f o r o p e r a n d s . I f th e f i r s t ' l o c a t i o n a t t h e c u r r e n t b r a c k e t d e p th p l u s o n e , c o n t a i n s a dummy . v a l u e , we f a i l . I f t h i s lo c a tio n c o n ta in s a r e a l v a lu e , b u t th e THE DESIGN OF THE PROTOTYPE SYSTEM. s e c o n d l o c a t i o n a t t h i s d e p th c o n t a i n s s dummy v a l u e , « e u s e t b s v a lu e i n t h e f i r s t l o c a t i o n an d a s i n g l e d e q u e u e d v a lu e ( i f we n e ed a se co n d v a lu e ) a s th e o p e ra n d s, and e v a lu a te th e o p e ra to r and s to r e t h e r e s u l t in t h e fashion d e s c r i b e d a b o v e . second lo c a tio n a ls o c o n ta in s a r e a l v a lu e , I f th e t h e tw o v a l u e s i n tem p a r e u s e d a s o p e ra n d s f o r t h e o p e r a t o r ( i f t h e o p e r a t o r i s a tw o - o p e r a n d o p e r a t o r : i f i t i s a o n e -o p e ra n d o p e r a t o r , we m u st f a i l ) a nd th e r e s u l t s a re s to r e d a s d e s c rib e d . * We c o n t i n u e t h i s p r o c e s s u n t i l t h e o p e r a t o r s t a c k i s u n til th e a lg o rith m in s u ffic ie n t qu eued fa ils e m p ty , o r a s a r e s u l t o f an a n o m alo u s tem p o r o p e ra n d s, c a u s e d b y KS s y n ta x e r r o r s . b o th of w h ic h c o n d itio n s a re We w i l l th e n f i n d t h e v a l u e o f t h e KS i n t h e f i r s t l o c a t i o n i n tem p a t b r a c k e t l e v e l z e r o . A lth o u g h t h e a l g o r i t h m s o u n d s c o m p le x , f i g u r e 8 w i l l i n d i c a t e how sim p le it r e a lly is . Its s u s c e s s i s b a s e d on t h e s t r u c t u r e o f t h e K S 's , w h ic h w as c a r e f u l l y d e s ig n e d f o r a n a lg o r i t h m o f t h i s t y p e . As lo n g a s t h e KS s y n ta x i s c o r r e c t , t h e a lg o r i t h m w o r k s . We h a v e d e s c r i b e d i n d e t a i l how t h e s y s te m e v a l u a t e s a K S; we w i l l now d i s c u s s how t h e s y s te m f a c t o r s a g o a l . THE DESIGN OF THE PROTOTYPE SYSTEM. ((Cl c :1)/' (V i We h a v e now s e e n ( ) A . X h u s, we d e q u e u e tw o o p e r a n d s a n d fo rm V I.V 2 , w h ic h g o e s i n t o th e f i r s t p l a c e i n tem p a t l e v e l 3 . FIGURE To I l l u s t r a t e E v a l u a t i n g a KS, i l l ) ' 6: ),u|. ( St.0)1 7 : pi,]) ) We h a v e s e e n ( )A , a n d a r e a s b e f o r e ^ e n t i t l e d S tep 8 : _pop A t o dequi tw o o p e r a n d s , a n d fo rm V 3 .V 4 , w h ic h g o e s I n t o th e s e c o n d l o c a t i o n a t l e v e l 3 i n te m p . ( t h e q u e u e i s e m p ty ) O p e ra to r s ta c k S te p 9 : pop ) B r ■= 2 S te p 1 0 : pop O He l a v e p o p p e d ) 0 , a n d m u s t I n s p e c t tem p a t a l e v e l o n e d e e p e r th a n th e b r a c k e t d e p th t o f i n d o u t w h at s h o u ld b e d o n e a b o u t o p e r a n d s , We f i n d b o t h l o c a t i o n s o c c u p i e d , a n d h e n c e m u s t u s e t h e i r o c c u p a n t s . We fo rm V I.V 2 + V 3 .V 4 , a n d s t o r e i t i n th e f i r s t l o c a t i o n in V l.V 2 -tV 3 .V 4 S te p 1 1 z pop ) tem p a t t h e b r a c k e t d e p th . D Br = 1 S te p 12 : p o p N ‘ A nd a g a i n , we m u st i n s p e c t tem p f o r o p e r a n d s . T h ere i s o n e , a n d we r e q u i r e o n ly o n e , s o we fo rm V 1.V 2+V 3.V 4, and p la c e i t i n t h e f i r s t l o c a t i o n a t th e b r a c k e t d e p th . S te p 13 : T he o p e r a t o r s t a c k i s e m p ty , s o we i n s p e c t te m p , a .id f i n o u r r e s u l t w h e re we e x p e c t e d i t . FIGURE 8 : B r i s a g a i n 1 , s o we may t e r m i n a t e " h a p p y " - To I l l u s t r a t e E v a l u a t i n g a K S. P a rt 2 How the prototype factors a goal. T h e p r o t o t y p e u s e s some te c h n i q u e s p o p u la r i n t h e c u r r e n t A r t i f i c i a l I n ­ te llig e n c e lit e r a t u r e : th is b lo c k , f o r e x a m p le , u s e s a te c h n i q u e known a s b a c k w a rd c h a i n i n g , w h ic h r e a l l y d e s e r v e s d e s c r i p t i o n o n l y b e c a u s e t h e la n g u a g e i n w h ic h t h e p r o t o t y p e w as im p le m e n te d d o e s n o t a llo w r e c u r s i o n , an d some i n g e n u i t y w as r e q u i r e d t o g e t t h e p r o t o t y p e t o c h a i n b a c k w a rd . We w i l l b r i e f l y d e s c r i b e t h e a l g o r i t h m t h a t t h e s y s te m u s e s . When we r e q u i r e t h e s y s te m t o f a c t o r a g o a l , we a r e r e q u i r i n g i t t o r e c o r d a ll K S 's n e ce ssary to d e s c rib e th e p r im it iv e s and c o n d itio n s on p r im it iv e s . goal c o m p le t e ly i n te r m s o n ly o f T h u s, any r e f e r e n c e t o an o b je c t m u st b e a b l e t o b e r e s o l v e d i n t o a s e t o f r e l a t i o n s h i p s d e f i n e d o n p r im ­ i t i v e s ; t h e r e l a t i o n s h i p s a n d t h e d e s c r i p t i o n s o f t h e p r i m i t i v e s m u st h a v e b een s to r e d . O n ly K S 's d e s c r i b i n g t h e s t r u c t u r e s o f c o m p o s ite s a r e s t o r e d i n a n y th in g l i k e t h e i r o r i g i n a l f o rm : KS's d e s c r i b i n g p r i m i t i v e s a r e d e ­ c o m p o sed , e n d t h e d e s c r i p t i o n s a r e s t o r e d i n t h e p r i m i t i v e l i s t , and l a t e r i n t h e s y s te m p r i m i t i v e l i s t . A c h ie v in g t h i s • i s r e l a t i v e l y s im p le . ^W e d o i t a s f o llo w s : T h e s y s te m c o m p o s ite l i s t is i n i t i a l i s e d w i t h t h e m a in sy s te m g o a l a s i t s o n l y m em ber. ' • When f g o a l i s in v o k e d , t h e a c t i o n f i e l d o f t h e XS t h a t h a s b e e n p a ssed to i t , is in s p e c te d . I f t h e name t h a t a p p e a r s t h e r e , d o e s n o t a p p e a r i n t h e s y s te m c o m p o s ite l i s t , th e n t h e KS i s ig n o r e d ,, an d f g o a l t e r m i n a t e s . THE DESIGN OF THE PROTOTYPE SYSTEM. . 67 t lis t, I f t h e name d o c s , h o w e v e r, a p p e a r d th e p a ra m e te r o f t h e name i s e x a m in e d ; p r im itiv e , i t is i n s p e c t e d a n d t h e de sc p r im itiv e l i s t . If c o m p o sed , and e n te re d in appear th e it d e s c rib e s if 1 a m em bers o f t h e i t h e s y s te m c o m p o s ite l i s t , th e re . ( O b j e c ts may a p p e a r i r o n ly a s t h e o p e r a n d s o f r e l a t i o n s h i p s , w h ic h e x p l a i n s why c o n d itio n s ta c k i s o p e ra n d se arch e d , sta c k i s but its s e a r c h e d .) th e T h e c o n d i t i o n o p e ra n d m em bers a r e n o t p o p p e d ; t h i s is so t h a t a t t h i s s t a g e , a l l t h r e e s t a c k s g e n e r a t e d b y t h e KS may b e e n t e r e d i n t o t h e s y s te m s t r u c t u r e l i s t a s a r e c o r d u n d e r t h e name o f th e o b je c t. W h e th e r t h e o b j e c t d e s c r i b e d i s a p r i m i t i v e o r a c o m p o s ite , i t s name i s now rem o ved fro m t h e s y s te m c o m p o s ite • T h is p r o c e s s c o n t i n u e s u n t i l t h e s y s te m c o m p o s ite l i s t i s e m p ty , when t h e g o a l h a s b e e n A lth o u g h no il l y f a c to re d . c h e c k s h a v e b e e n im p le m e n te d i n t h e p r o t o t y p e , it is easy en o u g h t o s e e t h a t i f t h e e n t i r e k n o w ^ d g e b a s e f o r t h e b lo c k f g o a l h a s been c o n s u lte d , and can n o t be fa c to r e d . th e s y s te m c o m p o s ite l i s t i s u n c h an g e d , th e g o a l T h i s w o u ld b e c a u s e d e i t h e r b y a s p e l l i n g e r r o r , o r b y an i n s u f f i c i e n t k n o w le d g e b a s e . T h is a lg o r i t h m h a r d l y fu rth e r, re q u ir e s f u r t h e r com m ent; we w i l l n o t d i s c u s s an d w i l l move t o a d i s c u s s i o n o f how t h e t e s t s m e rg e s. THE DESIGN OF THE PROTOTYPE SYSTEM. it sy s te m g e n e r a t e s an d How the system generates and tests merges. The " g e n e r a t e a n d t e s t " te c h n iq u e i s a l s o w e l l known i n th e A r t i f i c i a l I n t e l l i g e n c e l i t e r a t u r e , a n d we h a v e u s e d a v r y much s i m p l i f i e d v e r s i o n b y l i m i t i n g t h e s c o p e o f b o th m e rg e g e n e r a t i o n a n d m erg e t e s t i n g . M erges a r e g e n e r a t e d o n l y u p t o t h e p r i m i t i v e l e v e l ; a f t e r t h a t , t h e m e rg e s r e ­ s u l t fro m f o r w a r d c h a i n i n g th r o u g h t h e s t r u c t u r a l d e s c r i p t i o n . T h e " m erg e g e n e r a t e " d u t i e s l i e s o l e l y w i t h t h e k n o w le d g e b a s e : K S 's i n ­ fo rm t h e g tm e r b l o c k w h ic h r e g i o n s s h o u ld b e t e s t e d w i t h a v ie w t o m e rg ­ ing-. T h e p r o c e s s im p le m e n te d i n t h e p r e s e n t s y s te m i s e x tr e m e ly s im p le , a n d g o e s as f o l l o w s : • The b lo c k e v a lu a te s K S 's an d r e c o r d s t h o s e c a n d i d a t e s rec o m ­ m ended f o r m e rg in g b y K S 's w h ic h e v a l u a t e t o g r e a t e r t h a n 0 ,7 5 tru e (th is fig u r e is p u re ly a r b it r a r y ) a n d c o n tin u e s t o - d o s o u n t i l i t h a s e v a l u a t e d a l l K S 's r e l e v a n t t o in th e p i c t u r e . it f o r a l l r e g io n s T h i s i s u n w ie ld y , g r a n t e d , b u t t h e s y s te m i s a p ro to ty p e . ’e‘‘ • When t h e e v a lu a to r i s s a tis fie d , a l l m erg e c a n d i d a t e s a r e c o v e re d , and th e v a lu e s t h a t w o rld r e s u l t f o r te x t u r e , g rey re ­ av erag e l e v e l a n d c e n t r e o f g r a v i t y f o r t h e C a n d id a te r e g i o n , a r e found. ( T h e s e p a r a m e t e r s a r e n o t c la im e d t o b o t h e best fo r t e s t i n g a m e rg e .) A t t h i s s t a g e , we t e s t o n ly t h a t t h e new a v e r a g e g r e y l e v e l an d te x tu r e a re th e sam e a s t h o s e o f t h e m erg e c a n d i d a t e s , THE DESIGN OP THE PROTOTYPE SYSTEM. but i t i s i n te n d e d t h a t the* p r i m i t i v e l i s t s o p h is tic a te d , be c o n s u lte d t o g o a l - d i r e c t e d m e rg in g . a llo w more I f th e r e s u l ts a re s a t ­ i s f a c t o r y , t h e c a n d i d a t e s re m a in i n t h e m erg e l i s t . • T h e m e rg e l i s t is th e n passed to t h e n e ig h b o u r - c o tie m e rg in g s e c t i o n , an d t h e p i c t u r e r e p r e s e n t a t i o n i s u p d a te d a c c o r d i n g l y . A lth o u g h t h i s se g m e n t o f t h e p r o t o t y p e i s s t i l l e x tr e m e ly p r i m i t i v e , • i t / i s a se g m e n t t h a t w i l l a llo w g r e a t e x p a n s io n a s i t o f a c t i v e k n o w le d g e ’ c o u ld b e s e e n t o b e p r o d u c t i v e . i s h e re t h a t th e u se T he i n t e n t i o n w o u ld b e t o add t o th e g e n e r a te s t a g e 's l i s t o f c a n d id a te r e g io n s th o s e re g io n s t h a t s t r u c t u r e i n d i c a t e s may w e l l b e m e rg e d t o fo rm a m is s in g p r i m i t i v e . The t e s t s t a g e w o u ld b e i n s t r u c t e d t o b e l e n i e n t i n i t s t e s t i n g o f t h e s e c a n d i d a t e s , a n d s h o u ld a l s o p a s s o u t i n f o r m a ti o n i n d i c a t i n g how " g o o d " a m e rg e i s p e rf o rm e d u n d e r t h e s e c o n d i t i o n s . The suggestions d e s c r i b e d a b o v e w o u ld le n d g r e a t p o w er t o t h e s y s te m , b u t a r e f a r t o o s o p h i s t i c a t e d t o h a v e b e e n im p le m e n te d i n t h e p r e s e n t p r o t o ­ ty p e . We w i l l d i s c u s s n e x t how t h e p r o t o t y p e f i n d s a g o a l i n a p i c t u r e . A c t iv e k n o w le d g e w as m e n tio n e d i n t h e i n t r o d u c t i o n a s a c o n c e p t i n ­ tr o d u c e d a s f a r a s I c a n s e e , 'b y F r e u d e r i n h i s 1976 t h e s i s . i s t h a t i f o n e h a s fo und p a r t o f an o b je c t, w h e r e t o lo o k f o r t h e r e s t o f i t . THE DESIGN OF THE PROTOTYPE SYSTEM. T he id e a o n e h a s a g o o d i d e a ’ off F i n d in g t h e g o a l. The f i r s t p o i n t t o n o t e h e r e i s th a t th is s e c ti o n o f th e p ro to ty p e h a s n o t y e t b e e n im p le m e n te d 6 ; t h u s , t h e 'a l g o r i t h m d e s c r i b e d h a s n e i t h e r b e e n t e s t e d , n o r d e e p ly e x a m in e d , a n d p o t e n t i a l im p le m e n ta tio n d if f ic u ltie s h a v e n o t y e t b eco m e a p p a r e n t . T he p r o c e s s t h a t w o u ld h a v e b e e n u s e d i s a n o t h e r o n e f a m i l i a r i n t h e A r ­ t i f i c i a l In te llig e n c e lite ra tu re , t h a t o f f o rw a rd c h a in in g .- T h is w o u ld h a v e b e e n d i r e c t e d to w a rd f i n d i n g t h e m a in s y s te m g o a l , g iv e n t h e l o c a t i o n o f th e p r im it iv e s . F o r th e p ro ce ss to s t a r t , m a tc h e s o u s t a l r e a d y h a v e b e e n f o u n d f o r a l l m em bers o f t h e s y s te m p r i m i t i v e l i s t . We in t e n d t h e p r o c e s s t o f o llo w t h e s e s t e p s : • T he s t r u c t u r a l p r i m i t i v e lis t has been in itia lis e d w ith th e n am es o f t h e a b s o l u t e p r i m i t i v e s ; i t now c o n t a i n s ( b e c a u s e t h e s e p r i m i t i v e s h a v e b e e n m a tc h e d ) , a g a i n s t e a c h name a l i s t o f t h e r e g i o n n u m b e rs w h ic h m a tc h t h a t p r i m i t i v e . T he g o a l f i n d e r m u st now f i n d i n t h e s y s te m s t r u c t u r e l i s t a d e s c r i p t i o n o f a n o b j e c t , T h is w as a s a r e s u l t o f p io b le m s w ith tim e , an d t h e fa c t th a t th e ' ‘t e c h n i q u e o f r u n n in g b lo c k s a s se g m e n ts t o f i t th em i n t o t h e 32K s p a c e ' a llo w e d , w as f a i l i n g : t h e se g m e n ts th e m s e lv e s w ere g e t t i n g t o o b i g . Any im p l e m e n ta tio n o f t h e a lg o r i th m d e s c r i b e d w o u ld h a v e e n d e d u p i n t h e g tm e r s e g m e n t, re-a rra n g e m e n t w h ic h s im p ly o f t h e p r o t o t y p e 's THE DESIGN OF THE PROTOTYPE SYSTEM.. had no sp ace le ft, and a m a jo r s t r u c t u r e w o u ld h a v e b e e n n e c e s - w h ic h i s d e s c r i b e d o n ly i n te r m s o f r e l a t i o n s h i p s b e tw ee n mem­ b e rs o f th e s tr u c t u r a l p r im itiv e lis t. I f such a d e s c r ip tio n c a n n o t b e f o u n d , t h e g o a l c a n n o t b e f o u n d , an d t h e s y s te m f a i l s . • A d a ta s t r u c tu r e is s e t u p , w h ic h c o n t a i n s a n o r d e r i n g o f t h e s y s te m p r i m i t i v e s r e q u i r e d f o r t h e o b j e c t t o b e f o u n d , r e c a l l i n g t h s t LEG1 an d LEG2, f o r e x a m p le , r e f e r t o d i s t i n c t l e g s , a n d m u st t h e r e f o r e b e m a tch e d t o d i s t i n c t r e g i o n s , • "I’h e r u l e is e v a lu a te d f o r t h i s t h e name o f t h e o b j e c t i s o r d e r in g : if it is s u c c e s s f u l, d e m o ted t o t h e s t r u c t u r a l p r i m i t i v e l i s t , i f i t i s n o t t h e r e a l r e a d y , a n d t h e m a tc h in g s e t i s e n t e r e d a g a in s t i t . • Tf i t i s u n s u c c e s s f u l, n o th in g i s done. A new o r d e r i n g o f t h e p r i m i t i v e s i s now t r i e d , a n d t h e p r o c e s s c o n t i n u e s e i t h e r u n t i l t h e s y s te m u n a b le to f i n d s KS which is i n fa ils as a re s u lt of b e in g terms only of members o f th e s y s te m p r i m i t i v e l i s t , o r u n t i l t h e s t r u c t u r e l i s t i s e m p ty , i n w h ic h c a s e t h e sy s te m h a s f o u n d t h e g o a l . I t c a n b e s e e n t h a t t h i s i s a s im p le t e c h n i q u e , an d t h a t i t i s i n a f a i r l y p r i m i t i v e f o r a , b u t t h a t i t W ill a llo w o f e x p a n s io n , an d c o u ld w e l l becom e p o w e r f u l» T he f i r s t n e c e s s i t y f o r t h e te c h n i q u e t o b ecom e t r u l y p o w e r f u l w o u ld b e t h e p e r f o r m in g o f some form o f s e n s i t i v i t y a n a l y s i s o n t h e KS, t o d e t e r ­ m in e w h ic h p r i m i t i v e s w ere a b s o l u t e l y n e c e s s a r y f o r t h e KS t o e v a l u a t e as tr u e . A t t h i s s t a g e , n o t b e in g a b l e t o m a tc h a l l a b s o l u t e p r i m i t i v e s i s f a t a l ; w i t h a m ore s o p h i s t i c a t e d s 'y ste m , t h e c o n c e p t o f a c t i v e know­ THE DESIGN OF.THE PROTOTYPE SYSTEM. le d g e may b e em p lo y ed t o a llo w m o re l e n i e n t c l a s s i f i c a t i o n o f r e g i o n s t h a t a p p ea r in th e r i g h t p la c e f o r p r im it iv e s , b u t have n o t been so c l a s s i f i e d . T h u s , f o r a p o w e r f u l s y s te m , we n e e d some fo rm o f tw o -w a y i n f o r m a ti o n flo w b e tw e e n g tm e r and t h i s s e g m e n t, a llo w in g e a c h b lo c k t o r e c o n s id e r I t s d e c i s i o n s i n t h e l i g h t o f new e v id e n c e u n c o v e r e d b y t h e o t h e r b l o c k . T h is f r e e r f lo w o f i n f o r m a t i o n w i l l r e q u i r e a g r e a t d e a l o f w o rk t o im p le m e n t, b u t s h o u ld g e n e r a t e a s y s te m o f e n o rm o u s p o w er a n d c o n s i d e r a b l e p o t e n t i a l . CONCLUSION. I n t h e a b o v e d i s c u s s i o n s , we h a v e shown t h e d e s ig n o f a p r o t o t y p e s y s te m i n te n d e d t o show t h e f e a s i b i l i t y a n d d e s i r a b i l i t y o f b u i l d i n g t h e s y s te m d e s c r i b e d i n t h e c h a p t e r o n t h e new p a ra d ig m . Many o f t h e s e d e s ig n d e ­ c i s i o n s w e r e ta k e n d u r i n g t h e b u i l d i n g o f t h e s y s te m , a lth o u g h t h e m a jo r s t r u c t u r e o f t h e d e s i g n h a d b e e n s k e tc h e d o u t b e f o r e h a n d . d e s ig n has p r o d u c e d a s y s te m w h ic h w o rk s t o As i t i s , t h e th e e x te n t o f s tim u la tin g c u r i o s i t y , a n d i n my v ie w , o n e w h ic h h a s r a i s e d m o re q u e s t i o n s th a n i t h a s an sw ered . Some o f t h e m ore i n t e r e s t i n g o n e s a r e n o te d b e lo w : • How c a n i n e x a c t k n o w le d g e b e h a n d le d i n a s y s te - ♦ How c a n a c t i v e k n o w le d g e ■' We h a v e d e s c r i b e d f o rw a rd c h a i n i n g t o t h e g o a l . o f t h i s k in d ? d e p lo y e d r e a l l y e f f e c t i v e l y ? Can t h i s b e made t o w o rk w e l l w i t h an in f o r m a ti o n i n t e r c h a n g e b e tw e e n t h i s b l o c k , an d t h e g e n e r a t e and t e s t m erg e b lo c k ? THE DESIGN OF THE PROTOTYPE SYSTEM. 75 • J u s t whaL l e v e l o f e x p l i c i t k n o w le d g e i s n e c e s s a r y i n t h i s s y s ­ tem ? Do we n e e d t o d e f i n e different "knowledge languages" & ith d i f f e r e n t c a p a c i t i e s f o r d i f f e r e n t b l o c k s , t o an y g r e a t e r e x t e n t t h a n we h a v e d o n e a l r e a d y ? • W ill e l a r g e s e t o f m e rg in g K S 's m anage e l l c l a s s e s o f p i c t u r e s , o r o u s t s e t s o f m e rg e K S 's w h ic h a r e p o t e n t i a l l y c o n t r a d i c t o r y , . b e a s s o c i a te d w ith d i f f e r e n t c la s s e s o f p ic tu r e s ? • W h a te v e r t h e a n sw e r t o t h e p r e v i o u s q u e s t i o n , how c a n t h e s e KS’ s be d is c o v e re d ? T h e s e a r e among t h e m a jo r i s s u e s r a i s e d b y t h e d e s ig n , an d p r o v id e g ro u n d f o r e x te n s iv e re s e a rc h . THE DESIGN OF THE PROTOTYPE SYSTEM. THE IMPLEMENTATION OF THE PROTOTYPE. As we h a v e b r i e f l y m e n tio n e d t h e s e g m e n t a ti o n o f t h e c o d e , t h e la n g u a g e o f im p l e m e n ta tio n a n d t h e s y s te m o n w h ic h t h e s y s te m was im p le m e n te d , we w i l l n o t d is c u s s th e s e is s u e s a g a in . We w i l l d i s c u s s t h e way i n w h ic h t h e p r o t o t y p e w as im p le m e n te d i n te rm s o f t h e d a t a s t r u c t u r e s , t h e e r r o r h a n d l i n g , t h e te c h n i q u e s u s e d t o c o d e t h e s y s te m , a n d t h e c o d e g e n e r a t e d . THE DATA STRU CTU RES. As we h a v e s t a t e d a b o v e , t h e s y s te m d a t a s t r u c t u r e s w ere c o d e d a s p r o c e ­ d u r e s , w ith t h e d a t a in t h e o r i g i n a l im p l e m e n ta tio n b e in g l o c a l t o t h e p r o c e d u r e ; o p e r a t o r s a n d d a t a w ere t h e n p a s s e d i n t u r e s a s p a ra m e te rs f o r t h e s e p r o c e d u re s . an d o u t o f t h e s t r u c ­ We h a v e s a i d a b o v e t h a t tw o c a t e g o r i e s o f d a t a a r e r e c o g n i s e d : s y s te m d a t a , w h ic h a r e r e q u i r e d e i t h e r b y m o re th a n o n e KAB, o r b y o n e KAB o n m o re th a n o n e o c c a s io n , an d s im p le d a t a , w h ic h e x i s t l o c a l t o a b lo c k . S y stem d a t a h a d t o b e p l a c e d i n a common b lo c k d e c l a r e d i n th e lo a d e r , a s w e l l a s i n t h e b l o c k , a s t h e H P-1000 when i t lo a d e d a se g m e n t, o v e r ­ w r o t e t h e p r e v io u s s e g m e n t 's l o c a l d a t a s p a c e , w h ic h w as n o t r e s t o r e d when th e p r e v i o u s se g m e n t was r e l o a d e d ; o n ly d a t a common w i t h t h e l o a d e r w ere s a fe . T h is s itu a tio n is not id e a l fro m a s o f tw a r e e n g in e e r i n g p o i n t - o f - v i e w , an d le'd t o an a m ount o f d e b u g g in g t h a t w o u ld o t h e r w is e h a v e THE IMPLEMENTATION OF THE PROTOTYPE. been u n n e c e s s a r y , c au se d by e r r o r s su c h a s m is s p e lt, common b lo c k n am es, and i n a p p r o p r i a t e a c c e s s t o s t r u c t u r e s . T he c o m p ile r u s e d s t o r e d common b lo c k s c o n t i g u o u s l y , w ith no run-tim er1b o u n d s u b s c r ip te d v a r ia b le s . a b o u t 75% o f t h e ch e c k in g on ac c e sse s to T h is c r e a t e d an a p p a l l i n g o v e rh e a d i n d e b u g g in g : e rro rs f o u n d , w o u ld h a v e b e e n f o u n d an d r e j e c t e d b y a l a n g u a g e t h a t c h e c k e d b o u n d s o n s u b s c r i p t e d v a r i a b l e s a t r u n tim e . S im p le d a t a d i d n o t i n g e n e r a l p r e s e n t s u c h p r o b le m s . T hese d a ta ( fo r e x a m p le t h e s t a c k s g e n e r a t e d b y a r u l e when i t w as b e in g e v a l u a t e d ) w ere m o re t r a c t a b l e , l a r g e l y a s n o m o d i f i c a t i o n s h a d t o b e made t o p r o c e d u r e s u s i n g s im p le d a t a , when t h e c o d e h a d t o b e se g m e n te d . D a ta s t r u c t u r e s w e re c o d e d t o r e t u r n , d e p e n d in g o n t h e d a t a s t r u c t u r e , p a r a m e t e r s o t h e r th a n t h e d a t a r e q u e s t e d . ro u tin e s th a t c o m p ris e t h e s y s te m a r e I n a p p e n d ix I , w h e re t h e s u b ­ i n d i v i d u a l l y d e s c r i b e d , we h av e d o c u m e n te d t h e m e an in g o f r e t u r n e d p a r a m e t e r s . ERROR HANDLING. v. T he e r r o r h a n d l i n g p r o v id e d i n t h e im p l e m e n ta tio n i s at th is q u ire d to a p a r a m e t e r w h ic h i n d i c a t e s w h e th e r i t c essfu l r e tu r n o r w h e th e r i t l e v e l o f im p l e m e n ta tio n . s im p le , b u t i t . h a s p ro v ed e f f e c tiv e has f a ile d ; in g e n e ra l, s y s te m m u st f a i l , a lth o u g h t h e r e a r e e x c e p t i o n s . THE IMPLEMENTATION OF THE PROTOTYPE. E ach r o u t i n e i s r e ­ has been i f a ro u tin e f a i l s , suc­ th e When a r c - u tin c d e t e c t s a c o n d i t i o n a s a r e s u l t o f w h ich i t w i l l fa il, it w i l l w r i t e a m e ssa g e t o t h e o u t p u t d e v ic e d e s c r i b i n g t h e f a i l u r e an d i t s s o u r c e ( t h e num ber o f t h e c u r r e n t K S ). I t w i l l th e n s e t i t s r a m e te r t o z ero , s ta tu s p a ­ a n d w i l l t e r m i n a t e , b y g o in g t o t h e s t a t e m e n t n u m b ered " 7 0 " (7 0 w as c h o s e n f o r n o p a r t i c u l a r r e a s o n ) . H en c e, i n a n y r o u t i n e , " g o to 7 0" m eans t h a t t h a t r o u t i n e s h o u ld f a i l an d t e r m i n a t e . A ro u tin e t h a t c a l l s a r o u tin e t h a t th e n f a i l s , w i l l i t s e l f f a i l , u n le s s th e e r r o r is o n e o f t h e s m a ll c l a s s o f n o n - r a t a l e r r o r s t h a t w i l l b e T h u s, th e d e s c rib e d . f a i l u r e o f a n y o n e r o u t i n e c a u s e s a c h a in o f f a i l u r e s , u n t i l t h e lo a d e r i t s e l f f a ils . I n m o st c a s e s , e r r o r s w i l l b e r e p o r t e d a lo n g t h e c h a i n , a n d o n e e r r o r may g e n e r a t e a c h a i n o f e r r o r m e s s a g e s . N o n -f a ta l e r r o r s a re : * An a tte m p t t o p o p fro m a n e m p ty c o n d i t i o n s t a c k , i f a t l e a s t o n e c o n d itio n has a lre a d y been popped e v a lu a te d a l l o u r c o n d itio n s , ( th is m eans th a t we h a v e a n d m u st move t o t h e n e x t p h a s e o f e v a l u a t i n g t h e K S ). ♦ An a tte m p t to access r e g i o n 's n e ig h b o u r n e ig h b o u r s (th is in f o r m a t i o n code, w ill ab o u t th e n 't h w h e n v - th a t r e tu r n a re g io n has r e g io n o f a few er th a n n s t a t u s v a lu e t h a t f o r c e s t h e c o n d i t i o n v a lu e t o z e r o ) . T h e s e e r r o r - h a n d l i n g te c h n i q u e s h a v e s o f a r p r o v e d a d e q u a te t o t h e n e e d s o f d e b u g g in g t h e p r e s e n t s im p le k n o w le d g e b a s e . THE IMPLEMENTATION OF THE PROTOTYPE. CODING TECHNIQUES USED FOR BUILDING THE PROTOTYPE SYSTEM. T he s y s te m w as b u i ? t o n s o u n d so ftw a re e n g in e e r i n g p rin c ip le s . D a ta s t r u c t u r e s w ere " h id d e n " fro m h i g h e r - l e v e l 'p r o c e d u r e s , b y u s i n g t h e a p ­ p ro a c h d e s c rib e d . T he c o d e i t s e l f w as s t r u c t u r e d , a lth o u g h i n some p r o ­ c e d u r e s t h e s t r u c t u r e _ i s m e ssy , l a r g e ly a s a r e s u l t o f th e p r a c t i c e o f p u t t i n g " f i x e s " i n , w ith o u t p e r f o r m in g an y r e v i s i o n s t o r e g a i n s t r u c t u r a l e le g a n c e . A l l r o u t i n e s a r e r e q u i r e d t o i n d i c a t e w h e th e r th e y h a v e f a i l e d o r s u c c e e d e d a n d , a lth o u g h o n e may a rg u e t h a t i t i s p o s s i b l e f o r 6 r o u t i n e t o b e u n a b le , b y v i r t u e o f i t s f a i l i n g , to r e p o rt t h a t i t h as f a i l e d , th e te c h n i q u e w ork s w e l l e n o u g h i n p r a c t i c e . T he la n g u a g e u s e d was s t a n d a r d FORTRAN 77 w i t h tw o e x c e p t i o n s . • An o p t i o n p r o v i d e d t h e c o m p ile r t o We h a v e b y H e w le tt- P a c k a r d t h a t a llo w s o n e t o f o r c e dem and e x p l i c i t t y p i n g o n a l l v a r i a b l e s , w h ic h t o a v e r y l a r g e e x t e n t s i m p l i f i e s d e b u g g in g . • A r o u tin e s p e c if ic t o t h e H P-1000 w as u s e d w h ic h r e c o v e r s a p a ­ r a m e te r l i s t w h ic h i s g iv e n when t h e p ro g ra m i s r u n . This m e an t t h a t t h e o u t p u t d e v ic e c o u ld b e s p e c i f i e d a t r u n tim e , b y p a s s i n g t t h e p ro g ra m , i n t h e i n v o c a t i o n , t h e num ber o f t h e d e v ic e t o w h ic h t h e o u t p u t s h o u ld b e d i r e c t e d . T he DO WHILE s t a t e m e n t , a lth o u g h s t a n d a r d t o FORTRAN 7 7 , was n o t u s e d ; t h e s t r u c t u r e shown b e lo w w as u s e d i n s t e a ’d , l a r g e l y ' a s 1 d i d n o t r e a l i s e u n t i l t o o l a t e , t h a t FORTRAN 77 p r o v id e d t h i s s ta te m e n t . • THE IMPLEMENTATION OF THE PROTOTYPE. , 76 aaa CONTINUE I F ( i n v e r s e c o n d i t i o n ) GOTO bbb ( s t a r t o f b lo c k ) ) ( (e n d o f b lo c k ) GOTO a a a bbb CONTINUE L o g i c a l v a r i a b l e s w ere n o t u s e d , a s a r e s u l t o f a c o m p ile r b u g t h a t made t h e i r b e h a v io u r u n p r e d i c t a b l e . te n d e d t o b e o f th e to INTEGER; t h i s I n s te a d , a l l v a r i a b l e s w h ic h w ere in ­ l o g i c a l ty p e w e re d e c l a r e d a s INTEGER*2 ( a s o p p o se d a s s o c i a te s w ith th e c la s s o f v a ria b le a u n iq u e ty p e , m a k in g c h a n g e s t o t h e i r d e c l a r a t i o n s im p le ) an d th e n a s s ig n e d e i t h e r z e r o ( f a l s e ) o r one ( tr u e ) a s n e c e s s a ry . T h e c o d in g - te c h n i q u e s u s e d w ere f a i r l y s t a n d a r d ; t h e c o d e t h a t was g e n ­ e ra te d i s a w e ..in te r e s ti n g . THE CODE. T h e p r o t o t y p e s y s te m was c o d ed a s a l a r g e s e t o f s u b r o u t i n e s , w h ic h a r e i n d i v i d u a l l y d e s c r i b e d i n a p p e n d ix I . T h is te c h n i q u e a llo w e d se g m e n ta ­ t i o n to be im p le m e n te d e a s i l y when i t was r e q u i r e d , fro m w h ic h s i m p l e r su b s y s te m s c o u ld b e c lo n e d . THE IMPLEMENTATION. OF THE PROTOTYPE. an d le d t o a sy s te m U sin g t-licsc t e c l i n j q u c s , somt' 4300 H n e s w ero w r i t i e i j , to iraplBmcnL th e p r o t o t y p e d e s c r i b e d a b o v e , w i t h t h e e x c e p tio n o f t h e s e c t i o n o f g tm e r t h a t c h a in s f o rw a rd th r o u g h t h e s y s te m s t r u c t u r e l i s t t o f i n d t h e m ain sy s te m g o a l. T h is c o d e i s k i t h ' c o m p ile r p re s e n te d , re p o rts an d t h e in its se g m e n te d f o rm , i n lo a d m ap. It a p p e n d ix I I I , c a n b e s e e n w hen c e r t a i n s u b r o u t i n e s a r e i n s p e c t e d ( " s t r l i s V , t h e s y s te m s t r u c t u r e l i s t , fo r ex­ a m p le ) , t h a t t h e r e a r e s e c t i o n s o f c o d e t h a t a r e n o t u s e d b y t h e sy s te m as i t is a t p re s e n t. T h e s e a r e f o r t h e u s e o f t h e s e c t i o n t h a t w as n o t im p le m e n te d . T he a l g o r i t h m s u s e d a r e d e s c r i b e d i n "T he D e s ig n o f t h e P r o t o t y p e S y stem " a n d t h e n e ig h b o u r - c o d e m e rg in g te c h n i q u e s i n " N e ig h b o u r C o d e s" . im p le m e n ts t h e s e a lg o r i th m s c o r r e c t l y , a s f a r a s I c a n s e e . The code The p r o to ty p e h a s b e e n t e s t e d s u c h t h a t t h e p r e s e n t v e r s i o n h a s p ro d u c e d n o e r r o r s when r e q u i r e d t o d e a l w i t h K S 's o f d i f f e r e n t ty p e s i n d i f f e r e n t b l o c k s . T e s t i n g d o e s n o t a llo w o n e t o c e rtify a s y s te m e r r o r - f r e e , b u t a l l e rro rs en­ c o u n te r e d h a v e b e e n d e a l t - w i t h , an d I h a v e s e e n n o e r r o r s fro m t h e p r e s e n t v e r s i o n i n a num ber o f t e s t s . CONCLUSION. T he im p l e m e n ta tio n o f t h e p r o t o t y p e h a s b e e n d e s c r i b e d . We h a v e d i s c u s s e d t h e i s s u e s a n d te c h n i q u e s i n v o lv e d , r a t h e r th a n t h e d e t a i l s o f t h e c o d e . T he s y s te m , i t i s c la im e d , w o rk s , an d r e s u l t s w i l l b e g iv e n a n d d i s c u s s e d i n t h e f o llo w in g c h a p t e r . THE IMPLEMENTATION OF THE PROTOTYPE. I n t h i s c h a p t e r , r e s u l t s o b ta in e d fro m w o rk i n t h i s p a ra d ig m w i l l b e d e ­ s c rib e d . We w i l l a tte m p t t o show t h a t th e y e n c o u r a g e t h e u n d e r t a k i n g o f f u r t h e r w o rk i n t h i s p a r a d ig m . T h e r e s u l t s a r e o f tw o t y p e s ; t h o s e o b ­ t a i n e d w i t h i n t h e p a ra d ig m , b u t n o t a s a r e s u l t o f t h e u s e o f t h e s y s te m d e s c r ib e d a b o v e , and th e r e s u l t s o b ta in e d by p ro to ty p in g th is s y s te m . T h e f o rm e r a r e m o re d i r e c t l y e n c o u r a g in g . RESULTS OBTAINED WITHIN THE PARADIGM. We h a v e d i s c u s s e d a b o v e t h e w o rk o n t h e p a r t i c l e - s i z e d i s t r i b u t i o n a n a ­ ly s e r . I t i s n o t im m e d ia te ly o b v io u s t h a t t h i s i s w ith in th e scope o f t h e p a ra d ig m o f f e r e d , b u t i t c a n b e s e e n t h a t t h e p i c t u r e ' i s b e in g h a n d le d i n te r m s o f r e g i o n s , a n d t h a t t h e p r o c e s s i s k n o w le d g e - g u id e d , a lth o u g h t h e k n o w le d g e u s e d i s n o t e x p l i c i t . T h is w o rk h a s g e n e r a te d some p ro m ­ is in g re s u lts . T h e p h o to g r a p h s p r o v id e d a s f i g u r e 11 show t h e q u a l i t y o f p i c t u r e ta k e n o n D e e l k r a a l g o ld m in e , w h ile d a t a w e re b e in g c o l l e c t e d f o r t h i s p r o j e c t . T h e s e p i c t u r e s a r e h a r d l y c o m p r e h e n s ib le , b u t show g o ld o r e o n a c o n v e y o r b e lt, The o r e i s b e in g c o n v ey e d t o a m ill, an d h a s n o t b e en c ru s h e d . T he p ro b le m p o s e d b y t h e l a r g e q u a n t i t y o f a d s o rb e d f i n e p a r t i c l e s c an b e se e n to be c o n s id e r a b le . RESULTS. 1 -Si . 81 • I t c a n a l s o b e s e e n t h a t tli c p r o to ty p e o f th e p a r t i c l e - s i z e d i s t r i b u t i o n a n a l y s e r (PSDA) h a n d le s t h e p ro b le m f a i r l y w e l l , a s i t h a s se g m e n te d t h e p i c t u r e , d e s p i t e i t s q u a l i t y , i n t o r e g io n s s e n s ib ly . The PSDA h a s been an d h a s m erged t h o s e r e g i o n s s e e n t o h a n d le many s u c h p i c t u r e s ; th e te c h n i q u e s i t u s e s a r e c l o s e l y li n k e d t o t h e i d e a s d e s c r i b e d a b o v e , w i t h t h e e x c e p tio n t h a t th e y a re s t r u c t u r e o f t h e s y s te m . in g e n eral m ore d e e p ly em bedded in th e T h u s , t h e PSDA f i n d s t h e p a r t i c l e s i n t h e p i c ­ tu r e by: 1. S e g m e n tin g t h e p i c t u r e i n t o r e g i o n s . 2. M e rg in g t h e s e r e g i o n s a c c o r d in g t o t h e r u l e s d e v is e d . 3. G o in g o v e r t h e m e rg e d p i c t u r e le d t o t o u n d o t h o s e m e rg e s w h ic h h a v e r e g io n s o f a su s p e c t s h a p e , ( e .g . h o u r g la s s - s h a p e d re ­ g io n s a r e n o t e n c o u r a g e d ) T h is t e c h n iq u e is r e d o l e n t o f t h e i d e a s t h a t m o t i v a t e t h e p a ra d ig m p r e ­ s e n t e d , o f a k n o w le d g e - g u id e d p r o c e s s , a n d o f a c t i v e k n o w le d g e . T hese id e a s h a v e b e e n b a s i c t o t h e w o rk d o n e b o th b y t h i s a u th o r a n d b y B e r g e r , who h a s o b t a i n e d t h e s e r e c e n t r e s u l t s ’ w i t h t h e PSDA. T he p o i n t h e r e i s t h a t t h e s e i d e a s c a n l e a d t o u s e f u l w o rk in g s y s te m s . P T he PSDA was d e v e lo p e d u s i n g r e g i o n s a s t h e f e a t u r e f i r s t e x t r a c t e d , a f t e r i t b e c a m e 'a p p a r e n t t h a t t h e y w o u ld b e t h e s i m p l e s t f e a t u r e t o w o rk w it h . (T h e p r o c e s s d e s c r i b e d a b o v e w o u ld b e f a r m o re cum bersom e i f to be e x tra c te d .) T hus, th is w o rk can e d g e s w ere b e c la im e d t o b e w i t h i n t h e p a ra d ig m p r o p o s e d on t h i s C o u n t a s w e l l , an d i t s p r e s e n t a p p a r e n t s u c c e s s can b e u se d t o s tr e n g th e n th e j u s t i f i c a t i o n RESULTS. f o r t h e " p arad ig m . 9 : The a b o v e phoL ograpl- is show th e r e s u l t s oi! th e PCDA w o rk , The lo p p h o lo i’n ip h i s ' o t th e p i c t u r e ta k e n on th e m in e : th e b o tto m K1G th e tiC G in i'n iiitio n a r r i v e d a t Ijy th e PSDA. RESULTS OBTAINED BY PROTOTYPING THE SYSTEM. I c a n n o t c la im y e t t h a t t h e p r o t o t y p e *->■ I s , and g e n e r a te s , t e s t s , g io n s , b u t th e la tte r is a n a ly s in g s c e n e s ; a c tiv ity f a c to r s i s n o t y e t g u id e d to w a rd t h e p r i m i t i v e s r e q u i r e d , o r to w a rd f i n d i n g an o b j e c t i n t h e p i c t u r e . o u t,. it c o n fir m s a n d im p le m e n ts m e rg e s b e tw e e n r e ­ We w i l l show h e r e rom t h e s y s te m a s i t ' e x p a n d s a g o a l , an d m e rg e s r e g i o n s , a lth o u g h t h e m e rg in g i s n o t g o a l - d i r e c t e d . R e fer to f ig u r e 1 0 , w h ic h show s t h e k n o w le d g e b a s e o n w h ic h t h e sy s te m o p e r a t e s i n t h i s e x a m p le . I t c o n s i s t s o f 12 K S 's , t h e 1 2 't b of w h ic h is n o t u s e d , a s t h e KAB f i n i s h h a s n o t b e e n im p le m e n te d , w ith t h e r e s u l t t h a t t h e s y s te m w i l l c y c l e e n d l e s s l y th r o u g h t h e r u l e b a s e , w hen i t s t a s k s h a v e b e e n p e r f o r m e d , a s o p p o se d t o te r m i n a t i n g c l e a n l y . T h e K S 's w i l l b e i n ­ t e r p r e t e d b e lo w . T h e r e a r e o n ly tw o K S 's w i t h " s t a r t " i n t h e i r SBC f i e l d , an d t h e i r m eaning h a s b e e n g iv e n a b o v e , a s t h e KS’ s u se d i n t h e s t a r t b lo c k d o n o t v a r y . T h e K S 's w i t h f g o a l s i n t h e i r SBC f i e l d ‘ fo rm t h e d e s c r i p t i o n o f a n e l e ­ p h a n t, a lth o u g h a n a r b i t r a r y h a v in g f o u r l e g s , N o tic e o n e . T he tw o e y e s , tw o e a r s , e le p h a n t has been d e s c rib e d a p o t e n t i a l s o u rc e o f c o n fu s io n h e re . The ta g s i n t h e SBC f i e l d s f o r f g o a l and g tm e r a r e f g o a l s an d g tm e r g , f o r e n t i r e l y to r ic a l rea so n s, c o m p le x itie s . RESULTS. as and a tr u n k , w ith no s p a t i a l t e - h is ­ an d c h a n g in g them w o u ld h a v e in v o lv e d u n n e c e s s a r y la tio n s h ip s p e c if ie d b e tw e e n t h e s e p r i m i t i v e s . T he d e s c r i p t i o n may be t r i v i a l , an d i n a c c u r a t e , b u t i t i s s u f f i c i e n t t o i l l u s t r a t e t h e p r o c e s s . We h a v e d e s c r i b e d a l e g a s c o n s i s t i n g o f a t h i g h o n to p o f a k n e e o n to p o f a s h i n , an d " e y e " , " e a r " , " t r u n k " , " t h i g h ” , " s h i n " a n d " k n e e " a r e a l l p r i m i t i v e s , w h o se d e s c r i p t i o n a lth o u g h o p e n t o a rg u m e n t, i s s u f f i c i e n t l y c o m p re h e n s ib le i n t h e KS la n g u a g e t o n e e d n o f u t h e r d i s c u s s i o n . i s o n l y o n e r u l e w i t h g tro e rg i n its SBC f i e l d , T h ere w h ic h e x p r e s s e s t h e in ­ t e n t i o n th a t- r e g i o n s w i t h n e ig h b o u r s w i t h t h e sam e g r e y - l e v e l , s h o u ld b e m e rg e d .to th e m . .At t h i s s t a g e o f o u r d e m o n s t r a t i o n , we m u st com pose a p i c t u r e a n d r e n d e r i t i t i t o t h e l l e p r e s e n t a t i o n f o r t h e s y s te m t o uses, a s we a r e n o t y e t u s i n g t.he s o f tw a r e e s c r i b e d t o B e r g e r i n t h e t e x t a b o v e , f o r c o m p u tin g n e ig h b o u r i:c d e s , b e c a u s e i t ivt^aft.ito ta k e o n e . ta tio n is e a s i e r t o com pose a p i c t u r e t o t h e s y s t e m 's l i k i n g T he p i c t u r e we h a v e u s e d i s it:g e n e ra te s in fig u re 11. shown w ith t h e r e p r e s e n ­ T he o u t p u t o f th e s y s te m f o r t h i s I'ljictu i-e, -g iv e n t h i s k n o w le d g e b a s e , i s show n i n f i g u r e 1 2 . We h a v e a n - \■itT'tatsdx t h e o u t p u t a s b e in g m o re u s e f u l i n t h a t fo rm , t h a n i f it w e re d e s c r iv n d . V What i s i W r t h n o t i n g i s : * < Vhe sys-tern h a s f a c t o r e d t h e g o a l s u c o . j s f u l l y , an d h a s a f u l l - :/ id e s e i r ip t io n o f i t i n te r m s b o th o f p r i m i t i v e s a n d o f s t r u c t u r e . • The s y s te m has g e n e ra te d , mes.'jWf; b e tw e e n r e g i o n s , te s te d , and th e c o n firm e d r e s u lts c o r r e c tly r e f le c te d in th e re p r e s e n ta tio n . RESULTS. of a n d im p le m e n te d th e se m e rg e s a re Thus t h e p r o t o t y p e i s d o in g w h at we h a v e c la im e d i t c a n d o . p e r h a p s c l e a t i s why t h i s I t i s i m p o r ta n t b e c a u s e i t W hat i s n o t i s im p o r ta n t. i s £. c l e a r i n d i c a t i o n t h a t a p r o t o t y p e o f t h i s n a t u r e c a n b e s u c c e s s f u l l y b u i l t , an d c a n b e e x p e c te d t o w ork w ith s im p le p ic tu re s . It is ro o st u n f o r t u n a t e t h a t t h e p r o b le m s t h a t p r e v e n t e d t h e im p l e m e n ta tio n o f t h e b lo c k t h a t w ou ld h a v e m e rg e d f o r w a r d t o t h e m ain s y s te m g o a l , o c c u r r e d when th e y d i d , a s t h e s u c c e s s o f t h i s b lo c k w o u ld h a v e made t h e p r o t o t y p e a m ore c o n v in c in g a rg u m e n t f o r f u r t h e r w o rk to w a rd b u i l d i n g a m o re s o p h i s t i c a t e d v e r s i o n o f t h e s y s te m d e s c r i b e d ; a s i t i s , th e p ro to ty p e i s o p e n t o t h e a rg u m e n t s o o f t e n s u c c e s s f u l a g a i n s t w o rk i n t h e a r t i f i c i a l - i n t e l l i g e n c e f i e l d , " S u r e , i t lo o k s g o o d now , b u t w h at h a p p e n s when i t e n c o u n t e r s t h e r e a l p r o b le m s ? " . T h is i s u n f o r t u n a t e , a s t h e a rg u m e n t i s s t r o n g , a n d a s we h a v e s a i d a b o v e , th e re d o e x i s t p r o b le m s f a r h a r d e r th a n t h e o n e s s o lv e d h e r e , many o f w h ic h w i l l n o t r e s p o n d w e l l t o b e in g s i d e s t e p p e d . c ritic is m I m u st a n sw e r th is f r a n k l y , b y s a y in g t h a t I am n o t c e r t a i n t h a t t h e s e p ro b le m s may b e s o lv e d i n t h a t t h e s y s te m i n t h e fo rm d e s c r i b e d , w i l l a n a ly s e r e a l s c e n e s , I ro u st e x p r e s s m o re f a i t h i n t h e p a ra d ig m d e s c r i b e d (T h e e v id e n c e in i t s favour i s s t r o n g e r . ) , w h ic h n o t o n ly h a s r e a s o n a b l e t e n e t s , b u t w h ic h c a n a l s o b o a s t a w o rk in g system ( t h e PSDA) d e s ig n e d w i t h i n i t . T he p r o t o t y p e c a n b e s t b e d e s c r i b e d a s p a r t o f an u n f i n i s h e d lo n g - te r m ;> e x p e r im e n t: i t h a s w o rk e d t o t h e e x t e n t t h a t i t h a s b e e n im p le m e n te d , an d t h i s i n d i c a t e s t h a t f u r t h e r w o rk o n i t w o u ld b e f r u i t f u l . fo rm , it s tr o n g c a n b e m ade t o w o rk on s im p le p i c t u r e s , a rg u m e n t fo r it I f in th e f u l l w ould r e p r e s e n t h e r e , w ith a v ie w t o b u i l d i n g a n e v e n m ore p o w e r f u l s y s te m . RESULTS. a a l a r g e r r e s e a r c h e f f o r t i n t o t h e p ro b le m s r a i s e d I am u n a b le ' 85 -k; w h at I c a n s a y say h e re t ;hy i t rfo rm e d t o s h o u ld n ’t , L n a t th e work and o f f e r s h o p e C O N C L U S IO N . .We h a v e show n r e s u l t s fro m w o rk o n t h e p a r t i c l e - s i z e d is trib u tio n l y s e r , an d fro m t h e p r o t o t y p i n g o f t h e s y s te m d i s c u s s e d . ana­ T he o u t p u t o f t h e s y s te m f o r a g iv e n k n o w le d g e b a s e w as sh o w n , a n d t h e p r o t o t y p e sy s te m c o u ld b e s e e n t o f a c to r a g o a l, p le m e n t m e rg e s . T hese r e s u l t s do p a ra d ig m is ju s t if i e d , p r e s e n te d a b o v e. and t o g e n e ra te , c o n f ir m th a t t e s t , c o n f ir m a n d im ­ fu rth e r b u t do n o t y e t f u l l y v a l i d a t e w ork in th is th e 's y stem d e s ig n T h e r e i s , h o w e v e r, h o p e f o r t h e d e s i g n , a s a lth o u g h i t has n o t been v a lid a t e d , t h e p r o t o t y p e s u g g e s ts t h a t i t may b e . S tro n g a rg u m e n ts may s t i l l b e r a i s e d a g a i n s t t h e d e s ig n a n d t h e p r o t o t y p e , b u t f u r t h e r w o rk a lo n g t h e s e l i n e s seem s t o b e j u s t i f i e d . RESULTS. OOM GOA LS ‘ ( ( ( ( ( ( ( ( H A S i L E G l) W lS<LEE2>)A HAS<LEG?))A HA5(LEG4: )A HAS < E Y E !))A HAS<EYE2>)A HAS<EAR1>)A W S (E A R 2 ))A H A 5 (T R U f« l> )A 1ELEFHT<COI1Pi« 0D3«FGDALS ‘ (m < K N E E l,T H lE m > a N (S H IN l,K lE E V )A « L E G < C O T )' (l04'F£O A L5 »(SHA PE(RCUI0> SlZE<UShALL> )A 'E Y E tPR ll1> ‘ QOS'START M M DB5 «tRlE(OU»>*ClCTXT<FGOALS>* •SihG<CENTRE,fil>*M EREE<CENTRE,Rl)* O aV FG O A L S •((({ S H A P E iR O lH D > TEX1U K (!.OW >)A E F L E C < U K > )A )A S 1 2 E < L A R £ E ')A 'E S )R < P R ]IV * : a U<I1EDIUM> FIG. 10,1 : Tlie K n o w led g e b ase used f o r t he ex am p le . V L P r r LEC<La-' ft. Tf* CO V 'FG Q W .5 J lff'F G O A L S * ( S H t f t< L * T ) S IZ E iM E O lU m M 'T K lG H tP R lIV * S I Z £ ( S m u L > ) S 1K E £ ( P R m “ 0 1 J* F S D ftL S « (S H A P E < l» T > S iZ E C to D I U li! S '6 H lH iP R I M > » D 1 2 * F IH i5 H «!R tJE<D ’J I1)*C H C T X T <FlH IS H >‘ FIG. 10,2 : The K n o w led g e b a s e u s e d ' o r th e e x a m p le . Region 1 2 3 4 f ig . 11 Code 2 1-12 4 3 1 3 4 1-1 14 Z 1 23 Are qreu lerel 0,0 0,0 63,0 63,0 The picture used in the example, with its representation. 1kp r tto v i^ itjstewv | 4k wvm a o c o l- AGEKGOAD SYSTEM PEEX1IRES CORRECT S P E L L IN G ,< - 6 CHAPS C H CTX KFG OA LS) FSO A LS RNUM 6 MtETMW S H lN <PR IM > FIG.12.1: Hie o u tp u t o f th e system fo r the g iv e n knowledge base and th e gi. p ic tu re . A. H W f IS PIG 12,2: The o u tp u t o f the system f o r Che g iv en knowledge base and th e given p ic tu re . & :<C E N T R E.R 1> E P » £ < C E H T R E ,R V 1.000 4HB5GE 2 < 3 YIO W .5; T h e o u t p u t o f th e s y s te m f o r th e g iv e n k n o w le d g e b a s e a n d t h e g iv e n p ic tu r e . fm 4 RNUH RtMl FIG,42.4= T he o u t p u t o f th e s y s te m f o r th e g iv e n k n o w le d g e b a s e a n d t h e g iv e n p ic tu re . 6 STATE 4 P R fiU S T FOLLOWS EYE ROUIO EAR R O U ® M EO IU U D U DK TR L M : L «T 'D K liED IUtlLO U TH IG H V Y KNEE ROUND th e . p n w t W r ' STRUCTURE F O L LO JS A TER STA tK I ANDSTACK IN T H IS ORDER I CANDSTfCK RTORSTACK A )A )A )A )A )A )A )A )(((((((( ANDSTACK HAS HAS HAS HAS HAS CANDSTACK TRUNKIEAR2 EAR1 EY E2 E Y E I ATORSTACK HAS HAS LEG4 LEG} HAS HAS L E S2 LEG! ANDSTACK ON ON ” l ” m T H lM tM B NCTIffi FOLLOWS j-' -1 -1 2 4 ? B 0 0 H 0 % _ _ _ _ _ 1 } 4 1- 1 0 0 00 0 0 # 0 14 2 0 0 B 0 0 0 0 0 D A_____1 2 3 0 0 0 0 G 0 0 0 0 0 0 00 0 0 9 0 0 0 0 0 o o ^ th u is ■ lk e 4 0 e Cll 1 /5 6 0 1 D0 } 0 ob U o o o o a o o o o o o o lo 0 0 0 C 0 0 0 0 0 9 0 9 C 0 0 0 [G 00 0 0 0 0 0 0 0 0 0 0 p a o oo o o o o o b a g o o p 9 0 G0 0 G G 0 0 0 0 0 0 0 i) NCXREF _________________ — IXf' 5 6 7 B M O rE ? L ^ — — a to j - 4 I . KJUH FIG 42.5; The o u t p u t o f th e s y s te m f o r th e g iv e n k n o w le d g e b a s e a n d t h e g iv e n C O N C L U SIO N A new p a ra d ig m t o a llo w g e n e r a l s c e n e a n a l y s i s h a s b e e n p r e s e n t e d . A s y s te m h a s b e e n d e s ig n e d w i t h i n t h i s p a ra d ig m , a n d p r o t o t y p e d i n a l i m i t e d fo rm , t o show t h a t t h e p a ra d ig m d o e s in d e e d s i m p l i f y t h i s p r o b le m . d e s i g n . a n d im p l e m e n ta tio n o f t h e p r o t o t y p e h a v e b e e n d i s c u s s e d , o u tp u t o f th e p ro to ty p e , p re s e n te d . T he and th e o p e r a t i n g o n a g iv e n k n o w le d g e b a s e , h a s b e e n S u p p o r t fro m o t h e r w o rk f o r t h e p a ra d ig m h a s b e e n p r e s e n t e d . We h a v e s a i d a b o v e t h a t t h i s w o rk b y i t s n a t u r e c o u ld n o t y e t d e m o n s tr a te t h e v a l i d i t y o f t h e p a r a d ig m , o r o f t h e s y s te m d e s ig n e d w i t h i n i t , but m u st b e l i m i t e d t o sh o w in g t h a t t h e r e h a v e b e e n n o g r o s s e r r o r s i n t h e i r c o n s t r u c t i o n , a n d t h a t t h e y a r e f e a s i b l e a n d v a l i d g o a l s t o w o rk to w a rd . I b e l i e v e t h a t t h i s h a s b e e n d o n e , b y t h e p r e s e n t a t i o n b o th o f t h e s u c c e s s of th e PSBA w ork., w h ic h h a s b e e n show n t o h a v e b e e n d o n e w i t h i n t h i s p a ra d ig m , an d b y t-/..e r e s u l t s o f t h e w o rk o n t h e p r o t o t y p e , w h ic h h a v e b e e n e n c o u r a g in g , a s we h a v e show n t h a t t h e r e p r e s e n t a t i o n u s e d i s t r a c t a b l e , t h a t a p r o t o t y p e c a n b e b u i l t t h a t may h a n d le p i c t u r e s u s i n g t h i s r e p r e ­ s e n t a t i o n ', a n d t h a t t h i s p r o t o t y p e may f a c t o r t h e g o a l t h a t i t has been p r e s e n t e d w i t h , i n t o a fo rm o f t h i s r e p r e s e n t a t i o n . T he u n f o rtu n a te asp ect of th is w o rk i s its n e ce ssary s u p e r f ic ia lity ; v i s i o n i s a h a r d p r o b le m , b u t i t i s t r y i n g t o b e i n t h e p o s i t i o n a d o p t, w h ere o n e c a n s a y o f t h i s w o rk o n l y t h a t i t p r e s e n ts I m u st a lin e of a p p ro a c h b y w h ic h t h e p r o b le m may p o s s i b l y b e s o l v e d , a n d show s t h a t t h i s a p p ro a c h h a s n o g l a r i n g e r r o r s , a n d t h a t s y s te m s c a n b e b u i l t u s i n g t h a t w o rk u n d e r c e r t a i n c i r c u m s t a n c e s . CONCLUSION it, REFEREN CES. Armco A u to m e tr ic s , M anual fo r B a r r , A. a n d F e ig e n b a w a , E .A . a P a r tic le S iz e D is tr ib u ti o n A n a ly se r, "T he H andbook o f A r t i f i c i a l I n t e l l i g e n c e " , W illia m K aufm an i n c . ,1 9 6 1 . B e rg er, S F -, B .S c .( E le c . •‘'F i r c i c l e E n g .) S iz e d is s e r ta tio n D is trib u tio n s u b m i tte d A n a ly s is " , to u n p u b lis h e d U n iv e rs ity of th e t f i t w a t e r s r a n d , J o h a n n e s b u r g , 1984. B e rg er, S .F ., ( p r i v a t e c o n v e r s a t i o n s ) , 1 9 8 4 ( a ) , an d 1985. B rach m an , R . J . , e t a l , "W hat a r e E x p e r t S y s te m s ? " , i n H a y e s - R o th ,P . et a l ( e d s ) , " B u ild i n g E x p e r t S y s te m s " , A d d is o n -W e s le y , 1983. B u c h an a n , R .J . and S h o r tliff e , E .H ., " R u le - b a s e d E x p ert S y s te m s " , A d d iso n -W e sle y , 1 9 8 4 . C h a r n ia k , E .C . "A Common L an g u a g e -G o n ip re h e n sio n R e p r e s e n ta tio n In fo r m a tio n " , fo r A rtific ia l P r o b le m - s o lv in g and I n te llig e n c e v o l . 16 I n te llig e n c e v o l . 15 p p 2 2 5 -2 5 5 , 1981. D a v is, R ., " R e a s o n in g p p l7 9 - 2 2 2 , 1 9 8 0 . REFERENCES. about C o n tro l" , A rtific ia l , D a v i s , R , , " C o n te n t R e f e r e n c e : R e a s o n in g a b o u t R u l e s " , A r t i f i c i a l I n t e l ­ l i g e n c e v o l . 15 p p 2 2 J - 2 4 0 , 1980 ( a ) . D u b o is , D. an d P r a d e , H . , " F u z z y S e ts a n d S y s te m s: T h e o ry a n d A p p lic a ­ t i o n s " , A ca d em ic, 1 9 8 0 . F o r s y t h , D .A ., " P a r t i c l e S i z e D i s t r i b u t i o n A n a l y s i s " , u n p u b lis h e d B .S c . d i s s e r t a t i o n s u b m i tte d t o U n i v e r s i t y o f t h e W iw a te rs ra n d , J o h a n n e s b u r g , F r e u d e r , B .C ., "A C o m p u ter S y stem f o r V i s u a l R e c o g n i tio n U s in g A c t iv e K n o w led g e ", A .I .- T R - 3 4 5 , M . I . T . , 1 9 7 6 . H a y e s - R o th , F . e t a l , "An O v erv ie w o f E x p e r t S y s te m s " i n H a y e s - R o th , F . e t a l , ( e d s ) " B u ild i n g E x p e r t S y s te m s" , A d d is o n - W e s le y , 1 9 8 3 . L e n a t, D .B ., "T h e N a t u r e of H e u r is tic s " , A rtific ia l In te llig e n c e 19 p p l8 9 - 2 4 9 , 1962 M a rr , D . , " R e p r e s e n t in g an d C o m p u tin g V is u a l I n f o r m a tio n " i n P .H . an d Brow n, R .H . ( e d s ) " A r t i f i c i a l I n t e l l i g e n c e : a n M .I .T . W in s to n , P e rsp ec ­ t i v e " , M . I .T . p r e s s , 1 9 7 9 . M a n d e lb r o t, B . , "The F r a c t a l G eo m etry o f N a t u r e " , W illia m F re e m a n , 1 9 6 2 . N a z i f , A .H ., an d L e v i n e , M .D ., "L o w -L ev e l Im age S e g m e n ta t io n : an E x p ert S y s te m " , I . E . E . E . t r a n s . P a t t e r n A n a l y s is a n d M a ch in e I n t e l l i g e n c e , v o l . 6 n o . 5 ,o p 5 5 5 - 5 7 6 , S e p te m b e r , 1 9 8 4 . REFERENCES. N iem an n , H. a t a l , "A K now ledge B ased S y stem f o r A n a l y s is o f G a te d B lo o d P o o l S t u d i e s " , I . E . E . E . t r a n s . P a t t e r n A n a l y s is an d M ach in e I n t e l l i g e n c e , v o l . 7 n o . 3 , p p 2 4 6 - 2 5 9 , May, 1985. , ( p r i v a t e c o n v e r s a t i o n ) , 1984. SPIDER M a n u al, MITSUI c o r p . , 1985. R E A D IN G S . Many good in tro d u c tio n s to im ag e p r o c e s s i n g a n d s c e n e a n a l y s i s e x i s t : am o n g st t h e b e t t e r a r e b o o k s b y R o s e n f e ld a n d K ak , P r a t t , G o n z a le s an d W in tz , B a l l a r d an d Brow n, a n d Duda an d H a r t . A g o o d i n t r o d u c t i o n t o A r­ t i f i c i a l I n t e l l i g e n c e i s " A r t i f i c i a l I n t e l l i g e n c e " , b y P .H . W in s to n , a n d "T he H andbook o f A r t i f i c i a l I n t e l l i g e n c e " c i t e d a b o v e . READINGS. APPENDICES APPENDICES APPENDIX A. THE SUBROUTINES INVOLVED The s u b r o u tin e s w i l l b e p re s e n te d one by o n e , w ith a l i s t o f th e r o u tin e s c a l l e d b y t h e s u b r o u t i n e , an d an y n e c e s s a r y comments o n t h e s u b r o u t i n e . T he v a r i a b l e s h a v e b e e n e x t e n s i v e l y a n d c a r e f u l l y d e c l a r e d i n each ro u ­ t i n e ; we w i l l n o t d o t h i s h e r e . Program RINT Calls these subroutines. • RMPAK • CONMAT CONHEAD Comments. RINT i s t h e m a in lo a d e r p r o g ra m : i t c o l l e c t s t h e im ag e r e p ­ r e s e n ta tio n fro m d i s k , a n d th e n s c h e d u le s t h e p ro g ra m s e g m e n ts , a s d e ­ s c rib e d in th e te x t . Appendix A. THE SUBROUTINES INVOLVED 93 Program INITS Calls these subroutines COMPUST • PRML1ST STRLIST Comments. IN ITS is a se g m e n t, w h ic h i s why i t m u st b e d e f i n e d a s p r o g ra m , t h a t i n i t i a l i s e s t h e sy s te m d a t a s t r u c t u r e s t h a t r e q u i r e i t . Program START Calls these subroutines • CLFIND • CSSETUP Appendix A. THE SUBROUTINES INVOLVED ASETUP • APSETUP • AHEAD SEGRT C o m m e n ts . START i s t h e se g m e n t t h a t i s b lo c k . START m u st e v a lu a te KS’ s , r e f e r r e d t o above as th e s t a r t a n d h e n c e c o n t a i n s m o st o f t h e KS e v a l u a t i o n a n d a c t i o n c o d e , w h ic h i s p r e s e n t i n a l l KS e v a l u a t i n g r o u ­ tin e s . T h is s e c t i o n o f s t a r t d o e s n o t h i n g b u t c a l l t h e a p p r o p r i a t e r o u - Prcgram FGOAL C a lls t h e s e s u b r o u t i n e s » L1STPG0ALS • COMPLIST Comments. FGOAL i s t h e m ain p ro g ra m f o r f a c t o r i n g t h e m ain s y s te m g o a l. FGOAL c a l l s th e n e c e ssa ry r o u tin e s , b u t does l i t t l e Appendix A. THE SUBROUTINES INVOLVED ' i t s e l f b u t p e rf o rm 95 a n e le m e n ta r y c h e c k on w h e th e r t h e m ain sy s te m g o a l i s b a s e , w h ic h w o rk s l i k e th is : in t h e k n o w led g e I f t h e p r e s e n t KS num ber i s l e s s th a n t h e num ber o f t h e p r e v io u s KS s e e n b y FGOAL, an d t h e m ain s y s te m g o a l i s s t i l l i n t h e s y s te m c o m p o s ite l i s t , th e n we h a v e c y c le d th r o u g h t h e k n o w le d g e b a s e w i t h o u t s e e i n g t h e m a in s y s te m g o a l , a n d i t i s n o t t h e r e . Program GTMER Calls t h e s e subroutines • 6TI2F ‘ • BRHLIST \ s m is t C o m m e n ts . GTMER i s g fp M . t h e se g m e n t t h a t g e n e r a t e s a n d t e s t s m erg es f o r r e - T h is p ro g ra m a g a i n s im p ly c a l l s t h e a p p r o p r i a t e s v ; r o u t i n e s d o t h e w o rk . Appendix A, THE SUBROUTINES INVOLVED ro u tin e s : th e Subroutine AGET Calls these subroutines • COMPLIST Comments. AGET im p le m e n ts t h e a c t i o n GET, w h ic h r e c o v e r s t h e m ain sy ste m g o a l fro m t h e o p e r a t o r , an d p u t s i t i n t o t h e s y s te m c o m p o s ite l i s t . Subroutine AHEAD Calls these subroutines • MRECORD • CHCTXT Comments. AHEAD c a l l s t h e a p p r o p r i a t e r o u t i n e t o im p lem e n t t h e a c t i o n d e s c r i b e d b y t h e e c t i o n name i n t h e KS a c t i o n f i e l d . Appendix A. THE SUBROUTINES INVOLVED Subroutine ANDSTACK C a lls t h e s e s u b r o u t i n e s (NONE CALLED) C o m m e n ts . ANDSTACK im p lem e n ts th e o p e ra n d s ta c k ( c o n ta in s c o n d itio n n a m e s, n o t c o n d i t i o n o p e ra n d n a m e s). Subroutine APSETUP Calls these subroutines (NONE CALLED) Comments. APSETUP r e c o v e r s t h e p a r a m e t e r l i s t t h a t i s a s s o c i a t e d w ith th e a c tio n in th e a c tio n f i e l d o f t h e c u r r e n t KS, an d r e t u r n s a r r a y o f p a r a m e t e r n am es. Subroutine ASETUP Calls these subroutines Appendix A. THE SUBROUTINES INVOLVED it as an C o m m e n ts . ASETUP r e c o v e r s t h e a c t i o n f i e l d from th e KS, s t r i p p e d o f t h e n u m b e r, SBC an d c o n d i t i o n f i e l d s . Subroutine ATORSTACK Calls these subroutines (NONE CALLED) Cobiments. ATORSTACK im p le m e n ts t h e o p e r a t o r s t a c k d e s c r i b e d i n t h e m ain I'-s Subroutine BACKE Calls these subroutines Comments. Same as "ROCKE" (q .v .), b u t f o r m em b ersh ip o f t h e b a c k g ro u n d Appendix A. THE SUBROUTINES INVOLVED S u b r o u tin e BTS Calls these subroutines (NONE CALLED) C o m m e n ts . B ts m akes a lo u d n o i s e a t t h e o p e r a t o r t e r m i n a l i f t h e sy ste m Subroutine CANDSTACK Calls these subroutines (NONE CALLED) Comments. CANDSTACK im p le m e n ts t h e c o n d i t i o n o p e ra n d s t a c k . Subroutine CHCTXT Calls these subroutines (NONE CALLED) Comments. CHCTXT c h a n g e s t h e SBC t o t h e v a lu e p a s s e d i n , im p le m e n tin g t h e CHCTXT a c t i o n . Appendix A. THE SUBROUTINES INVOLVED Subroutine CLEAN Calls these subroutines (NONE CALLED) Comments. CLEAN c l e a n s up a n e ig h b o u r c o d e a s d e s c r i b e d i n a b o v e , b y re m o v in g m u l t i p l e i n s t a n c e s a n d e n d - ir o u n d i n s t a n c e s . Subroutine CLFIND Calls these subroutines Comments. CLilND f i n d s t h e c o n d i t i o n l i s t i n t h e KS, and BTS i s c a l l e d i f a n e r r o r i s e n c o u n e r e d . Subroutine CMERGE Calls these subroutines • INSTNO Appendix A, THE SUBROUTINES INVOLVED SEARCHI Comments. CMERGE i s u s e d t o rem ove s e t s o f i n t e r n a l r e g io n s fro m th e c o d e s t h a t a r e a b o u t t o b e m e rg e d . (S e e t e x t f o r d e t a i l s . ) Subroutine COMPUST Calls these subroutines (NONE CALLED) Comments. COMPLIST i s t h e s y s te m c o m p o s ite l i s t , m e n tio n e d i n t h e t e x t above. Names may ' in th e l i s t . T. M e d t o t h i s l i s t o n ly i f th e y d o n o t m a tc h a n y name i'M< • • ■b e s e a r c h e d , an d r e t u r n s a p a r a m e t e r t h a t i n ­ d i c a t e s w h e th e r i u o f th e lis t is - i n s a m a tch t o t h e p a t t e r n s u b m i tte d . T h e le n g t h r e t u r n e d a s a p a r a m e t e r , a s when i t i s e m p ty , t h e sy s te m g o a l h a s b een fa c to re d . Subroutine CONHEAD Calls these subroutines Appendix A. TOE SUBROUTINES INVOLVED 102 Comments. CONHEAD loads the appropriate block, and passes S u b ro u tin e CONMAT C alls th e s e s u b r o u tin e s (NONE CALLED) Com m ents. CONMAT t e s t s t h e SBC f i e l d c u r r e n t SBC. S u b ro u tin e CSSETUP C alls th e s e su b ro u tin e s • ATORSTACK « ANDSTACK CANDSTACK • REVERSE Appendix A. THE SUBROUTINES INVOLVED of th e c u rre n t Comments. CSSETUP sets up the condition stacks in the fashion described S u b ro u tin e CVARFCL C alls th e s e s u b ro u tin e s • NUMEVAL • RNUMEVAL • QUALEVAL C o m m e n ts . CVARFCL, a s i t s name i m p l i e s , is a c lo n e o f CVARFIX, w h ic h a llo w s a n y r e g i o n r e f e r e n c e t o a p p e a r t o g e t h e r w i t h CENTRE i n a c o n d i t i o n p a ra m e te r l i s t . CVARFIX w i l l n o t p r o d u c e u sa b l-> r e s u l t s w ith t h i s o f p a ra m e te r l i s t , a s i t w as I n te n d e d t o b e u s e d w i t h l i s t s ty p e c o n s is tin g o f a r e g i o n r e f e r e n c e a n d an y o t h e r ty p e o f p a r a m e t e r ( f o r ROCK, f o r e x ­ a m p le ) . A maximum o f tw o r e g i o n r e f e r e n c e s may a p p e a r i n a n y p a r a m e t e r l i s t ; i f tw o a r e u s e d , o n e m u st b e CENTRE. Appendix A. THE SUBROUTINES INVOLVED Subroutine CVARFIX Calls th e s e su b ro u tin e s • NUMEVAL • RNUMEVAL • QUALEVAL C om m ents. CVARFIX T he v a r i a b l e s fix e s th e a re p a ssed in c o n d itio n as s tr in g s , in a s e t o f a r r a y s , one f o r each ty p e . v a r ia b le s as d e s c r ib e d above. a n d CVARFIX r e t u r n s t h e v a lu e s T h u s i f we w ish e d t o f i x t h e p a ­ r a m e te r s t r i n g CENTRE, Q+, 1 00 , t h e a r r a y p a s s e d ( u v a r ) i n w o u ld c o n t a i n a s i t s f i r s t e le m e n t t h e s t r i n g "CENTRE” , a n d s o o n . The f ix e d p a ra m e te rs w o u ld b e r e t u r n e d a s f o l l o w s : T h e f i r s t p a r a m e t e r w i l l b e i n r e g v a r ( l ) ( a r e g i o n t y p e ) , t h e se c o n d i n q u a l v s r ( 2 ) i n n u m v a r(3 ) ( a n u m b e r). (a q u a lif ie r ) , T h u s t y p i n g i s p e rf o rm e d . an d t h e t h i r d T he r o u t i n e c a n n o t h a n d le t h e s y s te m p r i m i t i v e ty p e y e t . (S e e t h e comment o n CVARFCL, b e f o r e u s in g t h i s r o u t i n e .) Appendix A. THE SUBROUTINES INVOLVED S u b ro u tin e EDGE C alls th e s e su b ro u tin e s • CANDSTACK • CVAKFIX C om m ents. EDGE im p le m e n ts t h e e d g e c o n d i t i o n , w h ic h h a s o n e o p e r a n d , a re g io n r e f e r e n c e , an d r e t u r n s t h e v a lu e 1 . i f t h e r e g i o n r e f e r r e d t o i s a i e d g e, and a 0. o th e r w i s e . As w i t h a l l c o n d i t i o n s t h a t u s e a r e g io n r e f e r e n c e o p e r a n d , EDGE u s e s v e c t o r o p e ra n d s an d r e t u r n s v e c t o r r e s u l t s . S u b ro u tin e GTMERCON C alls th e s e s u b ro u tin e s • CLFIND • GSSETUP • VECREVAL • ASETUP Appendix A. THE SUBROUTINES INVOLVED il 106 APSETUP • MBROK • NCFU1 • HEWSTATS C o m m e n ts . GTMERCON g e n e r a t e s , b e tw e e n r e g i o n s . in th e i r SBC f i e l d te s ts , c o n fir m s and T he g e n e r a t e p h a s e o c c u r s f i r s t : im p le m e n ts m erges a l l K S 's w i t h g tm e rg a r e e v a lu a te d f o r a l l r e g io n s in th e p i c t u r e . c a n d id a te s a r e re c o rd e d on d i s k . : M erge T h e t e s t a n d c o n fir m p h a s e o c c u r s n e x t . A l l recom m ended m e rg e s a r e p a s s e d t o MEROK, w h ic h a c c e p t s o r r e j e c t s th e m ; if th e y a r e a c c e p t e d , th e y a r e a u t o m a t i c a l l y c o n fir m e d b y th e c o n fir m p h a s e , w h ic h o c c u r s n e x t . T h e c o n f ir m p h a s e t h e n c a l l s NCFUL, a n d HEWSTATS t o u p d a te t h e r e p r e s e n ­ t a t i o n o f th e p ic tu r e . N o te t h a t GTMERCON i s in v o k e d r a t h e r s t r a n g e l y , a s i t s t a r t s i n t h e f i r s t p h a s e , a n d i s in v o k e d o n c e f o r e v e r y KS f o r e v e r y r e g i o n , l e a v i n g te m p o ­ r a r y r e s u l t s e a c h tim e . w hen g tr a e r i s I t t h e n c h a n g e s p h a s e , b u t c a n s t i l l o n ly e x e c u te lo a d e d b y r i n t ; in v o k e d when a . g tm e r KS i s p h ase, an d t e r m i n a t e s v a ria b le . th u s , in th e l a s t tw o p h a s e s , i t i s o n ly f o u n d , e x e c u te s u n t i l it d e c id e s t o c h an g e l e a v i n g t h e num ber o f t h e n e x t p h a s e a s a sy s te m T h is may s o u n d c o m p le x , b u t i t w as i n f a c t t h e e a s i e s t way I c o u ld s e e o f g e t t i n g t h e r o u t i n e t o w o rk a s I w a n te d i t t o . Appendix A. THE SUBROUTINES INVOLVED I 107 Subroutine INSTNO Calls th e s e s u b r o u tin e s (NONE CALLED) C om m ents. INSTNO c o u n ts t h e num ber o f i n s t a n c e s o f a g iv e n r e g i o n i n a n o th e r r e g i o n ' s n e ig h b o u r c o d e . S u b ro u tin e LGBUF C alls th e s e s u b ro u tin e s (NONE CALLED) Com m ents. T h is i s a H e w le tt- P a c k a r d ro u tin e th a t e n la r g e s th e d is k b u ffe r a re a . S u b ro u tin e LISTPGOALS Calls th e s e s u b ro u tin e s • CLFIND • CSSETUP Appendix A. THE SUBROUTINES INVOLVED 108 ASETUP • NAHFINB COMPLIST • STRLIST • PRMLEXP C o m m e n ts . LISTPGCA'uS t a k e s a KS, s e t s u p t h e a p p r o p r i a t e s t a c k s ( w i th CSSETUP), r e t r i e v e s t h e name o f t h e o b j e c t b e in g d e s c r i b e d , i f t h e name i s i n t h e s y s te m c o m p o s ite l i s t . and checks I f i t i s , th e d e s c r ip tio n i s p a s s e d t o t h e sy s te m s t r u c t u r e l i s t , a n d th e n t o PRMLEXP. I f i t i s n 't , t h e r o u t i n e i g n o r e s t h e KS, an d t e r m i n a t e s . S u b ro u tin e MATCHP Calls th e s e s u b ro u tin e s (NONE CALLED) Com m ents. MATCHP m a tc h e s a g iv e n s t a c k a g a i n s t t h e s y s te m p r i m i t i v e l i s t (w h ich c o n t a i n s b o t h a b s o l u t e an d s y s te m p r i m i t i v e s ) t o a s c e r t a i n w h e th e r t h e KS w hose c o n d i t i o n o p e ra n d s t a c k i t i s , may b e u s e d n e x t f o r fo rw a rd c h a in in g t o th e g o a l. I f a l l t h e n am es i n t h e s t a c k , a r e i n t h e p r i m i t i v e l i s t , t h e KS may b e u s e d . Appendix A. THE SUBROUTINES INVOLVED Subroutine MFROK Calls these subroutines (NONE CALLED) Com m ents. MEROK t e s t s m e rg e s , an d r e t u r n s a f l a g t o a c c e p t o r r e je c t S u b ro u tin e MRECORD C alls th e s e s u b ro u tin e s CVARFCL Com m ents. MRECORD r e c o r d s d e t a i l s o n d i s k o f a m erg e t h a t h a s b e e n r e ­ commended b y a KS. T he d e t a i l s a r e r e c o r d e d o n d i s k s im p ly b e c a u s e th e y w e re i n t h e e a r l i e s t s y s te m b u i l t , an d t h i s h a s n o t b e e n rem oved fro m t h e S u b ro u tin e NAMELIST C alls th e s e s u b r o u tin e s (NONE GALLED) Appendix A. THE SUBROUTINES INVOLVED 110 C o m m e n t s . NAMELIST h o ld s t h e p o i n t e r s f o r s t r l i s t , s tr u c tu r e re c o rd s. an d t h e nam es o f th e A " n e x t p o i n t e r " f a c i l i t y h a s b e e n p r o v id e d in th is S u b ro u tin e NAMFIND C alls th e s e s u b ro u tin e s (NONE CALLED) C om m ents. NAMFIND i s a r o u t i n e c lo n e d fro m APSETUP, t h a t r e t r i e v e s from a KS t h a t d e s c r i b e s an o b j e c t , t h e name o f t h e o b j e c t d e s c r i b e d , and w h e th e r i t i s a p r i m i t i v e o r a c o m p o s ite , b o th o f w h ic h p i e c e s o f i n f o r ­ m a tio n a r e i n t h e a c t i o n f i e l d o f t h e KS. S u b ro u tin e NCFUL C alls th e s e su b ro u tin e s • CLEAN • NCMERGE C om m ents. n e ig h b o u r NCFUL i s codes, th e w h ic h c a llin g checks ro u tin e in Appendix A. THE SUBROUTINES INVOLVED fo r m e rg in g ro u tin e s u s in g t h e n e ig h b o u r c r o s s r e f e r e n c e t a b l e 111 w h e th e r t h e r e g io n s h a v e b e e n m e rg e d , a n d c l e a n s u p t h e c o d e s b e f o r e th e y a r e m e rg e d . S u b ro u tin e NCMERG C alls th e s e su b ro u tin e s • . INSTNO • ROTATE • CMERGE C om m ents. NCMERG u s e s CMERGE t o rem o v e i n t e r n a l r e g i o n s , an d l i n k s t h e n e ig h b o u r c o d e s when t h i s h a s b e e n d o n e . S u b ro u tin e NEWSTATS C alls th e s e s u b ro u tin e s (NONE CALLED) Com m ents. NEWSTATS c a l c u l a t e s t h e a v e r a g e g r e y l e v e l , g r e y l e v e l v a r i ­ a n c e , c e n t r e o f g r a v i t y , a n d nu m b er o f p i x e l s o f a c o m p o s ite r e g i o n fo rm ed b y a m e rg e . Appendix A. THE SUBROUTINES INVOLVED 112 Subroutine NNUME Calls th e s e s u b ro u tin e s ' CANDSTACK • CVARFIX Com m ents. NNUME i s t h e p r o c e d u r e c o r r e s p o n d i n g t o t h e c o n d i t i o n NNUli, w h ic h h a s tw o c o n d i t i o n o p e r a n d s , a r e g i o n r e f e r e n c e a n d a n u m b e r. if t h e r e g i o n r e f e r r e d t o h a s t h e g iv e n num ber o f n e ig h b o u r s , NNUME a s s i g n s t h e v e c t o r t h e v a lu e 1 . i n t h e c o r r e s p o n d i n g e le m e n t, w h ic h o th e r w is e i s a s s ig n e d 0 . NNUM a t p r e s e n t i s u s e d w i t h o n ly CENTRE a s a l e g a l r e g i o n re fe re n c e , fo r s im p lic ity . S u b ro u tin e NUMEVAL C alls th e s e s u b ro u tin e s (NONE CALLED) Com m ents. NUMEVAL r e t u ' - s t h e n u m e r i c a l v a lu e o f a s t r i n g o f c h a r a c t e r s r e p r e s e n t i n g a n u m b e r, f o r e x a m p le , t h e s t r i n g " 1 0 0 " i s e v a l u a t e d t o t h e num ber 1 0 0 . Appendix A. THE SUBROUTINES INVOLVED Subroutine PRMLEXP C alls th e s e su b ro u tin e s • COMPLIST • PRHLIST • ANDSTAGK • CANDSTACK C o m m e n ts . PRMLEXP e x p a n d s s y s te m g o a l . th e p rim itiv e lis t by f a c t o r i n g t h e m ain PRMLEXP i s p a s s e d a K S 's c o n d i t i o n f i e l d , t h e name o f t h e o b j e c t d e s c r i b e d b y t h e KS, an d w h e th e r i t i s a p r i m i t i v e o r a c o m p o s ite . If it is a p r im itiv e , its d e s c rip tio n i s p la c e d in th e p r im it iv e l i s t , t h e o p e r a t o r s b e in g i g n o r e d , an d t h e c o n d i t i o n o p e ra n d s b e i n g p l a c e d i n th e f ie l d F i e l d s e x i s t a t p r e s e n t f o r CONCAV, fo rc e d by th e c o n d itio n . SHAPE, TEXTUR, REFLEC a n d SIZ E . T h e s e d a t a a r e th e n p a s s e d t o t h e p r im ­ itiv e lis t. I f th e o b je c t i s a c o m p o s ite , a l l th e c o n d itio n o p e ra n d s in its de­ s c r i p t i o n a r e p a s s e d t o COMPLIST, w h ic h a d d s th em t o t h e s y s te m c o m p o s ite l i s t , i f th e y a r e n o t t h e r e a l r e a d y (We e m p h a s is e t h a t a n o b j e c t may a p ­ p e a r in a n o th e r o b j e c t 's d e s c r i p t i o n a s a c o n d itio n o p e r a n d .) . Appendix A. THE SUBROUTINES INVOLVED T he name o f t h e o b j e c t d e s c r i b e d by t h e KS i s th e n rem oved from th e sy ste m c o m p o s ite l i s t . S u b ro u tin e PRMLIST C a lls t h e s e s u b r o u t i n e s (NONE CALLED) C o m m e n ts. PRMLIST im p le m e n ts t h e s y s te m p r i m i t i v e l i s t , w h ic h c o n t a i n s a r e c o r d o f t h e a b s o l u t e p r i m i t i v e s e n c o u n te r e d when t h e g o a l w as f a c ­ to re d . T h is s t r u c t u r e may a l s o b e s e a r c h e d f o r m a tc h e s t o a nam e, and w i l l r e t u r n a l i s t o f t h e r e g i o n n u m b ers t h a t m a tc h t h e p r i m i t i v e . S u b ro u tin e PUTIT C alls th e s e s u b ro u tin e s C o m m e n ts . PUTIT s t o r e s t h e te m p o r a r y r e s u l t s e v a lu a tio n . -.n c o u n te r e d T he a lg o r i t h m i s d e s c r i b e d i n t h e t e x t . Appendix A. THE SUBROUTINES INVOLVED d u rin g ru le Subroutine QUALEVAL C alls th e s e s u b r o u tin e s (NONE CALLED) Com m ents. QUALEVAL r e t u r n s a n u m e ric a l v a lu e fo r a q u a lifie r. T he p r e s e n t d e f i n e d q u a l i f i e r s a r e : QUITE, VERY, QUITEN, VERYN, DK, Q \ QN-. Q+ a n d QN- s p e c i f y a r a n g e r a t h e r th a n a v a l u e , a n d a s su c h a r e r e t u r n e d a s n e g a t i v e n u m b e rs , a n d t h e c o n d i t i o n s u b r o u t i n e s r e c e i v e th em i n t h i s fo rm . T he n u m b e rs u s e d a r e n o t im p o r t a n t , b u t a r e c h o se n h e r e t o b e i n th e ran g e 0 - 1 f o r c o n v e n ie n c e , w i t h n e g a t i v e n um bers b e in g used to it. A s p e c ify a ran g e . S u b ro u tin e REVAL C alls th e s e s u b ro u tin e s • VECREVAL C o m m e n ts . REVAL i s a h i g h e r l e v e l fo rm o f VECREVAL, an d c a l l s c a l l t o VECREVAL w i l l r e t u r n t h e v e c t o r v a lu e o f a KS. A c a l l t o REVAL w i l l r e t u r n t h e maximum e le m e n t v a l u e o f t h e v e c t o r v a lu e o f a KS. Appendix A. THE SUBROUTINES INVOLVED S u b ro u tin e REVERSE C alls th e se s u b ro u tin e s (HONE CALLED) Com m ents. REVERSE n am es a s n e c e s s a r y ( s e e t e x t o n d e co m p o sin g K S 's ). S u b ro u tin e RMPAR C alls th e s e s u b ro u tin e s (NONE CALLED) C om m ents. T h is i s a H e w le tt- P a c k a r d r fro m t h e i n v o c a t i o n o f t h e p ro g ra m . o f t h e m ain p ro g ra m t o b e d i r e c t e d "RU, H IN T ,2 5 " m eans r u n t h e p r o g ra i S u b ro u tin e RNUMEVAL Calls th e s e s u b ro u tin e s • NUMEVAL Appendix A. THE SUBROUTINES INVOLVED It d e v ic e s : ; C o m m e n ts . RNUMEVAL e v a l u a t e s an d r e t u r n s th e r e g io n r e f e r e n c e v e c to r g e n e r a t e d b y t h e r e g i o n r e f e r e n c e o p e ra n d . S u b ro u tin e ROCKE C a lls t h e s e s u b r o u t i n e s • CANDSTACK • CVARFIX C o m m e n ts . ROCKE e v a l u a t e s t h e " r o c k n e s s " o f a g iv e n r e g i o n , an d c o r r e ­ sp o n d s t o t h e c o n d i t i o n "ROCK", w h ic h h a s tw o o p e r a n d s , a r e g i o n r e f e r e n c e and a q u a l i f i e . in t h a t o rd e r. ROCKE r e t u r n s a v a l u e o f e i t h e r 0 . o r 1- , d e p e n d in g o n W h eth er t h e r e g i o n i n d i c a t e d b e lo n g s t o t h e r o c k c l a s s to th e d e g re e in d ic a t e d by th e q u a l i f i e r , o r n o t. T he v a lu e i s r e t u r n e d a s a v e c t o r , e a c h member o f w h ic h i n d i c a t e s t h e " r o c k n e s s " o f a d i f f e r e n t c a n d i d a t e f o r t h e g iv e n r e g i o n i d e n t i f i e r ( s e e t e x t ) . v e c to r is re tu rn e d as T he l e n g t h o f t h e w e l l , b e in g - 1 f o r a n i d e n t i f i e r w i t h o n ly o n e p o s s i b l e m a tch ( l i k e "CENTRE"). Appendix A. THE SUBROUTINES INVOLVED Subroutine ROTATE C alls th e s e s u b ro u tin e s • ROUND C o m m e n ts , ROTATE u s e s ROUND t o r o t a t e t h e n e ig h b o u r c o d e u n t i l t h e r e ­ q u i r e d r e g i o n ( n o r m a lly t h e r e g i o n ' s m erg e p a r t n e r ) i s i n t h e f i r s t p o ­ s i t i o n in th e cod e. S u b ro u tin e ROUND C alls th e s e s u b ro u tin e s (NONE CALLED) Com m ents. ROUND r o t a t e s t h e n e ig h b o u r c o d e o n e p l a c e . S u b ro u tin e RQUEUE C alls th e s e s u b ro u tin e s (NONE CALLED) Appendix A. THE SUBROUTINES INVOLVED Com m ents. RQUEUE im p le m e n ts t h e q u e u e u s e d t o k e e p c o n d i t i o n s i n o r d e r when t h e y b e e n e v a l u a t e d . (S e e t e x t f o r d e t a i l s . ) S u b ro u tin e SEARCHI C alls th e s e s u b ro u tin e s (NONE CALLED) C om m ents. SEARCHI f in d s th e p o s it io n o f t h e n e x t o c c u rre n c e , a f t e r a g iv e n p o s i t i o n , o f a n i n d i c a t e d r e g i o n i n a n e ig h b o u r c o d e . S u b ro u tin e SEGLD C alls th e s e s u b r o u tin e s (NONE CALLED) Com m ents. SEGLD l o a d s a se g m e n t an d t r a n s f e r s c o n t r o l t o i t : o t h e r H e w le tt- P a c k a r d r o u t i n e . Appendix A. THE SUBROUTINES INVOLVED it is an­ ■t fr' / ' : S ubi-outine SEGRT C a lls t h e s e s u b r o u t i n e s (NONE CALLED) C o m m e n ts'. SEGRT I s a H e w le tt- P a c k a r d r o u t i n e t h a t r e t u r n s c o n t r o l from t h e se g m e n t t o t h e lo a d e r . S u b ro u tin e SIMGE C a lls t h e s e s u b r o u t i n e s » CANDSTACK • CVARFCL Com m ents. SIMGE im p le m e n ts t h e c o n d i t i o n SIMG, w h ic h i s r e q u i r e d t o h a v e a s i t s o p e ra n d s tw o r e g io n r e f e r e n c e s . A t p r e s e n t one o f th e s e re fe re n c e s rou st b e t o CENTRE, a s we h a v e n o t m ade p r o v i s i o n f o r c o m p a rin g a l l members o f a s e t i n a l l p o s s i b l e w ays w ith a l l members o f a n o th e r s e t . re tu rn e d as th e A 1. is c o n d itio n v a lu e i f th e g re y le v e ls a r e s im ila r , a 0 . i f th e y a r e n o t. Appendix A. THE SUBROUTINES INVOLVED Subroutine SiMTE C alls th e s e su b ro u tin e s • CANDSTACK • CVARFCL Com m ents. SIMTE is s i m i l a r t o SINGE, b u t c o m pares t e x t u r e s ( g r e y - l e v e l v a r i a n c e ) r a t h e r th a n g r e y l e v e l s . S u b ro u tin e STRLIST C alls th e s e s u b ro u tin e s • NAMELIST • MATCH! Com m ents. STRLIST im p le m e n ts t h e sy s te m s t r u c t u r e lis t. b e e n t e r e d i f t h e i r name d o e s n o t a l r e a d y a p p e a r i n t h e R e c o rd s may lis t, o r d e m o ted t o p r i m i t i v e s , w hen a m a tch l i s t m u st b e s p e c i f i e d . d e le te d , The l i s t a l s o a llo w s a s e a r c h t o b e made f o r t h e n e x t l e g a l s t r u c t u r a l d e s c r i p t i o n ( i n te rm s p r i m i t i v e s o n l y ) . T h e r e c o r d s a r e k e p t i n a s im p le a r r a y , th e Appendix A. THE SUBROUTINES INVOLVED 122 list structure being imposed by NAMELIST, which stores the pointer!- to S u b ro u tin e TRUEE C alls th e s e su b ro u tin e s • CANDSTACK C om m ents. TRUEE im p le m e n ts t h e c o n d i t i o n TRUE. I t a lw a y s p o p s o n e o p ­ e r a n d fro m t h e c o n d i t i o n o p e ra n d s t a c k , a n d a lw a y s r e t u r n s t h e v a l u e 1 . : t h u s , TRUE m u st a lw a y s h a v e o n e o p e r a n d , c o n v e n t i o n a l l y c a l l e d DUM, b u t n o t in sp e c te d . S u b ro u tin e VECREVAL C alls th e s e su b ro u tin e s • RQUEUE • ANDSTACK Appendix A. THE SUBROUTINES INVOLVED 123 % BACKE NNDME • TRUEB • ATORSTACK C o m m e n ts . VECREVAL e v a l u a t e s a KS, r e t u r n i n g a e n tir e KS. T h e te c h n iq u e u s e d i s v e c to r v a lu e fo r th e e x h a u s tiv e ly d e s c r ib e d in th e te x t . N o te t h a t t h i s s u b r o u t i n e may n o t a lw a y s a p p e a r w ith i t s f u l l com p lem en t o f c o n d i t i o n e v a l u a t i o n c a l l s ( c a l l s t o : ROCKE, BACKE, THUEE, EDGE, NNUME, SIMGE, o r SIHTE) b u t i s d o c u m en te d h e r e a s n e e d in g them a l l , p l i c i t y and g e n e ra lity . Appendix A. THE SUBROUTINES INVOLVED fo r sim ­ APPENDIX B. M THE BACKUS NAUR FORM SYNTAX OF THE KS'S. MOOIM IS OH CR 00041 USING 00012 B-K5 ft=0060 11:1? Mi FRL, IDOl L , I960 00D? Backus Naur Form Expression Of Rules , 0005 $006 The rules require the use of the characters < and >jto evoid iLonCusiori.howveT .i* u it here ( inC >. 00QB 0009 0010 Q011 0012 0015 0014 0015 0016 001? 001B 0019 0620 U021 0022 0023 00 2 4 6625 0026 0027 0028 0029 0030 60?1 0052 0037 0034 0035 0036 003? 003B 003? 0040 0041 <rule)::=(digit)<digit>(digit>*<cl!st>*<slist> <clist>::«(<operend> (operand))AI(<oper6-.d> (operand))0II(operand))N (operand)(condition)I(clist> (condition)::- BMCK((regionno>,(qualifier))I ROCK<(regionno),(qualifier»l TRUE<DU«) I 5irKE<<regionno>,<regionno)>I SMTEUrbgionno) ,(f eoionno>> I W<obin:me>,(objname>) I Hr* jnaBis), (objnasie) >I r;:aionno),(integer>> TL.'V '-'tdes»l SKft£H(»hdes»l Sl2E{<sides»l ft£FLEC((rfdes)>l aHVEX4(cdes» (Ides’ ' I'K IG K Ih E D lltllL n i! (iM et.-: i =V T IPMD (rfdes)::=HIGHIMEOIUMILOU {cdes>::,i(quaiifi6r> (sides>::-BIGILITTLEIMEOiiS1 (regionno>::»R(integer)ICEN1RE (integer)::=(digit)I(digit>(integer) (digit>::=0UI21?l4l5l6l7l8l9 (qualifier)::*OUITEIOUlTENIlERYIUERYNIDKim-IQ« (elist)::=r£SEE((regianno),<merlist))l CHCTXT<<neucontext>)I fi£ET(GM.>l (objnaee)1(objdescriptar)> (objdescriptor>::'PRIHIC011P (objn»me)::=(char!ist) (charlitt):^(char)|(char>(cherlist> (char>::-AI8ICIDIEIFIGmillJIKILmiNI0IPIBlRISniUIUiyiXIYIZ (n e rlis t)::’ <recnum)l(regnunr>(tnernst) 0043 tl'W 0045 Noteimerlisl and charlist are limited to six member end seven menbers respectively.for reasons of practicality. For the language to work,an objnase should have adefinition to be used. Appendix B. The Backus Naur Form Syntax of the KS's. APPENDIX C. A COMPLETE LISTING OF THE CODE. T h is lis tin g i s bound i n a s e p a r a t e v o lu m e f o r s i m p l i c i t y , a n d rosy b e o b t a i n e d fro m P r o f e s s o r M.G. R o d d , D e p a rtm e n t o f E l e c t r i c a l E n g in e e r in g , U n i v e r s i t y o f t h e W itw a te r s r a n d , 1 J a n Sm uts A v e ., J o h a n n e s b u r g , Appendix C. A Complete Listing of the Code. S o u th Author Forsyth David Alexander Name of thesis A paradigm for general scene analysis. 1985 PUBLISHER: University of the Witwatersrand, Johannesburg ©2013 LEGAL NOTICES: Copyright Notice: All materials on the U n i v e r s i t y o f t h e W i t w a t e r s r a n d , J o h a n n e s b u r g L i b r a r y website are protected by South African copyright law and may not be distributed, transmitted, displayed, or otherwise published in any format, without the prior written permission of the copyright owner. Disclaimer and Terms of Use: Provided that you maintain all copyright and other notices contained therein, you may download material (one machine readable copy and one print copy per page) for your personal and/or educational non-commercial use only. The University of the Witwatersrand, Johannesburg, is not responsible for any errors or omissions and excludes any and all liability for any errors in or omissions from the information on the Library website.