Drawing Analogies Thomas G Evan's ANALOGY program (described in Minsky's edited volume Semantic Information Processing, 1968), solved geometric proportional analogies, like this: a b c 1) Describe briefly how Analogy solved this type problem. How might this sort of reasoning come into play in architectural design? 2) Write, demonstrate, and document your own (simple!) version of a geometric analogy program. Let it take as input three lists of relations and geometric figures, symbolic descriptions corresponding to a, b, and c. Let it (either) produce a fourth list corresponding to d (?), or (if you prefer) choose from a set of candidate descriptions [d1, d2, d3, d4} also given as input in the same form as a, b, and c. This essay has three parts. First is a brief review of what has been done in Thomas Evan's Analogy program. Second part is discussion of the use of analogy transfer with focus on Architecture. Finally, a prototype implementation of a simple analogy transferring program called TA. 1. what’s been solved from Evan’s Analogy program Evan's Analogy program (Evans 1968) solves recognition and transformation of geometric analogy problem. The question is, Figure A is to Figure B as Figure C is to what figures? In his test examples, the program was given 5 sets of possible solutions to be selected for Figure D. The Analogy program does two parts of work, 1) pattern recognition, identifying objects from line drawing, 2) description processing, including 1 finding rules for transformation, comparing and checking parts that have been transformed between figures. The first part of the Analogy program deals with pattern recognition. It finds abstraction, and generalization of complex pictorial material (line drawing) into interrelating parts (geometric shapes) and use the extracted structure information from the representation (list of shapes and spatial relations) as input for the second part, the description processing. The second part of the Analogy program deals with description processing. The description of a drawing is represented as a list that represents different shapes and their spatial relationships. For example, (inside P1 P2) means shape P1 is inside shape P2. The processing will match two lists and generate rules for transformation. This processing does not understand geometric concepts and could well be applied to non geometrical subject reasoning. Basically, the program generates the description of rules by comparing two lists (from two figures) to find what element (shape) has been removed or added to transform one drawing to another. The idea of transformation can be described as copying with substitution. The description processing is therefore consists of decomposition of relations and shapes, relationship calculation and similarity calculation. A result of the processing will look like this: ((remove (P1)) (add (P3)) ((P2 P4))). This description processing of matching lists can be viewed as a general problem solving behavior which can apply to different domain. 2. why analogy? Why is analogy interesting? In the “structure-mapping theory” (Gentner 1983) Gentner suggests analogy is the interpretation of rules for mapping knowledge about a base 2 domain into a target domain. It has also been suggested that creativity is based on some use of mapping analogies to ideas in novel ways (e.g. Boden (Boden 1990), Koestler (Koestler 1964)). In architectural design, applying analogies such as images of natural and artificial forms from rocks and flowers to boats and buildings (Tzonis 1992)— is frequently discussed. For example, architectural design primers (Laseau 1980), stories of the master designers (Guiton 1987), and studies of design process (Broadbent 1973) all discuss the use of visual references as analogies and metaphors. Analogy is important to design because it involves first the rule-finding part and then the geometric manipulation part. To use analogy in understanding or manipulating design is to find ways to do relational transfer. After the transfer of one particular rule from a domain, design can then incorporating the mapping other attributes of the base domain into the target one. This analogy applying process would help discovery of unexpected connections between different objects and domains, and can use the rules to propagate more rules. Several important features of applying analogy are important for design. First, analogy transfer involves general problem solving strategies such as extract abstract representation of objects and finding the rules within its specific content of the domain. Second, the analogy processing involves many different activities such as similarity comparisons and applications of the abstract representation back to the objects. For architectural design, the use of analogy is a complex process. To do analogy transfer, it requires mental recognition of features from a base domain to map to the target domain. For example, the veins of a leaf can map to veins of a human body or veins of a building which are the circulation paths. After the mapping of veins to circulation paths has been identified, then the mapping of how leaf transport water and other fluids through different mechanisms and different capacity of paths can map to design of different corridors and 3 service cores. These kinds of new combinations and mapping, and application to the target domain of architectural design would certainly depend on some kind of aesthetic judgment or evaluation to see how ideas can fit well together. However, any successful or failure of mapping analogy from base domain to target domain will intrigue designers to find out new aspects of viewing the design problem, evaluation of applying rules and finally learn something from the analogy transfer. 3. My Transferring Analogies program To demonstrate how a simple geometric analogy transfer can be done, I built a program called Transferring Analogies. The Transferring Analogies (TA) program is built on the hypothesis that a test only involves two shapes and one spatial relation in each figure. This is a simple prototype of doing geometric analogy transfer. The hypothesized question is to 1) find the rule by which Figure A has been changed to make Figure B, 2) apply the rule to Figure C and 3) generate the resulting figure. a b c d Figure 1, a sample analogy test question, A is to B as C is to what ? Mapping principles are: 1) Relation between objects are mapped from base A to target B; and 2) the particular relations mapped are determined by comparisons between figures A to C; and 3) attributes of objects, such as the shape and the relative movement of objects are mapped from base C to target D. 4 For example, Figure 1 shows a sample analogy test question. Figure A has a big box contains a small circle. Figure B has also a big box and a small circle, but the circle is moved distance dx, dy from the containment to become overlapping. Figure C has a big triangle contains a small box. We know for Figure D the resulting shapes will have also a triangle and a box, but what will be the location for the small box? Our geometric analogy reasoning tells us we need to move the small box down to where relatively the small circle is in Figure B. Let's see how the TA program does this. The TA program uses the Cocktail Napkin's (Gross 1996) shape recognition and relationship finding utilities. Therefore, the first part of Evan's work of pattern recognition is done through the Napkin. The TA program uses the output of the pattern recognition (shapes and relations) to do the second part -- description processing. The TA program takes lists that were given from the Napkin recognition such as List A (contains box circle) and List B (overlap box circle) to find what spatial relationships was transformed from list A to list B. Each shape in the list have slots for all the attribute such as xy coordinates for the location and bounding box for the shape. The TA program involves 1) generalization of rule by comparing Figure A and Figure B (move small circle down to dx dy), 2) decision on what to transformed by comparing Figure A and Figure C (substitute big box into big triangle and small circle into small box), then 3) apply rule one (move down to dx dy) to the mapping of Figure C (small circle mapped to small box) and result in transformation to make Figure D (have a big triangle first, then move small box down to dx dy). This TA prototype is simple but it works. Bellows are several screen shots of how the TA program works. In Figure 2. four windows and a dialog box are shown. Window A has four command buttons, first one is to clear the drawing area for that window, second button is to copy figures in window A to window B, third one is to copy figures from 5 window A to window C, fourth button is a function to bring up all the four windows (A, B, C, D) up to the front so other windows will not obstruct the view. A user can draw a squiggle line inside a box in window A, then copied it to window B and moved the squiggle line down to "below" the box. When user click on the "check" button in window B, a dialog pops up to describe the transformation between windows A and B (spatial relations of squiggle line to box is changed from "overlap" to "below." Figure 2. TA program, the dialog shows the transformation between A & B windows. A window has 'overlap' relations and B window has 'below' relations. User can then copy the figures from window A to window C, substitute the outer box to be a round circle, and substitute the squiggle line to be a small box. She can then copy the figures from window C to window D (as shown in Figure 2, windows C & D have exact the same configuration). When clicked on the "show" button in window D, the program will move the small box down dx, dy and pop up a dialogue showing applying "below" relations for the small box to the big circle. (as shown in Figure 3) 6 Figure 3. The dialog shows what need to be done to C to generate D window. Apply the 'below' relations to the overlapping small box to generate figures for D. Figure 4 and 5 show another two analogy transfer examples. Window A in Figure 4 shows a box overlaps a vertical line on its bottom. The box was moved to below the vertical line in window B. Window C has a circle overlapped with a horizontal line on its bottom. Therefore, in window D, the circle will be moved to be below the horizontal line. The list of (box v-line) is mapped to (circle h-line) and transformation (move box (dx dy)) is mapped to generate (move circle (dx dy)). Figure 4. Movement of box from A to B is mapped to circle of C to D. 7 Figure 5 shows an example of reversing relationships between different objects. Window A of (above h-line circle) has been changed to window B that is (below h-line circle). Window C has (above box spiral) relations and therefore window D should have (below box spiral) because (h-line circle) is mapped to (box spiral). Figure 5. Line above circle in A transforms to line below circle in B. Likewise, box above spiral in C transforms to box below spiral in D. Figure 6 is an interesting example of how applying analogy transfer of reversed relationship twice can generate back to the original spatial relationship. In window A an horizontal line is above the circle (above h-line circle) and in window B the horizontal line was moved to below the circle (below h-line circle). Window C has same spatial relationship between the circle and the horizontal line (below h-line circle) and then of course the D window will have (above h-line circle) configuration which is the same as the original A window. 8 Figure 6. Sample of reverse relationship. Line "above" circle in A becomes circle "above" line in B. Circle "above" line in C (same as B) becomes line "above" circle in D (same as A). Appendix, the actual code (in-package "NAPKIN") ;;-----------------------------------------------------------------------------;; ;; File: CROSS.LISP ;; ;; Author: Ellen Do ;; ;; Description: ANALOGY A : B = C : D ;; ;; GIVEN A & B & C, WHAT WILL BE D? ;; ;; THIS CODE WORKS UNDER THE FOLLOWING ASSUMPTION ;; ;; TWO SHAPES CHANGING SPATIAL RELATIONS ;; FROM WINDOW-A TO WINDOW-B ;; ;; WINDOW-C *MUST* HAVE SAME SPATIAL RELATIONSHIP ;; WITH WINDOW-A ;; ;; WINDOW-C CAN HAVE 1 OR 2 SHAPES BE SUBSTITUTED ;; ;; * I haven't check when different spatial relations belong to same family ;; such as (contains overlap concentric) ;;-----------------------------------------------------------------------------;;------------------------------------------------------------------------------ 9 ;; VARIABLES FOR THE GRAPHIC SKETCHPAD WINDOW (defvar *a-window*) (defvar *b-window*) (defvar *c-window*) (defvar *d-window*) ;;-----------------------------------------------------------------------------; MAKE SKETCHPAD TO BE A CLASS OF DIAGRAM WINDOW (defclass sketchpad (diagram-window) ((pad-name :accessor pad-name :initform "sketchpad" :initarg :pad-name))) (defmethod initialize-instance ((self sketchpad) &rest initargs) (apply #'call-next-method self initargs) (setf (drawing-area self) (make-bounding-box :min-x 0 :min-y 40 :max-x (point-h (view-size self)) :max-y (point-v (view-size self)) ))) (defmethod view-key-event-handler ((self sketchpad) key) (cond ((command-key-p) (case key (#\a (basic-select-glyphs self (diagram-glyphs self))))) (t (case key (#\delete (erase-selected-glyph self))))) (call-next-method self key)) ;;-----------------------------------------------------------------------------;; SET UP THE SET OF 4 WINDOWS : A B C D (defmethod setup-analogy-windows () (setf *a-window* (make-instance 'sketchpad :view-size #@(150 150) :view-position #@(300 40) :window-title "a-window" :window-type :tool)) (setup-bar-menu *a-window* '((clear new 197 click) (copy copy-from-a-to-b 194) (copy copy-down 171) (all show 198)) #@(5 5) #@(35 0)) (setf *b-window* (make-instance 'sketchpad :view-size #@(150 150) :view-position #@(450 40) :window-title "b-window" :window-type :tool)) (setup-bar-menu *b-window* '((clear new 197 click) (check check 196 pop)) 10 #@(5 5) #@(35 0)) (setf *c-window* (make-instance 'sketchpad :view-size #@(150 150) :view-position #@(300 210) :window-title "c-window" :window-type :tool)) (setup-bar-menu *c-window* '((clear new 197 click) (copy copy-from-c-to-d 194)) #@(5 5) #@(35 0)) (setf *d-window* (make-instance 'sketchpad :view-size #@(150 150) :view-position #@(450 210) :window-title "d-window")) (setup-bar-menu *d-window* '((clear new 197 click) (show show-result 191)) #@(5 5) #@(35 0))) ;;-----------------------------------------------------------------------------;; CHECK IS FINDING RELATIONS BETWEEN A & B (defmethod check ((w sketchpad)) (let* ((relation (find-relations-change *a-window* *b-window*))) (message-dialog (format nil "Spatial relation of --~%~A ~%to --~%~A~%~%changed from --~%~A~%to -~%~A." (glyph-type (second (cross *a-window*))) (glyph-type (third (cross *a-window*))) (first relation) (second relation)) :size #@(200 200) :position (add-points #@(170 20) (view-position w)))) (invalidate-view w)) ;;-----------------------------------------------------------------------------;; MISC COPY FUNCTIONS FROM WIN 1 TO WIN 2 (defmethod copy-to-next ((win1 sketchpad) (win2 sketchpad) ) "Copy diagram glyphs from WIN1 to window WIN2." (add-glyphs-to-diagram win2 (diagram-glyphs win1)) (display-diagram win2)) ;; COPY GLYPHS FROM A TO B --------------------(defmethod copy-from-a-to-b ((w diagram-window)) "Copy a sketch from current sketchpad to right side window." w (copy-to-next *a-window* *b-window*)) ;; COPY FROM C TO D WINDOW ---------------------11 (defmethod copy-from-c-to-d ((w diagram-window)) "Copy a sketch from current sketchpad to right side window." w (copy-to-next *c-window* *d-window*)) ;; COPY FROM A TO C WINDOW ---------------------(defmethod copy-down ((w diagram-window)) "Copy a sketch from current sketchpad to down side window." w (copy-to-next *a-window* *c-window*)) ;; COPY FROM WIN 1 TO WIN 2 MOVED #@(20 20) ----------------(defmethod copy-to-next-move ((win1 sketchpad) (win2 sketchpad) ) "Copy diagram glyphs from WIN1 to WIN2." (add-glyphs-to-diagram win2 (diagram-glyphs win1) #@(20 20)) ;; move delta (display-diagram win2)) ;;-----------------------------------------------------------------------------;; REFRESH ALL THE SKETCHPAD WINDOWS ;; (show-wins (list *a-window* *b-window* *c-window* *d-window*)) ;(windows :class 'sketchpad) (defmethod show-wins (list) "Bring up all windows from a list" (mapcar #'window-select list)) (defmethod show-all ( &optional (list (windows :class 'sketchpad) )) "Bring up all 'sketchpad' class windows." (dotimes (i (length list)) (set-window-layer (elt list i) i))) (defmethod show (win) win (show-all )) ;;-----------------------------------------------------------------------------;; COMPARE CROSS PRODUCT OF WIN1 WIN2 AND ;; MAKE LIST ;; ((RELATION-1 SHAPE-1A SHAPE-1B) (RELATION2 SHAPE-2A SHAPE-2B) ;; ;; NEED TO CHECK WHEN THE RELATION TYPE IS MORE THAN ONE ;; EX: LINE-CONNECT, ABOVE, LINE-A-SIDE ;; SHOULD TAKE THE "PREFERABLE ONE" INSTEAD OF THE FIRST ONE" (defmethod cross (win) "Take the FIRST relation type from the glyph-cross-product" (first (glyph-cross-product (diagram-glyphs win) *spatial-relation-predicates* nil))) (defmethod compare-change (win1 win2) "Take (r1 s1 s2) and (r2 s3 s4) returns ((r1 s1 s2) (r2 s3 s4))" (let* ((r1 (first (cross win1))) 12 (g1-a (glyph-type (second (cross win1)))) (g1-b (glyph-type (third (cross win1)))) (r2 (first (cross win2))) (g2-a (glyph-type (second (cross win2)))) (g2-b (glyph-type (third (cross win2))))) (list (list r1 g1-a g1-b) (list r2 g2-a g2-b)))) ;;-----------------------------------------------------------------------------;;(compare-change *a-window* *b-window*) #| (find-object (first (compare-change *a-window* *b-window*)) (second (compare-change *a-window* *b-window*))) |# ;;-----------------------------------------------------------------------------;; COMPARE 2 LISTS to find ;; identical element TYPE to determine what is the SPATIAL RELATION change ;; which could be reversed (because sequence of shapes in cross-product could be reversed) ;; if (contains circle line) and (above circle line) returns (contains above) ;; if (contains circle line) and (above line circle) returns (contains (reverse of above)) ;;-----------------------------------------------------------------------------;; CHECK THE ITEM SEQUENCE AND ;; SEE IF THE SPATIAL RELATION PREDICATE NEED TO ;; BE REVERSED (defmethod find-object (list1 list2) "Take (r1 s1 s2) and (r2 s3 s4) returns (r1 r2) that is applied from s1 to s2" (let* ((r1 (first list1)) (s1 (second list1)) (s2 (third list1)) (r2 (first list2)) (s3 (second list2)) (s4 (third list2))) (if (or (equal s1 s3) (equal s2 s4)) (list r1 r2) (list r1 (reverse-relation r2))))) ;; QUICK CHECK TO REVERSE RELATION --------------(defmethod reverse-relation (relation) (cond ((equal relation 'concentric) 'concentric-by) ((equal relation 'contains) 'contained-by) ((equal relation 'immediately-above) 'immediately-below) ((equal relation 'above) 'below) ((equal relation 'immediately-right-of) 'immediately-left-of) ((equal relation 'right-of) 'left-of) ((equal relation 'concentric-by) 'concentric) ((equal relation 'contained-by) 'contains) ((equal relation 'immediately-below) 'immediately-above) 13 ((equal relation 'below) 'above) ((equal relation 'immediately-left-of) 'immediately-right-of) ((equal relation 'left-of) 'right-of) (t relation))) ;;-----------------------------------------------------------------------------;; COMPARE WIN 1 WIN 2 SEE WHAT RELATIONS BEEN CHANGED ;; COMPARE-CHANGE RETURNS (R1 R2) (defmethod find-relations-change (win1 win2) (let* ((r1 (first (compare-change win1 win2))) (r2 (second (compare-change win1 win2)))) (find-object r1 r2))) ;; format the information of RELATION CHANGE into a list-----------(defmethod apply-relations-change (win1 win2 win3) (let* ((r1 (first (cross win1))) ; relation1 ;(s-a1 (second (cross win1))) ; shape1 ;(s-a2 (third (cross win1))) ; shape2 ;(r2 (first (cross win2))) ; relation2 ;(s-b1 (second (cross win2))) ; shape3 ;(s-b2 (third (cross win2))) ; shape4 (r3 (first (cross win3))) ; realtion3 ; should be same as r1 or reverse r1 (s-c1 (second (cross win3))) ; shape5 (s-c2 (third (cross win3))) ; shape6 (change (find-relations-change win1 win2)) (newr (second change))) (cond ((equal r1 r3) (list newr s-c1 s-c2)) (t (list newr s-c2 s-c1))))) ;;-----------------------------------------------------------------------------;; APPLY RELATIONS-CHANGE TO D WINDOW (defmethod show-result (win) ;(new win) (check-distance1 *a-window* *b-window* *c-window* *d-window*) (let* ((newlist (apply-relations-change *a-window* *b-window* *c-window*))) (message-dialog (format nil "Change spatial relation from -- ~%~A~%to --~%~A~%~%for -~%~A~%to --~%~A." (first (cross *c-window*))(first newlist) (glyph-type (second newlist)) (glyphtype (third newlist))) :size #@(200 200) :position (add-points #@(170 20) (view-position win))) (invalidate-view win))) ;----------------14 ;; FIND TOP LOCATION OF BOUNDING BOX TO DETERMINE *MOVE* OF ;; SPATIAL RELATION ;; haven't dealt with scaling of shapes yet. (defmethod get-top-location (glyph) (let* ((x1 (bounding-box-min-x (raw-glyph-bounding-box (glyph-raw-glyph glyph)))) (y1 (bounding-box-min-y (raw-glyph-bounding-box (glyph-raw-glyph glyph))))) (make-point x1 y1))) (defmethod get-bottom-location (glyph) (let* ((x1 (bounding-box-max-x (raw-glyph-bounding-box (glyph-raw-glyph glyph)))) (y1 (bounding-box-max-y (raw-glyph-bounding-box (glyph-raw-glyph glyph))))) (make-point x1 y1))) ;;-----------------------------------------------------------------------------;; find out which shape is moved, and moved how much ;; ASSUME THAT ONLY ONE SHAPE MOVED ;;-----------------------------------------------------------------------------(defmethod check-distance1 (win1 win2 win3 win4) (let* ((Ra (first (cross win1))) ; relation A (g1 (second (cross win1))) ; glyph1 (g2 (third (cross win1))) ; glyph2 (Rb (first (cross win2))) ; relation B (RB-checked (second (find-relations-change win1 win2))) (g3 (second (cross win2))) ; glyph3 (g4 (third (cross win2))) ; glyph4 (Rc (first (cross win3))) ; relation C (g5 (second (cross win3))) ; glyph5 (g6 (third (cross win3))) ; glyph6 (Rd (first (cross win4))) ; relation D (g7 (second (cross win4))) ; glyph7 (g8 (third (cross win4))) ; glyph8 (g1-t (get-top-location g1)) ;; TOP-LOCATION OF SHAPE (g2-t (get-top-location g2)) (g3-t (get-top-location g3)) (g4-t (get-top-location g4)) (g5-t (get-top-location g5)) (g6-t (get-top-location g6)) (g7-t (get-top-location g7)) (g8-t (get-top-location g8)) (move-1-3-2 (subtract-points g4-t g2-t)) ;; MOVING DISTANCE (move-2-3-1 (subtract-points g4-t g1-t)) (move-1-4-2 (subtract-points g3-t g2-t)) (move-2-4-3 (subtract-points g3-t g1-t))) (list Rb Rb-checked Rd g5-t g6-t g7-t g8-t) 15 (cond ((and (equal g1-t g3-t) (equal Ra Rc)) (move-glyph g8 (point-h move-1-3-2) (point-v move-1-3-2))) ;; if 1=3 & Ra=Rc then move 2 apply to 8 ((and (equal g2-t g3-t) (equal Ra Rc)) (move-glyph g7 (point-h move-2-3-1) (point-v move-2-3-1))) ;; if 2=3 & Ra=Rc then move 1 apply to 7 ((and (equal g1-t g4-t) (equal Ra Rc)) (move-glyph g8 (point-h move-1-4-2) (point-v move-1-4-2))) ;; if 1=4 & Ra=Rc then move 2 apply to 8 ((and (equal g2-t g4-t) (equal Ra Rc)) (move-glyph g7 (point-h move-2-4-3) (point-v move-2-4-3))) ;; if 2=4 & Ra=Rc then move 1 apply to 7 ;-----------------NEED FURTHER GENERALIZATION OF RELATION SET------------;((equal g1-t g3-t) (same-set Ra Rc)) ;(move-glyph g7 (point-h move-1-3-2) (point-v move-1-3-2))) ;; if Ra Rc belong to same set then move 2 apply to 8 ;; if 1=3 & Ra = reversed Rc then move 2 apply to 7 )) (display-diagram win4) (invalidate-view win4)) ;;-----------------------------------------------------------------------------;; POSSIBLE USE OF CONSTRAINTS CODES ; (setf *a* (second (cross *a-window*))) ; (setf *b* (third (cross *a-window*))) ; (apply-constraint (make-instance 'contained-by-constraint) *b* *a*) ;; USEFUL INFO ; *spatial-relation-predicates* ; (find-relation-set 'contains ) ; (CONCENTRIC CONTAINS OVERLAP) ; (find-relation-set 'LINE-B-SIDE ) ; (bottom (third (cross *b-window*))) ;-----------------------;; SET UP THE 4 ANALOGY WINDOWS (setup-analogy-windows) REFERENCES 16 Boden, Margaret A. The Creative Mind, myths and mechanisms. London: Georgia Weidenfeld and Nicolson, 1990. Evans, T.G. “A Program for the Solution of a Class of Geometric Analogy IntelligenceTest Questions.” In Semantic Information Processing, ed. M. Minsky. 271-353. Cambridge, MA: MIT Press, 1968. Gentner, Dedre. “Structure-Mapping: A Theoretical Framework for Analogy.” Cognitive Science 7 (1983): 155-170. Gross, Mark D. “The Electronic Cocktail Napkin - working with diagrams.” Design Studies 17 (1 1996): Koestler, Arthur. The Act of Creation. New York: Macmillan, 1964. Laseau, Paul. Graphic Thinking for Architects and Designers. New York: Van Nostrand Reinhold, 1980. Tzonis, Alexander. “Huts, Ships, and Bottleracks: Design by Analogy for Architects and/or Machines.” In Research in Design Thinking, eds. N. Cross, K. Dorst, and N. Roozenburg. Delft: Delft University Press, 1992. 17
© Copyright 2026 Paperzz