Maintaining Spatial Relations in an Incremental Diagrammatic Reasoner
Maintaining Spatial Relations in an Incremental Diagrammatic Reasoner
Ronald W. Ferguson, Joseph L. Bokor, Rudolph L. Mappus IV and Adam Feldman College of Computing Georgia Institute of Technology 801 Atlantic Avenue Atlanta, GA 30332 {rwf, jlbokor, cmappus, storm} @cc.gatech.edu
Abstract gram. This work extends the GeoRep diagrammatic rea- soner (Ferguson & Forbus, 2000), which is described in Because diagrams are often created incrementally, a qualitative section 3. After describing GeoRep, we discuss how Ge o- diagrammatic reasoning system must dynamically manage a po- Rep was modified to allow incremental processing, and tentially large set of spatial interpretations. This paper describes cover a number of implementation issues: how to handle an architecture for handling spatial relations in an incremental, nonmonotonic diagrammatic reasoning system. The architecture composite objects, the interface between low-level and represents jointly exhaustive and pairwise disjoint (JEPD) spatial high-level reasoning, and a modified default assumption relation sets as nodes in a dependency network. Examples of these mechanism. We also describe extensions to a user interface spatial relation sets are interval relations, relative orientation rela- allowing a user to create diagrams and update the infer- tions, and connectivity relations. The network caches dependen- ences of the reasoner. We then discuss future challenges cies between low-level spatial relations, allowing those relations for this architecture. to be easily assumed or retracted as visual elements are added or removed from a diagram. We also describe how the system sup- ports high-level reasoning, including support for creating default 2. Related Work assumptions. Finally, we show how this system was integrated In qualitative spatial reasoning, researchers have explored with an existing drawing program and discuss its possible use in how to process qualitative spatial vocabularies incremen- diagrammatic and geographic reasoning. tally. Notably, Hernández (1993) proposed mechanisms for maintaining consistent spatial knowledge that include a 1. Introduction propagation heuristic for inserting relations and reason Diagrams are useful across a wide variety of reasoning maintenance mechanisms for deleting relations. These tasks. Because a single diagram conveys many spatial rela- mechanisms use a dependency network, similar to that in a tions at a glance, it provides a rich medium for many do- truth-maintenance system. The system uses a combined set mains, including geography, architecture, and engineering. of orientation and topological spatial relations to represent A body of research exists showing how diagrams are used qualitative 2-D positions. in many cognitive tasks (Glasgow, Narayanan, & Other research has explored the use of conceptual Chandrasekaran, 1995). neighborhoods (Freksa, 1992) and topological distances These characteristics are more interesting when we con- (Egenhofer & Al-Taha, 1992) to understand gradual change sider that the spatial relations in a diagram may not be in the context of qualitative spatial vocabularies. Egenhofer static. Diagrams frequently change over time. The addition, and Al-Taha, for example, show how an analysis of topo- remo val, and modification of elements also changes the set logical distance between members of a relation set can be of spatial relations. Handling such incremental changes used to construct a graph that links the closest qualitative without significant reprocessing of previously established spatial relations. This graph can be used to show the set of spatial relations is key to making spatial and diagrammatic necessary intervening qualitative states that must occur be- reasoning efficient. tween two given states. An incremental processing approach is also be moti- Along with this research in qualitative spatial reasoning, vated other factors. For example, problem solving may there are a number of sketching systems that must maintain drive changes to a particular diagram as new ideas or sub- knowledge of the links between individual visual elements tasks emerge. Also, if the conceptual interpretation of the and the inferred relations, although few of them have ex- spatial relations is computationally expensive, we do not plicit frameworks for handling dependencies between spa- want to recompute the interpretation when only minor tial relations. A family of sketch interpretation systems by changes are made. Finally, a more practical benefit of in- Davis and colleagues (Davis, 2002) use blackboard systems cremental processing is that it distributes the processing to integrate a low-level reasoner with a high-level descrip- burden evenly over the extent of the task, which is useful tion language, as with GeoRep, but can handle sketched on low-end devices, such as personal digital assistants. shapes as well as vector graphics. In this paper, we describe an architecture for the main- Another approach is found in the Geometer’s Sketchpad, tenance of incremental, nonmonotonic changes to a dia- which uses a constraint system to dynamically enforce a set of constraints over abstract geometric LLRD Modules vector elements, including lines, rays, and cir- parallel graphicsfile basic prox. segments cles (Scher, 2000). These constraints Input shapes Proximity segments Segment Interval include geometric relations such as the Filter detector Orientation Relations attachment of a segment endpoint along prox. a circle perimeter and the bisection of prox. segments Segment corners Corner shapes an angle. The user can then move Connectivity Angularity Shape points in the figure as desired, subject Orientation corners only to the geometric constraints. This Concavity Index Line Detect polys allows visualization of simple geomet- (simple) polygons corner segments Segments segment concavities ric conjectures, such as the (true) con- index Detect polys Protrusion, jecture that the bisectors of a triangle’s (breakdown) Indentation angles intersect at a single central point. Detection However, unlike those in GeoRep, the indentation, spatial relations in Geometer’s Sketch- arc, circle, beside, above, parallel, polygon, concave, protrusion, ellipse, hort- perpendicular polyline, convex pad are not discovered by the system, prot-above line, point, equidistant, surrounding- but are entered explicitly by the user. glyph, vert-equidistant polygon mid- spline, text before,overlaps, acute,obtuse, connect, starts,ends, linear, perpen- Generated Low-Level Relations intersects, during,interval- dicular-to corner 3. The GeoRep Reasoner equal, meets This work extends an existing dia- grammatic reasoner, GeoRep, to make Figure 2: Data flow diagram of GeoRep’s Low-Level Relation Describer (LLRD). The processing incremental. GeoRep top portion shows the collections of visual operators and the visual elements they proc- (Ferguson & Forbus, 2000) has been ess. The lower portion shows the set of spatial relations produced by each set of visual used in a numb er of diagrammatic rea- operators. soning domains, including military dia- grams (Ferguson, Rasch, Turmel, & Forbus, 2000), simple physical diagrams (Ferguson & For- The first stage, the Low-Level Relational Describer bus, 1998), and logic circuits (Ferguson, 2001). In addition, (LLRD; Figure 2) represents a set of low-level visual rela- it has been used as the visual representation system for sev- tions. These low-level relations are generated starting with eral cognitive mo deling simulations (Ferguson, 2000; Fer- proximity calculations and ending with more complex rela- guson, Aminoff, & Gentner, 1996). tions, such as interval relations between parallel line seg- GeoRep’s input is a line-drawn diagram, given as a vec- ments. tor graphics file. The vector graphics file may contain a va- These particular spatial relations are also designed to riety of visual element types, including line segments, cir- model those qualitative spatial relationships that are de- cles, ellipses, arcs, spline curves and positioned text. tected in early vision. For example, it is well-known that GeoRep’s output is a predicate calculus representation. The humans are sensitive to relative angles (such as perpendicu- representation has three parts: the low-level spatial rela- lar lines), indentations in figure boundaries (Hoffman & tions, the high-level interpretation of the diagram, and in- Richards, 1984), and to vertical and horizontal orientations termediate spatial and conceptual relations that are pro- in the assumed frame of reference (Rock, 1973). Interest- duced in the process of interpretation. ingly, one relation set used that has not been tested for early To generate this representation, GeoRep uses a two- vision is interval relations (Allen, 1983) between parallel stage architecture (Figure 1). lines. In practice, these relations are extremely useful in modeling aspects of visual perception such as the detection of qualitative symmetry (Ferguson, 1994). A simple atten- High-level tion model uses a proximity detector to limit visual relation Line Low-level relations drawing relations (place tests to proximate visual elements. This acts as a limited vocabulary) focusing mechanism that keeps processing tractable. LLRD HLRD The system also models some aspects of attention and perceptual organization, though in a domain-dependent fashion. Grouping rules can be used to simulate simila rity- Visual Visual based grouping, and multiple LLRDs can be used to simu- operation domain library theory late visual separation based on preattentive factors such as color (Ferguson, 2001). Figure 1: Simplified GeoRep architecture, containing stages The second stage, the High-Level Relational Describer for low-level and high-level visual reasoning (HLRD; Figure 3) uses these low-level relations and a rule- 4. Making GeoRep Incremental
Truth-maintenance query One limitation of GeoRep is its processing model. Low-level system & Query Relational knowledge base mechanism GeoRep processes figures in batch mode on static dia- Description response grams. This is due to limitations of the LLRD rather than the HLRD. The HLRD is inherently incremental High-level Callbacks because it is based on an LTMS. Visual relations can be to LLRD Rule Engine filter relational visual routines description assumed or retracted at any time, and the consequences of these relations will also be assumed or retracted ac- cordingly. However, once the LLRD detects a visual re- filter lation between elements, it cannot retract it. The LLRD Visual spec HLRD domain does not store information about which visual elements theory are used in particular spatial relations. Therefore, making GeoRep incremental requires an incremental LLRD. The following sections describe Figure 3: The HLRD architecture, which reasons over the low- how we modified the LLRD and extended GeoRep to level description to produce a domain -specific interpretation process diagrams incrementally. based visual domain theory to produce a description of the 4.1 Creating the LLRD dependency network diagram. The output of the HLRD describes the diagram The dependency network we developed for the incremental using domain-dependent high-level relations. For example, LLRD draws on previous research on the mathematical using domain-dependent rules, the HLRD produces the de- character of qualitative spatial vocabularies that are jointly scription of the logic circuit in Figure 4, which includes the exhaustive and pairwise disjoint (JEPD) (Cohn, 1997). By gates, the inputs and outputs, and the input and output la- ensuring the JEPD character of each node’s relation set, bels. It has also been used in map-based military diagrams, this network can take advantage of a number of such vo- called Course of Action (COA) diagrams. cabularies shown to be JEPD, such as ni terval relations The HLRD rules use a pattern-directed inference system (Allen, 1983) and RCC (Cohn, 1995; Cohn, Randell, Cui, that is supported by a logic-based truth maintenance system & Benett, 1993). The logical properties of these JEPD sets (LTMS) (Forbus & de Kleer, 1993; McAllester, 1990). are important because they allow the dependency network HLRD rules use the LLRD’s low-level visual relations as to isolate a set of spatial relations relative to other possible well as domain knowledge, such as an ontology of logic relations. gate types . HLRD rules are typically constrained to run The incremental LLRD includes a dependency network only on proximate visual elements and can call visual op- (Figure 5) that tracks the low-level relations supported by erations within the LLRD. each visual element, maintaining consistency as visual ele- Once the HLRD has generated a high-level description, ments are added or removed and storing the necessary in- it can either be retrieved directly, or filtered by relation formation to allow reconsideration when elements are type to simulate different diagrammatic representation lev- modified. els (Ferguson & Forbus, 2000).
(SYSTEM-OUTPUT WIRE-S11) (SYSTEM-OUTPUT WIRE-S15) (INPUT-LABEL
Figure 4: SR-Latch logic diagram and the representation produced by GeoRep Each relation node in the network Interval has five key parts: a relation type, a (meets
This is equivalent to the set of tests applied to segments in the original version of the LLRD L4 L4 architecture. Other types of relations are handled somewhat L1 L3 L1 L3 L1 L3 L1 L3 diffe rently. Boolean relations are handled as JEPD L2 sets with one element. Proximate is one relation L2 L2 L2 handled in this fashion. 1 2 3 4 4.2 Handling composite objects Polyline/Polygon Detection Example: Step 1 A polyline is detected (polyline
4.4 Handling default assumptions Finally, to allow the HLRD to properly handle incremental LLRD information, we extended the default assumption A B C mechanism in the HLRD’s LTMS (Figure 8). While the +(UNINTERPRETED
(McAllester, 1990) to update the LTMS’s belief i i
n n n n a a o o i i state. h h t t c c a a t e t e
The LTMS is a more powerful reasoner than the e e M M r r
p NAND- p NAND- LLRD’s dependency network, but the network is still NAND-GATE r NAND-GATE r e GATE e GATE t t n n an adequate foundation for the LTMS given the con- I I straints of spatial domains. An LTMS makes infer- ences based on both true and false nodes, while the - Interpretation-Hypothesis Node Grey shading indicates TRUE nodes. LLRD’s dependency network is roughly equivalent White indicates FALSE or UNKNOWN - Default Assumption Node nodes. to the nodes in a justification-based TMS (JTMS). Such nodes represent only Horn clauses, and unlike Figure 8: A default assumption mechanism was added to the truth- LTMS nodes, do not distinguish between false and maintenance system in the HLRD to allow for clean retraction and unknown. However, for any JEPD set represented by re-assump tion of default interpretations. a LLRD node, we can make a closed-world assump- tion over the set of internal relations that allows us to node. The interpretation-hypothesis node is a standard treat the selected internal relation as true, and the rest as LTMS node, created as an assumption and justified by the false. In addition, due to the nature of visual relation detec- appropriate implicational structure. tion, when an LLRD node is OUT, all of its internal rela- These nodes allow all potential interpretations to be tions can be treated as false, and not simply unknown. This available even if some have been previously rejected. is because an LLRD node becomes OUT only when a nec- When a new composite object is detected, it is default- essary visual precondition becomes invalid. assumed, rather than assumed. This creates both a default used to make more powe rful inferences. For example, it assumption node for the new object as well as an interpreta- could aid in the re-evaluation of modified visual elements. tion-hypothesis node. Thus, for each potential interpreta- Because each relation node depends on a procedural visual tion, there will be a valid interpretation-hypothesis node. test to choose between its alternative internal relations, However, at any instance, only one valid interpretation ex- once a visual element is modified, the tests must be rerun to ists for each set of interpretation hypotheses. The existence determine if the previously chosen internal relation remains of multiple interpretation-hypothesis nodes causes a con- valid. If not, a chain of visual tests must be applied to the tradiction within the LTMS, triggering the interpretation se- modified visual element and all proximate elements. lector. Another potential use of this network is to let the HLRD Selection between potential interpretations is handled in influence the LLRD by, for example, setting test tolerance a domain -dependent fashion. For example, in the logic cir- values (e.g., the margin for a perpendicular line test). For cuit domain, the maximally-preferred alternative (Doyle, example, it should be possible to have the HLRD detect 1992) is the interpretation with the most elements. In the quadrilaterals that are almost square, and then mo dify the example, the NAND gate is selected because the AND gate relative-angle test so that the LLRD recognizes a necessary is a subset. corner as perpendicular. This handles the case where one composite object has Finally, there is the problem of tradeoffs between spatial two possible interpretations. However, to support dynami- reasoning and visual processing. Assuming that visual cally changing interpretations, we must also consider what happens when removing part of an object requires revising our interpretation again. In this case, we may want to revert to a previous interpretation that was discarded because it was not the maximally preferred. This is handled by activating the selector mechanism when an interpretation hypothesis node is retracted. In the example, this corresponds to remo ving the circle from the NAND gate, which causes a retraction of the NAND gate interpretation, and the reactivation of the AND gate inter- pretation. The interpretation selector returns to the next - best alternative interpretation, allowing the AND gate in- terpretation (and all its high-level consequences) to be reac- tivated.
5. Integration into a Drawing Program We use an existing drawing system, JFig (Hendrich, 1999), as an interface to the reasoner. JFig is a Java implementa- tion of the well-known XFig program (Smith, 1999), and is freely available on the web. We customized the JFig inter- face (Figure 9) to notify the reasoner of visual element adds, deletes, and modifies. Figure 9: Drawing a figure in JFIG. An additional menu al- Whenever a new element is added or deleted from the lows the interface to control the link to the incremental ver- diagram in JFig, the corresponding element in GeoRep is sion of Ge oRep. added or removed, and the dependency network is updated. The restore command works on the most recently removed processing is extremely cheap, which spatial relations are object, and makes the corresponding element valid again in really worth caching in this kind of mechanism? In this ar- GeoRep. chitecture, we have assumed that even very low-level spa- tial relations are worth caching in order to test the implica- 6. Conclusions and Future Work tions of the architecture. Clearly, however, the utility of caching these relations depends critically on the task and We have presented an extensible architecture for incre- the power of the visual processing system (i.e., the visual mental reasoning over a variety of spatial relations. This operators available to the LLRD). framework employs jointly exhaustive and pairwise disjoint Finally, we note that this work is only one part of a la r- relations to encapsulate visual reasoning subtasks. ger effort to create a next -generation diagrammatic rea- Although the dependency network handles the addition, soner. This reasoner will combine incremental spatial rea- retraction, and restoration of visual elements, there are soning with other abilities, such as dynamic reinterpretation many ways in which the dependency network could be of diagrams. Cognitive Science Society (pp. 12). Hillsdale, NJ: Law- Acknowledgements rence Erlbaum Associates. Ferguson, R. W., & Forbus, K. D. (1998). Telling juxtapo- An earlier version of this paper will appear at the 2003 sitions: Using repetition and alignable difference in dia- Conference on Spatial Information Theory. Portions of this gram understanding. In K. Holyoak & D. Gentner & B. research were supported by the Cognitive Science and Kokinov (Eds.), Advances in Analogy Research (pp. 109- Computer Science programs of the Office of Naval Re- 117). Sofia, Bulgaria: New Bulgarian University. search, and by the National Science Foundation under the Ferguson, R. W., & Forbus, K. D. (2000). GeoRep: A Learning and Intelligent Systems program. We would also flexible tool for spatial representation of line dra wings, like to thank Norman Hendrich, the creator of JFig, for very Proceedings of the 18th National Conference on Artifi- useful advice and suggestions on interfacing to that pro- cial Intelligence (pp. 510-516). Austin, Texas: AAAI gram. Special thanks to Ken Forbus and several anonymous Press. reviewers for feedback on an earlier version of this paper. Ferguson, R. W., Rasch, R. A. J., Turmel, W., & Forbus, K.
D. (2000). Qualitative spatial interpretation of Course-of- References Action diagrams, Proceedings of the 14th International Allen, J. F. (1983). Maintaining knowledge about temporal Workshop on Qualitative Reasoning. Morelia, Mexico. intervals. Communications of the ACM, 26, 832-843. Forbus, K. D., & de Kleer, J. (1993). Building Problem Cohn, A. G. (1995). A hierarchical representation of quali- Solvers. Cambridge, MA: The MIT Press. tative shape based on connection and convexity, Interna- Freksa, C. (1992). Temporal reasoning based on semi- tional Conference on Spatial Information Theory COSIT- intervals. Artificial Intelligence, 54(1-2), 199-227. 95. Semmering, Austria. Glasgow, J., Narayanan, N. H., & Chandrasekaran, B. Cohn, A. G. (1997). Qualitative spatial representation and (1995). Diagrammatic Reasoning: Cognitive and Com- reasoning techniques. In G. Brewka & C. Habel & B. putational Perspectives. Menlo Park, CA: The AAAI Nebel (Eds.), Proceedings of KI-97 (pp. 1-30). Freiburg, Press/The MIT Press. Germany: Springer-Verlag. Hendrich, N. (1999). JavaFIG: The Java diagram editor Cohn, A. G., Randell, D. A., Cui, Z., & Benett, B. (1993). [Web page]. Computer Science Department, University Qualitative spatial reasoning and representation. In N. P. of Hamburg, Germany. Retrieved December 28, 1999, Carrete & M. Singh. (Eds.), Proc of the IMACS Work- from the World Wide Web: http://tech1.informatik.uni- shop on Qualitative Reasoning and Decision Technolo- hamburg.de/applets/javafig/ gies, QUARDET '93 (pp. 513-522). Barcelona: CIMNE. Hernández, D. (1993). Maintaining qualitative spatial Davis, R. (2002). Position statement and overview: Sketch knowledge, Proceedings of the European Conference on recognition at MIT. Paper presented at the AAAI Spring Spatial Information Theory (COSIT) (pp. 19-22). Elba, Symposium on Sketch Understanding, Palo Alto, CA. Italy. Doyle, J. (1992). Rationality and its roles in reasoning. Hoffman, D. D., & Richards, W. A. (1984). Parts of recog- Computational Intelligence, 8(2), 376-409. nition. Cognition, 18(1-3), 65-96. Egenhofer, M., & Al-Taha, K. (1992). Reasoning about McAllester, D. (1990). Truth maintenance, Proceedings of gradual changes of topological relationships. In A. Frank the Eighth National Conference on Artificial Intelligence & I. Campari & U. Formentini (Eds.), Theory and Meth- (pp. 1109-1116). Boston, MA: AAAI Press. ods of Spatio-Temporal Reasoning in Geographic Space Rock, I. (1973). Orientation and Form. New York, NY: (Vol. 639, pp. 196-219). Pisa, Italy: Springer-Verlag. Academic Press. Ferguson, R. W. (1994). MAGI: Analogy-based encoding Scher, D. (2000). Lifting the curtain: The evolution of the using symmetry and regularity. In A. Ram & K. Eiselt Geometer's Sketchpad. The Mathematics Educator, (Eds.), Proceedings of the Sixteenth Annual Conference 10(2), 42-48. of the Cognitive Science Society (pp. 283-288). Atlanta, Smith, B. V. (1999). XFig: http://www.xfig.org. GA: Lawrence Erlbaum Associates. Ferguson, R. W. (2000). Modeling orientation effects in symmetry detection: The role of visual structure, Pro- ceedings of the 22nd Conference of the Cognitive Science Society (pp. 143). Hillsdale, New Jersey: Erlbaum. Ferguson, R. W. (2001). Symmetry: An Analysis of Cogni- tive and Diagrammatic Characteristics. Unpublished Ph.D., Northwestern University, Evanston, Illinois. Ferguson, R. W., Aminoff, A., & Gentner, D. (1996). Mod- eling qualitative differences in symmetry judgments, Proceedings of the Eighteenth Annual Conference of the