ENGINEERING INFORMATICS ENGINEERING INFORMATICS FUNDAMENTALS OF COMPUTER-AIDED ENGINEERING Second Edition Benny Raphael NationalUniversityofSingapore,Singapore Ian F.C. Smith SwissFederalInstituteofTechnology(EPFL),Switzerland Thiseditionpublishedin2013 ©2013,JohnWiley&Sons,Ltd FirstEditionpublishedin2003 ©2003,JohnWiley&Sons,Ltd.Allrightsreserved. Registeredoffice JohnWiley&SonsLtd,TheAtrium,SouthernGate,Chichester,WestSussex,PO198SQ,UnitedKingdom Fordetailsofourglobaleditorialoffices,forcustomerservicesandforinformationabouthowtoapplyforpermissionto reusethecopyrightmaterialinthisbookpleaseseeourwebsiteatwww.wiley.com. TherightoftheauthortobeidentifiedastheauthorofthisworkhasbeenassertedinaccordancewiththeCopyright, DesignsandPatentsAct1988. Allrightsreserved.Nopartofthispublicationmaybereproduced,storedinaretrievalsystem,ortransmitted,inany formorbyanymeans,electronic,mechanical,photocopying,recordingorotherwise,exceptaspermittedbytheUK Copyright,DesignsandPatentsAct1988,withoutthepriorpermissionofthepublisher. Wileyalsopublishesitsbooksinavarietyofelectronicformats.Somecontentthatappearsinprintmaynotbeavailable inelectronicbooks. Designationsusedbycompaniestodistinguishtheirproductsareoftenclaimedastrademarks.Allbrandnamesand productnamesusedinthisbookaretradenames,servicemarks,trademarksorregisteredtrademarksoftheirrespective owners.Thepublisherisnotassociatedwithanyproductorvendormentionedinthisbook. LimitofLiability/DisclaimerofWarranty:Whilethepublisherandauthorhaveusedtheirbesteffortsinpreparingthis book,theymakenorepresentationsorwarrantieswithrespecttotheaccuracyorcompletenessofthecontentsofthis bookandspecificallydisclaimanyimpliedwarrantiesofmerchantabilityorfitnessforaparticularpurpose.Itissoldon theunderstandingthatthepublisherisnotengagedinrenderingprofessionalservicesandneitherthepublishernorthe authorshallbeliablefordamagesarisingherefrom.Ifprofessionaladviceorotherexpertassistanceisrequired,the servicesofacompetentprofessionalshouldbesought. LibraryofCongressCataloguing-in-PublicationData Raphael,B.(Benny) Engineeringinformatics/BennyRaphael,IanSmith.—Secondedition. pagescm Includesbibliographicalreferencesandindex. ISBN978-1-119-95341-8(cloth:alk.paper)1.Engineering–Dataprocessing.2.Artificial intelligence.3.Expertsystems(Computerscience)I.Smith,IanF.C.II.Title. TA345.R382013 620.00285—dc23 2013000149 AcataloguerecordforthisbookisavailablefromtheBritishLibrary. PrintISBN:978-1-119-95341-8 Setin10/12ptTimesbyLaserwordsPrivateLimited,Chennai,India. 1 2013 Contents Foreword to the First Edition xiii Preface to the Second Edition xvii Preface to the First Edition xix 1 Fundamental Logic and the Definition of Engineering Tasks 1 1.1 Three Types of Inference 1 1.2 Engineering Tasks 3 1.3 A Model of Information and Tasks 5 1.4 Another Task Definition 8 1.5 The Five Orders of Ignorance 9 1.6 Summary 9 Exercises 10 References 10 2 Algorithms and Complexity 11 2.1 Algorithms and Execution Time of Programs 12 2.1.1 Program Execution Time versus Task Size 12 2.2 ‘Big Oh’ Notation 14 2.2.1 Definition of the Big Oh Notation 15 2.2.2 Big Oh and Tightness of Bound 16 2.2.3 Classification of Functions 20 2.2.4 Examples 21 2.2.5 Tractability and Algorithm Optimality 30 2.3 Practical Methods for Determining the Complexity of Algorithms 30 2.4 P, NP and NP-Completeness 34 2.4.1 Zero–One Integer Programming (ZOIP) Problem 35 2.4.2 Classes of NP-Complete Problems 36 2.5 Summary 37 Exercises 37 Reference 40 Further Reading 40 vi Contents 3 Data Structures 41 3.1 Introduction 41 3.2 Definitions 42 3.3 Derived Data Types 42 3.3.1 Examples of Derived Data Types 43 3.3.2 User-Defined Data Types 45 3.4 Abstract Data Types 46 3.4.1 Linked Lists 47 3.4.2 Graphs 50 3.4.3 Trees 52 3.4.4 Stacks 56 3.4.5 Queues 60 3.5 An Example: Conceptual Structural Design of Buildings 63 3.6 Network Science 70 3.6.1 Types of Networks 71 3.7 Hashing 73 3.8 Summary 74 Exercises 74 Further Reading 79 4 Object Representation and Reasoning 81 4.1 Introduction 81 4.2 Grouping Data and Methods 82 4.3 Definitions and Basic Concepts 83 4.3.1 Classes and Objects 83 4.3.2 Object-Oriented Programming (OOP) 84 4.3.3 Messages 84 4.4 Important Characteristics of Objects 84 4.4.1 Encapsulation of Data and Methods 84 4.4.2 Message-Passing Mechanism 85 4.4.3 Abstraction Hierarchy 86 4.4.4 Secondary Features of Object Representation 88 4.4.5 Decomposition versus Abstraction 89 4.5 Applications Outside Programming 90 4.5.1 Knowledge Representation 91 4.5.2 User Interfaces 91 4.5.3 Off-the-Shelf Components 91 4.5.4 Product Models 91 4.6 An Object-Oriented Design Methodology 93 4.6.1 Single versus Multiple Inheritance 93 4.6.2 Message-Passing Architecture 94 4.7 Summary 95 Exercises 95 References 101 Further Reading 101 Contents vii 5 Database Concepts 103 5.1 Introduction 103 5.2 Basic Concepts 104 5.2.1 Initial Definitions 104 5.2.2 Evolution of Types of Databases 104 5.2.3 The Three-Level Architecture 106 5.3 Relational Database Systems 106 5.3.1 The Relational Model 107 5.3.2 Limitations of Relational Databases 111 5.3.3 Accessing Data in Relational Databases 112 5.4 Relational Database Design 114 5.4.1 First Normal Form 114 5.4.2 Second Normal Form 115 5.4.3 Third Normal Form 118 5.4.4 Boyce-Codd and Higher Normal Forms 119 5.4.5 Importance of Database Design 120 5.5 Transaction Processing 120 5.5.1 Definition of Transaction 121 5.5.2 Implementing Transactions 122 5.5.3 Properties of Transactions 124 5.6 Other Types of Database 124 5.6.1 Object-Oriented Databases 124 5.6.2 Geographical Databases 124 5.6.3 Multimedia Database Systems 125 5.6.4 Distributed Databases 125 5.7 Summary 126 Exercises 127 Reference 131 Further Reading 131 6 Computational Mechanics 133 6.1 Introduction 133 6.1.1 Challenges of Computational Mechanics 134 6.2 From Physical Principles to Practical Systems 135 6.3 Methods for Finding Solutions 137 6.3.1 Galerkin Method 137 6.3.2 Remarks 139 6.4 Issues in Computer-Aided Engineering 139 6.4.1 Accuracy 140 6.4.2 Speed 141 6.4.3 User Interaction 142 6.5 Summary 142 References 142 Further Reading 142 viii Contents 7 Constraint-Based Reasoning 143 7.1 Introduction 143 7.2 Terminology 145 7.3 Constraint-Solving Methods 146 7.3.1 Levels of Consistency for Label Propagation 147 7.3.2 Global Consistency in Label Propagation 148 7.3.3 Constraint Propagation 149 7.4 Reasoning with Constraints on Discrete Variables 149 7.4.1 CSP Complexity for Discrete Variables 151 7.5 Reasoning with Constraints on Continuous Variables 151 7.5.1 Constraint-Based Support for Collaborative Work 152 7.6 Summary 156 References 156 8 Optimization and Search 157 8.1 Introduction 157 8.2 Basic Concepts 158 8.2.1 Types of Optimization Problem 160 8.2.2 Formulating Optimization Tasks 161 8.2.3 Representing Search Spaces 163 8.2.4 Representing Constraints 164 8.2.5 Some Optimization Problems 165 8.3 Classification of Methods 167 8.4 Deterministic Optimization and Search 169 8.4.1 Special Cases 169 8.4.2 Deterministic Methods 174 8.5 Stochastic Methods 179 8.5.1 Pure Global Random Search 182 8.5.2 Local Search with Multiple Random Starts 182 8.5.3 Simulated Annealing 182 8.5.4 Genetic Algorithms 184 8.5.5 Controlled Random Search 184 8.5.6 PGSL 185 8.6 A Closer Look at Genetic Algorithms 188 8.6.1 Representation: Genetic Encoding 188 8.6.2 Evaluating an Individual 189 8.6.3 Creating the Initial Population 189 8.6.4 The Fitness Function 190 8.6.5 Reproduction 190 8.6.6 Mutation 192 8.7 Summary of Methods 192 Exercises 193 References 198 Further Reading 198