Evaluation and Implementation of Match Algorithms for Rule-Based Multi-Agent Systems Using the Example of Jadex
Total Page:16
File Type:pdf, Size:1020Kb
Universität Hamburg Fakultät für Mathematik, Informatik und Naturwissenschaften Evaluation and Implementation of Match Algorithms for Rule-based Multi-Agent Systems using the Example of Jadex Master's Thesis Diplomarbeit Eryk Lagun [email protected] Studiengang Informatik Matrikelnummer: 5318142 Fachsemester: 16 Erstgutachter: Dr. Lars Braubach Zweitgutachter: Dr. Guido Gryczan Contents 1 Introduction.....................................................................................................1 1.1 Motivation and Goals....................................................................................................1 1.2 Context and Scope.........................................................................................................2 1.3 Intended Readers........................................................................................................... 4 1.4 Outline ........................................................................................................................... 4 2 Background......................................................................................................6 2.1 Rule-based Systems....................................................................................................... 6 2.1.1 Definition............................................................................................................ 7 2.1.2 Rule Execution................................................................................................... 8 2.1.3 Recognize-Act Cycle..........................................................................................8 2.1.4 Rule Representation Example ............................................................................ 9 2.1.5 Control Flow and Conflict Resolution Strategies............................................. 10 2.1.6 Rule-based Programming .................................................................................11 2.2 Multi-Agent Systems................................................................................................... 12 2.2.1 Definition.......................................................................................................... 12 2.2.2 Mentalistic Notions.......................................................................................... 13 2.2.3 Agents and Objects...........................................................................................14 2.3 Jadex ............................................................................................................................ 14 2.4 Summary...................................................................................................................... 15 3 Match Algorithms .........................................................................................17 3.1 The Match Problem.....................................................................................................17 3.1.1 Rule Satisfaction Testing.................................................................................. 18 3.1.2 Naive Approach................................................................................................20 3.1.3 Analogy to Relational Databases......................................................................20 3.2 Improving the Match ...................................................................................................20 3.2.1 Exploiting Static Information...........................................................................21 3.2.2 Exploiting Temporal Redundancy....................................................................21 3.2.3 Exploiting Structural Similarity .......................................................................22 3.3 State Supports.............................................................................................................. 22 3.3.1 Types of State Supports....................................................................................22 3.3.2 State Support Combinations .............................................................................23 3.3.3 McDermott's Conjecture...................................................................................24 3.4 Description of the Match Algorithms..........................................................................24 3.4.1 The Rete Algorithm Example...........................................................................24 3.4.2 Eager Evaluation Algorithms ........................................................................... 27 3.4.3 Lazy Evaluation Algorithms.............................................................................29 3.4.4 Binding Space Algorithms................................................................................ 30 3.5 Problems of Match Algorithms ...................................................................................31 3.5.1 Low Temporal Redundancy ............................................................................. 31 3.5.2 Cross-Product Effect........................................................................................ 32 3.5.3 Long-Chain Effect............................................................................................ 32 3.5.4 Utility Problem................................................................................................. 32 3.6 Optimizations for Match Algorithms ..........................................................................32 3.6.1 Rule Condition Reordering............................................................................... 33 3.6.2 Fine-Grained Indexing...................................................................................... 35 3.7 Summary...................................................................................................................... 36 4 Evaluation......................................................................................................38 4.1 Comparison of the Algorithms ....................................................................................38 4.1.1 Rete versus Treat..............................................................................................38 4.1.2 Lazy Evaluation and Binding Space Algorithms .............................................40 4.1.3 Problems of the Results ....................................................................................41 4.1.4 Conclusions ...................................................................................................... 42 4.2 Analysis of the Jadex Rule System .............................................................................43 4.2.1 Measurements of Structural Properties ............................................................43 4.3 Match Algorithm Classification Scheme.....................................................................45 4.3.1 Space Complexity and Benefits of State Supports ...........................................46 4.3.2 The Classes Recomputing and State-saving..................................................... 47 4.3.3 Advantages and Disadvantages of each Class.................................................. 48 4.4 Evaluation of the Algorithms for Jadex.......................................................................50 4.4.1 Pre-Selection of the Algorithms .......................................................................50 4.4.2 Choice of the Algorithm...................................................................................50 4.4.3 Performance Expectations................................................................................ 52 4.5 Summary...................................................................................................................... 53 5 Implementation .............................................................................................55 5.1 The Jadex Rule System Design ...................................................................................55 5.1.1 Representation of the State............................................................................... 55 5.1.2 Representation of the Rules.............................................................................. 57 5.1.3 Interfaces to the Match Algorithms..................................................................57 5.2 Detailed Description of the Algorithm ........................................................................ 58 5.2.1 Match Processing.............................................................................................. 59 5.2.2 Dynamic Join Ordering .................................................................................... 61 5.3 Implementation of the Algorithm................................................................................61 5.3.1 Preliminaries.....................................................................................................62 5.3.2 Abstract Program Code .................................................................................... 63 5.3.3 The Index Structures.........................................................................................66 5.3.4 The State Supports............................................................................................67 5.3.5 Representation and Evaluation of Constraints .................................................68 5.3.6 Implementation of the Joins .............................................................................70 5.3.7 Implementation of Negation.............................................................................77