Learning from Cases : Retrieving Cases in CAD Systems Based on Design Criteria by Jau-Yung Shih B.S. Architecture National Cheng-Kung University Tainan, Taiwan June, 1986 SUBMITTED TO THE DEPARTMENT OF ARCHITECTURE IN PARTIAL FULFILLMENT OF THE REQUIREMENTS OF THE DEGREE MASTER OF SCIENCE IN ARCHITECTURE STUDIES ATTHE MASSACHUSETTS INSTITUTE OF TECHNOLOGY JUNE, 1991 @ Jau-Yung Shih 1991 All rights reserved The author hereby grants to M.I.T. permission to reproduce and to distribute copies of this thesis document in whole or in part Signature of Author Jau-Yung S14ih, Department of Architecture, 10 May 1991 Certified by Ti'mothy E.'Johnson Principal Research Associate, Thesis Supervisor Accepted by Julian Beihisg Chairman Departmental Committee for Graduate Students R~otch MASSACHUETTS INSTUITE OF TECHnI OGY JUN 06 1991 LIBRARIES Learning from Cases : Retrieving Cases in CAD Systems Based on Design Criteria by Jau-Yung Shih Submitted to the Department of Architecture on May 10, 1991, in partial fulfillment of the requirements for the degree of Master of Science in Architecture Studies ABSTRACT Architects usually regard case studies as architecture. Cases stand for existing answers resources for free interpretation. This thesis knowledge into architectural design projects and retrieval of cases through satisfying criteria an important way to study to real problems and provide investigates encoding design through formal computation, provided by designers. Knowledge in architectural design has been distinguished into domain knowledge and design knowledge [Schmitt et al 90]. Domain knowledge investigates precise rules in design, and design knowledge deals with more flexible or personal rules in aesthetics or spatial arrangement. The Retrieving Cases Based on Design Criteria (RCBDC) program proposed in this thesis is a prototype for a CAD system with Case-Based Reasoning to deal with design knowledge. This thesis concentrates on the issues of retrieval within CAD systems using Case-Based Reasoning. Two kinds of retrieval have been developed: Critical Retrieval retrieves cases that meet the assigned single design criteria. Designers can filter among these retrieved cases by adding more and more design criteria. General Retrieval calculates all the possible permutations among repeated elements, and retrieves cases that have spatial relationships that are most similar to the current project. Thesis Supervisor : Timothy E. Johnson Title : Principal Research Associate Acknowledgements First of all, I would like to thank my thesis advisor, Timothy Johnson, for leading me into the field of design computation, and his consistent help since I entered MIT. I had benefited fruitfully from our weekly meeting throughout my graduate study. My particular thanks go to my thesis committee: William Mitchell, whose studio I took in 1990, had been an ideal environment for introducing various ways of delicately applying technology to design practice. His inspirational questions always extend my viewpoint into a broader vision; Earl Mark, who had also provided my earliest computer and movie making courses, had been giving his penetrating criticism and consistent support during the thesis meeting. I am also grateful to the following people: Robert E. Healey, Terry Field, and Chai-Boon Lim for patiently proof-reading my drafts. Edward Lavine, for his enthusiasm and providing me an excellent working environment - MIT Visual Art Computer Center during my thesis research; Pegor Papazian, for the early discussion and lending me some valuable documents. Brook William, for his companionship and routine discussion. My deepest gratitude go to my family, my wife Judy Wu, my parent Yen-Ping Shih and Heuey-Chin Fang for providing doubtless support and encouragement during my graduate study. i ii Table of Contents Abstract Acknowledgements Chapter1: Introduction 1.1 Knowledge and Rules in Cases 1.2 Case-Based Reasoning 1.3 Problems with current CAD systems 1.4 Concepts of CAD systems with CBR 1.5 Related Research and Synopsis Chapter2: Implementation 2.1 2.2 2.3 2.4 Scenario Retrieving Cases Based on Design Criteria program Representation in the RCBDC program Script in the RCBDC program Chapter3: Matching and Retrieving 3.1 3.2 3.3 3.4 Architecture of Matching Matching by Elements Matching by Spatial Relationships Detail of Permutation in Matching Chapter4: Testing 4.1 Testing Critical Retrieval 4.2 Testing General Retrieval Chapter5: Evaluation and Conclusion 5.1 Evaluation of Critical Retrieval 5.2 Evaluation of General Retrieval 5.3 Conclusion 5.4 Future Work Appendix A Program of Checking Penetration Relationship Appendix B Program of Adjacency in Critical Retrieval Appendix C Program of Penetration in General Retrieval References Chapter One Introduction 1.1 Knowledge and Rules in Cases The best way to learn what is ice cold is to touch ice. Learning from case studies is not the only way to accumulate knowledge, but it is one of the most effective ones. High school teachers teach geometry by solving sample problems, and students learn it by practicing more problems. These geometry sample problems are not equal to the total knowledge of geometry, but each of them stands for some principle of geometry, and provides teachers and students a media to communicate with each other. Without these sample problems, the knowledge of geometry will remain unknown. Architects also regard case study as one important way to acquire design knowledge. Cases stand for existing solutions to problems in the real world. Take a Gothic church as example, Any existing church provides solutions to its structural requirements, choice of materials, social role, religious function, and local weather. By studying these the construction and maintenance documents of these churches, we can attain more associated knowledge. With this information, architects can be aware of unseen problems and can predict how their own designs will behave in the future. Therefore, the best way to learn how to design a Gothic church is to consult case studies of Gothic churches: to visit Gothic churches, study their layout, investigate their working drawings, and talk to people that go to Gothic churches. Learning from cases have the following advantages: 1. Information for designing is too abundant to choose at this time. We must have ways to evaluate the feasibility of choices, Cases stand for existing solutions to real world problems and knowledge from cases will be reliable. 2. Cases provide existing facts for free interpretation, so we can interpret them according to our present need. The Eiffel tower meant something to nineteenth century architects, and it means something different for twentieth century architects, and carries other meanings for sculptors, structural engineers. Everyone can always learn something from an existing case, therefore, knowledge in cases is flexible and can be reinterpreted according to present needs. 3. Knowledge in cases is not isolated or fractured, it depicts the whole environment that stimulated the solutions. When we learn from cases, we do not just obtain several isolated rules, but also understand under which circumstance, these rules will be effective. 4. The knowledge generated from a case is easier to recall, and to remember for a longer time. Japanese policemen use this theory, they asked speeding violators not just to pay their tickets, but also to watch films of traffic accident. Those who see these films know better, and remember longer these lessons. Although learning from cases is a better way to obtain knowledge, the means of translating knowledge from cases into a current project in a computer system is not yet fully developed. Almost all the current expert systems are rule-based systems, they follow if... then.... commands and do as they are told. The advantage of case knowledge that cases are allowed to be interpreted freely becomes a disadvantage in such a system. Because "interpreted freely" does not tell computer clearly what to do. To solve the paradox of free interpretation, we must clearly understand our application goal. A stone can serve as a hammer, a weapon, building material, and many other functions. If we know that what we need is building material, then we can judge the stone from the view point of serving as building material. If we know our goals, then we know which function we need, we can evaluate whether stone is suitable for that function or not, and we can decide to use it or not. Such goal-oriented backtracking is one of the basic abilities in human thinking, and it is also suitable for retrieving rules from cases. Although cases are allowed to be interpreted freely from different perspectives, if we know our goals, then we can decide which function we need. From the viewpoint of this function, we can abstract rules from cases, finally we can apply these rules back to our goals. Designers like to work on sketches, learn from sketches, because sketches can provide the most intuitive form of free interpretation. A skillful designer can see more possibility from sketches, because he/she has profound design knowledge (shape rules, relation rules, or function rules ...etc), has many ways to interpret these intuitive forms, and can abstract useful knowledge from these sketches and yield more feasible solutions. The rules of spatial relationships do not exist by themselves, they depends on how designers interpret and abstract them. A central issue for making intelligent machines is that machines should have the ability to learn from past experience. When more and more experience accumulates, machines should adapt appropriately based on that experience. With rule-based systems it is hard to achieve this goal, because such systems are designed to strictly follow rules. To change the rules within a system after each operation is not adequate or feasible. Case-based systems (CBR) are able to learn from experience, as more and more cases are put into the Case-Based Reasoning systems, their central processing mechanisms remain the same, but the databases for consulting constantly change. Therefore, new experience in CBR systems influences future operations, and CBR systems' response are based on past experience. 1.2 Case-Based Reasoning People realize that learning from cases is a better way to obtain knowledge, and many research projects concerning Case-Based Reasoning have been conducted in recent years. Case-based reasoning is defined by Christopher K. Riesbeck in Inside Case-Based Reasoning [Riesbeck 89] : We retrieve a prior case from memory, attempt to determine its relevance, and decide what to do, based upon what happened in that case. That is what I have called case-based reasoning. The word case just refers to an experience. In essence then, case-based reasoning means no more than reasoning from experience. The issue of whether something is best called a case, or a rule, is one of understanding how experiences get encoded in memory. Case-Based Reasoning is an important subject in current artificial intelligence research, and its application in computer-aided design ranges from simple icon applications to complex architectural floorplans. "Simple" in this context means only a few rules encoded. "Complex" involves encoding many rules. I will use the icon application to explain a simple Case-Based Reasoning application, then discuss more complicated applications. Icon application is widely used in current computer systems. To delete files in a Macintosh computer, we don't have to remember the exact command, we just have to find an icon that looks like a trash can, and drag files into the icon. Before icons were developed, computer users were often baffled by mistyping commands or had trouble working among different operation systems. All major computer systems have their own operating systems, and their commands for the same operation are all different. In different computer systems, to delete files we must exactly remember different spellings for the same concept. MS. DOS ( IBM's operating system), "del" is the acceptable spelling, you can not type "delete", or "erase". Icon recognition does not have to be very accurate. In the HyperCard software on a Macintosh, if we want to go to the Home Card, we just click on an icon that looks like a house. Although different icons symbolize home in different files, the result for clicking on them is the same, it will always bring us to the Home Card (figure 1.1). 1.1 Different home icons in HyperCard, but represent the same function. We can go on to explain icon application by case-based reasoning. When we wish to delete files, we start to recall in our memory, and remember that we have deleted files in the past by using the trash can. " The trash can icon can delete a file " this knowledge had been encoded in our memory from past experience. Such activity of retrieving useful experience from memory is typical case-based reasoning operation. People do not always remember everything precisely, and do not have the ability to remember everything in detail for a long time. Icons are designed for us to easily recall meanings, to easily put our experience into future operations, they are designed for case-based reasoning operations. Other applications of case-based reasoning are more complicated than the icon application. Icons may have only a few rules encoded in them. But, to arrange an architectural floorplan, economical issues, environmental issues, energy issues, pedestrian access, visual access, and the relationships between facades and floorplans.... all must be considered. Thus, the rules (knowledge, constraints) encoded in an architectural floorplan are enormous, and require a more advanced system. 1.3 Problems with current CAD systems Knowledge in architectural design has been distinguished into domain knowledge and design knowledge. Domain knowledge investigates precise rules in design, such as structural analysis, cost estimation, or energy consumption. Design knowledge deals with more flexible or personal rules in aesthetics or spatial arrangements. Schmitt defines these two kinds of knowledge in terms of function and rules [Schmitt et al 90]. Domain Knowledge, which allows the analysis of a design to determine its function. Design Knowledge, which is used to generate designs that achieve a desired function. Domain Knowledge is based on precise physical principles and can be formalized in a system of general rules. Design Knowledge is more difficult to capture in such a concise form. We therefore represent this knowledge in the form of a library of concrete cases. In recent years, computer-aided design systems have successfully assisted architects in many fields dealing with domain knowledge, they help calculate strength in structural design, estimate construction cost, and predict energy consumption. But, applying design knowledge to CAD systems is not yet fully developed. Most of the current CAD systems simply serve as graphic tools. The reason for this is that designers all have individual design methods, and these personal methods all work, so it is hard to judge which design method is better than the other. Moreover, most designers do not distinguish every step, every operation in their design process, and they do not clearly understand their own design methods. Since we do not have a well-formed design method as paradigm, we do not have an existing model to implement design knowledge into CAD systems. In circuit design, we can evaluate a design product by its speed, volume, or economy, and we can also evaluate which design process is better by evaluating which circuit produced by its design process is better. In an architectural design, the criteria for evaluation are numerous, and many of them relate to aesthetic or cultural issues which heavily depend on personal interpretation. Thus, evaluating an architectural design is difficult, and evaluating its design process is even harder. Although architectural designs are difficult to evaluate by general rules, they still can be evaluated by personal criteria, as every designer does in his/her daily design process. Without these personal criteria, designing operations would never proceed. If a CAD system could evaluate designs by each designer's own criteria, then it could really help designers to deal with design knowledge. To design a personal CAD system, a Case-Based Reasoning approach is highly appropriate. A CBR system has a case library that stores many cases as a knowledge source, the system can adapt the knowledge from these cases during the design process. If all cases in the case library are designed by one designer, the criteria the CBR system uses will be this designer's criteria, and the system can serve as a truly personal design tool for dealing with design knowledge. Although current CAD systems help designers deal with domain knowledge, the most exhausting aspect at design activity is not applying domain knowledge, but applying design knowledge. A CAD system with CBR can help designers retrieve design knowledge from their past projects, apply it to future design operations, and help designers deal with the most exhausting design activity - applying design knowledge. 1. 4 Concepts of CAD systems with CBR This thesis discuss a prototype for an interactive Computer-Aided Design (CAD) system with Case-Based Reasoning (CBR). A CAD system with CBR has a database (case library) for storing past experience, and the ability to abstract knowledge from these cases to solve emerging problems during design exploration. In CAD systems with CBR, designers can save their design projects into the case library after each design operation, so the system will be equipped with more and more personal design knowledge through use. If a designer gradually changes his design criteria, his cases will also reflect this trend. CAD systems with CBR will necessarily follow the designers' changes, retrieve the new criteria from cases in the case library, and apply them to future design operations. An ideal CAD system with CBR should have four fundamental functions for the design operation : 1. Editing shapes. 2. Retrieving cases. 3. Adapting knowledge. 4. Evaluating. 1. Editing shapes: To edit shapes is to generate, move, rotate, and erase shape elements lines, circles, and curves. The composition of these shapes usually depicts objects in the real world. Many different ways of generating and editing shapes have been developed, usually following the designers' habits of designing, they range from one-dimensional wire frame drawing , to three-dimensional solid modelling. Current commercial CAD systems, like AutoCAD, VersaCAD......etc. are equipped with sufficient editing functions. 2. Retrieving cases: In different stages of design process, designers usually consult different cases to solve their current design problems. In solving a design problem, designers first have to define their problems, decide the criteria for retrieving cases, start a search in their memory, and recall the relevant cases. Usually these cases exist in magazines, books, working drawings, or slides. A computer aided design system with case-based reasoning should help retrieve the relevant cases by the criteria assigned by designers. The criteria could be a location with several elements, such as "An apartment in Cambridge with four bedrooms" or a specific spatial relationship, like " Any residential project that has a kitchen adjacent to a livingroom ". A successful retrieval operation depends on both systematic labeling of cases during the saving process and efficient computing the relevance between cases and the current project during the retrieval process. Current CAD systems only provide a file name to represent a design project, these systems do not have the ability to analyze the contents of these files before retrieval, so designers usually have to spend a lot of time searching for relevant cases. Enhancing the efficiency of retrieval of cases during the design process is one of the central issues of CAD systems with CBR. 3. Adapting knowledge : To adapt knowledge means to abstract useful knowledge from retrieved cases, and apply it to the current project. Usually a case can be abstracted in many different ways, so designers must clearly understand their goals and clearly know the functions they need, in order to abstract useful knowledge. Before adapting, designers must decide which aspect of the current project need to be changed, so that the system can check situations in both the current project and retrieved cases and define the domain of adaptation. During the adapting process, the systems should abstract the rules from retrieved cases according to the goal and apply these rules to the current project. 4. Evaluating : Although promising cases are retrieved for the purpose of providing useful knowledge, not every adaptation operation may be adequate. From one perspective, some knowledge might be adequate, from another perspective, it might not be. To avoid improper adaptation, CAD systems with CBR must have evaluating mechanisms to test the adequateness of spatial relationships before or after the adaptation operation. Evaluating before adaptation has the advantage of avoiding unnecessary operations, and enhancing design efficiency. However, it may reject many design possibilities and restrict design exploration. Evaluating after adaptation can also point out inadequate spatial arrangements and ask the designer to return to the previous designs, or continue the design process to change other parts of the design. 1.5 Related Research and Synopsis Current applications of case-based reasoning include legal reasoning, mediation, manufacturing, medical diagnosis, military application, and instruction. [Kolodner88]. At this time, none of the case-based reasoning research has dealt with spatial relationships in architectural design, although some research has been done on the design domain: The CYCLOP program [Navinchandra 87] attempts to draw knowledge from precedent cases to fix emerging construction problems during design exploration. The CYCLOP program is used in designing landscape architecture. It can retrieve a appropriate case from memory to provide new criteria for solving the current problem. The CYCLOP program uses scripts written in Lisp as indices and a database for its searching, matching, and retrieving operation. 10 The TYRO program [Macneil 89], allows a graphic designer to take a "program by designing" approach to building a case library of basic design processes. TYRO works on the domain of graphic design and uses the Boston MBTA route map to demonstrate the knowledge adaptation process. After several design operations done by the designers, the TYRO program can generalize and generate a constrained graphical object capable of being reused in a range of similar contexts. Adaptation and augmentation of the case library in the TYRO program takes place as trial layout reveal failure condition. The CHEF program [Hammond, 1989], designs recipes for the Chinese cuisine, it generates new recipes by consulting the given materials and old recipes. CHEF has a case library of about 20 existing recipes. When a new menu is ordered, CHEF will respond with a recipe, and can repair this recipe if the user is not satisfied with it. Ishizaki uses "examples" as a way of creating computer programs without conventional programming [Ishizaki 1989]. His Example-Based Graphical Programming system generates a computer program from the recorded designing operations. This program works on graphic design and a dynamic display of animal migration is used to demonstrate the design process. This thesis investigate retrieval issues in computer aided design systems with case-based reasoning. A Retrieving Cases Based on Design Criteria (RCBCD) program is implemented to demonstrate the process of retrieving relevant cases according to assigned design criteria. Applying CBR to CAD systems is a new approach. The scope of research would of necessity be very broad, and since little research has been done in this field. I have focused on the issues of retrieval of cases, for retrieving cases is one of the most important but time-consuming activities in the design process. This thesis assumes the reader is not familiar with the problems integrating the CAD systems with Case-Based Reasoning, and will provide fundamental background knowledge in Chapter One. Readers who are familiar with this topic, can start with Chapter Two, which discusses the implementation of the RCBDC program. The outline of each chapter is : Chapter One discusses the advantages of learning from cases, the problems with current Computer Aided Design systems, and the concepts of Case-Based Reasoning. Chapter Two introduces the implementation and the scenario of the RCBDC program, and discusses the problems of knowledge representation in CAD systems with CBR. Chapter Three explains the operation of searching and matching in the RCBDC program. Two specific types of matching are analyzed: matching by elements and matching by spatial relationships. Chapter Four tests the Critical Retrieval and General Retrieval process in the RCBDC program. Chapter Five evaluates the retrieving functions, makes the final conclusion and suggests future research. 12 W I IRip-- Chapter Two Implementation 2.1 Scenario The Retrieving Cases Based on Design Criteria (RCBDC) program is an interactive computer aided design system that allows architects to design residential ||I i li CAD w th CBR ROOM TYPES RET ZIEVED CASE CURRENTPROJECT DRAW ELEMENTS BALCONY BATHROOM BEDROOM A3 BRiROOM WALL -- Am TIONSPACE DINVIGROOM STUDY DOOR ENTRANCE CURRENT PROJECT MATCHED O LIVINGROOM ERASE KITCHEN ROTATE MOVE STAR STORAGE_ RETRIEYEDCASE penetrable BR 1 penetrable BR 2 penetrable BR 2 penetrable BR 2 CI 1 SO I BA 1 CI 1 penetrable BR 1 penetrable BR 1 penetrable BR 1 penetrable BR 2 CI 2 BA 1 SO 1 CI 2 A2 T=Target element R-Reference element penetrable BR 1 BL 1 penetrable BR 1 SO 1 penetrable BR 1 BA I penetrable BR 1 C1 2 penetrable BR 2 C 2 penetrable LI 1 CI 1 LI 1 CI 2 penetrable KI 1 CI I penetrable BA 2 CI I GENERALFUNCTION EXIT SAYE IEVALUATOR Adjacency &Adjacency & "BEDROOM K-distance X-distance CBR & BA CHECK LATION REDRAW RESTART CHECK ERLAP CASEINTO PROJECT I MROOM TYPE djanengy & Adjaoency & 'ADJACENTV-distance Y-distance | CRITICALRETRIEVAL, ATDIN PENETR PENETRATDNRO0MTY E LATEST CASES ADJACENC M SELECTED CASES CRITICALRESTART PREVIOUSNEXT R CneDico I & X-Y Distance A7 2.1 A screen display from the Retrieving Cases Based on Design Criteria program 13 - A8 -A6 GENERAL RETRIEVAL At West Bulding, Cornr appartment Very Beautiful view to theCharles A4 APPLY RULES projects (Figure 2.1). In different stages of their design, designers can choose different design criteria and retrieve cases to consult. The RCBDC program (Figure 2.1) divides the screen into the following functional areas: 1. Two grid boards used as a drawing area. Al in Figure 2.1. 2. Presentation area for showing assigned relationships. A2 in figure 2.1. 3. Editing tools area. A3 in Figure 2.1. 4. General functions area, including Exit, Restart...etc. A4 in figure 2.1. 5. Evaluator area. A5 in Figure 2.1. 6. General retrieval area. A6 in Figure 2.1. 7. Critical retrieval area. A7 in Figure 2.1. 8. Applying rules area. A8 in Figure 2.1. The two grid boards are the working area for the current project and retrieved cases (Al in Figure 2.1). Designers can edit shapes on the board marked "Current Project", and the retrieved cases are shown on the board marked "Retrieved Case". For simplicity, these two boards use modular grids. The Presentation area below the two grid boards is designed for showing assigned design criteria and spatial relationships (A2 in figure2.1). These relationships include relationships within the current project, retrieved cases and both. Clauses enable the designers to easily understand the computation process, and to observe the design project from the perspective of the first-order calculus. For example, the clause penetrable (BR 1 BA 2 ) in the Presentation area means Bedroom 1 has a penetration relationship with Bathroom 2. The editing tools seating in the upper right corner of the screen (A3 in figure2.1) provides basic shapes - rectangles and lines, and basic functions - 14 erase, rotate, and move. Labels, "Roomtype" are used to index a Among the basic shapes, "door" ''entrance" symbolizes the main outside. (Figure 2.2). like bedroom, bathroom, found under rectangle and make it a specific room. provide a negative space in walls, and entrance to a residential project from LI LI LI LI A Draw a rectangle Input label Draw a door After Redraw Designate the Entrance 2.2 The process of creating a Livingroom and indicating an entrance The general control functions seating in the bottom left corner of the screen (A4 in figure2.1), performs general operations for the RCBDC program, including "SAVE","EXIT","RESTART".... etc. The "SAVE" command will put the current project into the case library, making it resource for future consultation. The "RESTART"command abandons all existing current projects and retrieved cases, and returns the screen to blank grid boards. The "CASE INTO PROJECT" command puts the retrieved case into the grid board of the current project for modification. The Evaluator shown at the bottom left of the screen, checks improper spatial relationships among shape elements (A5 in figure 2.1). The evaluator can be used before or after knowledge adaptation. The "CHECKOVERLAP" command checks the spatial relationship in the current project and tells the designer which elements should be moved to avoid overlapping (Figure 2.3). 15 A spatial arrangement for testing evaluator After clicking at "CHECK-OVERLAP", the system will find the error and suggest designer to move diningroom or livingroom 2.3 Testing Check-overlap evaluator General Retrieval (A6 figure2.1) allows the architect to retrieve cases based on a group of design criteria. For the penetration relationship, the system will abstract all the existing penetration relationship in the current project and search the database to find out which cases in the case library have the highest number of matched penetration relationships. Details of General Retrieval will be discussed in Chapter Four and Five. Critical Retrieval (A7 in figure 2.1) is similar to General Retrieval. The difference between them is that General Retrieval usually generate many clauses as criteria for matching. It is hard to find a exact match, therefore the system will retrieve the case that has the highest number of matched clauses. Critical Retrieval allows designers to choose one single criteria at a time, like "retrieve those projects with two bedrooms", or"retrieve those projects in which the bedroom is penetrable to the bathroom". If we choose one design criteria to retrieve cases, many files will fulfill the criteria and are selected. After the first retrieval, designers can add other criteria to retrieve among these selected cases. In this way, the selected cases will be filtered again and again, and become fewer and fewer. Applying Rules (A8 in figure2.1) abstracts rules from retrieved cases, and applies them to the current project. These rules in design, include rules 16 for judging quantity adequateness, and rules for deciding quality criteria. Applying the rules of spatial relationships is a complex issue, for shapes can be analyzed in many different ways. Designers should clearly understand their goal, so they know how to abstract and apply the rules. This part of applying rules is major component in CAD systems with CBR. The RCBDC program concentrates on developing the retrieval components, and this part of applying rules will be left for future research. The RCBDC program works on a Macintosh computer and is programmed in Prolog, a logic language with several important features which assist the retrieval operation, including pattern matching, tree-like data structuring, and automatic backtracking. The program also uses Macintash Quickdraw to achieve all the drawing functions, and dialog boxes to communicate with the users. 2.2 Retrieving Cases Based on Design Criteria program The Retrieving Cases Based on Design Criteria program detailed in this thesis is a prototype for a CAD system with case-based reasoning in the field of residence design. Architects can design residential projects by using this program and save the design in the database (case library) for future use. During the design process, architects can assign design criteria and ask the program to retrieve the most relevant cases for consulting. After searching, the system retrieves exact-matched cases, if the system can not find an exactmatched case, then it retrieves the closest cases. The retrieved cases are listed in the sequence of relevance. The Case-Based Reasoning Flow Chart [Riesbeck 89] proposed by Riesbeck (Figure2.4), expresses the structure of the RCBDC program. The flow chart separates the process of CBR into six major steps, Input, Assign 17 Indices, Retrieve, Adapt, Test, Explain. The following addresses the most important content of each step: Input Assign Indices Indexing Rules Input + Indices ulech ryRetrieve Mae Retrieved Caseae Adaptation Adapt Store Proposed Solution i4 Test dAssg Case Failure Description Explain Predictive Features New Solution Repair Casusal Analysis Repair Rules 2.4 Case-Based Reasoning Flow Chart proposed by Riesbeck Inputting is the process of transfering information into a computable format. In CAD systems, it consists of creating, editing shapes, or importing files. To create an efficient CBR system in CAD, shape elements have to be labeled clearly, spatial relationships defined clearly, and a game-like operation used to avoid unnecessary computation. Thus, CBR systems have to create their shape elements according to a modular systems and use a hierarchical format for the purpose of the game-like operation. For example, 18 a bedroom is not loosely composed of lines, but formed by a rectangle and an assigned roomtype "BR", which will serve as a label in computation. (Figure 2.5). CAD systems with CBR can only process information in an adaptable format, so the cases in the case library must be generated in similar CBR systems, otherwise the data transfer between CBR and other CAD systems will not be possible (because current CAD systems do not label their elements in the same way) (X1X,Yl) + BR BR (X2,Y2) rectangle (X1,Y1,X2,Y2) rectangle ( BR) rectangle (X1,Y1,X2,Y2,BR) 2.5 Inputting process of a rectangle Assigning Indices is needed to label the input elements properly for the purpose of retrieval, as books in a library are assigned indices before they are put onto the selves, so that users can find them. Indices usually are sets of symbols depicting original objects, so users or computers can know these objects by checking the symbols in their indices. The RCBDC program can abstract element-numbering clauses and spatial-relation clauses - adjacency and penetration, and list these clauses in the database as indices for retrieval. In the conceptual level of the residential projects, adjacency and penetration are the most fundamental spatial relationships. Other spatial relationships will be explored in future research, visual access, pedestrian sequence, ventilation condition, day lighting conditions ... etc. The RCBDC program has a modular grid for inputting elements, so it can efficiently compute the spatial relationships of penetration and adjacency. In Figure 2.6, part of a residential project is automatically assigned indices by the number of elements, the implied adjacency relationships, and the defined penetration relationships, so these relationships can be used as indices for future retrieval. To speed up the process of retrieval, a systematic way to assign 19 indices is necessary, so the searching operation is directed to the right category, avoiding unnecessary searches in other areas. To search for a twobedroom apartment in the database, the system searches among the residential projects, and not among office building designs, or other categories. rectangle(300,84,324,108,'KI',1). rectangle(324,84,348,108,'CI',1). rectangle(300,108,348,156,'DR',1). door(336,84,348,84). door(324,96,324,108). door(324,108,348,108). numberof roomtype('KI',1). numberof roomtype('CI',1). numberof roomtype('DR',1). adjacency('Kl',1,'CI',1). adjacency('Kl',1 ,'DR',1). adjacency('CI', 1,'DR',1). penetrable('Kl',1,'CI',1). penetrable('Cl',1,'DR',1). 2.6 Part of a residential project can be analyzed into different groups of clauses, and these clauses will serve as indices for retrieving Retrieving means searching in the database, selecting the most relevant cases, and presenting them for consulting. The basic idea of retrieving design cases from case library is like searching a book through the computer system in a library. The different is that libraries have systematic way to label books, but the labeling a design case is not fully developed. By different design criteria and different ways of retrieving, we can retrieve different cases for consulting. Two kinds of retrieval methods, Critical Retrieval and General Retrieval, will be discussed in Chapter Five. Adapting means abstracting the knowledge from retrieved cases and applying it to the current project. To abstract the knowledge from design cases encounters the same problem as in assigning indices - there are too many possible perspectives, so backtracking from the goal to abstracting useful rules is also applicable in adapting - We must know our goal, then we can know which function we need, so we can abstract rules from these cases according to this function. Finally we can apply the abstracted rules to the 20 current project to achieve the designated goal ( The thesis concentrates on the retrieval issues. This part of applying design knowledge will be left for future research). Testing evaluates the appropriateness of spatial relationships before and after knowledge adapting. Testing before adapting avoids unnecessary operations, while testing after adapting can pick up mistakes and require designers to make changes. These mistakes includes improper numbering of elements - " there are four bathrooms in a two-bedroom apartment ", or improper spatial relationships - "oa kitchen is penetrable to a bedroom " or "the guestroom has visual access to the master bedroom". To explain is to present design projects and interact actively with users during the design process. Designers must know how CAD systems work these retrieval operations, so they can provide useful information when necessary. Designers also have to interrupt a inadequate operation. For the users to understand what and how the RCBDC program is doing at every step of retrieving process is essentially to the users. The knowledge representation of computer systems and human thinking is not the same, so computer systems have use certain format to communicate with users. The RCBDC program is programmed in Prolog, which has two categories in its database - lists and first-order calculus. To represent a two-bedroom, twobathroom apartment by using lists ([Apartment, BR, BR, BA, BA.......I ), each variable depicts a fact in the object. Another way to present the apartment is using first-order calculus - room(BR, 1), room(BR,2), room(BA,1), room(BA,2), which uses a predicate (room) to depict the general function of this object, and uses variable ( BR,BA,1,2....) to depict the content of this object. The RCBDC program uses first-order calculus as database, because it easily represents design knowledge, and is also easy to understand. The advantages offered by using the first-order calculus, the RCBDC program does not have to transfer clauses into other format, it just print out these clauses after each operation. 21 Another important step in the CBR flow chart is saving. CAD systems with CBR learn from past experience, so they must have sufficient cases in the case library for retrieving. During the saving process, a case should be systematically assigned labels, these labels then can be used as source of matching and retrieving in the future operation(Figure 2.6). Assigning labels does not necessarily have to be done before saving, labels can be created during the retrieving process. The process will save more space in memory, but spend much more time in retrieving, and will not be able to handle a large database. The discussion above introduces the six major steps in the Case-Based Reasoning operation, They are the most important steps in the RCBDC program proposed by this thesis. 2. 3 Representation in the RCBDC program In the early stages of development, CAD systems did well in dealing with the numerical calculation. CAD systems also deal with other kinds of representation, semantic, linguistic, logic... .etc. Lisp and Prolog were designed to meet this need. Representation concerns how to decode knowledge into a certain format, and how to encode the formatted knowledge into a computer system. Marvin Minsky's "frame theory" uses a series of frames to represent knowledge and proposes a fundamental theory for artificial intelligence applications [Minsky 74]. Prolog uses first-order predicate calculus to depict design elements and spatial relationships to represent design knowledge [Mitchell 90]. 22 According to how it is observed the same object, it usually has many different representations. Figure 2.7 shows a single rectangle and four different possible representations in first-order calculus. X-Distance (X1,YI) O(2,Y1) Y LI (X1,Y2) -Distance (X2Y2) by a single rectangle rule: by four lines: rectangle (X1,Y1,X2,Y2,Recl) line line line line by two L-shapes: (X1,Y1,X2,Y1,Linel) (X2,YlX2,Y2,Line2) (X2.Y2,X1,Y2,Line3) (X1,Y2,X1,Y1,Line4) by center and X, Y distance L-shape (X1,Y1,X2,Y1,X2,Y2,L-Shapel) L-shape (X2,Y2,X1,Y2,X1,Y1,L-Shape2) rectangle-center (X1,Y1,X-distance,Y-distance,Recl) 2. 7 Four representations for a single rectangle shape Figure 2.8 uses clauses of elements and clauses of spatial relationship to represent two adjacent rectangles. X-D D1 DI rectangle (X1,Y1,X2,Y2,Rec1) rectangle (X3,Y3,X4,Y4,Rec2) align-left-front-rulel (Recl,Rec2,D1) rectangle (X1,Y1,X2,Y2,Rec1) rectangle (X3,Y3,X4,Y4,Rec2) align-left-front-rule2 (Recl,Rec2,D2) 1, , | Y-D rectangle-center(Xl,Yl,X-distanceY-distance,Rec1), rectangle-center(X2,Y2,X-distance,Y-distance,Rec2), relation-center-rulel(Recl,Rec2,X-D,Y-D) 2. 8 Two adjacent rectangles can have different representation by clauses of elements and clauses of spatial relationship Clauses of elements alone, are enough to represent a set of shapes, but the clauses of relationships can be expressed depending on the viewpoint we are observing this shapes and this makes the shapes easier to retrieve by certain design criteria. Figure 2.9 represents a set of shapes in a twodimension drawing and associated labels to indicate their function, there are 23 also implied relationships of adjacency and penetration. The twodimensional drawing is the most familiar representation for designers. 2.9 A set of shapes represented by 2-D drawing In the RCBDC program, a room is represented by a rectangle with a roomtype-label designating its function, a door is a negative space in the wall, and a entrance indicated by a triangle mark. All the room and door elements are placed on a grid system to limit their arrangement possibilities. ( The RCBDC program concentrates on the retrieving issues, so it does not provide a complete set of spatial relationships outside the grid system ). First-order calculus is used to represent these shape elements (figure 2.10). - 0- rectangle(288,72,336,120,'BR',1). rectangle(336,60,384,144,'LI',1). rectangle(288,120,336,144,'SO',1). rectangle(288,144,336,168,'BA',1). rectangle(336,144,360,168,'CI',1). rectangle(360,144,384,168,'KI',1). door(336,108,336,120). door(300,120,312,120). door(300,144,312,144). door(336,144,336,156). door(360,144,360,156). door(336,168,348,168). door(336,144,360,144). entrance(345,189,337,189,341,177). 2.10 Use elements and first-order calculus to represent a set of shapes For two rectangles, their spatial relationships can be distinguished into "separation", "connection", "inside-seperation", "inside-connection", and "overlap" [Wang 86]. The RCBDC program uses a grid system for inputting, and forbids overlapping to avoid spatial ambiguity. "Insideseperation", "inside-connection", and "overlap" are different overlapping 24 conditions, so they are not allowed in the RCBDC program. In the residential designs, shape elements are arranged compactly to reduce construction cost and enhance easy access between elements. Therefore, "connection" becomes the most important spatial relationship. The terms used in the RCBDC program for "connection" are "adjacency" and "penetration". "Adjacency" concerns the connection of physical elements, and "Penetration" concerns the pedestrian access between elements. In the RCBDC program, The adjacency relationship indicates that two not-overlapping rooms share the same wall ( Not including those that are joint at one point ), and the penetration relationship indicates that two rectangle have an adjacency relationship, and a door is in their common wall (figure 2.11). - IEM I Imt-----------i. EI I =E- ne I - M E Uo - E- - EH E5I EIm - moEE- MM * 3n -M Penetration Relation Adjacency Relation 2.11 Adjacency relationship and penetration relationship defined by the RCBDC program In different stages of design, designers may retrieve cases according to different criteria. These criteria could include the numbering of elements, the adjacency relationship, or the penetration relationship. If the current criteria is to consult projects with four bedrooms, then we have to pay attention to the numbering of elements, and retrieve all the four-bedroom apartment cases. If the current criteria is to retrieve cases with kitchen adjacent to living-room, then we have to switch to the adjacency 25 relationship. The residential project in figure 2.9 can also be represented by clauses of numbering of elements, clauses of adjacency, and clauses of penetration relationship( Figure 2.12). I I I r numberof roomtype('BR',1). penetrableQBR',1,'LI',1). number_of-roomtype('LI',1). penetrable('BR',1,'SO',1). number_ofroomtype('SO',1).penetrabe('LI',1,'CI,1). numberofroomtype('A',1). penetrable('SO',1,'BA',1). ~~number-of-roomtype('CA,) number of roomtypeCcl,1). penetrable('BA',1,'CI',1). Z-17-1 1). penetrable('C',1,'KI',1). number-of-roomtype(KI', 11 adjacency('BR,1,'LI',1). adjacency(BRY1,SO',1). adjacency('LI',1,'SO',1). adjacencyfLl',1,'CI,1). daec(L'1'I',1). adjacency(SO',1,'BA',1). adjacencyCBA',1,'CI',1). adjacency('CI',1,'KI',1). 2.12 A residential project (Figure 3.76) can be represented separately by numbering of elements, penetrable relationship and adjacency relationship The RCBDC program implements the functions for abstracting the numbering of elements clauses and the spatial relationship clauses, ( Figure 2.10 and Figure 2.12) and saves them along with the case in the database. These clauses in the database will serve as labels for matching, so in the retrieving process, the system does not have to abstract these rules again. The clauses really enhance the efficiency of retrieval process. 2.4 Script in the RCBDC program Section 2.3 demonstrated that a residential spatial relationships can be saved into database first-order calculus. Actually, spatial relationships stand for just part of the design knowledge. Additional design knowledge might be better represented by other kinds of representation. Text is a good media to express design knowledge. Text labels have been used to depict architectural elements for a long time. They are also one of the most important media to represent a design 26 projects. In some situations, text is even more important than twodimensional drawing to describe architecture. In the RCBDC program, the text that is used to describe a case is called " script". Script supplements the information provided by first-order calculus, and depicts a project by describing its history, environment.... which can not be easily expressed by the first-order calculus (Figure 2.13). Script can also be used as labels for matching in the retrieving process. The CYCLOP program [Navinchandra 87] used scripts as source of matching and retrieving. Sg i gAt the west wing of building, with an excellent view to the Charles River from the livingroom and master bedroom. In the afternoon, the noise from highway traffic can not be avoided 2.13 Scripts in cases can provide extra information and serve as labels in retrieving process Some libraries have implemented advanced searching systems. After the users input a few key words, the systems will search these key words in those books' titles and abstracts in the computer database, and report the matched books. The current searching systems in CBR systems or in libraries use spelling of words as source of matching and retrieving. A more advanced text-retrieving system depends on the development of semantic analysis, so the systems can really "read" the context of the scripts and search for the right meaning in cases, not just looking for correct spelling. Current RCBDC program have scripts associated with each case in the database, so when users retrieve a case, these scripts will show up at the same time. The text-retrieving function in current RCBDC program is not implemented yet, and will be left to future research. 27 Chapter Three Matching and Retrieving Architecture of Matching 3.1 Matching is the the process of calculating relevance between the current project and cases in the case library. The RCBDC program can abstract the clauses from the current project according to the criteria assigned by the designer, and calculate how many of these clauses can be found in compared cases. Figure 3.1 presents a design project, in which the user sets penetration as the retrieval criteria. The RCBDC program then abstracts and lists the clauses of penetration in the current project. In the matching process, C CURRENT PROJECT penetrable penetrable penetrable BR 1 BA 1 BR 1 SO 1 BR 1 C 1 RETRIEVED CASE penetrable penetrable penetrable penetrable penetrable penetrable penetrable penetrable penetrable BR 1 BL 1 BR 1 SO 1 BR 1 BA 1 BR 1 C1 2 BR 2 CI 2 LI 1 CI LI 1 CI 2 KI Ca BA 2 Cp 3.1 A example of exactly matched 28 MATCHED penetrable penetrable penetrable BR 1 BA 1 BR 1 SO 1 BR 1 CI 2 the RCBDC program analyzes the clauses of penetration of cases in the case library, and find all the matched clauses. In this matching operation(figure 3.1) the number of penetration clauses in the current project is three, and the number of matched clauses is also three, so the compared case is an exact-matched case. Usually, not all clauses in the current project can be exactly matched to a case in the case library. In that condition the RCBDC program picks out those clauses that are matched to the compared case. In Figure 3.2, there are five penetrable clauses in the current project, but only three of them can be matched to the compared case, so the match number in this operation is three. To calculate the actual number of matched clauses among the repeated elements, the ordinal numbers in clauses, like "1" in penetrable(LI,1,BA,1), should be rearranged through permutation. The details of permutation will be discussed in Section 3.4. I A BA RA L K D MATCHED RETRIEVED CASE CURRENT PROJECT LI LI LI LI BR I B penetrable penetrable penetrable penetrable penetrable A 1 BR 1 1 KI I 1 DR 1 1 BA 2 1 BA 1 penetrable penetrable penetrable penetrable penetrable penetrable penetrable penetrable penetrable penetrable penetrable penetrable 1 C11 2 BA 1 2 SO 1 2 C1 1 1 DR 1 KI 1 LI DR 1 LI BA 2 C1 2 CI 1 2 C12 CI 3 BR BR BR BR KI CL3 LI LI I BL 1 3.2 Partly matched case, 3 out 5 clauses are matched 29 penetrable penetrable penetrable LI KI 1 LI 1 DR 1 BR 2 BA 1 1 This section introduces the method of calculating the number of matched clauses in one case, then explains the process of matching and retrieval with all the cases. The RCBDC program can abstract clauses from a current project according to the design criteria, and compare the current projects to all the cases in the case library. It lists all the retrieved cases in the sequence of relevance, and retrieves the most relevant cases for consulting. Case Library sequence of project for retrieving Matched Number Case 4 4 L~L) r Case 1 3 Case 2 3 casG2 Gs1 GD Matched Number 5 Case 3 2 Case 5 2 9 Case 6 3.3 The operation of matching and retrieving cases in case library, and the selected cases are listed from the case with the highest match number to the case with the lowest match number In Figure 3.3, the program calculates the matched number of each case in the case library, and lists those cases from the highest number of matched clauses to the lowest, so the user can retrieve the most relevant case for consulting. If the first retrieved case is not suitable to solve the current 30 Retrieve First problem, the user can retrieve the second, the third.... The user can also choose another design criteria to retrieve other cases for consulting. 3.2 Matching by Elements Matching by elements involves selecting an element, and retrieving a case that has this element. For example, a user designing a residence with a study room, might wish to retrieve cases that have study. In the RCBDC program, we can use "roomtype" under "Critical Retrieving" to select an element, and retrieve those cases that have this element. The following is the process of retrieving all the cases with a study in the RCBDC program: 1. First, design a project with a bedroom, a study, and a circulation space. Click on roomtype under Critical Retrieval. A dialog box will show up and ask you to select a roomtype by selecting an element. - U - --- - Please choose the roomtype B - t-- ( ok ) mu --- 2. Click on "SD", which represents a study. The RCBDC program will use it as the criteria for retrieval. You had selected SD Now start Retrieulng B ok s.- 31 3. The program retrieves a case with a study and informs you that Database2, Database 6, and Database 8 each has a study. RETRIEVED CASE SELECTED CASES database2 database6 database8 3.4 Retrieving cases with a study as criteria When a user selects a study as the criteria for retrieval, the system puts the clause number_ofroomtype(SD,1) into temporary memory and starts to search in the database. While reviewing the case Database2, the system finds the same clause numberofroomtype(SD,1), so it puts Database2 into the selected cases for retrieval(Figure 3.5). In this way, the system continues to find that Database6 and Database8 also have the same clause numberof-roomtype(SD,1) in their database, so it also puts these two cases into the cases selected for retrieval. 32 B__ S R Select study room -P- numberofroomtype(BR,1) numberofroomtype(CI,1) numberofroomtype(SD,1) Match study room in a case numberofjoomtype(BA,2) numberofroomtype(BR,) numberofjoomtype(Cl) number of roomtype(DRA) number-of-roomtype(KI,1) number ofjroomtype(SD,1) numberofroomtype(SO,1) 3.5 The process of selecting, searching, and matching for a study Since we can retrieve cases by the selected roomtype, we can also add one more criteria to this system- the closest number of roomtype. For example, when we try to design a four-bedroom apartment, we will try to find existing apartments with four bedrooms for consulting. If we can not find any four-bedroom apartment, then we will try to find some threebedroom apartments or five-bedroom apartments, because their design may be similar to a four-bedroom apartment. In Figure 3.5, to add this criteria of "closest number" to the system, we include both the study "SD" in the clause number_o froomtype(SD,1) and the number "1". The RCBDC program will calculate which case has "SD", and has the closest number to "1". 3.3 Matching by Spatial Relationships Matching by spatial relationships involves retrieving cases that have the highest number of spatial relationships matching the current project. 33 Spatial relationships can be abstracted in different ways, like adjacency relationship, penetration relationship, visual access... .etc. Abstracting spatial relationships in CAD systems begins by computing the location values between each element. Figure 3.6 demonstrates the process of abstracting the adjacency relationships among a set of elements. rectangle(312,96,372,132,'BR',1). rectangle(312,96,372,132,'BR',1). rectangle(348,132,372,192,'CI',1). rectangle(348,132,372,192,'CI',1). rectangle(372,168,408,204,'SD',1). rectangle(372,168,408,204,'SD',1). rectangle(372,96,396,120,'BA',1). rectangle(372,96,396,120,'BA',1). 1I rectangle(312,96,372,132,'BR',1). rectangle(348,132,372,192,'CI',1). rectangle(372,168,408,204,'SD',1). rectangle(372,96,396,120,'BA',1). adjacency('BR',1,'CI',1). adjacency('BR',1,BA',1). adjacency ('CI',1,'SD',1). 3.6 Process of abstracting adjacency relationships To abstract the adjacency and penetration relationships from design projects, we need to compute between pairs of rectangular elements. In the RCBDC program, "adjacency" means two rooms have common wall, and are not overlapped. "Penetration" means that two rooms have an adjacency relationship, and there is at least a door in their common wall. Figure 3.7 shows the process of abstracting penetration relationships. 34 rectangle(312,96,372,132,'BR',1). rectangle(348,132,372,192,'CI',l). rectangle(372,168,408,204,'SD',1). rectangle(372,96,396,120,'BA',1). door(372,108,372,120). door(360,132,372,132). door(372,168,372,180). M penetrable(BR','CI'). penetrable(BR','BA'). penetrable(CI',SD). rectangle(312,96,372,132,'BR',1). rectangle(312,96,372,132,'BR',1). rectangle(348,13Z372,192,'CI',). rectangle(348,132,372,192,'CI',1). rectangle(372,168,408,204,'SD',1). rectangle(372,168,408,204,'SD',1). rectangle(372,96,396,120,'BA',1). rectangle(372,96,396,120,'BA',1). door(372,108,372,120). door(360,132,372,132). 3.7 Process of abstracting penetration relationships Automatic backtracking is one important feature of the Prolog language, so it provides an effective way to abstract the penetration relationship. One rectangle element is selected to check for the penetration relationship, Prolog searches for other rectangles correctly relate with a door between them- to fulfill a penetration relationship. If this rectangle does not have a penetration relationship with any other rectangle, Prolog returns a "fail" signal to the system. After abstracting the spatial relation rules in the current project, the RCBDC program can start searching and matching. In the case library, every case is saved with its spatial relationships, so the system does not have to abstract them again. The matching process in the RCBDC program searches for exact-matched spatial-relationship clauses by using the permutation operation, which will be discussed in Section 3.4. In Figure 3.8, three penetration clauses are matched to the clauses in the database of a compared case. 35 A 81 I- penetrable BR 1 CI 1 penetrable BR 1 BA 1 penetrable CI 1 SD 1 penetrable penetrable penetrable penetrable penetrable penetrable penetrable penetrable penetrable penetrable penetrable penetrable penetrable penetrable penetrable penetrable F] BR 1 BA BR 1 SO BR 1 CI SD 1 CI RcI LIlI DR 1 LI LI 1 CI DR 1 U LI 1 CI BR 2 CI BA 2 CI SO 2 CI BA 3 CI SO 3 CI CI 1 CI CI 2 CI U I-U 1 1 2 2 E r penetrable CI 2 SD 1 penetrable BR 1 BA 1 penetrable BR I CI 2 1 1 1 1 1 2 2 1 1 3 3 3.8 Process of Matching Penetration Relationships In addition to matching by penetration, the RCBDC program can also retrieve cases using the criteria of adjacency. Retrieval by "adjacency" is similar to retrieval by penetration, with different designated spatial relationship clauses. 3.4 Detail of Permutation in Matching Permutation in matching is an operation to search for the highest matched number in the clauses of spatial relationship. In a two-dimensional drawing designers have the ability to find out the matched spatial relationships by visual inspection. On the other hand, the internal representation of spaces in RCBDC program is based on concentrating identifying numbers with space types, if their numbers are not the same in these clauses, then they can not be matched by computers during the 36 matching process (figure 3.9). To calculate the genuine match number, we have to rearrange the ordinal numbers in clauses by permutation and find the highest matched number. IB I I penetrable(BR, 2, SO, =\= penetrable(BR, 2, BA, 1). \ penetrable(BR, 1, BA, 1). penetrable(BR, 3, SO, 1). = ,enetrable(BR, 3, SD, 1). penetrable(BR, 1, BA, 1). penetrable(BR, 2, SO, 1). penetrable(BR, 3, SD, 1). penetrable(BR, 1, SD, 1). penetrable(BR, 2, BA, 1). penetrable(BR, 3, SO, 1). 1). penetrable(BR, 1, SD, 1). Computers Designers 3.9 In a two-dimensional drawing, designers can find matching by visual inspection,. Computers can not do this, because the ordinal numbers are not the same. For the case in figure 3.9, there are 3! = 6 possible of permutations of bedrooms. The original bedrooms' ordinal number (1, 2, 3) will be changed to ( 1, 2, 3 ), ( 1, 3, 2 ), ( 2, 1, 3 ), ( 2, 3, 1 ), ( 3, 1, 2 ), ( 3, 2, 1), and these six permutations are used to calculate the number of matched clauses (Figure 3.10). For a design project that has many repeated elements, the permutation number will be enormous - to compare a four-bedroom, three-bathroom project with another four-bedroom, three-bathroom case, the number of permutation will be 4! * 3! = 144. For designers, it is very difficult to compare all these permeations visually, for computers, it is a time-consuming operation. 37 Permutation for New Clauses ordinal numbers in after Permutation Bedroom, "BR" Clauses in case Matched Number ( 1,2, 3) penetrable(BR, 1, BA, 1). penetrable(BR, 2, SO, 1). penetrable(BR, 3, SD, 1). penetrable(BR, 1, SD, 1). penetrable(BR, 2, BA, 1). penetrable(BR, 3, SO, 1). (1,3,2) penetrable(BR, 1, BA, 1). penetrable(BR, 3, SO, 1). penetrable(BR, 2, SD, 1). penetrable(BR, penetrable(BR, penetrable(BR, SD, 1). BA, 1). so, 1). (2,1,3) penetrable(BR, 2, BA, 1). penetrable(BR, 1, so, 1). penetrable(BR, 3, SD, 1). penetrable(BR, penetrable(BR, penetrable(BR, SD, 1). BA, 1). so, 1). penetrable(BR, (2 3 1) penetrable(BR, 2, BA, 1). penetrable(BR, 3, SO, 1). penetrable(BR, 1 , SD, 1). penetrable(BR, SD, 1). BA, 1). SO, 1). (3,1,2) penetrable(BR, 3, BA, 1). penetrable(BR, 1, SO, 1). penetrable(BR, 2, SD, 1). penetrable(BR, penetrable(BR, penetrable(BR, SD, 1). BA, 1). SO, 1). (3,2,1) penetrable(BR, 3, BA, 1). penetrable(BR, 2, SO, 1). penetrable(BR, 1, SD, 1). penetrable(BR, 1, SD, 1). penetrable(BR, 2, BA, 1). penetrable(BR, 3, SO, 1). penetrable(BR, 3.10 Calculating six permutation sand their matched number s In addition to permutation, there are other ways to solve the problem of finding similar spatial relationships. For example, the system can choose the most critical elements in both projects and start to match them first, then go on to match other less important elements. This type of matching is similar to designers' visual inspection, and is a less time-consuming operation, but an evaluation system must determine the ranked importance of elements before this matching operation. 38 Chapter Four Testing 4.1 Testing Critical Retrieval Critical Retrieval in the RCBDC program is the retrieval of cases by a single design criteria. This single design criteria could be expressed by a number-of-element clause, such as numberofroomtype(BR,2), or a spatial relationship clause, such as adjacency(BR,1,BA,2). In each critical retrieval operation, designers first designate a roomtype or a spatial relationship as the criteria. After the first retrieval operation, designers can select another design criteria, and the system chooses from the first set of cases that meet the additional criteria. As designers add more criteria, the retrieved cases become fewer, and designers can focus on the final retrieved cases. In real world design situations, critical retrieval problems happen all the time. For example, in a residential design project, the clients might propose several requests for his/her own house, like "with storage space","two bedrooms", and "livingroom next to balcony". Clients usually ask an architect to achieve a variety of separate goals. In the RCBDC program, we can use these three goals as three design criteria in the critical retrieval activity. We first retrieve those cases with storage space, then filter these retrieved cases again by selecting cases with two bedrooms. Finally, we add the last criteria "livingroom is penetrable to balcony" and retrieve these cases that fulfill these three criteria. In the RCBDC program, "roomtype", "number & roomtype", "adjacency", and "penetration" are four kinds of commands for critical retrieval. The "roomtype" command retrieves cases that have a designated 39 roomtype. "Number & roomtype" retrieves cases that have the same number of a designated roomtype as in the current case. "Adjacency" retrieves cases by designated adjacency relationships, and "penetration" retrieves cases by designated penetration relationships (A7 in figure 2.1). The following demonstration (Step 1 to Step 13) outlines the process of selecting cases that meet the three design criteria of "with storage space", "two bedrooms", and "livingroom is penetrable to balcony" in the RCBDC program. Step 1. Design a concept project which fulfills the three design criteria with storage space ", " two bedrooms ", and " livingroom is penetrable to balcony " (figure 4.1). B R IS B 4.1 Step 1, Inputting a concept project with a storage space, two bedrooms, and a livingroom which is penetrable to a balcony Step 2. Use the "storage space" as the first critical retrieval criteria. Click on the "Roomtype" button under "Critical Retrieval", The system will ask you to select the designated element. CR ITIC AL RETR IEV AL Please choose the roomtype PENETR ATION R00MTYP NUMBER & ADJACENCY RO0MTYPE CRITICAL RESTART [ ok 4.2 Step 2, Clicking on "Roomtype "under " Critical Retrieval to activate the critical retrieval process 40 Step 3. Return to the project, and click on the storage space element to select his as the retrieval criteria. II B You had selected SO Now start Retrieuing IIIQRl ok ) 4.3 Step 3. Clicking on the storage element to select it as the retrieval criteria in "Roomtype" retrieving function Step 4. The system retrieves the case Database2 that fulfills this criteria, and informs you that Database2, Database3, Database4, Database5, Database6, Database7, Database8 also meet this criteria. RETRIEVED CASE CURRENT PROJECT SELECTED CASES RETRI EYED CRITERIA database2 database3 database4 database6 databas*6 database7 database8 Roomtype SO At East Building, Cornor appartment Very Beautiful view to the Charles 4.4 Step 4. After the first retrieving process, the system retrieves the case Database2. There are seven cases that meet this criteria. 41 Step 5. Use the "Next" or "Previous" commands to view the other selected cases. All of these selected cases have storage space, although the number of storage spaces may differ. RETRIEVED CASE RETRIEVED CASE RETRIEVED CASE L A IA Database 4 Database 3 Database 5 RETRIEVED CASE RETRIEVED CASE RETRIEVED CASE L... Database 6 Database 8 Database 7 4.5 Use " Next "or " Previous " to view these selected cases. Including Database2, these seven cases all have storage space to fulfill the first retrieval criteria. Step 6. Add another criteria " two bedrooms" for retrieval, by clicking on "Number & Roomtype". CRITICAL RETR IEV AL PENErRATI Please choose the roomtype RO0MTYPE NUMBER&I ADJACENCY ROOMTYPE CRITICAL RESTART ok _ _ _ _ _ _ _ _ _ 4.6 Step 6. Clicking on "Number & Roomtype" again to start 42 _ _ _ another critical retrieving process for the criteria "two bedrooms". Step 7. Click on a bedroom. The system will calculate the number bedrooms, and retrieve all the cases that have the exact number of this roomtype from among the cases that met the first retrieved criteria. Now You are Retrieue 2 BR II - - - ok 4.7 Step 7. Click on a bedroom, and the system will recognize that there are two bedrooms in this project, and use "two bedrooms" as retrieval criteria. Step 8. The system retrieves the case Database4, and informs you that five cases fulfill both design criteria- " with storage space " and " two bedrooms". In figure 4.8, the criteria are listed under the left grid board, and the selected cases are listed under the right grid board. RETRIEVED CASE CURRENT PROJECT W AA I RETRIEVED CRITERIA SELECTED CASES Roo r Rtpe SO Number & Roomtyjpe 2 BR database4 database5 database6 database? databas*s K At West Building, Cornor apartment Veroc Beautiful view A the Charles 4.8 Step 8. After second retrieving process, five cases meet both criteria. 43 Step 9. Use " Next" and" Previous" to view those cases that meet both criteria (figure 4.9). RETRIEVED CASE RETRIEVED CASE Database 5 Database 6 RETRIEVED CASE RETRIEVED CASE Database 8 Database 7 4.9 Step 9. After second retrieving process, including Database4, five cases met both criteria and are selected. Step 10. Use the third criteria "livingroom penetrable to balcony" to continue the retrieval process. Click on the "Penetration" command under "Critical Retrieval", The system will ask you to choose the first room in the penetration relationship. CRITICAL RETRIEVAL /I FENETRtATIONI ROOMTYPEJ Please choose first room ADJACENCY ROOMTYPE ok CRITICAL RESTART 4.10. Step 10. Click on "Penetration" to start the critical retrieving process by the penetration relation.ships Step 11. Click on the livingroom, the system will ask you to choose another element ( figure 4.11 ). 44 S IR Please choose second room ) (Zok 4.11. Step 11. Click on livingroom to choose it as first element in the penetrable relationship. Step 12. Choose the second room, balcony. The system will test the penetration relationship first, and go on to retrieve among the selected bases( Database4, Database 5, Database6, Database7, and Database8 ) by the criteria " livingroom is penetrable to balcony ". If the two elements you choose do not have a penetration relationship, the system will ask you to choose again. Yes, they are penetrable ( ok 4.12. Step 12. Clicking on balcony to choose it as the second element in the penetration relationship, and the system will recognize their penetration relationship, and start to retrieve cases according to this criteria. Step 13. The system retrieves the case Databse5. Only Database5 fulfills all three criteria " two bedrooms", "two bathrooms", and " livingroom is penetrable to balcony". The three retrieval criteria and selected cases are listed under the grid boards (figure 4.13). 45 RETRIEVED CASE CURRENT PRQJECT RI II HAI A - -B~ -- I I- RETRIEVED CRITERIA SELECTED CASES Roomtype SO Number & Roomtype 2 BR Adjacency LI BL database5 I I I 4. 13. Step 13.Only the case "database 5" fulfill those three criteria and is retrieved for consulting. In the first retrieval process, seven cases fulfilled the design criteria with storage space", and were all selected. In the second retrieval process based on the criteria" two bedrooms ", five cases among these seven cases met both criteria. In the third and final retrieval process for the criteria "livingroom penetrable to balcony ", only one case fulfilled these three criteria and was retrieved. 4.2 Testing General Retrieval The General Retrieval in the RCBDC program retrieves cases by several spatial relationship clauses. These clauses are abstracted from the current project based on the assigned design criteria. In the process of General Retrieval, designers designate a design criteria, the system abstracts the related clauses from the current project based on this criteria, and searches the case library to find cases that have the highest number of matched clauses. The system then retrieves these cases. 46 The operation of General Retrieval is similar to searching activity in real world design practice. During the design process, designers usually retrieve cases that have similar spatial relationships to the current project, so they can learn from these cases. General Retrieval in RCBDC program can help designers to retrieve these such cases. The following process explains how the program retrieves cases by General Retrieval. Step 1. Draw part of a residential project as an example. This example has two bedrooms, a storage space, a bathroom, and a circulation space ( figure 4.14). I Io I ImIe -- I I I mea mun - -B - Iu BIRan 4.14 Step 1. Designing part of a residential project to test General Retrieving Step 2. Click on "Penetration" under " General Retrieval" to activate the retrieval process by penetration relationships. The system abstracts penetration clauses from the current project (figure 4.15), searches the database and retrieves cases with the highest number of matched clauses. 47 "ROOM TYPE #ADJACENT ~ B Penetrable CI BR 1 A I Penetrable CI BR 2 1 1 Penetrable BR 2 Penetrable BR 2 SO 1 BA 1 4.15 After clicking on "Penetration", the system will abstract those penetration clauses with ordinal number from the current project. Step 3. After the system has finished searching in the case library, it will inform you that the four spatial relationship clauses in the current project have found a total match in the case Database4 ( figure 4.16). Emact match, 4 Penetrable Relation is Matched Now you are retrieving "database4" ok ) ( ok 4.16 Step 3. The RCBDC program returns the result of matching. Step 4. The RCBDC program retrieves the Database4, and lists the clauses of penetration relationships. (Figure 4.17). The element CI 1 in the current project is matched to the element CI 2 in the case Database4, and the element BR 2 in the current project is also matched to the element BR 1 in Database4. 48 RETRIEVED CASE CURRENT PROJECT B AAA- - B CURRENT PROJECT MATCHED penetrable penetrable penetrable penetrable penetrable penetrable penetrable penetrable CI CI BR BR 1 BR 1 1 BR 2 2 SO 1 2 BA 1 RETRIEVED CASE BR 1 BA 1 BR 1 SO 1 CI 2 BR 1 C1 2 BR 2 penetrable penetrable penetrable penetrable penetrable penetrable penetrable penetrable penetrable BR BR BR BR BR LI Ll KI BA 1 BL 1 1 SO 1 1 BA 1 1 CI 2 2 CI 2 1 C1 1 I CI 2 1 CI 1 2 C1 1 At West Building, Cornor appartment Very Beautiful view to the Charles 4.17 Step 4. The RCBDC program retrieve the case Database4 and lists the clauses in the current project, in the compared case, and their matched clauses. In figure 4.17, The repeated elements "BR", "BA", and "CI" are calculated through permutation. There are two bedrooms in the current project and two bedrooms in the compared case, the bedrooms' ordinal numbers (BR,1, BR,2) in the penetration clauses are replaced by the permutation (BR,1, BR,2) first and (BR,2, BR,1) second. The total number of possible permutations will be 2! (BR) * 2! (BA) * 2! (CI) = 8 eight. After calculating all possible permutations, the system changes the original ordinal number (BR,1,BR2), (BA,1), and (CI,1) to (BR2,BR1), (BA,1),(CI,2), to calculate the highest match number (figure4.18). 49 Match Number New Clauses penetrable penetrable CI(1) penetrable penetrable CI CI BR BR 1 1 2 2 BR 1 BR 2 SO 1 BA 1 penetrable penetrable penetrable penetrable CI CI BR BR 2 2 2 2 BR BR SO BA ( (BA,1) BR 1 BR 2 penetrable CI penetrable CI penetrable BR penetrableBR (CI(1 (BA,2) penetrable penetrable penetrable penetrable Original : (BR,1,BR,2) (BA,1,BA,2) CI(1) (BR,2,BR,1 (BA,2) BA 2 CI CI BR BR 2 2 2 2 BR 1 BR 2 SO 1 BA 2 penetrable CI(1) penetrable penetrable penetrable CI CI BR BR 1 1 1 1 BR 2 BR 1 SO 1 BA 1 penetrable penetrable penetrable penetrable CI CI BR BR 2 2 1 1 BR BR SO BA penetrable penetrable penetrable penetrable CI CI BR BR 1 1 1 1 BR 2 BR 1 SO 1 BA 2 penetrable CI(2) penetrable penetrable penetrable CI CI BR BR 2 2 1 1 BR 2 BR 1 SO 1 BA 2 CI(2) CI(1) (B~l) SO 1 penetrable penetrable CI(2) penetrable penetrable K (BA,2) 1 2 1 1 2 1 1 1 Highest Number (BR,2,BR,1) (BA,1) (CI,2) 4.18 Calculating the highest match number through permutation. Step 5. In this retrieval operation, cases Database4 and Database5 have similar penetration relationships (Figure 4.19). 50 RETRIEVED CASE RETRIEVED CASE -- I.-------- m BL.. i L r.. -Eu ~ .L Database 5 Database 4 4.19 Step 5. Database4 and Database5 have the right penetration relationships and had been selected. The current project ( figure 4.14 ) is part of a residential project, and it has only four penetration relationships in it. In a more complicated current project, there will be more penetration clauses, and it will be difficult to find a totally matched case for retrieving. Under this condition, the RCBDC program will retrieve the cases with the highest number of matched clauses instead. The following process will demonstrate a more complicated case of General Retrieval. Step 1. Design a residential project which is more complicated than the last case (figure 4.20). Click on "Penetrable" to retrieve cases by penetration relationships, the system abstracts these clauses of penetration with ordinal numbers from the current project, and searches the case library. 51 Penetrable KI 1 Penetrable CI 1 Penetrable SO 1 r HPenetrable BA 1 Penetrable BR 1 Penetrable BR 2 Penetrable BA 2 Penetrable SO 2 ,A R CI DR BR BR DR DR DR DR 1 1 1 1 1 1 1 1 4.20. The RCBDC program abstract penetration relationships from the current project. Step 2. There are eight clauses in the current project. The RCBDC program can not find a case that has the same eight clauses, so it retrieves the case with the highest number of matched clauses. The highest number of matching in this retrieving operation is six. The system reports this result and retrieves the case Database2 (figure 4.21). Now you are retrieuing "database2" Not exact match, 6 out of 8 Penetrable Is Matched ok j [ ok ) 4.21 The RCBDC program find out the highest number of matched clauses is six, and retrieve the case Database2 for consulting. Step 3. In figure 2.2, the RCBDC program has retrieved Database2, and lists the penetration clauses. In this retrieval process, only Database2 has the most similar penetration relationship with the current project, so it is the only one to be retrieved. 52 RETRIEVED CASE CURRENT PROJECT EMM -- MEu t - - WO -E - A I u...--M SMMMMIMIMIMIML p _ _ EMMbH Eu.E CURRENT PROJECT penetrable penetrable penetrable penetrable penetrable penetrable penetrable penetrable I C1 1 DR 1 BR BR DR DR DR DR _ RETRIEVED CASE MATCHED penetrable penetrable penetrable penetrable penetrable penetrable KI CI SO BA BR BA 1 CI 1 1 DR 1 1 BR 1 'A BR 1 DR 1 1 DR penetrable penetrable penetrable penetrable penetrable penetrable penetrable KI CI BA BR BR BR DR 1 CI 1 1 DR 1 1 DR 1 SO 1 1 BA 1 DR 1 1 SD 1 At East Building, Cornor appartment Very Beautiful Yiew to the Charles 4.22 In this operation, the case Database2 is retrieved, and the highest number of matched clauses is six. 53 Chapter Five Conclusion 5.1 Evaluation of Critical Retrieval Critical Retrieval in the RCBDC program retrieves cases by a single design criteria at a time. After the first retrieval operation, designers can add another design criteria to retrieve cases among selected cases. As designers add more and more design criteria, the selected cases will become fewer and fewer. Designers can focus on the final selected cases. The advantages of Critical Retrieval in RCBDC program are: 1. If we see design as a goal-achieving activity, then fulfilling a design criteria is like achieving a goal. The operation of Critical Retrieval in RCBDC program is similar to design practice in the real world. For designers, achieving several goals at the same time is the essence of design operation. Critical Retrieval can retrieve cases that have achieved these goals for consultation. The previous section demonstrates the retrieval of a case that fulfills three design criteria (or three design goals ). 2. Critical Retrieval in the RCBDC program provides very clear explanations after each operation. Designers can understand which design criteria they have used, and which cases were selected during the retrieval operation. 3. The RCBDC program allows designers to use a programing-bydrawing approach to input design criteria, which is convenient to most 54 designers. Designers usually like to work in the two-dimensional drawing environment rather than using number and text in computer language. Programming-by-drawing reduces the risk of incorrect interpretation of design problems from two-dimensional design to computer language. The disadvantages of Critical Retrieval in RCBDC program are: 1. Critical Retrieval in RCBDC program treats all the design criteria as equally important, and does not rank them. In the real world, not all design goals are absolutely necessary. A mean of ranking design criteria is an important aspect of future development. 2. Programming-by-drawing is a better approach for designers to input data. However, if designers need to use design criteria that does not exist in the current project, they will encounter problems. In real world design practice, designers like to observe cases that have design criteria missing from their current projects. So the RCBDC program should provide other types of input, not just programming-by-drawing from the current project. 5.2 Evaluation of General Retrieval General Retrieval in the RCBDC program abstracts the clauses of spatial relationships from the current project according to designated criteria, searches case library to find cases that have the highest number of matched clauses, calculates every possible permutation among repeated elements, and retrieves cases for consulting. The advantages of General Retrieval in the RCBDC program are: 55 1. Retrieving useful cases outside the computer system, designers usually have to spend much time searching among different sources, drawings, books, and magazines. Retrieving useful cases inside the computer system, designers still have to spend time opening, checking, and quitting these files. Retrieving cases for consulting is always a timeconsuming activity. General Retrieval can enhance the efficiency by searching similar cases in the case library before opening these files, and retrieves only similar cases for consulting. 2. The General Retrieval in the RCBDC program also provides a very clear explanation after each operation. It lists spatial relationship clauses according to the design criteria in the current project, in the compared case, and in both of them, so that designers can clearly understand which clause is matched in the retrieval process. 3. The General Retrieval in the RCBDC program retrieves cases by calculating every possible permutation. Designers have a limited ability to check spatial relationships visually. When the number of repeated elements becomes too large, the possible permutations will be too difficult for designers to find all spatial relationships. The General Retrieval helps designers solve this problem. The disadvantages of General Retrieval in the RCBDC program are: 1. At this point the RCBDC program lacks an efficient hierarchical system to organize all the elements. The number of possible permutations will be enormous when the number of repeated elements become too large. An efficient hierarchical system can make all the elements in a design project more organized, make this design project easier to understand, save more time in calculating permutation, and enable the system to deal with more delicate design knowledge. 56 2. Due to insufficient editing tools ( the program can just draw rectangles to indicate rooms ), and the lack of a proper hierarchical system to organize these elements. The RCBDC program can not always infer sets of clauses from the drawing exactly as the designers intends. In figure 5.1, the designer intended to put two bedrooms penetrable to the same circulation space, but the RCBDC program treats this circulation space as two separate circulation spaces. I- I3In1B -Eu~mmm U.....E F---Mmm~normIemI 5.1 The Designers intent to put these two bedrooms penetrable to the same circulation space, but the RCBDC program treat it as two separated circulation space The RCBDC program also can not express spatial ambiguity. In figure 5.2, the livingroom "LI" serves as both livingroom and major circulation space, but the system can not recognize these overlapped functions. 5.2 The livingroom works at both livingroom and circulation space, but the RCBDC program can not recognize it. 57 5.3 Conclusion For a computer aided design system with case-based reasoning, the RCBDC program has partial success with a few goals. These goals include inputting shape elements, saving cases into a case library, assigning labels for indexing, and providing several ways of matching and retrieving. Two kinds of retrieval operations have been distinguished: Critical Retrieval retrieves cases that totally meet the assigned single design criteria. Designers can retrieve the most promising cases by adding more and more design criteria. General Retrieval retrieves cases that have the most similar spatial relationships as the current project. Designers can choose different spatial relationships as criteria for retrieval. The RCBDC program had been implemented on a Macintosh computer using the Prolog language. Several residential design projects had been input into the case library. The programming-by-drawing input and the clear explanation of the retrieval process which lists clauses of criteria and spatial relationships make the retrieval process easily understood by architectural designers. A few architectural students have tested this system and proved its feasibility. In addition to its retrieval function, it also help designers to contemplate and re-discover the implied spatial relationships existing in their own design projects. The RCBDC program uses a game-like operation, arranges shape elements according to special rules set by the system. For some spatial relationships the designer intend, the RCBDC program does not have the ability to recognize them. This program lacks a proper hierarchical system to organize all the shape elements, so the system can not calculate the spatial relationship 58 between "groups" of elements, and limits the development of important design knowledge. Organizing shape elements hierarchically will reduce unnecessary calculation, make design projects easily understood, and help develop more delicate design knowledge. The RCBDC program does not direct the retrieval process into specific category. When the case library has a large database, the retrieval operation will become very slow. To label cases into different categories during the saving process and direct the retrieval operation into the appropriate categories will be important. All the design criteria are treated equally in the RCBDC program. In real world design practice, some design criteria are more important than others. To implement an evaluation system for ranking the design criteria is necessary. The RCBDC program does not serve the function of adopting design knowledge. Nevertheless, retrieving useful cases alone is valuable. This has always been one of the most important and time-consuming activities in the design process. Other important features, including a hierarchical system to organize all the elements, more complete editing tools, and knowledge adapting, will be explored in future research. 5.4 Future Work The RCBDC program has implemented several basic functions for successfully retrieving cases based on assigned design criteria, but actually, it is an early research program for CAD systems with CBR. A few refinements and improvement should be considered in the future research : 59 The programming-by-drawing approach in the RCBDC program, is a convenient way for designers to work on the computer. It reduces the risk of incorrect interpretation from two-dimensional drawing to computer language. In the real world design practice, designers like to observe cases that have design criteria not existing in their current projects. So the RCBDC program should provide more ways of input, not just programming-bydrawing from the current project. In the current editing tools, only a few shape elements ( lines and rectangles ), and editing functions ( erase, rotate 90 degree, and move ) are provided. Future editing tools should meet all design needs, with more shape elements and editing functions. Some spatial relationships (adjacency and penetration) are implemented in the RCBDC program. Other spatial relationships, such as visual access, pedestrian sequence.... etc. should be developed in the future research. For a more advanced system, we should also consider how to input design criteria on "quality " issues rather than " quantity " issues. That aspect of quality varies between designers - a problem which can be overcome with case-based reasoning. Since CAD systems with CBR can be equipped with more and more personal design knowledge through use. They can adopt the judging criteria of a designer. The RCBDC program retrieves cases by matching their spatial relationship clauses. In addition to spatial relationships, text is another important mean to depict a design project. Retrieval by matching "text" should be developed in future research. Another central issue in CAD systems with CBR is how to adopt design knowledge from retrieved cases to the current project. Combining the adopting operation with the developed constraints system, or shape grammar system are major topics for future research. 60 Appendix A Program of Checking Penetration Relationship The following Prolog program checks the penetration relationship between two rooms. If a pair of rooms can fulfill one of these sixteen conditions, then they have penetration relation. check the penetration relation between two rectangles ********/ transferinto-penetrationrelation :recdata(A1,B1,C1,D1,Name1), recdata(A2,B2,C2,D2,Name2), door_data(E1,F1,E2,F2), number(A1), number(A2), number(E1), check-penetrationrelation(A1,B1,C1,D1,Namel,A2,B2,C2,D2,Name2,E1,F1,E2,F2), check-penetration-exist(Namel,Name2), fail. /************ There are 16 conditions /**** /**** / Al, B1, C1, D1, Namel is the first room A2, B2, C2, D2, Name2 is the second room /****** El, / / F1, E2, F2 is a door ******************/ check.penetrationrelation(A1,Bl,Cl,Dl,Namel,A2,B2,C2,D2,Name2,El,Fl,E2,F2) B1= D2, A1 < C2 , C1 > A2, A1 >= A2, C1 =< C2, F1= B1 , F2 = B1, El < C1, E2> Al, check-penetrationrelation(A,B,C,Dl,Namel,A2,B2,C2,D2,Name2,El,Fl,E2,F2) B1 = D2, Al < C2 , C1 > A2, A1 < A2, C1 =< C2, F1 = B1 , F2 = B1, El < C1, E2 > A2, 61 check-penetration relation(A1,Bl,C1,D1,Namel,A2,B2,C2,D2,Name2,E1,F1,E2,F2) B1 = D2, Al < C2 , C1 > A2, C2 < C1, A2=< A1, F1= B1, F2= B1, El < C2, E2 > A1, check-penetrationrelation(A,B1,C1,D,Namel,A2,B2,C2,D2,Name2,El,Fl,E2,F B1= D2, Al < C2 , C1 > A2, A1 < A2, C1> C2, F1 = B, F2= B1, 2 ) 2 ) El < C2, E2 > A2, /*************** This condition is rec 2 is adjacent on left of rec 1 *******/ check-penetration relation(A1,B1,C1,D1,Namel,A2,B2,C2,D2,Name2,E1,F1,E2,F C1 = A2, B1 < D2, D1 > B2, B1 < B2, D1 > D2, El = C1, E2 = C1, F1 < D2, F2 > B2, check.penetrationrelation(AI,B1,Cl,D1,Namel,A2,B2,C2,D2,Name2,E1,Fl,E2,F2) C1 = A2, B1 < D2, D1 > B2, B1 >= B2, D1 > D2, El = C1, E2 = C1, F1 < D2, F2 > B1, check-penetration relation(Al,Bl,Cl,Dl,Namel,A2,B2,C2,D2,Name2,E1,F1,E2,F2) C1 = A2, B1 < D2, D1 > B2, B1 < B2, D1 =< D2, El = C1, E2 = C1, F1 < D1, F2> B2, check-penetrationrelation(Al,Bl,Cl,D,Namel,A2,B2,C2,D2,Name2,El,Fl,E2,F2) C1 = A2, B1 < D2, D1 > B2, B1 >= B2, D1 =< D2, El = C1, E2 = C1, F1 < D1, F2 > B1, /*************** This condition is rec 2 is adjacent on right of rec 1 *******/ check-penetrationrelation(Al,Bl,C1,Dl,Namel,A2,B2,C2,D2,Name2,El,F1,E2,F2) C2 = Al, B1< D2, D1 > B2, B1< B2, D1 > D2, El = C2, E2 = C2, F1 <D2, F2> B2, 62 check-penetration relation(Al,Bl,Cl,Dl,Namel,A2,B2,C2,D2,Name2,El,Fl,E2,F2) C2 = Al, B1 < D2, D1 > B2, B1 >= B2, D1 > D2, El = C2, E2 = C2, F1< D2, F2> B1, check penetrationrelation(A,B,C,D,Namel,A2,B2,C2,D2,Name2,E1,F,E2,F2) C2= A1,B1 <D2,D1 > B2,B1<B2,D1=< D2, El= C2, E2 = C2, F1 <D1 , F2 > B2, check-penetrationrelation(A,B,C1,D,Namel,A2,B2,C2,D2,Name2,E1,Fl,E2,F2) C2 = Al , B1 < D2, D1 > B2, B1 >= B2, D1 =< D2, El= C2, E2 = C2, F1 < D1, F2> B1, t /*************** This condition is rec 2 is adjacent on bottom of rec 1 *******/ check-penetration relation(Al,Bl,C1,Dl,Namel,A2,B2,C2,D2,Name2,E1,Fl,E2,F2) B2= D1, Al < C2 , C1 > A2, A1 >= A2, C1=< C2, F1 = B2, F2 = B2, El< C1, E2> Al, check-penetration relation(A1,Bl,Cl,D1,Namel,A2,B2,C2,D2,Name2,E1,Fl,E2,F2) B2= D1, Al < C2 , C1 > A2, Al < A2, Cl =< C2, F1 = B2, F2 = B2, El < C1, E2> A2, check-penetrationrelation(A,B,C,D,Namel,A2,B2,C2,D2,Name2,E1,F1,E2,F2) B2= D1, Al < C2 , C1 > A2, C2 < C1, A2 =< Al, F1 = B2, F2 = B2, El < C2, E2 > Al, check.penetrationrelation(Al,B1,C1,D1,Namel,A2,B2,C2,D2,Name2,El,Fl,E2,F2) B2= Dl, Al <C2 , Cl > A2, Al <A2, Cl > C2, F1 = B2, F2 = B2, El < C2, E2 > A2, check.penetrationrelation(Al,Bl,C1,Dl,Namel,A2,B2,C2,D2,Name2,E1,Fl,E2,F2) fail. 63 Appendix B Program of Adjacency in Critical Retrieval The following Prolog program use the adjacency relationship provided by designers to retrieve cases that fulfill this criteria. /******* Checking adjacency relationship in the Critical Retrial /********************* Main program *******************/ critical-adjacency :some-previous work foradjacencyc, selectedfirstroomforadjacency, selectedsecondroomfor-adjacency, check adjacency-andlinsert, check-ifany-cases inselectedcases-adjacency, checkifthenewdatabaseisempty-adjacency, put-everything-intothe-spare-database-adjacency, consultthefirstcase_for-adjacency_1, consultthefirstcase_for-adjacency_2, abolish(sequence numberselectedcaseold,1), assert(sequencenumberselectedcase-old(1)), redraw,!. /********** some previous work ****************/ some-previous workfor-adjacency-c abolish(attS,2), abolishallthe-garbage_in_case, abolish(adjacencycrit,2), abolish(selectedcases_t,1), 64 ***********/ abolish(first-room-adjacency,5), abolish(retrievecriterion,1), assert(retrieve-criterion('Critical-Retrieve')). consultthefirstcasefor-adjacency_1 selected cases(A), abolish(choosedcase,1), assert(choosed-case(A)),!. consultthefirstcasefor-adjacency_2 abolishallthe-garbage_in_case, choosedscase(A), consult(A). /***************** select first room selectedfirstroomfor-adjacency :report('Please choose first room'), abolish(attS,2), getport(WINDOW), newrecord(eventrecord,EVENT), repeat, selectedfirstroomforadjacency(WINDOW,EVENT,MOVE), disposptr(EVENT). selectedfirstroomfor-adjacency(WINDOW,EVENT,MOVE) systemtask, getnextevent(16'ffff,EVENT,true), get_field(where,eventrecord,EVENT,EVENTPOINT), get_field(what,eventrecord,EVENT,1), (findwindow(EVENTPOINT,WINDOW,3),!;fail), globaltolocal(EVENTPOINT,EVENTPOINTLOCAL), point(X,Y,EVENTPOINTLOCAL), abolish(firstroomforadjacency,2), assert(first-roomfor-adjacency(X,Y)), (draw selectedrectanglejfor-adjacency_first,! report('Please select again'),fail ). /******* draw first selected room 65 drawselectedrectanglefor-adjacencyjfirst :assert(number-adjacency(O)), fiveatt(DX11,DY11,DX12,DY12,SpaceName), firstroomforadjacency(A,B), number(DX11), A > DX11, A < DX12, B > DY11, B < DY12, pensize(5,5), SpaceNamel = SpaceName, drawline(DX11,DY11,DX11,DY12), drawline(DX11,DY11,DX12,DY11), drawline(DX12,DY12,DX11,DY12), drawline(DX12,DY12,DX12,DY11), DX11_reLp1 DY11_rel_pl DX12_rel-pl DY12_rel_pl is is is is DX11, DY11, DX12, DY12, abolish(first-room adjacency,5), assert(first-room-adjacency(DX1 1_relpl,DY11_rel-pl, DX12_rel_pl,DY12_rel-pl,SpaceNamel)), abolish(first-roomforadjacency,2), fail. drawselectedjrectangle-for-adjacencyfirst abolish(attS,2). /************ select second room * selectedsecondroomfor-adjacency report('Please choose second room'), abolish(attS,2), getport(WINDOW), newrecord(eventrecord,EVENT), repeat, selectedsecondroomfor-adjacency(WINDOW,EVENT,MOVE), disposptr(EVENT). 66 selectedsecondroomfor-adjacency(WINDOW,EVENT,MOVE) systemtask, getnextevent(16'ffff,EVENT,true), get_field(where,eventrecord,EVENT,EVENTPOINT), get_field(what,eventrecord,EVENT,1), (findwindow(EVENTPOINT,WINDOW,3),!;fail), globaltolocal(EVENTPOINT,EVENTPOINTLOCAL), point(X,Y,EVENTPOINTLOCAL), abolish(secondroom foradjacency,2), assert(secondjroom foradjacency(X,Y)), (drawselectedrectanglefor-adjacencysecond,! report('Please select again'),fail ). / * draw second selected room drawselected-rectangle-for-adjacency-second fiveatt(DX11,DY11,DX12,DY12,SpaceName), secondroomfor-adjacency(A,B), number(DX11), A > DX11, A < DX12, B > DY11, B < DY12, pensize(5,5), SpaceNamel = SpaceName, drawline(DX11,DY11,DX11,DY12), drawline(DX11,DY11,DX12,DY11), drawline(DX12,DY12,DX11,DY12), drawline(DX12,DY12,DX12,DY11), DX11_rel-pl DY11_rel_pl DX12_rel_pl DY12_rel_pl is is is is DX11, DY11, DX12, DY12, abolish(second-room-adjacency,5), assert(second room adjacency(DX1 1rel_pl,DY1 1_rel_pl, DX12_rel_pl,DY12_rel_pl,SpaceNamel)), abolish(secondroom foradjacency,2), fail. 67 drawselected-rectangle-for-adjacency-second :abolish(attS,2). check-adjacency-andlinsert firstroom-adjacency(A1,B1,C1,D1,Namel), secondroomadjacency(A2,B2,C2,D2,Name2), (chechfiveatt-adjacency_c(A,B1,C1,D1,Namel,A2,B2,C2,D2,Name2), abolish(adjacency_crit,2), assert(adjacency-crit(Namel,Name2)), string('Yes,they are adjacency, Retrieve by ',Astring), stringCadjacency ',Bstring), string(Namel,Cstring), string(' ',Dstring), string(Name2,E_string), stringconcat(A-string,Bstring,Rlstring), stringconcat(Rlstring,C-string,R2_string), stringconcat(R2_string,Dstring,R3_string), stringconcat(R3_string,Estring,R4_string), report(R4_string) ; report('They are not adjacency, Please choose again'), abolish(retrievecriterion,1), redraw, st). check fullfil cases check-and-put-fullfill_casesinto_fullfil_casesfor_adjacency abolish(case-number,1), assert(case-number(O)), check-and-put-fullfill_cases_into_fullfilcasesfor_adjacency-2. check-and-put_fullfill_casesintofullfil_cases_foradjacency_2 abolishallthegarbage_in_case, casenumber(CaseNum), CaseNumber is ( CaseNum + 1), abolish(case-number,1), assert(case-number(CaseNumber)), 68 ( CaseNumber=< 8 ; CaseNumber> 8, fail ), string(database,Database_String), string(CaseNumber, CaseNumberString), stringconcat(DatabaseString,CaseNumberString,ComparedCase), abolish(compard_case,1), assert(compard-case(ComparedCase)), consult(ComparedCase), ( check and put-fullfillcasesintofullfilcasesfor_adjacency_3,! check-and-put fullfillcasesintofullfilcases-for-adjacency_2). check-and-put-fullfillcasesintofullfilcases_foradjacency_2 not ?(selectedcases(_)), abolish(retrievecriterion,1), report('Sorry,no case can match this condition'), redraw,st,!. check-and-put-fullfillcases_intofullfil_cases_foradjacency_2 pensize(1,1). /******** check to continue sorting or restart * checkif-any-casesinselectedcases-adjacency not ?(selectedcases()), check-and-put fullfillcasesintofullfilcases_foradjacency,!. check-if-any-casesinselectedcases-adjacency ?(selectedcases(_)), check-and-put fullfillcasesfromfulfillcases-adjacency. /****** check from fulfill cases which is right ****/ check-and-put-fullfillcasesfromfulfillcases-adjacency selected cases(F), abolishallthegarbage_in_case, consult(F), compard-case(ComparedCase), 69 adjacency-crit(A,B), adjacency(C,D), (A == C, B == D; A == D, B == C), assert(selected cases-t(F)), fail. check-and-put-fullfillcasesfromfulfillcases-adjacency abolish(selectedcases,1), check-and-put-fullfillcases_from_fulfillcases_2_adjacency. check-and.put-fullfillcasesfromfulfillcases_2_adjacency ?(selectedcases_t(_)), selectedcases_t(D), not ?(selected-cases(D)), assert(selected-cases(D)), fail. check-and-put-fullfillcasesfromfulfillcases_2_adjacency pensize(1,1). check-and-put-fullfillcasesintofullfilcasesforadjacency_3 compard-case(ComparedCase), adjacency-crit(A,B), adjacency(C,D), (A == C, B == D ; A == D, B == C), assert(selected-cases(ComparedCase)), check-and-put-fullfillcasesinto_fullfilcasesforadjacency_2. put itintocriticalcriteria-adjacency adjacency-crit(A,B), string('Adjacency ',A-string), string(A,Bstring), string(' ',C string), string(B,Dstring), stringC ',E string), 70 stringconcat(Astring,Bstring,R_string), stringconcat(Rlstring,C-string,R2_string), stringconcat(R2_string,Dstring,R3_string), stringconcat(R3_string,Estring,R4_string), assert(critical-criteria(R4_string)). checkifthenewdatabaseisempty-adjacency not ?(selected-cases(_)), report('No case can meet this condition,Sorry'), put-everything-backselectedcases-adjacency. put-everything-back-selected cases-adjacency selectedcasesspare(A), assert(selected-cases(A)), fail. put-everything-back-selected cases-adjacency pensize(1,1). checkifthenewdatabaseisempty-adjacency ?(selectedcases(_)), put-it intocriticalcriteria-adjacency. put-everything-into-the-spare-database-adjacency ?(selectedcases(_)), abolish(selectedcasesspare,1), put-everything-intothe-spare-database_2_adjacency. put-everything-into-the-spare-database_2_adjacency ?(selectedcases(_)), selected cases(A), assert(selectedcases-spare(A)), fail. put-everything-into-the-spare-database_2_adjacency pensize(1,1). 71 chechfiveatt-adjacency_c(A1,B1,C1,Dl,Namel,A2,B2,C2,D2,Name2) (Al = C2, Bl < D2 , Dl > B2; Cl = A2, Bl < D2 , Dl > B2; B1 = D2, Al <C2 , Cl > A2; Dl =B2,Al <C2 ,Cl >A2). 72 :- Appendix C Program of Penetration in General Retrieval The following Prolog program calculates all the possible permutations among repeated elements, finds out the hightest match number in this case, and compares this number with other case's numbers to decide their ranking. In the following program, some repeated part is shorted already. /***** main program * permutation-penetration :report('Retrieve Penetration by Permutation'), some-previous workfor-permutationpenetration, transferintoroom data, transferintonumberofroomtype-permutationpenetration, transferintolabel-penetration relation-permutationpenetration, compare-withalldatabase-permutationpenetration_1, checkifnosimilarexist-penetrationpermutation, somesomeafterafterwork-permutation-penetration, redraw. some previous work for label-penetration some-previous workfor-permutation-penetration abolish(roomdata,6), abolishallthe-garbage_in_case, abolish(permutationpenetration highest_number,1), assert(permutation-penetration-highestnumber(O)), abolish(attS,2), abolish(roomdata,6), abolish(labelpenetrationjt,4), abolish(labelpenetration_tt,4), abolish(retrievecriterion,1), assert(retrieve-criterion('P-Penetration')). 73 **********************/ check if no similar label-penetration can be found /******************** checkifnosimilarexist-penetration-permutation permutation penetration highest-number(Penetration), Penetration = 0, reportCNo similar label-penetration can be found'). checkifnosimilarexist-penetration-permutation pensize(1,1). /******************* some after work ************************/ somesomeafterafter-work-permutation-penetration abolish(sequence numberselectedcase-old,1), Number is 1, assert(sequence numberselectedcase-old(Number)), choosed case(A), consult(A), stringC Now you are retrieving ',Astring), string(A,Bstring), stringconcat(A-string,Bstring,Cstring), report(C-string). /****** * check not repeated penetration in current project checklabelpenetrationtexist(N,S,N1,S1) :- not ?(label-penetration_t(N,S,N1,S1)), not ?(label-penetration_t(N1,S1,N,S)), assert(label-penetration_t(N,S,N1,S1)). /**** * transfer into number of roomtype * transferintonumberof-roomtype-permutation-penetration abolish(numberofroomtypet,2), assert(number_of roomtypejt(1,1)), fiveatt(A,B,C,D,E), number(A), seperate existandnotexist-permutation-penetration(A,B,C,D,E), fail. 74 / transferintonumberof-roomtypepermutation-penetration retract(number-ofjroomtype-t(1,1)), pensize(1,1). seperate existandnot-exist-permutationpenetration(A,B,C,D,E) numberofroomtypejt(F,G), G1 is (G + 1), E == F, retract(numberofjroomtype-t(F,G)), assert(number-ofroomtype-t(E,G1)),!,fail. seperate existandnot-exist-permutation penetration(A,B,C,D,E) assert(number-of-roomtypet(E,1)). /*********************** transfer into penetration t * transferintolabel-penetration relation-permutation-penetration abolish(label-penetrationt,4), room data(A1,B1,C1,D1,Namel,S Number1), room data(A2,B2,C2,D2,Name2,S_Number2), entr_four(E1,F1,E2,F2), number(A1), number(A2), number(E1), check-penetration relation(A1,B1,C1,D1,Namel,A2,B2,C2,D2,Name2,E1,F1,E2,F2), check label penetration-exist-permutation penetration(Namel,SNumber1,Name2,S_Nu mber2), fail. transferintolabel-penetration relation-permutation-penetration pensize(1,1). check-label-penetration-exist-permutation-penetration(Namel,SNumberl,Name2,SNu mber2):not ?(label-penetration t(Namel,SNumber1,Name2,SNumber2)), not ?(label-penetration t(Name2,S_Number2,Namel,SNumberl)), assert(label-penetration-t(Namel,SNumberl,Name2,SNumber2)). /************************* compare with all database 75 compare-with alldatabase-permutation-penetration_1 - abolish(case-number,1), assert(case-number(O)), compare-withalldatabase-permutation-penetration_2. compare-with alldatabase-permutation-penetration_2 abolishallthe-garbage_in_case, abolish(permutation-penetrationcompared-case,1), abolish(compared case,1), casenumber(CaseNum), CaseNum =< 7, CaseNumber is ( CaseNum + 1), abolish(case-number,1), assert(case number(CaseNumber)), string(database,Database_String), string(CaseNumber, CaseNumberString), stringconcat(DatabaseString,CaseNumberString,Compared_Case), /** report(ComparedCase), * abolish(last-memory,2), abolish(last-memory,3), abolish(last-memory,4), abolish(last-memory,5), consult(ComparedCase), assert(permutation-penetration compared-case(O)), assert(compared-case(ComparedCase)), compare-withalldatabase-permutation-penetration_3,!. compare-with alldatabase-permutation-penetration_2 pensize(1,1). compare-with alldatabase-permutation-penetration_3 put-label-penetration ttpermutation-penetration, calculateinone case permutationpenetration, compare withalldatabase-permutation-penetration_2. /******************** put label-penetrationtt put-label-penetration tt-permutation-penetration abolish(label-penetrationtt,4), labelpenetration_t(A,B,C,D), 76 into it ********************/ not ?(label-penetration_tt(A,B,C,D)), assert(label-penetration_tt(A,B,C,D)), fail. put-label-penetration tt-permutationpenetration pensize(1,1). /******************** check which case has higher matched number checkwhichis-bigger-permutation-penetration :- permutation-penetration-highest_number(A), permutation-penetration compared-case(B), string('In this calculation the highest number is',S1), string(B,S2), stringconcat(S1,S2,S3), /*** report(S3), * B > A, /*** report('It is bigger'), * put -tttintotttt, abolish(permutation-penetration-highest-number,1), assert(permutation-penetration-highestnumber(B)), abolish(selectedcases,1), comparedcase(ComparedCase), abolish(choosedcase,1), abolish(selectedcases,1), assert(choosed-case(ComparedCase)), assert(selected-cases(ComparedCase)). puttttintotttt :abolish(label-penetration_tttt,4), label-penetration-ttt(A,B,C,D), assert(label-penetration-tttt(A,B,C,D)), fail. puttttintotttt pensize(1,1). checkwhichis-biggerpermutation-penetration permutation-penetration-highest-number(A), permutation-penetration compared-case(B), B =:= A, compared-case(ComparedCase), not ?(selected-cases(ComparedCase)), 77 *****************/ assertz(selected-cases(ComparedCase)),!. checkwhichis-bigger-permutation-penetration :- permutation-penetration-highest-number(A), permutation-penetration compared-case(B), B < A,!. checkwhich-is-bigger-permutation-penetration pensize(1,1). /********************* Calculate match number in one case********************/ calculateinonecasepermutation-penetration :- compare roomtypejinto-permutationpenetration, abolish(up-or down,1), go-into theendlessjloop-permutation-penetration. /************ Endless Loop ***************/ go-into theendlessloop-permutation-penetration abolish(number-all,1), assert(number-all(O)), go-into-balcony-permutation-penetration. /********* Calculate Match Number 2 *****/ calculatethematchnumber-permutation-penetration2 abolish(numbert,1), abolish(label-penetration_ttt,4), assert(number-t(O)), calculatethematchnumber-permutation-penetration_22. calculatethematchnumber.permutation penetration_22 labelpenetrationtt(A1,B1,C1,D1), number(B1), ( ?(label-penetration(A,B1,C1,D1)); ?(label_penetration(C1,D1,A1,B1))), assert(label-penetrationttt(A1,B1,C1,D1)), number t(X), X1 is (X + 1), abolish(numbert,l), assert(numbert(Xl)), fail. 78 calculatethematchnumber.permutation-penetration_22 numbert(X), abolish(permutation penetration-compared-case,1), assert(permutation-penetration comparedcase(X)), string('The match number is ',A), string(X,B), stringconcat(A,B,C). /*** report(C) . ***/ put permutation into it * compareroomtype-into-permutation penetration abolish(permutation,2), abolish(permutation,3), abolish(permutation,4), abolish(permutation,5), abolish(tempt-data,4), numberofroomtypejt(Al,B1), numberofroomtype(A2,B2), Al == A2, (not B1 =:=1 ; not B2 =:= 1), abolish(number incurrent-project,l), abolish(numberjin-compared_case,1), abolish(roomtype-compared,l), not ?(tempt-data(A1,B1,A2,B2)), assert(tempt-data(Al,B1,A2,B2)), assert(numberincurrent_project(B1)), assert(numberin compared case(B2)), assert(roomtype-compared(A1)), insert-permutation, fail. comparejroomtype into-permutation penetration abolish(tempt-data,4), pensize(1,1). report circulation number *****/ 79 report circulationnumber-permutation-penetration :numberall(X), X1 is (X + 1), abolish(number-all,1), assert(numberall(Xl)), string(' This circulation number is ',Shitl), string(X1,Shit2), stringconcat(Shitl,Shit2,Shit3). report(Shit3). ***/ /*** /** * Input BR permutation * putBR-permutation-penetration :numberofroomtype-t(A1,B1), numberofroomtype(A2,B2), Al A2 == == 'BR', 'BR', (not B1 =:=1 ; not B2 =:= 1), abolish(numberincurrent-project,1), abolish(numberin-compared-case,l), abolish(roomtype-compared,l), not ?(tempt-data(A1,B1,A2,B2)), /**** for local control ****/ assert(tempt_data(A1,Bl,A2,B2)), assert(numberincurrentproject(Bl)), assert(number-in-compared-case(B2)), assert(roomtype-compared(Al)), insert-permutation, fail. putBR-permutation-penetration abolish(tempt-data,4), pensize(l,l). putBA-permutation penetration abolish(tempt-data,4). 80 /*********** Input Balcony permutation * putBL-permutation-penetration :numberofroomtypet(Al,B1), numberofroomtype(A2,B2), A2 ==BL', Al =='BL' (not B1 =:=1 ; not B2 =:= 1), abolish(numberincurrent-project,1), abolish(numberjincompared-case,1), abolish(roomtype_compared,1), not ?(tempt data(A1,B1,A2,B2)), /**** for local control ****/ assert(tempt_data(Al,Bl,A2,B2)), assert(numberin currentproject(B1)), assert(numberlincomparedcase(B2)), assert(roomtype-compared(Al)), insert-permutation, fail. putBL-permutation-penetration abolish(tempt-data,4). go-into circulationpermutation-penetration-up ( not ?(permutation('C',_)), not ?(permutation('CI',,_)), not ?(permutation('CI',_,,_)), not ?(permutation('CI',_,_,_,_)), go-into-storage-permutation penetrationup; ?(up or-down('CI')), retract(up-or-down('CI')), go-into-storage-permutation-penetration-up; go-into circulation-permutation penetration ),!. 81 /****************** Bathroom ********************/ go-into bathroom-permutation-penetration not not not not ?(permutation('BA',_)), ?(permutation('BA',_,_)), ?(permutation('BA',_,_,_)), ?(permutation('BA',_,_,_,_)), go-into bedroom-permutation penetration,!. go-into-bathroom-permutation-penetration ( ?(permutation('BA',_)); ?(permutation('BA',_,_)); ?(permutation('BA',_,_,_)); ?(permutation('BA',_,_,_,_)), abolish(numberin current-project,1), abolish(numberin-comparedcase,1), abolish(roomtype_compared,1), numberofroomtype-t(Al,B1), numberofroomtype(A2,B2), Al == 'BA', A2== 'BA', assert(number incurrent_project(BI)), assert(numberin-compared-case(B2)), assert(roomtype-compared('BA')), substitute-permutation, (not ?(permutation('BA',_)), not ?(permutation('BA',_,_)), not ?(permutation('BA',_,_,_)), not ?(permutation('BA',_,_,_,_)), putBA-permutationpenetration, ( not ?(upor-down('BA')), assert(up-or-down('BA')); 1 =:= 1), go-into bedroom-permutation penetration; go-intobedroom permutation-penetration). 82 go into bathroom-permutation-penetration up :( not ?(permutation('BA',_)), not ?(permutation('BA',,_)), not ?(permutation('BA',_,_,_)), not ?(permutation('BA',_,_,_,_)), gointo circulation-permutation-penetration up; ?(up or-down(BA')), retract(up-or-down('BA')), go-into circulation-permutation penetrationup; go-into bathroom-permutation penetration ),!. / ************Bedroom ~********/ go-into bedroom-permutation penetration ( ?(tempt-data('Start')); assert(tempt-data('Start')) ), not not not not ?(permutation('BR',_)), ?(permutation('BR',_,_)), ?(permutation(BR',_,_,_)), ?(permutation('BR',_,_,_,_)), ?(label-penetration tt(_,_,_,_)),calculate thematchnumber-permutation-penetration2; calculatethematchnumber-permutation penetration ), checkwhichisbigger-permutation penetration, report circulationnumber-permutation-penetration, go-into bathroom-permutation penetration-up,!. go-into bedroom-permutation-penetration ( ?(permutation('BR',_)); ?(permutation('BR',_,_)); ?(permutation('BR',_,_,_)); ?(permutation('BR',_,_,_,_)) ), go-into bedroompermutationpenetration2,!. gojinto bedroom-permutation-penetration2 ( ?(permutation(BR',_)); ?(permutation('BR',_,_)); ?(permutation('BR',_,_,_)); 83 ?(permutation('BR',_,_,_,_)) ), abolish(number incurrent-project,1), abolish(numberinscompared-case,1), abolish(roomtype-compared,l), numberofroomtype-t(A1,B1), numberofroomtype(A2,B2), Al A2 == == 'BR', 'BR', assert(number in currentproject(B1)), assert(numberlin-comparedcase(B2)), assert(roomtype-compared('BR')), substitute-permutation, calculatethematchnumber-permutationpenetration2, checkwhichisbiggerpermutationpenetration, report circulationnumber-permutation-penetration, gointo bedroom-permutation-penetration2. go-into bedroom-permutation-penetration2 not ?(permutation('BR',_)), not ?(permutation('BR',_,_)), not ?(permutation('BR',_,_,_)), not ?(permutation('BR',_,_,_,_)), putBR...Rpermutationpenetration, gojinto bathroom-permutation-penetrationup . insert-permutation /**** 3,4 *****/ numberincurrent-project(X), numberincomparedcase(Y), roomtype-compared(G), X Y 3, 4, 84 L2 = [1,2,3,4], member2(A,L2), member2(B,L2), member2(C,L2), not A == B, not B== C, not C == A, assert(permutation(G,A,B,C)), fail. insert-permutation /**** 4,1 *****/ numberincurrent-project(X), numberincompared-case(Y), roomtype-compared(G), X Y 4, 1, L2 = [1,0,0,0], assert(permutation(G,0,0,0,1)), assert(permutation(G,0,0,1,0)), assert(permutation(G,0,1,0,0)), assert(permutation(G,1,0,0,0)),!. insert-permutation /**** 4,2 *****/ numberincurrent-project(X), numberincompared-case(Y), roomtypejcompared(G), X Y 4, 2, L2 = [1,2,0,01, assert(permutation(G,0,0,1,2)), assert(permutation(G,0,0,2,1)), 85 assert(permutation(G,,1,O,2)), assert(permutation(G,,2,O,1)), assert(permutation(G,1,,O,2)), assert(permutation(G,2,,O,1)), assert(permutation(G,1,,2,O)), assert(permutation(G,2,,1,O)), assert(permutation(G,1,2,,O)), assert(permutation(G,2,1,,O)), assert(permutation(G,,1,2,O)), assert(permutation(G,,2,1,O)),!. member2(X,[X ITail]). member2(X,[Head ITail]) member2(X,Tail). 86 REFERENCES Alexander, Christopher. 1967. "Notes on the Synthesis of Form". Harvard University Press, New York. Alexander, Christopher, S. Ishikawa, and M. Silverstein. 1967. "A Pattern Language". New York: Oxford University Press. Akin, 0. 1986 "A formalism for problem restructuring and resolution in design". Environment and Planning B volume 13. Antony, D. Radford & Gero, John S. 1988. "Design by Optimization in Architecture, Building, and Construction". Van Nostrand Reinhold Company, New York. Bratko, Ivan. 1986 "PROLOG, Programming for Artificial Intelligence", Addison- Wesley Publishing Company. Greenlee, Russell Lorance. 1988. "From Sketch to Layout: Using Abstract Descriptions and Visual Properties to Generate Page Layouts". MIT M.S.V.S. thesis. Gross, Mark Donald. 1989. "Relational Modeling: A Basis for ComputerAssisted Design". Electronic Design Studio MIT Press. Gross, Mark Donald. 1985. "Design as Exploring Constraints". Ph.D. dissertation, Graduate School of Architecture and Urban Planning, Massachusetts Institute of Technology. 87 Habraken, John & Gross, Mark. 1987. "Concept Design Games", Book One and Book Two, Department of Architecture, MIT. Hinrichs, Thomas R. 1988. "Towards an Architecture for Open World Problem Solving". Proceeedings of the Workshop on Case-Based Reasoning, Clearwater Beach, Florida, May 1988. Morgan-Kauffman Publishers. Ishizaki, Suguru. 1989 "Example-Based Graphical Programming", M.S.V.S. thesis. MIT. Johnson, J. H. & Brown, F. E. " An Interactive Computer Model of Urban Development: the Rules Governing the Morphology of Mediaeval London". Environment and Planning B volume 12. Knigt, Terry Weissman. 1989. "Color Grammar: Designing with Lines and Colors". Environment and Planning B volume 16. Knigt, Terry Weissman. 1986. " Transformations of Languages of Designs." Ph.D. dissertation, Graduate School of Architecture and Urban Planning, University of California, Los Angeles. Krishnamurti, R. & Giraud, C. 1986 "Towards a Shape Editor: the Implementation of a Shape Generation System". Environment and Planning B. Lieberman, Henry. 1989. "Graphics for Software Visualization". Media Lab. MIT. MacNeil, Ron. 1989. "TYRO: A Constraint Based Graphic Designer's Apprentice". Media Lab. MIT. 88 MacNeil, Ron 1989. "Adaptive Perspectives: Case-Based Reasoning with TYRO, the Graphic Designer's Apprentice". Media Lab. MIT. March, L. & Stiny, G. 1986. "Spatial Systems in Architecture and Design: Some History and Logic". Environment and Planning B volume 12. Mark, Earl 1989. "A Contrast in Pedagogy: The MIT vs. Harvard Approach to Computer Aided Design", Graduate School of Architecture and Urban Planning, MIT. Miller, Frank, C. 1989 " Form Processing Workshop: Architectural Design and Solid Modeling at MIT", Electronic Design Studio MIT Press. Mitchell, J. William. 1990 " The Logic of Architecture", MIT Press. Mitchell, J. William. 1990 "The Uses of Inconsistency in Design", 3rd International SUNY Buffalo CAD Symposium. Mitchell, J. William., Liggett, R. S. and Tan, Milton. 1989. "Top - Down Knowledge-Based Design". Electronic Design Studio MIT Press. Mitchell, J. William., Aran, B. and Liggett, R. S. 1982. "The Application of Statistical Pattern - Recognition Techniques in Dating Ancient Architectural Construction". Environment and Planning B volume 9. Nagakura, Takehiko. 1989. "Shape Recognition and Transformation-- A Script-Based Approach". Electronic Design Studio MIT Press. Navinchandra, Dundee J. 1988. "Case Based Reasoning in CYCLOPS, a Design Problem Solver", Proceeedings of the Workshop on Case-Based Reasoning, Clearwater Beach, Florida, May 1988. Morgan-Kauffman Publishers. 89 Navinchandra, Dundee J. 1987. "Exploring Innovative Design by Relaxing Criteria and Reasoning from Precedent Knowledge", Doctor of Science thesis, MIT. Riesbeck, Christopher K. 1989. "Inside Case-Based Reasoning". Hillsdale, N.J. Schmitt, Gerhard & Faltings, Bol 1990. "Knowledge Representation and Acquisition for Intelligent Computer-Aided Design and Construction Systems". Papazian, Pegor. 1991 "Computer Replication of Design Process". Graduate School of Architecture and Urban Planning, MIT. Schon, Donald A. 1988 "Designing: Rules, Types and Worlds". Department of Urban and Planning MIT. Shinn, Hong S. 1988 "Abstractional Analogy: A Model of Analogical Reasoning". Proceeedings of the Workshop on Case-Based Reasoning, Clearwater Beach, Florida, May 1988. Morgan-Kauffman Publishers. Sterling, Leon. & Shapiro, Ehud. 1986 "The Art of Prolog ". MIT Press Stevens, Garry. 1990 " The Reasoning Architect - Mathematics and Science in Design ". McGraw-Hill Publishing Company. Stiny, George. 1989 " What Designers Do That Computer Should ". Electronic Design Studio MIT Press. Stiny, George. 1987. "Composition Counts: A + E = AE". Planning and Design 14, no.2:167-82. 90 Stiny, George. 1982. "Shape are Individual". Environment and Planning B9:359-67. Stiny, George. 1980. "Introduction to Shape and Shape Grammars", Environment and Planning B7:343-351. Stiny, George. 1980. "Kindergarten Grammars: Designing with Froebel's Building Gifts." Environment and Planning B7 no.4:409-62. Stiny, George. 1977. "Ice-Ray: A Note on the Generation of Chinese Lattice Designs." Environmental and Planning B4:89-98. Tan, Milton. 1989 "Saying What It Is by What It Is Like - Describing Shapes Using Line Relationships" Electronic Design Studio MIT Press. Wang, Ming-Huang. 1986. "Ways of Arrangement". Ph.D. dissertation, Graduate School of Architecture and Urban Planning, MIT. Zhao, Jian. 1990. "Towards a Hypermedia Approach of Data Organization in Building-Modeling CAD System". S.M.Arch.S Thesis, MIT. 91