Most people come across the term ‘grammar rule’ when learning a foreign language. Grammar rules allow them to combine their learnt vocabulary in a meaningful way such that the sentences they build can be understood by others familiar with the language. Linguistics is, however, only one area where grammars are used nowadays.
Since the seminal work by Chomsky (1957), various research fields emerged that utilize formal grammar concepts. Mullins & Rinderle (1991) define grammars as ‘a structured way of describing the relationships between the entities of a language, whether that language be English prose, a computer programming language, a shape language, or perhaps a language of mechanical function and form’ (Mullins & Rinderle 1991). This definition suggests that grammars are used in a wide range of applications. Grammar rules are powerful representations to describe how from a finite set of elements (words, vocabulary) an infinite set of designs (sentences) can be developed.
Grammatical approaches have been successfully applied in numerous engineering design disciplines (Chakrabarti et al.
2011), e.g., in electrical engineering, architecture and mechanical engineering or in natural language processing, e.g., for automated language translation or speech recognition. In the area of compiler design, grammars are designed to automatically translate implemented source code from a higher programming language into machine code, and a whole research area of grammar engineering evolved dealing with the development of grammars. An elaborate set of methods to develop and analyze grammar rules exists in this area.
In architecture, grammars are successfully used to inspire designers’ thinking when developing new designs, or to capture and merge architectural styles. In mechanical engineering, grammars are often used to develop product concepts in the early stages of the design process. Though their use has shown success in the past in generating both known and new designs, the development of grammar rules is challenging. Several researchers mention the need for more support in the development of engineering design grammars (Gips 1999; McKay et al.
) and the lack of support for grammar design is still seen as one of the major drawbacks of grammatical design (Chakrabarti et al.
2011). Engineering design grammars are often developed for specific use cases and no commonly accepted criteria for ‘good grammars’ have been specified by the engineering design community. While in some areas, e.g., computer science in compiler design, different algorithms exist to analyze properties of the language that is described by a grammar, such analyses are usually not done when developing engineering design grammars. As an example, one can look at research on the automated synthesis of gearboxes, a commonly addressed engineering design task. Research on grammars for gearbox synthesis has been carried out by several researchers (Li & Schmidt 2004; Lin et al.
2010). Most researchers developed their own grammar for the problem instead of reusing previously developed ones and the grammar development process is usually not documented. Being presented only the final versions of different developed grammars and the synthesis results, it is not obvious to the designer which grammar or which particular rules are preferable for gearbox synthesis and why. Further, none of the publications investigated in depth how the grammar explores the design space. This makes it difficult to fully understand the importance and influence of single grammar rules on the synthesis process. The development of a new grammar for a particular design problem can therefore be seen as an art rather than a science. This makes the use of grammar-based methods for design synthesis challenging and might be one reason why they are still not wide-spread despite their potential for generating design alternatives and solution spaces.
The goal of the research presented in this paper is, therefore, to support human designers in developing grammar rules for grammar-based design synthesis methods. This is done by providing a method to systematically analyze developed grammar rules and their influence on the generated designs. The method is meant to provide more support for (a) the development of the grammar rules due to a better understanding of how they explore the design space, and (b) the application of sequences of rules. Systematic analyses can help designers to understand new and existing grammars in depth and allow them to make more informed decisions on reusing or developing engineering design grammar rules.
The paper is structured as follows. In Section 2, an overview of Computational Design Synthesis (CDS) in general and using grammars is presented. The use of design grammars is illustrated on the example of gearbox synthesis. Then, transition graphs are introduced and the analogy to grammar-based CDS is given using the gearbox example. In Section 3, the Network-Based Rule Analysis Method (NBRAM) to support grammar development and application is presented. In Section 4, the computational implementation of the NBRAM is described. Section 5 demonstrates how the NBRAM can be used to analyze application conditions for rules in detail using a gearbox synthesis case study. Section 6 demonstrates how the method is used to analyze a grammar for a sliding tile puzzle. Beneficial rule sequences are identified on a small-scale and successfully applied to solve a larger-scale problem. The results show the feasibility of the method to support grammar development and application. The method and its generality are discussed in Section 7. Conclusions are given in Section 8.
In this section, first a general CDS framework is presented. Then, grammar-based methods for CDS are presented and explained using a gearbox design synthesis case study. Background information is given on transition graphs and the analogy between transition graphs for compiler design and CDS is presented, which inspired the method presented in this paper.
2.1 Computational Design Synthesis (CDS)
CDS is a research area that develops methods and tools for supporting the generation of novel and creative, but also routine designs. Two major benefits of CDS methods are mentioned in Chakrabarti et al. (2011). First, the use of computer-based methods enables overcoming restrictions of human designers such as limited knowledge or design fixation. The computer is not biased per se and explores directions the human designer would probably not consider and thus computational methods have a chance to explore novel designs. Second, computer-based methods can support routine design by automating tedious tasks. In this paper, the terminology for the CDS process is used as defined by Cagan et al. (2005). In a first step, the designer formalizes the design problem at the required level of detail to allow for the synthesis of meaningful designs. After the representation is formalized, the CDS process consists of three repeated phases: generate, evaluate and guide. In the design generation phase, a design is selected and modified to represent a new design alternative that is then evaluated considering defined objectives and constraints. A decision is made in the search on how to proceed in the synthesis process, i.e., either to accept or reject the new alternative. The synthesis process is continued until either no further modifications are possible or it is stopped by a stopping criterion in the search method.
2.2 Grammar-based CDS
Stiny & Gips (1972) introduced shape grammars in 1972 and proposed the use of production systems (grammars) for design tasks. Parametric shape grammars were then developed and applied, e.g., to construct traditional Chinese ice-ray lattice designs (Stiny 1977) or to describe Palladio’s style for villa ground plans (Stiny & Mitchell 1978). Since then, research on shape grammars has become an active research area especially in architecture and also in other areas like engineering design (Chakrabarti et al.
2011). Besides shape grammars, other types of grammars are used in engineering design. Examples are parallel grammars (Starling & Shea 2005), spatial grammars (Gmeiner & Shea 2013; Hoisl & Shea 2013; Hoisl 2012; McKay et al.
) and graph grammars (Fu, Depennington & Saia 1993; Helms et al.
2009; Schmidt & Cagan 1997; Schmidt, Shetty & Chase 2000). An introduction to grammatical approaches for engineering design can be found in Mullins & Rinderle (1991), Rinderle (1991) and Cagan (2001).
In grammatical approaches to CDS, designers develop a grammar to represent a desired design language. It consists of a vocabulary, usually describing design elements and subsystems, as well as a set of grammar rules. These rules describe design transformations that are defined by a left-hand-side (LHS) and a right-hand-side (RHS), i.e., LHS
RHS. The LHS defines where the rule can be applied in a design and the RHS defines how the design transformation modifies the design.
Using graph grammars for design synthesis, each design is described using a graph representation that consists of nodes and edges. For example, nodes can represent components while edges describe functional or spatial relations between the nodes.
2.3 Example gearbox synthesis grammar
To demonstrate the use of grammars for CDS on an example, a gearbox synthesis grammar is presented in Figure 1. This rule set is further used in the case study in Section 5. The rule set consists of five topologic rules and is a subset of the rule set described by Königseder & Shea (2015). It was originally developed by Lin et al. (2010). Topologic rules change the topology of a graph, i.e., they add or remove nodes and edges. In Figure 1, the rule number and name are given (left) along with the graph grammar rule (middle) and a 3D representation of the rule (right).
Figure 1. Grammar rule set for gearbox synthesis (adapted from Lin et al. (2010)).
An example rule application sequence consisting of two rule applications is visualized in Figure 2. The generated graphs are given on the left, a 3D representation of the respective designs on the right. The process is started from an initial design consisting of two shaft nodes. In iteration 1, rule 3 (create a new gear pair, see Figure 1) is applied. The LHS of the rule consists of two shafts. These are matched to the two shafts in the initial design. The RHS of rule 3 consists of the two shafts and adds two gears between the shafts. The edge between gear and shaft indicates that the gear sits on the shaft. The edge between the two gears indicates that the two gears are in mesh. In iteration 2, rule 1 (create a new shaft, see Figure 1) is applied. Again, the two shafts are matched and a new shaft is added connecting the two matched shafts via two added gear pairs. Rules to both add and remove graph elements are included in the rule set since it is anticipated that the grammar will be combined with a stochastic search algorithm to effectively search the solution space.
Figure 2. Example rule application for gearbox synthesis rule set.
Many researchers in grammar-based CDS view the synthesis of designs as search through a generative tree, e.g., Brown (1997). In this tree, each node represents a design and the edges represent rule applications. Tree-based search methods like Breadth-First Search (BFS), Depth-First Search (DFS) or more sophisticated tree-search methods (Kumar et al.
2012) can then be applied to search for desirable designs. In Figure 3, a representation of a generative search tree for the gearbox synthesis problem is given. The depth of the search tree is limited to two rule applications starting from the initial design.
Figure 3. Generative search tree for gearbox synthesis problem.
2.4 Transition graphs and the analogy to CDS
Transition graphs as used, e.g., to describe finite automata in compiler design, inspired the presented research. They are introduced in the following and the analogy to CDS in engineering design is given.
Finite automata are recognizers that either accept or reject a given input string. Each finite automaton consists of a set of states including a start state and one or more final states, a set of input symbols (the input alphabet) and a transition function that defines the next states for each state and each symbol (Aho et al.
2006). Finite automata can be represented by ‘transition graphs, where the nodes are states and the labeled edges represent the transition function. There is an edge labeled
if and only if
is one of the next states for state
’ (Aho et al.
An example for a transition graph for a finite automaton is given in Figure 4 (left) where the start state is 1, the final state is 3 and the input symbols are
Figure 4. Analogy between transition graphs for a finite automaton (left) and to describe relations between designs generated during the CDS process (right).
This finite automaton accepts all strings of
’s that start and end with an
and have no or an arbitrary number of
’s in between. With the first input symbol
, the finite automaton transforms from the start state 1 to state 2. For every input symbol
, the finite automaton remains in state 2. The last input symbol
then transforms the finite automaton from state 2 into the final state 3. Examples of accepted strings are aa, aba, abba and abbba. Similar to an automaton that accepts or rejects a given sequence of input symbols, a transition graph, constructed for an engineering design grammar, could accept or reject a sequence of grammar rules applied to the initial design. In a transition graph for an engineering design grammar, each state represents a modified design and each input symbol represents a grammar rule transforming a state. An example transition graph for representing designs as states and rules as transitions between them is shown in Figure 4 (right). The designs presented here are those explored in Figure 3. The edges are labeled with the rule numbers that transform a design into another. Note that designs generated several times in the generative tree (Figure 3) are presented only once here leading to a network representation. Analyzing such a transition graph using techniques from data flow analysis, the grammar rules and influences of each rule application can be understood in detail.
Due to the identified need for more methodological support for design grammar development and inspired from research on transition graphs, a method is developed to support grammar development and application based on transition graphs.
3 Network-based rule analysis method (NBRAM)
The NBRAM analyzes the designs that are generated during CDS and the rules that are used to synthesize these. Figure 5 illustrates the three main steps.
Figure 5. Steps 1 and 2: Network generation through generation of designs (left) and synthesis of designs to a network representation (right).
In Step 1, designs are generated by searching through a generative tree. Starting from an initial design, i.e., the root of the generative tree, designs are generated through successive rule applications and each generated design is added to the generative tree as a child node of the previous design. Using tree-based search methods, such as DFS, i.e., expand first one rule sequence, or BFS, i.e., from one design apply multiple different rules in parallel before moving to the next level, the design space can be explored. Other search methods are also possible to use in this step and the goal is not to find an optimal design, but to explore a portion of the design space that can be analyzed in the following steps. Figure 5 (left) shows example representations of explored design spaces when using tree-based search methods. Each node in the graph represents one design and each edge between the nodes represents the rule that was applied to transform a design into another one.
Using grammars and search algorithms, the same designs are often generated repeatedly and tree-based representations often represent these designs as multiple different nodes in the tree, each resulting from a different rule sequence. Many search algorithms store a list of already explored designs to avoid expanding on the same design more than once. The authors propose that representing these repeated designs as one unique design instead of multiple times in the search tree can help gain useful insights and decreases the search space size because it allows the generation of a state transition graph, where states are unique.
Therefore, in Step 2 (Figure 5, right), all generated designs are analyzed to identify unique and repeated designs. Uniqueness is a problem dependent property and can, e.g., refer to a design’s topology in a structural design problem or its parameter values for parametric problems. The designer developing the grammar defines what uniqueness means for the given problem. The tree-based representations are traversed gradually and every time a previously undiscovered design is found, it is given a new, unique ID (UID). Every time an already discovered design is found, its node in the tree-based representation is deleted and the edges, i.e., the rule with which the design was generated and the rules that were applied next, are connected to the already generated (unique) design. Doing this, the tree-based representations merge to one or more networks of design transitions. In these networks, called transition graphs, each node represents a unique design, or state, and each edge represents a transition from a source design to a target design. A simple example for this is already given in Figures 3 and 4 (right).
The transition graph can be analyzed to gain information about (a) the rules themselves, and (b) the rule application sequences. In Step 3 of the NBRAM, different graph analyses are performed (see Figure 6). The designer is given two methods to access the information. First, automated network analyses are performed and results are presented to the human designer. Second, the network is represented visually for manual exploration of the generated designs and their relations. Implementation details of the respective graph searches are given in Section 4. Seven properties are identified to support the analysis of grammar rules and rule sequences. In general, more properties can be investigated. The seven properties presented below are selected to address topics that are (a) found most relevant to support grammar development and application by the authors, and are (b) previously discussed in grammar related research. The properties can be investigated with the NBRAM as shown in Figure 6.
Figure 6. Step 3: Analyzing the transition graph to understand grammar rules and their application. The pictograms for gearbox and sliding tile puzzle indicate for which case study the respective analysis is conducted.
Properties 1 to 3 are investigated automatically when using the NBRAM. In addition, the provided visualizations and interactive tools allow the designer to study the transition graph and investigate properties 4 to 7.
(Do–undo): Do–undo rule pairs are identified, i.e., pairs of rules where one rule un-does what the other did. A simple example of such a rule pair is two rules of which one adds a component and the other one deletes it. While rules that remove components are helpful in the generative process for back tracking, they can also cause difficulties. For the selection of an appropriate search algorithm, this information can be important because a repeated application of do–undo rules might result in generating the same designs over and over again. So, the designer can use this information on do–undo rules to either change the grammar, or select a search algorithm accordingly.
(Loops): Loops in the transition graph can be identified. Similar to do–undo rules, a loop in the transition graph represents a sequence of rules that, when applied to a design, modify it but in the end recreate exactly the design the sequence started with. Avoiding such loops in the synthesis process, either by reformulating the grammar or through using this information in a search algorithm, can allow for faster design space exploration.
(Multiple paths): Alternative rule sequences can be identified, i.e., sequences of rules that transform a given design
to a design
via different paths in the transition graph. Sometimes these alternative paths represent sequences of rules, where the order of the rule application does not matter. For example, applying rule A first and then rule B leads to the same design as applying rule B first and then rule A. The intermediate designs, however, are different. In other cases, alternative paths can represent different rule application sequences where one sequence consists of more rule applications than the other. If multiple paths exist, the designer can reason about them and consider, e.g., if the rule set can be reduced by deleting or combining rules. Reducing the number of paths can speed up the synthesis process. Depending on the intermediate designs that are generated via the different paths, it can, however, also be useful to preserve the generation of multiple paths and keep the intermediate designs as starting points for further exploration.
(Reachability): The designer of a grammar is often interested to know if the developed rules are able to generate a certain design or if there is a sequence of rule applications that transforms a given design into a desired design. Questions of reachability can be answered using the transition graph, e.g., is it possible to reach design
? This allows, e.g., analyzing if design
can be synthesized starting the synthesis process from design
(Sequences): Besides knowing if a design
can be reached from design
, designers are usually interested in knowing the required transformations. Which rules have to be applied to transform design
? Understanding the application of rules in sequences depending on the design
on which the sequence is applied can help designers to reason about improving the grammar rules and to learn meaningful sequences.
(Shortest Sequence): When more than one sequence of rule applications exists to transform a given design into a desired design, the designer either manually selects one or a search algorithm chooses which rules to apply. Sometimes it is worthwhile to explore rule sequences with many rule applications to generate promising intermediate designs (see also Property 3, multiple paths). Often, however, it is beneficial to know the shortest rule sequence to transform a design
into a design
. Learning shortest rule sequences to transform one design into another using the transition graph can then help to speed up the synthesis process.
(Location): It is often the case that the LHS of a rule matches in several locations of a design. How does the rule application location influence the generated results? The effect of a rule’s application location in the design can be analyzed by exploring the designs that are generated when applying the same rule to the same design but in different locations.
Analyses for the seven properties are conducted. The pictograms in Figure 6 for the gearbox synthesis (Section 5) and sliding tile puzzle (Section 6) indicate for which case studies the respective analysis results are presented.
The transition graph is generated using GrGen.NET (GrGen), an open source graph rewriting tool (Geiß et al.
2006). It is visualized using OrganicVIZ (Cash, Stanković & Štorga 2014), a graph visualization tool capable of representing large graphs and supporting graph analyses as well as providing several filtering options. Using OrganicVIZ, the designer can manually study the transition graph to understand the search space. Nodes and edges can be changed in size and color to provide an overview and emphasize certain designs in the search space. Highly connected designs, i.e., designs with several edges connecting it to other designs can, e.g., be represented with larger nodes. Additional information, e.g., on each design’s attributes, can be displayed to the user for each graph node and edge.
For the automated graph analysis, graph grammar rules implemented in GrGen are used to detect do–undo rules (Property 1), loops (Property 2) and alternative sequences (Property 3). To find shortest paths between any two designs in the transition graph, a BFS with backtracking is implemented (Property 6). A console application is developed such that the designer can interactively search shortest paths between designs and determine reachability between designs (Property 4). To analyze arbitrary paths between designs (Property 5) and analyze the influence of the rule application location (Property 7), the visualization in OrganicVIZ can be used.
5 Case study I – gearbox synthesis
Gearbox design using generative grammars is a common CDS problem and research has been carried out by several scientists (Schmidt et al.
2000; Li & Schmidt 2004; Lin et al.
2010; Starling & Shea 2005; Starling 2004; Swantner & Campbell 2012; Pomrehn & Papalambros 1995). It is therefore considered as an appropriate test case for the NBRAM and demonstrates how the method can be used to address the properties do–undo, loops, multiple paths and location.
5.1 Introduction to the gearbox case study
The five topologic rules of the gearbox grammar described in Section 2.3 are used to generate gearbox designs. The search space is explored exhaustively until a predefined depth
of the search tree is reached. More details and the pseudo-code of the algorithm are presented in Appendix A. The NBRAM is then applied to synthesize a transition graph from the generated search tree and to analyze the grammar rules and their application in detail.
Figure 7 shows the transition graph when the five topologic rules are applied exhaustively to an initial design (design with UID 1 in Figure 7). The initial design consists of input shaft, output shaft and a gear pair connecting the two. The maximum sequence length is set to two rules to generate the transition graph in Figure 7, i.e., the depth of the generative tree is two (
Figure 7. Transition graph for the gearbox case study. Rule sequences with two rules (
) are explored exhaustively starting the synthesis from design with UID 1.
The transition graph is generated automatically and is visualized using OrganicVIZ. Uniqueness is defined in this case study to distinguish between designs according to their topologies. Same colors of the graph nodes indicate that these nodes have the same number of forward and reverse speeds. The pictorial images are generated using yComp (Kroll et al.
2015) and are added manually. Node labels (UID) indicate the unique ID of each generated gearbox topology. This number is used to link the nodes in the OrganicVIZ visualization to the gearbox representations that are stored during the exhaustive generation and can be visualized, e.g., using yComp. The edge labels in Figure 7 indicate which rule is applied to transform a design into another one.
5.2.1 Analyzing LHS matches of rules (Property 7: location)
Analyzing all outgoing edges from one node, the human designer can explore the effect of LHS matches when the same rule is applied at different locations in a design. In Figure 7, rule 5 (replace a gear pair) is, e.g., applied at three different locations on the design with UID 2. Of the three rule applications two result in the same design (UID 17), while the third generates a different design (UID 9).
Between the designs with UID 1, UID 2, UID 3 and UID 4, rule 2 (delete a shaft) and rule 4 (delete a gear pair) are applied at various matches but result in the same designs. The human designer might find this interesting because they would expect a different behavior. Figure 8 represents a zoomed in view of the transition graph for the transitions between the designs with UID 1 and UID 2. Pictograms of the gearbox designs and example 3D visualizations are given. When rule 2 (delete a shaft) is applied to the design with UID 2, the human designer might expect that this rule is only matched once, since only one shaft can be removed between input and output shaft that have to remain in the design. This comparison between expected and actual matches of rules facilitates the identification of rules whose LHSs might be formulated too ambiguously or too constrained.
Figure 8. Zoomed in view on transitions for designs with UID 2 and UID 1. The graphs describing the gearbox designs are given along with an example 3D visualization.
Figure 9. Difference when using old/negative (left) or new/positive (right) implementation of application conditions for rules 2 and 4
The transitions between the design with UID 2 and that with UID 1 are analyzed in more detail to understand how the formulation of the LHS leads to several matches. It is found that the LHS matching conditions for rules 2 and 4 lead to more matches than intended. Based on that knowledge, the rules are formulated differently to better represent the rule designer’s intention of when a rule should be applied. In the original implementation, the rules are formulated using negative application conditions. These describe patterns in the LHS of a rule that define when the rule’s application should be prohibited. When a rule is matched on a graph but also the pattern described by the negative application condition exists in this graph then the rule is not applied. Instead of using negative application conditions, i.e., describing patterns that should not exist in the graph, the LHSs of the rules are formulated to describe patterns that have to exist. These are termed positive application conditions and describe patterns that are required in the graph to allow a rule’s application. In the following, the change from negative to positive application conditions is explained for rule 2. A more detailed explanation, also for rule 4, is given in Appendix B. In the original implementation, the LHS of rule 2 (delete a shaft) is looking for a shaft node and a gear node. The negative application condition describes a pattern such that the matched gear should not be in the same power flow path between input and output shaft as the matched shaft. This means an additional power flow path between input and output shaft has to exist to make sure that input and output shaft are still connected when the matched shaft is removed. Using this LHS rule formulation with the negative application condition, the shaft in the middle of the left power flow path and either the upper or the lower gear in the right power flow path of the design with UID 2 (Figure 8, left) can be matched. This leads to two possible rule matches. Since the designer intends to have only one match for rule 2 on the design with UID 2, the rule is changed and formulated using positive application conditions. The LHS is changed to only look for a shaft and a positive application condition is formulated as a pattern that contains a gear pair that should not be in the same power flow path as the matched shaft. Changing rule 2 this way, it is only matched once on the design with UID 2.
Changing the formulation of the LHSs of rules 2 and 4 (see Appendix B for details) reduces the number of matches as intended. Figure 9 shows the transition graphs for rule sequences with two rules using negative application conditions (Figure 9, top) and positive application conditions (Figure 9, bottom) for the LHS matching. In both cases, 18 topologically different designs are generated, but the number of rule applications, i.e., edges in the transition graph, varies. It is reduced from 50 to 30 when the LHSs are changed. Regions where the number of edges changes are highlighted in Figure 9. This reduction of LHS matches does not reduce the number of designs that are generated. The speed of exploring the search space, however, changes significantly. For a sequence length of 4 rules, e.g., 829 designs are generated exhaustively within 25 minutes with the new LHS application conditions. When using the old LHS application conditions, by contrast, the process is stopped after approximately 1 hour due to lack of memory on the laptop that is used (MacBook Pro, Intel Core i7 CPU with 2.80 GHz, 8 GB RAM).
5.2.2 Understanding the search space
Figure 10 visualizes transition graphs for sequences with 1–4 rules. For the given rule set, the number of topologically different designs increases drastically and it can be observed that designs are highly connected to each other. This means the same designs can be generated via numerous, different rule sequences.
Figure 10. Transition graphs for rule sequences from 1 (
) (top left) to 4 (
) (bottom right) rule applications.
5.2.4 Analyze alternative paths (Property 3: multiple paths)
It is further found, that rule 5 (replace a gear pair) can be replaced by applying a sequence of rule 4 (delete a gear pair) and rule 1 (create a new shaft). The NBRAM is used to investigate whether rule 5 can be removed from the rule set. Transition graphs are generated for a sequence length of three rule applications (
). Two rule sets are used, which are subsets of the original rule set. In the first rule set, rule 5 is kept but rules 1 and 4 are removed. In the second rule set, rule 5 is removed. Transition graphs for both rule sets are shown in Figure 11. The transition graph for the complete rule set, i.e., rules 1 to 5, and a sequence length of three (
) is shown in the lower left corner of Figure 10. Removing rules 1 and 4 from the rule set results in a drastically reduced transition graph. Only 22% of the topologies are explored compared to the complete rule set. Removing rules 1 and 4 is therefore considered inappropriate. When rule 5 is removed from the rule set, 49% of the topologies are explored compared to the complete rule set. Besides the number of generated topologies, the connectivity of designs also varies depending on the used rule set. Using rule 5 results in a stronger connected transition graph, i.e., designs can be transformed into others requiring fewer rule applications. Further, when the exploration is limited to a certain number of rule applications, more designs are explored when rule 5 is included in the rule set.
Figure 11. Transition graphs for rule sequences of 3 rule applications
for different rule sets. Rules 1 and 4 are replaced by rule 5 (left) and rule 5 is replaced by rules 1 and 4 (right).
For a sequence length of four rules, the effect of having rule 5 in the rule set is even stronger. Only 331 gearbox topologies are explored requiring 981 rule applications when rule 5 is deleted from the rule set compared to 829 topologies and 2,770 rule applications when rule 5 is used.
5.3 Key findings
Using the NBRAM, different aspects about the gearbox synthesis task and the grammar are learnt. First, the LHSs of rules are analyzed and inefficient implementations of the LHS application conditions are discovered. Second, the highly interconnected nature of the search space and the exponential growth of the number of gearbox topologies when applying longer sequences of rules are understood from the transition graph visualizations. Third, do–undo rule pairs are identified and loops in the transition graph are analyzed automatically. This confirms the gained knowledge, that the gearbox designs are highly connected to each other. Fourth, it is discovered, that rule 5 can be replaced by the sequence rule 4
rule 1. Using the NBRAM, it is found, however, that it is useful to have rule 5 in the rule set. This is in accordance with the decision by Lin et al. (2010) to develop this rule for gearbox synthesis.
6 Case study II – sliding tile puzzle
The sliding tile puzzle is used as a second case study to demonstrate how the NBRAM can be used to address properties 1 to 6. This problem has been used frequently since its invention in 1879 (Slocum & Sonneveld 2006) and it is still used in artificial intelligence research. It is easy to understand, however hard to solve both, for humans as well as the computer. Further, it is easily scalable, which is why it is used in this paper to show how beneficial rule sequences can be learnt on a small-scale problem and used to solve larger-scale problems.
6.1 Introduction to the sliding tile puzzle case study
In a sliding tile puzzle, a number of tiles are arranged in a rectangle with one tile missing. By sliding tiles one after another into the missing spot, the tiles have to be ordered in a defined way. Even though the principle is easy to understand, for larger puzzles, numerous possible states exist, leading to a vast number of designs that have to be explored when trying to solve the problem. In 1879 Johnson proved that for each
-tile puzzle where
is the number of tiles, there exist (
)! states with only half of them being solvable (Johnson & Story 1879). For the classical 8-tile puzzle, also called
puzzle, this leads, e.g., to 9!/2
181,440 feasible states. The sliding tile puzzle is challenging not only to humans trying to solve it, but also for optimization algorithms due to the vast number of possible arrangements. When trying to understand the problem, human experts sometimes learn sophisticated relations between certain tile configurations and apply sequences to switch between known configurations quickly. As, in analogy to this, the goal in this paper is to support human designers in understanding relations between different designs and grammar rules that transform those designs, the sliding tile puzzle is a well-suited case study. It demonstrates that through analyzing transition graphs, human designers can gain deeper knowledge about designs and identify beneficial rule application sequences. The NBRAM is applied on a small-scale problem to increase the designer’s understanding of the problem and identify beneficial sequences in a first step. Then the learnt rule sequences are applied automatically on a larger-scale problem.
A small version of the puzzle is used in the first part of the case study consisting of five tiles, numbered one to five, arranged on a
tile grid. A grammar with four rules is developed to modify any given puzzle. The four rules (Up (U), Down (D), Right (R) and Left (L)) are visualized in Table 1. The LHS of each rule shows an example design on which the rule can be matched and the RHS shows the design after the rule application. Involved tile positions are highlighted in gray. In the last column of Table 1, the possible matches for each rule are given for the 5-tile puzzle, indicated by the positions on which the empty tile can be positioned.
Table 1. Rule set for the sliding tile puzzle.
6.2 Part 1: Understanding the small-scale problem
All possible states of the 5-tile puzzle are explored exhaustively. The transition graph is generated consisting of all unique designs where each unique design represents a possible tile configuration as a vector, e.g., (1, 2, 3, 4, 5, 0) represents the target design. The NBRAM is applied and results for properties do–undo, loops, multiple paths and reachability are shown in the following sections.
6.2.1 Understanding the search space
As for the sliding tile puzzle, half of the states are not solvable, two transition graphs are generated for all possible permutations of the tiles with numbers (0, 1, 2, 3, 4, 5) with ‘0’ denoting the empty tile. Both graphs are visualized in Figure 12 representing exactly what has been demonstrated mathematically in 1879, namely, that for a given puzzle, half of the states are solvable, whereas the other half are not, and that no solvable puzzle can be transformed into an unsolvable one and vice versa. Figure 13 shows a zoomed in view of the transition graph of solvable designs containing the final design. The node colors and sizes are visualized depending on the degree, i.e., the number of incoming and outgoing edges. Large red (dark) nodes are of degree six and represent designs where the empty tile is in the middle of the tile puzzle. The smaller green (light) nodes are of degree four and represent designs where the empty tile is in one of the corners of the tile puzzle. This shows that designs with higher degree, i.e., with the empty tile in the middle of the puzzle, are stronger connected to other designs because more rule applications are possible from this state than when the empty tile is in a corner.
Figure 12. Transition graphs for solvable (left) and unsolvable (right) puzzles. Large, red nodes are of degree six, smaller, green nodes are of degree four.
Figure 13. A zoomed in view of the transition graph showing designs and their transformations through rules. Large, red nodes are of degree six, smaller, green nodes are of degree four.
6.2.4 Analyze alternative paths (Property 3: multiple paths) and loops (Property 2: loops)
Alternative paths, as well as loops can be detected (see Figure 14) representing what humans trying to solve the tile puzzle also easily experience, e.g., that sliding tiles in a squared region repeatedly will transform the puzzle to its initial state after a given number of moves. Figure 14 shows an example of a loop that rotates three tiles in counter clockwise direction. Understanding such loops can help to avoid the application of a sequence of rules that describes such a loop, as then the whole sequence is negligible. It can also visually be recognized that there might be a shorter and a longer sequence of rule applications to transform a design from one state to another.
Figure 14. Loops are detected to reason about the rules and to avoid them during synthesis. Large, red nodes are of degree six and smaller, green nodes are of degree four.
Besides the manual interpretation of the transition graphs that represent the human’s understanding of this simple problem well, the automated analyses are also tested. Numerous alternative paths between designs are found and questions of reachability between any two designs are answered successfully. It is further demonstrated that the shortest paths can be found between any two designs.
6.3 Part 2: Applying knowledge on the large-scale problem
The 8-tile puzzle is used as a large-scale problem to analyze whether learning rule application sequences identified on a reduced problem, can help to solve larger-scale problems. An example puzzle is given in Figure 15.
Figure 15. Example for the 8-tile puzzle.
The task is to find a sequence of rule applications transforming the given puzzle (left) to the desired puzzle (right) using the information learnt on the 5-tile puzzle. While the 5-tile puzzle with its 6!/2
360 solvable states can be explored exhaustively, the 8-tile puzzle has a significantly larger search space with 9!/2
181,440 solvable states making it harder, and for larger puzzles impossible, to explore exhaustively.
Humans often follow certain strategies to solve the tile puzzle. The most common is to start solving the puzzle from the top to the bottom. Doing this, the tiles for the first row are arranged first and as soon as each of them is in its correct position, they are not moved any more. Then the next row is considered. Having such strategies allows humans to focus on different aspects one after another and makes it easier to handle the complexity of a large-scale puzzle.
Similar to this, the 8-tile puzzle is decomposed into 5-tile puzzles and these are solved sequentially. Problem decomposition is a commonly used problem solving technique (Pólya 1957) and is frequently used in engineering design (Pahl & Beitz 1984). Various methods exist to decompose problems into sub-problems, e.g., target cascading for parametric problems (Kim et al.
2003), or agent-based approaches in optimization (Barbati, Bruno & Genovese 2012), where sub-problems are solved by different agents and then recombined. Problem decomposition is used in this research to demonstrate how beneficial rule sequences can be used to solve a design task.
6.3.1 Algorithm used to solve large-scale problem (includes Property 5: sequences and Property 6: shortest sequence)
The human-based strategy for solving the tile puzzle from the top is implemented in this case study using heuristics (see Appendix C for further details). Further, the 8-tile problem is subdivided into a series of 5-tile problems to solve. The smaller 5-tile puzzle is mapped into a region of the 8-tile puzzle and only tiles within the smaller
regions are changed. The remaining tiles stay untouched. Changing between
regions, e.g., first looking at the upper region, then at the lower region in the
puzzle, tiles can move through the whole
puzzle. A schematic overview of the algorithm used to solve the larger-scale problem is presented in Figure 16. The rationale behind this algorithm is that the information learnt on the small scale supports solving the large-scale problem by directing the search to explore only promising regions of the search space. Other algorithms can be used; however, the simple algorithm developed for this case study showed sufficient for demonstration purposes. It is described on a generic level in the following as it is generally applicable to decomposable problems for which heuristics are available to define promising designs. For the interested reader, the problem specific implementation for the sliding tile puzzle is given in Appendix D. It is based on two heuristics for changing between regions in the 8-tile puzzle and for identifying promising designs for the current iteration. Both heuristics are explained in more detail in Appendix C.
Figure 16. Schematic overview of the algorithm used to solve larger-scale problem based on beneficial rule sequences learnt on small scale.
The algorithm is presented in Figure 16 and consists of three steps.
In Step 1, the search space of the small-scale problem is explored exhaustively. NBRAM is applied to the small-scale problem, i.e., the transition graph is generated and beneficial rule sequences are identified.
In Step 2, the search space of the large-scale problem is explored gradually. The learnt sequences from Step 1 are applied to explore parts of the search space of a larger-scale problem. The process is started from the initial design (Step 2.1). In Step 2.2, promising designs are identified. What is considered promising is problem dependent and heuristics, i.e., knowledge that is derived from experience, or rules of thumb can be used to determine if a design is promising. For the puzzle in Figure 15, e.g., a promising design would be one where tile ‘3’ is in the first row such that the first row is ‘1’, ‘2’, ‘3’, i.e., it fits with the final design. Once promising designs are identified, the currently explored design and the promising designs are mapped from the large-scale space to the small-scale space (Step 2.3). Through this mapping, the problem is reduced from the larger-scale to a smaller-scale problem for which rule sequences among designs are known. Using this information about the small-scale problem, sequences of rule applications, i.e., paths in the transition graph, can be found that reach the promising designs starting from the current design (Step 2.4). The found paths are then mapped back to the large-scale space, i.e., the rule sequences that successfully solve the small-scale problem are used to explore portions of the space of the large-scale problem (Step 2.5). This can be done for all of them or they can be filtered to consider only the most promising ones with respect to some criteria. Now that different paths to promising designs are explored, it is checked whether or not a final design is found (Step 2.6). If not, the search continues with Step 2.2 by selecting one of the explored designs and defining promising designs that should be reached from there. If a final design is found, this means that a sufficiently large portion of the large-scale space is explored (2.7) and the algorithm continues with Step 3.
In Step 3, the sequence of rule applications to solve the large-scale problem is found by searching the shortest path from the initial to the final design.
Figure 17. Sequence of rule applications to solve example 8-tile puzzle.
6.4 Key findings
NBRAM enables understanding the search space of the sliding tile puzzle visually, e.g., through the visualization of the two unconnected transition graphs of solvable and unsolvable designs. Further, it is shown that the understanding of the search space can be used to identify beneficial rule application sequences. In the second part of the case study, beneficial sequences are used to solve a larger-scale problem.
The two case studies demonstrate how the NBRAM can be used for different problems. The NBRAM should preferably be used to analyze grammar rules before they are applied in the CDS process in combination with a search algorithm.
Both case studies use graph grammars. The presented method is, however, similarly applicable to other types of grammars, e.g., shape grammars. In the transition graph each state would represent a shape and each rule application would be represented as a transformation of the shape to generate a new shape. Emergent sub-shapes can be handled as different possible locations to apply a rule. One challenge, however, is defining what constitutes a unique design, i.e., shape similarity, if a set grammar approach to shape grammars is not used.
The gearbox case study shows how the transition graph can be used to analyze rule applications where the location of the rule application in the design influences the synthesis results. Results show how rules can be identified that are matched more often than intended, i.e., their LHSs are formulated too vaguely. Modifying the LHS formulation of the rules makes it possible to reduce the number of indifferent (from an engineering point of view) matches of these rules. While the generated designs remain the same, these changes can have a strong influence on the run time and required working memory when the rules are used in the CDS process. Therefore, these detailed analyses of the LHSs can not only help the human designer to debug and understand rule matches, but also to speed up the synthesis process when LHSs are formulated more specifically to the synthesis task.
In the sliding tile puzzle case study, the transition graph for a small-scale problem, the 5-tile puzzle, is generated and analyzed giving insights on the grammar as well as the problem itself. The 8-tile puzzle is used to demonstrate that rule sequences learnt for small-scale problems can be used to solve large-scale problems. For the given puzzle, a rule sequence of 21 rule applications was found, while more sophisticated algorithms might find a shorter sequence of rule applications. The difference can be explained with the sequential subdivision of the 8-tile puzzle in 5-tile regions that restrict rule applications to smaller regions. The aim of this part of the case study, however, is not to search for computer-competitive strategies to solve the sliding tile puzzle, but to demonstrate that beneficial rule sequences can be learnt and applied that is successfully shown also with a simple search algorithm. For the tile puzzle only one final state exists, but the presented algorithm can likewise be used for problems with several final states and would present the rule sequence to the first final state that is found.
For both case studies, the automated analysis of the synthesized transition graphs enables the designer to identify loops and alternative sequences of rules. The case studies demonstrate the potential of using visualizations and analysis of transition graphs to strengthen the human designers’ understanding of developed grammar rules and the relations between designs and rule sequences. Depending on the problem at hand, it might be possible to explore the search space exhaustively for a smaller sub-problem, as in the tile puzzle case study, or for a limited number of rules in each applied rule sequence, as in the gearbox case study. For larger problems it is also possible to explore portions of the design space using stochastic search algorithms. Then, it is recommended to start the generation process repeatedly and from different initial designs to collect sufficient data and not let the choice of the initial design or the randomness of the search algorithm bias the results. The different designs are then combined to one or more transition graphs depending on whether or not the same designs are generated from different initial designs.
The algorithm that is proposed to solve the 8-tile puzzle is presented on a generic level in Figure 16. It is, however, only applicable to design problems, if they can be decomposed into smaller-scale problems. If this is not the case, beneficial rule sequences can still be learnt using NBRAM, but more sophisticated algorithms should be used to specify where to apply them.
For most real world engineering problems, the exact number of final designs is not known. Often, only some characteristics of final designs are known and an evaluation routine has to check whether these characteristics are present in an explored design and whether the design fulfills all constraints and can therefore be considered as a valid final design. The gearbox synthesis problem can be considered as such a real world problem. Finding beneficial rule application sequences can then be more complicated than the results of the sliding tile puzzle case study might suggest. This is especially the case for problems that cannot be decomposed into smaller-scale problems. Future research should address this issue and further investigate methods to automatically analyze the effect of the LHS application condition on the generated designs since in the current version of the method this is done through manual analysis of the visualization.
In this paper, seven properties for grammars are presented and it is shown how the NBRAM can be used to analyze these properties. Examples for further properties that can be considered in the future are the expressiveness of a grammar and the similarity of different grammars. The expressiveness property could indicate the breadth of ideas that can be described with a grammar. The similarity property could be used to identify similarities between different grammars based on the transition graphs they generate.
A modified sliding tile puzzle was used in research by Vale & Shea (2003) that is directed towards finding beneficial rule sequences. The method proposed in Vale & Shea (2003) learns performances of rule sequences from previous rule applications during the CDS process and uses machine learning (ML) techniques to decide on future rule applications. The focus is on accelerating the search process and learning during the CDS process. In this paper, by contrast, the focus is on supporting the human designer in developing grammars. Future research could, however, combine the presented approach with methods like the one presented in Vale & Shea (2003). Beneficial and counterproductive rule sequences could be learnt using the NBRAM and provided to the ML-based search as initial information. Similarly, the ML-based search could provide visualizations of the learnt information to the human designer to further increase their understanding of the grammar rules and the designs they generate.
The method presented in this paper can support designers in developing and applying grammar rules. The major contribution of the presented method is that it represents a novel approach to analyze grammar rules by combining a graph representation (transition graph) of generated designs and rule applications with network analysis algorithms and interactive visualizations. Exhaustively exploring small portions of the search space to collect data and generate transition graphs to visualize relations between different designs and sequences of rule applications allows for a systematic rule analysis and can give human designers useful feedback about the grammar they developed. Designs, for which the same rule can lead to different designs depending on the rule’s application location, can be identified and based on the resulting designs, the effect of the application location can be analyzed. This information can, e.g., be used to improve the LHS of a rule to increase or decrease the number of LHS matches. By manually analyzing the transition graph or computationally through graph search algorithms, loops in the transition graph can be identified. In addition, efficient rule application sequences can be identified through shortest path search in the transition graph. The two presented case studies demonstrate the potential of transition graph analysis to support the development and application of engineering design grammars.