Inferring a shape grammar: Translating designer's knowledge

Abstract This article focuses on a shape grammar, the rabo-de-bacalhau housing style, that was developed to enable the adaptation of existing houses to new requirements and most particular on the process of inference of the grammar. In the article we describe the process undertaken to develop the grammar and what the achievements of the transformation grammar are regarding the possibilities of a mass customization of a dwelling's rehabilitation work. The goal of this article is to describe and discuss how the designer's knowledge was encoded into shape rules. The process used to extract the architect's knowledge and to incorporate it into the transformation grammar enable us to abstract the designer's actions and to define a sequence of actions that can define a possible strategy of design. The proposed design methodology generates dwelling layouts that are legal because they follow the grammar language and adequate because they meet the a priori user and design requirements.


INTRODUCTION
Shape grammars were invented by Stiny and Gips (1972) more than 30 years ago. A shape grammar is a set of rules that apply step by step to shapes to generate a language of designs. In 1976 Stiny distinguished between original and analytical grammars. Original grammars enable new designs to be generated, based on a shape vocabulary and the spatial relations between the shapes. Stiny (1980b) created kindergarten grammars to exemplify how to create an original grammar using Fröbell's building gifts.
Analytical grammars make it possible to understand existing languages. According to Knight (2000), the first research into analytical grammars was carried out by Stiny in 1977, based on an analysis of Chinese lattice designs. This was the first parametric grammar and contained only five rules that enabled all known Chinese patterns to be generated, as well as endless new hypothetical designs. The second approach to analytical grammar was carried out by Stiny and Mitchell (1978), based on villas by the Italian Renaissance architect Palladio. Since then, numerous analytical grammars have been inferred from the works of various architects. Over the years other grammars, such as parametric grammars and color grammars, have emerged from research.
Shape grammars are defined in terms of shape rules and initial shapes. Each shape grammar defines a language of design. A shape grammar is not a deterministic process because it enables multiple designs to be generated, based on a single language but determined by different choices. The development of a shape grammar language aims to find multiple solutions based on the same set of rules or criteria and not just one solution to a given problem. Therefore, shape rules are used as mechanisms for generating designs. In shape grammars, rules to add and remove shapes can be used to transform spatial compositions. The Euclidean transformations provide for new shapes to be produced by changing the location (translation), orientation (rotation), reflection, or size (scale) of a given shape (Stiny, 1980a). In addition to shapes, labels can be added to shape rules to supply additional information about shapes and to guide them (Knight, 1983).
Shape grammars are used to define several kinds of design languages, by specifying new rules, and to describe the properties of designs, through analysis of the rules that generated them. This article focuses on the process of inference of a specific shape grammar that consists of a transformation grammar to adapt houses to new requirements (Eloy, 2012;Eloy & Duarte, 2012a).
This research aims to answer the need for a mass rehabilitation of Lisbon's existing housing stock. Approximately 64% of the housing stock in Lisbon is over 50 years old and therefore presents various constructional and functional problems that are the cause of its immediate unsuitability in terms of comfort. Our goal is to define a methodology that will enable a mass rehabilitation of the housing stock so that alternative housing solutions that meet recommended standards without much costs involved can be generated in a customized way answering to the specific needs of families.
This article is divided into three parts. In Section 2, a general approach in given on the use of shape grammars in architecture. The proposed transformation grammar is explained in Section 3, and the process to infer the transformation grammar is described step by step in Section 4.

SHAPE GRAMMARS IN ARCHITECTURE
Shape grammars have been applied to architecture using both analytical and original grammars. Analytical approaches are the most frequently used in the research that has been carried out so far.
Studies of analytical grammars aim to explain design languages (by author or typology), but they can also be used as generators of new solutions within the language. Studies of analytical grammars in architecture include those by Stiny and Mitchell on the Palladio villas grammar (1978) (2005), and Çagdaş on the traditional Turkish houses grammar (1996), among many others. The aim of those grammars goes from generating the existing instances to generating new instances in the same language (Colakoglu, 2005). These approaches to analytical grammars have different goals, and the grammar is conceived in different algebras. Grammars may use two-dimensional shapes (e.g., Palladian) and three-dimensional shapes (e.g., prairie houses). These forms of representation can be used isolated or combined by using a compound shape grammar defined in different algebras (Flemming, 1987;Duarte, 2001;Eloy, 2012).
Research into shape grammars has been introduced into architectural training courses to promote an abstract method of thinking about architecture. In this context, Li (2001) proposed teaching shape grammar to students using analytical grammar in order to understand a specific design language, and used the example of traditional Chinese architecture. This process advocated by Li argues that grammars do not constitute an authoritative definition of style. Analytical shape grammars allow us not only to understand a given language but also to generate different designs based on their compositional rules.
Original grammars exploit design solutions based on a vocabulary of shapes and spatial relations. These grammars are created from the outset by designers and enable a few or endless designs to be generated. As analytical grammars, original grammars are used in architectural training and also by architects in real contexts. Original shape grammars were used to generate new designs such as the "Fallen Tower" in Italy by Rand Brown, an art museum in Taiwan by We Cheng Chang, and a housing complex in Manhattan by Murat Sanyal (Colakoglu, 2005). Authors such as Duarte andBeirão (2011), Tuncer andSener (2010), and Turkienicz et al, (2008) also used original grammars in urban design studios to deal with complexity and explore multiple design solutions.

TRANSFORMATION GRAMMAR
Shape grammar theories were used to develop a methodology for transforming dwellings based on specific conditions. The developed grammar is called a transformation grammar, because it aims to transform dwellings to adapt them to contemporary user needs.
To tackle the problem of developing a general methodology for housing rehabilitation we used a case study, the rabo-de-bacalhau ("cod-tail") building type (see rabo-de-bacalhau characterization at http://repositorio-iul.iscte.pt/handle/10071/5526). This allowed us to apply the methodology to concrete buildings so that transformation principles could be inferred and then tested. Only with a specific morphology would it be possible to test different hypotheses for functional rehabilitation.
Within this context, the concept of transformations in design explored by Knight (1989Knight ( , 1994 in her study on stylistic changes was used as a starting point. In this study, Knight presents a process for describing stylistic alterations based on the concept of shape grammars. The relationship between different phases of an author's work may be described by transformation operations that change one phase into another. We propose to call Knight's work the meta transformation grammar (Fig. 1).
Our transformation grammar, however, proposes a different approach, in that it aims not to understand how rules evolve from an original rabo-de-bacalhau dwelling style grammar through an adapted rabo-de-bacalhau dwelling grammar but to understand the principles and rules that enable original dwellings to be adapted to new designs that meet new lifestyles.
Work done by Colakoglu (2005) explores a grammar that induces a type of transformation because it includes both the rules for generating traditional Hayat houses and the rules that enable the generation of these type of houses but conforming to a contemporary context. Again, our work did not aim to infer rules from the original dwelling layouts nor rules to design new contemporary adapted rabo-de-bacalhau dwellings but rules to transform the original dwellings into new ones.
The transformation grammar enables one specific dwelling to be transformed into another by applying transformation rules rather than generation rules as in a traditional shape grammar. In this grammar, there is no predefined initial shape, but there are countless possibilities because the initial shape is the floor plan of the existing dwelling, which can have many specific and complex shapes.
For the goal of rehabilitation, the use of a shape grammar enables existing houses to be transformed in a very precise and systematic way. This process was used to manage shape transformation within dwellings to create a systematic and methodical process that could encompass all the valid transformation rules for a given dwelling. The transformations respond to functional and technical requirements as well as constructional requirements.
The transformation grammar seeks to produce rehabilitated designs that are "legal projects" because they are in the transformation language and "adequate projects" because they satisfy the a priori set of user requirements (Duarte, 2001). According to Duarte, a grammar applied to an architectural problem must satisfy two functions: it must create or transform an object within a specific language and it must create objects that satisfy requirements stated at the outset. As such, the grammar is structured as a discursive grammar, which includes a shape aspect and a descriptive aspect that evolve in parallel to guarantee that an appropriate dwelling design can be obtained from the description contained in the functional program for the dwelling.
In order to verify the functional suitability of the original dwellings and the rehabilitation proposals, it was necessary to determine the fundamental performance criteria by which housing spaces fulfill functional requirements, and then to find a formalism that could be used to analyze spatial configurations from this perspective. The first task was based on Pedro's (2000) work, while space syntax was used for the functional analysis of spatial configurations. The transforma-tion grammar clarifies the principles behind the adaptation of the dwellings, such as making circulation more fluid by removing doors in hallways or enlarging social areas by connecting adjacent rooms. The grammar also encodes principles related to constructional constraints, such as avoiding the removal of concrete columns or other structural elements.

The architectural design process
Although shape grammar was used to produce the transformation, there are several ways of managing the architectural rehabilitation process. The traditional architectural process of planning and designing rehabilitation work relies on the architect's knowledge and proceeds by exploration, using the project program, the existing building, and their combined constraints. To these elements, architects add the human capacity of continuous adaptation and the ability to return repeatedly to the beginning of the process. This research on design by shape grammars explores a method that seeks to encode both the architect's knowledge and the knowledge acquired from other experiences of rehabilitation work in the form of rules. These rules are used to transform dwellings, and incorporate substance and knowledge, and are assumed to represent the architect's knowledge from a wider perspective. However, although vast, the grammar knowledge itself is limited to the data entered into the knowledge database.

Implementation of the transformation grammar
At later stages and in more complex grammars, the computerized implementation of a shape grammar is beneficial because it allows a greater amount and variation of designs that will be generated in less time.
Experimental subjects who manually applied Duarte's (2001) shape rules of the Malagueira grammar to develop a design solution revealed that a grammar written for the computer is difficult and slow for a human designer to understand and apply (Duarte, 2001). This indicates that, in an earlier phase a shape grammar should be written so that it can be easily understood and applied by human designers. This will allow the grammar to be validated and possibly implemented on the computer afterward.
The mechanism used to generate solutions based on the transformation grammar is to a certain extent similar to an expert system because it uses the knowledge of an expert to the problem field and, by using a particular methodology, provides a solution.
Expert systems are used to simulate intelligent human processes for gathering, planning, rationalizing, and representing knowledge, and to reproduce this in the form of computerbased representations. The aim of creating an expert system is to produce, by rationalization and logical proposals, a representation of knowledge, demand, reasoning, and problem solving. From this perspective, an expert system lies at the core of the transformation grammar. The transformation grammar is similar to a spatial and formal expert system because instead of just codifying the expert knowledge in rules using symbols, the transformation grammar also uses shapes.
The aim of using the transformation grammar model is to generate transformations based on a language composed of rules derived from the intervention criteria for the existing housing spaces defined by experts, as in an expert system.
The transformation grammar has a conditional part in addition to a shape part, which covers knowledge in terms of the dimensions and the functionality of the dwelling areas. This conditional part was developed by using natural language (IF/Then conditions or tables and charts) at a first stage and later by using a mathematical language that forms a descriptive grammar. These descriptions reveal certain characteristics that cannot be described in shapes.
As in an expert system, in its initial stage the knowledge contained in the conditional part of the rules could be informed by trees, flow diagrams, and/or decision-making tables, and operated manually. In this study, the first phase of systematizing the transformation principles and rules was carried out using tables, flow diagrams, and text, and certain descriptive rules were produced to assess feasibility.
On a more efficient level, the transformation grammar may be computerized and, in this case, will consist of a program that processes the data to generate a more rapid solution to a given problem.
Research into computerized grammar interpreters has developed substantially in recent years, but a great deal of ground still needs to be covered in order "to make an impact on industry methods using grammar based approaches" (Chase, 2010). The goal of creating a shape grammar interpreter is to make conceptual design tools that support designers' ways of thinking and working and enhance creativity (e.g., by offering design alternatives that would be difficult or impossible to produce without the use of such tools; Chase, 2010). According to Tapia (1999), it should be easier to use a program to try out shape grammars than it is to test them by hand.

INFERRING THE TRANSFORMATION GRAMMAR
The process of inferring the transformation rules is highlighted in this chapter. As schematized in Figure 1, these rules were not inferred from the generation of the original or the adapted dwellings. The rules of the transformation grammar were inferred from the process of transforming the dwellings as carried out by several architects (experts) who acted as experimental subjects in a procedure similar to the one used in expert systems. These design processes are referred to as Style 1, Style 2, and Style 3 (and more) in Figure 1.
The methodology used to infer the transformation grammar was divided into three steps (see also http://repositorioiul.iscte.pt/handle/10071/5526): STEP 1. Testing the feasibility of the experimental setup by the main author of the research and defining a set of preliminary rehabilitation rules that could be transmitted to the architects in Step 2. STEP 2. Finding rehabilitation solutions that could satisfy the functional and constructional requirements of each family in a given dwelling. These solutions, designed by hand, were used to infer transformation rules. STEP 3. Testing the transformation rules inferred in the previous step to confirm both if there were gaps in the grammar and whether the solutions generated following these rules were satisfactory.
The goal was to relate domestic groups (families) to dwellings (existing houses). Prior to applying the methodology, data concerning the domestic groups, the case study dwellings, new housing functions, and the pack of ICAT functions was gathered and organized, as described below. These elements were then given to the designers (architects and students) in Steps 1, 2, and 3.

Families/future inhabitants
We used five families, differently composed in term of numbers, age, and family relationships, namely, couples with children, young couples without children, old couples, and couples with children from previous marriages. Interviews were done with five families, which were then assigned to different design problems (Table 1).
Initially, people living alone were not considered because the sample dwellings were too big for this family type. Later, the study focused on how couples with no children or one-person households could be accommodated by dividing each dwelling into two autonomous smaller dwellings, because this accounts for one of the most sought-after types of accommodation in the rehabilitation market in Lisbon (Caria, 2004). The division of dwellings was studied, and some rules for the implementation of this strategy were also designed. Nevertheless, the transformation grammar does not include this rehabilitation strategy.

Housing functional program
The minimum functional program for each family was determined in accordance with Pedro's (2000) guidelines and then combined with the requirements expressed by each family in an interview especially designed for this purpose (Table 2). Families were presented with what would be the minimum functional program assigned according to the number of inhabitants and their relationships within the family. In the interviews, the families were asked to describe the dwelling they thought they needed (i.e., not an ideal dwelling but one that could fulfill their real needs). They also were told that the dwelling would be in a rehabilitated building with small rooms (the average area of the habitable rooms is 13 m 2 ) and that they would have to consider economic constraints. The description had to include the required housing functions or rooms, as well as the topological relations between them. Finally, they were asked to rank their requirements in order of priority.

Existing houses
The housing sample is composed of 25 dwellings, some of which were chosen for use in the first and second steps.  a The additional media room area was not considered, because the living room area was indicated by the residents. b The circulation area was calculated using the ratio resulting from the case study analysis (16%).
The selection criterion for the first and second steps was to choose 10 dwellings of varying types and areas that could potentially satisfy the requirements of the functional programs for the selected families. To verify this criterion, the area of each dwelling was compared with the area requirements of each family (Table 3). Two different dwellings that satisfied this criterion were then assigned to each family to obtain 10 different dwelling proposals at the end of the experiment (5 families Â2 dwellings; Fig. 2). The 10 chosen dwellings corresponded to 3 Type A dwellings, 2 Type B dwellings, 2 Type C dwellings, and 3 Type D dwellings (Fig. 3).
Rabo-de-bacalhau dwellings were categorized into four subtypes in accordance with characteristics common to all the cases in the studied sample. The type (Fig. 3, left) has characteristics that are common to all subtypes: two symmetrical dwellings per floor, a front wing with a façade overlooking the road that contains most of the rooms and is occupied exclusively by the social and private areas; a rear wing in the rear façade with the service areas; and a main access nucleus in the center of the building. The principal characteristics used to distinguish between the four subtypes were width of front wing, as well as depth and function use of rear wing (Fig. 3).
For the third step, three different dwellings were chosen that were not used in the first and second steps. As stated above, the case study dwellings are characterized by small social areas. It was therefore established that the social areas (living room, dining room, and home office) should occupy at least two rooms or not less than 18 m 2 (depending on the number of inhabitants). Thus, a dwelling (e.g., for a couple with two children) would require at least four inhabitable rooms (two bedrooms plus two social rooms). The different

Pack of ICAT functions
In the design exercises, ICAT pack was reduced to technologies that had an impact on spatial organization. The resulting requirements were then added to the functional program.
The technologies and space requirements considered were the following: † home cinema or large TV screen, which require a spacious living room with a distance of at least 3 m between the screen and the couch or chairs; † home office, isolated or integrated into another area such as the living room, according to the needs of the new dwellers; and † definition of independent night and day areas for sector alarms.

Step 1
The first and second steps aim to identify the fundamental functional, spatial, and constructional transformations to be carried out on the dwellings that were studied. The first step, performed by the main author of the research, consisted of a design process to adapt the dwellings. This step was done in order to infer some basic transformation rules and to test the feasibility of the exercise, before assigning it to other subjects in Steps 2 and 3. This step included two stages. The first stage consisted of proposing transformations to the dwellings taking the future dwellers' requirements and constructional constraints into account. This resulted in 20 different layout proposals, 2 for each family/dwelling pair, in order to explore the various possible solutions. The plans corresponded to possible solutions for the transformations that fulfilled most of the requirements in accordance with the constructional restrictions of the building. The procedures required to perform this experiment included use of data concerning the family, the functional program, and the dwelling, design rehabilitation solutions on tracing paper, and the subsequent use of CAD for verification purposes (e.g., net areas and extent of demolition).
The second stage consisted of inferring transformation rules from the transformations proposed in the first stage. Only higher level transformation rules were inferred, meaning that detailing rules were not considered.
The rules were inferred by text, then by drawings. All the transformations regardless of the implementation sequences were written from all the generated designs. Subsequently, these transformations were drawn, step by step, in order to simulate a possible sequence of actions.
Space syntax was also used to help clarify the transformation principles, according to adjacency and connectivity issues, and make them more simple and rational. To this end, a transformation sequence was produced using both the floor plan and the graph (Fig. 4). Figure 4 also shows the shape rule used in each step of the derivation. The results revealed that not every shape action has an immediate corresponding graph action. In the fifth step of the derivation in Figure 4, a change in shape (i.e., the enlargement of a room) did not have an impact on the justified graph. Nevertheless, changes in the graph are usually linked to changes in the shape and function of a room in terms of the dwelling layout. Changes in arcs and nodes in the dwelling graph occurred as a result of changes in door positions, the size of openings, connections between rooms, division of rooms, or the addition of different rooms within a single space. During this stage, we understood that adjacency graphs and not just connectivity graphs (as the ones shown in Fig. 4) would be extremely useful to inform transformation decision as such as demolitions.
The conclusion of first step enabled the following to be accomplished: † After the first transformation, all others followed substantially the same criteria. † When the functional program requested two or more bedrooms, the first decision was the location of the private area. † When the functional program requested fewer than two bedrooms, the first decision was the location of the social area. † Transformation rules differed according to different dwelling types.

4.6.
Step 2 In Step 2 architects with experience in designing houses were used to design more rehabilitation solutions. The goal of this step was to enlarge the set of rehabilitation solutions in order to understand how different approaches may be used to solve the same problem and, therefore, to obtain a larger basis for inferring rules. Another goal was to understand how designers think when they are designing, if it is possible to encode that process into design rules, and how to do it. To accomplish these goal and to enable the design of the most accurate solution for the given problem, we proposed to put designers "into the mode of doing" as Schon suggests (1992, p. 131). This design step aimed to identify the functional, spatial, and constructive transformations performed by human designers by hand, in order to infer the corresponding transformation rules and encode them into a transformation grammar. In this second step, the same data from Step 1 was used, namely, 10 existing dwellings and five different families. Two of the architects participating were asked to design a solution for all 10 family/dwelling pairs (2 dwellings for each family), which yielded 20 different drawn proposals. Three architects designed for five family/dwelling pairs (1 dwelling only per family), producing 15 different drawn proposals.
The design tasks were explained to each of the architects separately, and they then completed the work in their offices. In addition to a verbal explanation, the other elements given to the designers were the dwelling layouts (plotted on a scale of 1:100, or DWG drawing), a written description of family desires, and a brief description of the major functional and constructional aspects they had to follow.
The architects were asked to perform two tasks: first, to draw a design solution for each family/dwelling pair, taking the functional program into account as well as the construction constraints; and second, to explain the strategy they used to obtain each design proposal.
The data that resulted from this step included sketches (two of the architects designed by computer and therefore did not produce sketches; Fig. 5), final drawings of the proposed layouts, and verbal explanations or texts explaining the process followed in each case. Figure 5 shows total and partial solutions of dwelling transformations that correspond to the traditional process of architectural designing going from the general to detail and back again. These drawings and the explanations, despite being vague, help us to "tell the story" of the design process and then, after identifying a possible sequence of actions, abstract the shape aspects of the dwelling layouts proposals and divide transformations acts into "erasing" (demolishing), "adding" (constructing), and assigning (functions to rooms).
The data was analyzed, and transformation rules were inferred. It was possible to identify two types of design proposals: only one architect proposed transformations where the kitchen moves to the front façade (Fig. 6a), and four architects proposed transformations where the kitchen is left in its original position in the back wing ( Fig. 6b-d). A third transformation method, which enabled the architects too divide the dwelling into two autonomous ones, was proposed in a later stage (Fig. 6e). All the architects respected the given constraints and the priorities expressed by the families. One architect did not comply with the constraint of not demolishing more than 2 m of wall. In general, they said that it was difficult to respond to the functional requirements because of the original morphology of the dwellings and the demolition constraints.
The solutions proposed by the architects were evaluated in order to calculate the level of satisfaction of the dwellers and the fulfillment of the functional and constructive rules. The following criteria were used in the evaluation: satisfaction of functional program; satisfaction of the extra areas requested by families and the connections between them; satisfaction of the general functional aspects for housing; and satisfaction of constructional aspects in accordance with rabo-de-bacalhau buildings. The highest level of satisfaction was obtained when the proposal fulfilled most of those aspects (Fig. 7). The evaluation enabled the different project options to be selected and the reasons why one option was more successful than the others to be understood. In the examples of Figure 6, the solution 6a got the highest evaluation because by moving the kitchen to the front façade, the solution allows private areas to be individualized, and social and service areas to be together and near the entrance. Solution 6b got ranked second in the evaluation be- cause the social areas were moved to the back wing near the original kitchen instead of moving the kitchen.
The general opinion expressed by the architects was that the rules were the following: 1. Difficult to respond to in functional terms because of the original morphology of the dwelling. It was difficult to ensure that the private area was kept intact while also keeping the social area together and close to kitchen. 2. Very restrictive in constructional terms, owing to demolition restraints. In most cases, the rule of not demolishing more than 2 m of wall was a huge restriction. This rule restrains actions such as merging different areas to create larger ones, and the incorporation of circulation areas within social areas. The result of this step was a transformation grammar that can be used to adapt existing dwellings to specific families.

4.7.
Step 3 The third step was carried out by a class of 22 architecture students on the "Shape Grammar and Digital Tools" course from the third year of the Integrated Masters in Architecture pro-gram at the Instituto Universitário de Lisboa. The students had had previous classes on the subject of shape grammar, so they were familiar to some extent with the mechanics of using rules and shapes.
The goal was to test the proposed grammar on dwellings that had not been used to infer its rules. This enabled us to check whether the inferred rules provided the compositional means for making new transformations in other existing dwellings for other families. The exercise was explained by the author to all the students at the same time, and the work was subsequently completed in the presence of the author. The author explained the aim of the exercise, the tasks, how they had to be executed, and how to use the grammar and the rules.
Students were divided into 10 different groups, consisting of one, two, or three people (Table 4). The aim of putting students into groups of different sizes was to test different approaches to using the grammar. The approaches examined were attempts to use the grammar by one person only and attempts involving two or three people, thus allowing for dialogue and exchange of ideas.
This first session lasted 3 h, during which only five groups were able to finish one dwelling derivation. Three of the remaining five groups took part in a second 2-h session in order to finish the dwelling derivation. The groups worked in a computer room, each using one computer equipped with Autocad software.
The groups worked with five dwellings that were part of the corpus but had not been used in previous steps. The five family profiles used in Step 2 were also used in this step. Each of the 10 student groups had to transform one dwelling for a family.
In addition to a verbal explanation, the following additional information was given to each group: † the adapted functional program (the ideal program plus the description of the family's extra requirements, in order of priority), including the net floor areas required for each room; † the dwelling layout in a DWG file; and † a version of the transformation grammar rules in which the function and dimension conditions were simplified in natural language in Portuguese (81 rules grouped according to a specific sequence).
The dwelling transformations obeyed the following task sequence: 1. The author of the research started by explaining the grammar, the sequence of rules (Eloy & Duarte, 2012a), and the aim of the exercise. 2. Students had to read the family's adapted functional program. This functional program had a description of the spaces required and the topological relationships, as well as the net floor area required. 3. One dwelling, previously chosen by the author (in accordance with predefined data), was given to students as a DWG file. The initial labels hs, nhs, Xki, Xba, Xla, and Cbc were already marked on the dwelling layout. In addition to the floor plan, the DWG file included a grid in which the new dwelling layout had to be entered, step by step, after each rule application. 4. Students then started the dwelling transformation, using the given functional program and the shape rules document. 5. Students drew onto the DWG file. Each new rule applied had to be written in the file and the resulting application drawn. They were asked not to delete anything and to change to a new color grid if they made a mistake or chose another approach to the design (as explained in sequence 3 above). Completed experiment and complied with all rules a Did not complete the experiment and did not comply with all of the rules. b Completed the experiment but did not comply with all of the rules. c Completed the experiment and complied with all of the rules. Inferring a shape grammar 165 transformation but in the rules that enable them to be adapted to new lifestyles. To infer the rules and principles of dwelling transformation, we have done several exercises with architects (expert designers) in order to analyze their solutions to specific rehabilitation problems. The goal was to encode the architect's knowledge in the form of rules that incorporate substance and knowledge, and are assumed to represent the architect's knowledge from a wider perspective.
For that we used a three-step method that enabled us to have a basic set of principles; ask architects to design transformation solutions and encode them into shape rules; and test the shape grammar in a practical exercise. In Steps 1 and 2 architects were put "into the mode of doing" as Schon suggested (1992, p. 131). When asked, architects had difficulty in explaining the design process, which proved that "designers know more than they can say, [and] tend to give inaccurate descriptions of what they know" (Schon, 1992, p. 131). This situation was expected, and therefore architects were asked to deliver all their drawings in order for the authors to analyze the design process. These drawings had the information to understand the path architects followed when designing. Even when the design process didn't followed a continuous path (as it usually doesn't), that information was used to assign a sequence to the grammar. The third step helped to clarity the viability of the grammar in a mass customization dwelling design because it generated several design possibilities for the same design problem. The three steps of the process used to encode the rules enabled the grammar to be tested and refined. The process of inferring rules from rehabilitation designs enabled us to verify that rehabilitation works can be summarized into three basic types of rules (adding and demolishing walls and assigning functions). These activities are present in all the actions performed by architects when facing a rehabilitation assignment. Although the presented grammar is specific to rabo-de-bacalhau dwellings, we believe that future lines of research will involve the generalization of the grammar and the development of a more general transformation grammar by extracting from the rabo-debacalhau grammar its methodological structure and rule types, and using this information in the definition of a more general grammar that can be applicable in the development of other specific transformation grammars. This new grammar would use the same general framework of rules and then integrate specificities of different building types, such as considering different construction constrains and different functional organizations, among other parameters (Eloy & Duarte, 2012b).