Incremental Constraint Satisfaction and its Application to Graphical Interfaces
Software that emphasizes pictures, rather than text, has become increasingly popular since the introduction of the Macintosh computer. Creating this software is a time-consuming task that can take months or years. Researchers have attempted to speed up this process by developing constraint-based tools that automate portions of the software development cycle. However, these tools are often limited in the types of applications they can generate, since 1) they lack powerful editing models that can manipulate complex data structures, such as lists, trees, and sets; and 2) in large applications, they cannot perform constraint satisfaction quickly enough to provide instantaneous feedback to the user. We present tools for overcoming each of these difficulties. First, we describe a new model, called constraint grammars, that integrates aspects of both attribute grammars and constraint-based, object systems to produce a powerful specification language for graphical interfaces. Constraint grammars integrate important concepts such as the part-whole hierarchy, almost-hierarchical structures, and multidirectional constraints. These features are augmented with a pattern-matching editing model that permits a designer to manipulate complex data structures. We then present techniques for incrementally resatisfying multidirectional, noncircular sets of constraints. It is shown that minimizing the number of re-solved constraints is NP-complete. We therefore describe an approach that attempts to minimize the amount of time spent updating the constraint solution. This technique divides constraint solving into two phases-a planning phase that linearly orders the constraints and an evaluation phase that solves the constraints using this linear order. Previous approaches have thrown away the linear order whenever the constraint system changes. However, this is unnecessary since only a local portion of the linear order is typically modified. We exploit this fact to develop an algorithm that incrementally updates this order. We the augment this algorithm with a heuristic that attempts to choose a linear order that minimizes the number of equations that the evaluation stage must solve. We present benchmarks that show that these algorithms can significantly reduce the number of equations examined by the planning phase and the number of equations solved by the evaluation phase.