Brahms Tutorial

Brahms Tutorial

-

Documents
171 pages
Lire
Le téléchargement nécessite un accès à la bibliothèque YouScribe
Tout savoir sur nos offres

Description


Brahms Tutorial

TM01-0002
Version 1.2
30 March 2011


Printed on: This is an uncontrolled copy when printed.
3/31/11 3:08 PM
NOTICE: Not for use or disclosure outside of NASA Ames Research Center except under written agreement.
© 2001-2011 NASA Ames Research Center. All Rights Reserved.

Technical Memorandum
TM01-0002

BRAHMS TUTORIAL



VERSION 1.2

CONTACT

Brahms Contact
William Clancey – Project Lead (650) 604-2526





ABSTRACT
This document is a guide to programming in Brahms, an agent-oriented modeling language.

DATE: 30 March 20
KEYWORDS: Brahms, Tutorial

This document has not been reviewed by the Intellectual Property Organization.
Printed on: This is an uncontrolled copy when printed.
3/31/11 3:08 PM Refer to the NX Brahms location for the latest version.
NOTICE: Not for use or disclosure outside of NASA Ames Research Center except under written agreement.
© 2001-2011 NASA Ames Research Center. All Rights Reserved.
Brahms Tutorial Version 1.2 Page iii
TM01-0002 3/31/2011 Prologue
CONTRIBUTORS

Alessandro Acquisti
William J. Clancey
Ron van Hoof
Mike Scott
Maarten Sierhuis





Printed on: This is an uncontrolled copy when printed.
3/31/11 3:08 PM Refer to the NX Brahms location for the latest version.
NOTICE: Not for use or disclosure outside of NASA Ames Research Center except under written agreement.
© 2001-2011 NASA Ames Research Center. All Rights Reserved.
Brahms Tutorial ...

Sujets

Informations

Publié par
Nombre de visites sur la page 156
Langue English
Signaler un problème
Brahms Tutorial TM01-0002 Version 1.2 30 March 2011 Printed on: This is an uncontrolled copy when printed. 3/31/11 3:08 PM NOTICE: Not for use or disclosure outside of NASA Ames Research Center except under written agreement. © 2001-2011 NASA Ames Research Center. All Rights Reserved. Technical Memorandum TM01-0002 BRAHMS TUTORIAL VERSION 1.2 CONTACT Brahms Contact William Clancey – Project Lead (650) 604-2526 ABSTRACT This document is a guide to programming in Brahms, an agent-oriented modeling language. DATE: 30 March 20 KEYWORDS: Brahms, Tutorial This document has not been reviewed by the Intellectual Property Organization. Printed on: This is an uncontrolled copy when printed. 3/31/11 3:08 PM Refer to the NX Brahms location for the latest version. NOTICE: Not for use or disclosure outside of NASA Ames Research Center except under written agreement. © 2001-2011 NASA Ames Research Center. All Rights Reserved. Brahms Tutorial Version 1.2 Page iii TM01-0002 3/31/2011 Prologue CONTRIBUTORS Alessandro Acquisti William J. Clancey Ron van Hoof Mike Scott Maarten Sierhuis Printed on: This is an uncontrolled copy when printed. 3/31/11 3:08 PM Refer to the NX Brahms location for the latest version. NOTICE: Not for use or disclosure outside of NASA Ames Research Center except under written agreement. © 2001-2011 NASA Ames Research Center. All Rights Reserved. Brahms Tutorial Version 1.2 Page iv TM01-0002 3/31/2011 Prologue APPROVED William Clancey Date Project Lead Printed on: This is an uncontrolled copy when printed. 3/31/11 3:08 PM Refer to the NX Brahms location for the latest version. NOTICE: Not for use or disclosure outside of NASA Ames Research Center except under written agreement. © 2001-2011 NASA Ames Research Center. All Rights Reserved. Brahms Tutorial Version 1.2 Page v TM01-0002 3/31/2011 Prologue Revision History Version Contact Action Version 0.1 Draft Alessandro Acquisti New Initial draft. 02/01/2001 510/823-5008 Version 0.2 Draft Alessandro Acquisti Add Added sections Q&A and proposed schedule of Tutorial. 02/21/2001 510/823-5008 Version 0.4 Draft Alessandro Acquisti Add, Extensive revision of structure and content. Added 03/15/2001 Change material from: 1) Maarten Sierhuis‘s PhD thesis; 2) 510/823-5008 Brahms Language Specification TM99-0008; 3) Brahms Installation readme.txt file; 4) Brahms 2001 TM01-0001 Project Plan. Added initial code. Version 0.5 Draft Alessandro Acquisti Change Extensive revision of structure and content. Revised 03/29/2001 chapter 4, sections 1-4 510/823-5008 Version 0.6 Draft Alessandro Acquisti Change Extensive revision of structure and content. Revised 04/01/2001 chapter 4, sections 5 et seq. 510/823-5008 Version 0.7 Draft Alessandro Acquisti Add, Added tutorial code and discussion to chapter 4. 04/10/2001 Change 510/823-5008 Version 0.8 Draft Alessandro Acquisti Add, Added links to Tutorial Files. 04/15/2001 Change 510/823-5008 Cleaned up various sections after Ron‘s comments Version 0.9 Draft Alessandro Acquisti Add, Added Bill, Maarten, Ron, and Charis‘ comments. 04/17/2001 Change General revision and updates. 510/823-5008 Version 0.9.4 Request Alessandro Acquisti Add, Added hyperlinks, index. Changed color and format for for Comments Change code sections, figures, tables. Edited ‗Validation‘ 510/823-5008 05/12/2001 chapter. Added new links to code. Version 0.9.5 Request Alessandro Acquisti Change General clean-up. Modified sections to reflect transition for Comments from SimAgent 1.0 to Agent Environment. 510/823-5008 05/26/2001 Version 0.9.6 Request Alessandro Acquisti Change Added new screenshot figures and corrected some for Comments areas. 510/823-5008 06/12/2001 Actions Taken are: New = new document, Add/Delete/Change = a section or topic has been added, or deleted, or changed. Printed on: This is an uncontrolled copy when printed. 3/31/11 3:08 PM Refer to the NX Brahms location for the latest version. NOTICE: Not for use or disclosure outside of NASA Ames Research Center except under written agreement. © 2001-2011 NASA Ames Research Center. All Rights Reserved. Brahms Tutorial Version 1.2 Page vi TM01-0002 3/31/2011 Prologue Version Contact Action Version 0.9.7 Request Alessandro Acquisti Add Added Ron‘s answers to language questions from for Comments Brahms Forums. 510/823-5008 06/25/2001 Version 0.9.8 Request Alessandro Acquisti Add, Added reference section. Changed Agent Viewer for Comments Change description. Changed other parts in response to 510/823-5008 06/30/2001 comments and suggestions from test-users. Version 0.9.9 Request Maarten Sierhuis Add, Made changes and added details in several sections. for Comments Change 510/604-4917 07/11/2001 Version 0.9.9.4 Request Alessandro Acquisti Add, Added new material originated from feedback of new for Comments Change Brahms users. Extensively revised previous material. 510/823-5008 07/11/2001 Adapted code. Altered the structure and order of Chapters 2 and 3. Version 0.9.9.5 Request Alessandro Acquisti Add, Corrected typos in various sections and inserted for Comments Change Composer description. 510/823-5008 01/01/2003 Version 1.0 Alessandro Acquisti Add, General clean up and revision. Change 07/01/2003 510/823-5008 Version 1.1 Bin Zhang, Add, Updated to conform to new Brahms Composer. New 10/24/2005 Change language specifications *not* yet added. Alessandro Acquisti Version 1.2 Ron van Hoof Change Updated to conform to new Brahms Agent Environment. 3/30/2011 New language specifications *not* yet added. Actions Taken are: New = new document, Add/Delete/Change = a section or topic has been added, or deleted, or changed. Printed on: This is an uncontrolled copy when printed. 3/31/11 3:08 PM Refer to the NX Brahms location for the latest version. NOTICE: Not for use or disclosure outside of NASA Ames Research Center except under written agreement. © 2001-2011 NASA Ames Research Center. All Rights Reserved. Brahms Tutorial Version 1.2 Page vii TM01-0002 3/31/2011 Prologue TABLE OF CONTENTS 1. INTRODUCTION ................................................................................................................................ 1-1 1.1 PURPOSE ...... 1-1 1.2 INTENDED AUDIENCE ...................... 1-2 1.3 DOCUMENT SUMMARY .................................................................................................................... 1-2 1.4 DOCUMENT CONVENTIONS ............. 1-2 1.5 ACKNOWLEDGEMENTS ................... 1-2 1.6 CONTACTS AND HELP..................... 1-3 2. OVERVIEW OF BRAHMS AND THE ATM SCENARIO .................................................................... 2-4 2.1 WHAT IS BRAHMS? AN INTRODUCTION TO ITS THEORETICAL FOUNDATIONS AND CONCEPTS ............. 2-4 2.2 ANATOMY OF A BRAHMS MODEL: THE ATM SCENARIO ..... 2-6 2.3 OBJECT-ORIENTED PROGRAMMING AND BRAHMS ............................................................................ 2-9 2.3.1 The Atm case in object-oriented programming .... 2-9 2.3.2 The Atm case in Brahms .................................... 2-10 3. INSTALLATION AND COMPONENTS ............................................................ 3-13 3.1 BRAHMS OVERVIEW ..................................................................................... 3-13 3.2 INSTALLATION .............................. 3-13 3.2.1 Installing Brahms Agent Environment ................................................ 3-13 3.2.2 Installing MySQL ................. 3-14 3.2.3 Installing the License File ................................................................... 3-14 3.2.4 Choosing the Brahms Model Directory ............... 3-15 3.2.5 The Atm Files ..................................................................................................................... 3-15 3.2.6 To Summarize: What you Will Need .................. 3-16 3.3 DESCRIPTION OF COMPONENTS ................................................................................................... 3-16 3.3.1 Introduction: The Life of a Brahms Simulation ... 3-16 3.3.2 The Brahms Composer: Opening, Creating, and Building a Model ... 3-17 3.3.3 The Brahmsposer and the Virtual Machine: running a Model .... 3-24 3.3.4 Brahms Agent Viewer ......................................................................................................... 3-26 3.4 SUMMARY OF STEPS .................... 3-30 3.5 A NOTE ON DEBUGGING… ........... 3-31 3.6 KNOWN BUGS IN BRAHMS AGENT ENVIRONMENT .......... 3-31 3.7 CONTACTING THE BRAHMS PROJECT TEAM FOR TECHNICAL SUPPORT........................................... 3-31 3.8 OTHER IMPORTANT DOCUMENTS .................................................................. 3-32 3.9 LATEST CHANGES ........................................................ 3-32 3.10 DOCUMENT INDEX .................................................... 3-33 4. ATM SCENARIO .............................. 4-34 4.1 STRUCTURE OF THE SCENARIO ..................................................................................................... 4-35 4.2 EXPECTATIONS AND GOALS .......... 4-35 4.3 LESSON I: GETTING STARTED ....... 4-37 4.3.1 Introduction ......................................................................................................................... 4-37 4.3.2 Task .................................... 4-37 4.3.3 Description: compilation unit ............................... 4-37 4.3.4 Tutorial 4-38 Printed on: This is an uncontrolled copy when printed. 3/31/11 3:08 PM Refer to the NX Brahms location for the latest version. NOTICE: Not for use or disclosure outside of NASA Ames Research Center except under written agreement. © 2001-2011 NASA Ames Research Center. All Rights Reserved. Brahms Tutorial Version 1.2 Page viii TM01-0002 3/31/2011 Prologue 4.3.5 Syntax ................................................................................................................................. 4-40 4.4 LESSON II: GEOGRAPHY ............... 4-41 4.4.1 Introduction ......................... 4-41 4.4.2 Task .... 4-41 4.4.3 Description .......................................................................................................................... 4-41 4.4.4 Syntax ................................. 4-42 4.4.5 Tutorial 4-43 4.5 LESSON III: GROUPS, AGENTS AND ATTRIBUTES ........................................... 4-49 4.5.1 Introduction ......................................................................................... 4-49 4.5.2 Task .................................................................... 4-49 4.5.3 Description .......................... 4-49 4.5.4 Syntax . 4-53 4.5.5 Tutorial ................................................................ 4-54 4.6 LESSON IV: FACTS AND BELIEFS .................................................................. 4-58 4.6.1 Introduction ......................... 4-58 4.6.2 Task .... 4-58 4.6.3 Description .......................................................................................... 4-58 4.6.4 Syntax ................................................................. 4-60 4.6.5 Tutorial 4-60 4.7 LESSON V: WORKFRAMES AND PRIMITIVE ACTIVITIES .... 4-64 4.7.1 Introduction ......................................................................................... 4-64 4.7.2 Task .................................................................... 4-64 4.7.3 Description .......................... 4-64 4.7.4 Syntax . 4-73 4.7.5 Tutorial ................................................................ 4-74 4.8 LESSON VI: CLASSES, OBJECTS AND RELATIONS .......................................... 4-88 4.8.1 Introduction ......................................................... 4-88 4.8.2 Task .... 4-88 4.8.3 Description .......................................................................................... 4-88 4.8.4 Syntax ................................. 4-91 4.8.5 Tutorial ................................ 4-91 4.9 LESSON VII: THOUGHTFRAMES AND OTHER ACTIVITIES ............................... 4-100 4.9.1 Introduction ....................................................................................... 4-100 4.9.2 Task .................................. 4-100 4.9.3 Description ........................................................ 4-100 4.9.4 Syntax ............................... 4-102 4.9.5 Tutorial .............................................................................................. 4-103 4.10 LESSON VIII: VARIABLES ........................................................................ 4-108 4.10.1 Introduction ....................................................... 4-108 4.10.2 Task .. 4-108 4.10.3 Description ........................................................................................ 4-108 4.10.4 Syntax ............................... 4-111 4.10.5 Tutorial .............................................................. 4-111 4.11 LESSON IX: COMPOSITE ACTIVITIES ........................ 4-117 4.11.1 Introduction ....................................................................................... 4-117 4.11.2 Task .................................. 4-117 4.11.3 Description ........................................................ 4-117 4.11.4 Syntax ............................... 4-119 4.11.5 Tutorial .............................................................................................. 4-120 4.12 LESSON X: MULTI-AGENT, RANDOMNESS, AND COMPLEX INTERACTIONS ................................. 4-125 4.12.1 Introduction ....................................................... 4-125 Printed on: This is an uncontrolled copy when printed. 3/31/11 3:08 PM Refer to the NX Brahms location for the latest version. NOTICE: Not for use or disclosure outside of NASA Ames Research Center except under written agreement. © 2001-2011 NASA Ames Research Center. All Rights Reserved. Brahms Tutorial Version 1.2 Page ix TM01-0002 3/31/2011 Prologue 4.12.2 Task .................................................................................................................................. 4-125 4.12.3 Description ........................ 4-125 4.12.4 Syntax ............................... 4-133 4.12.5 Tutorial .............................. 4-134 4.13 LESSON XI: DETECTABLES, PRIORITIES AND THE COMPLETE SCENARIO ................................... 4-136 4.13.1 Introduction ....................................................................................................................... 4-136 4.13.2 Task .. 4-136 4.13.3 Description ........................ 4-137 4.13.4 Syntax ............................... 4-140 4.13.5 Tutorial .............................................................................................................................. 4-141 4.14 CONCLUDING ISSUES .............................................................................................................. 4-145 4.14.1 How to build your next model ........................... 4-145 4.14.2 Debugging tips .................. 4-146 4.14.3 Validation .......................................................................................................................... 4-147 4.14.4 Further issues and exercises 4-147 5. VALIDATION .................................. 5-149 5.1 MODELING WORK PRACTICE ...................................................................... 5-149 5.2 COMPUTATIONAL MODELS IN SIMULATION ................................................... 5-150 5.3 TYPES OF MODELING SYSTEMS .. 5-151 5.4 VERIFICATION AND VALIDATION................................... 5-153 5.4.1 The purpose of verification and validation ........................................ 5-153 5.4.2 The verification and validation process ............ 5-154 5.4.3 Data validation .................................................................................. 5-155 5.4.4 Conceptual model validation ............................................................ 5-155 5.4.5 Experimentation validation ............................... 5-158 6. INDEX ............................................................................. 6-159 7. REFERENCES AND OTHER LINKS ............................................................................................. 7-161 Printed on: This is an uncontrolled copy when printed. 3/31/11 3:08 PM Refer to the NX Brahms location for the latest version. NOTICE: Not for use or disclosure outside of NASA Ames Research Center except under written agreement. © 2001-2011 NASA Ames Research Center. All Rights Reserved. Brahms Tutorial Version 1.2 Page x TM01-0002 3/31/2011 Prologue FIGURES FIGURE 1 - THE COMPOSER: THE GRAPHIC INTERFACE ................................................................................ 3-18 FIGURE 2 - THE COMPOSER: THE INTERNAL TEXT EDITOR ............ 3-19 FIGURE 3 - OPENING THE COMPOSER ......................................... 3-20 FIGURE 4 - IMPORTING THE ATM COMPLETE SCENARIO IN THE COMPOSER .................................................... 3-21 FIGURE 5. SELECT A HISTORY FILE TO PARSE IN THE AGENT VIEWER ............................ 3-27 FIGURE 6. CREATING HISTORY DATABASE .................................................................................................... 3-27 FIGURE 7. PARSING HISTORY FILE INTO HISTORY DATABASE ......... 3-27 FIGURE 8. AGENT VIEWER APPLICATION – AS OF JULY 2004 ........ 3-28 FIGURE 9. ATMMODEL.B IN NOTEPAD .......................................................................................................... 4-39 FIGURE 10 - CREATING GEOGRAPHY AREAS IN THE COMPOSER .... 4-43 FIGURE 11. BELIEFS AND FACTS VENN DIAGRAM .......................................................................................... 4-60 FIGURE 12. THE SIMULATION ENGINE (VIRTUAL MACHINE) ........................................................................... 4-78 FIGURE 13. THE AGENT VIEWER AND THE ATM SCENARIO ........... 4-80 FIGURE 14. THE FIRST ACTIVITY IN THE AGENT VIEWER .............. 4-81 FIGURE 15. THE EXPLANATION FACILITY IN THE AGENT VIEWER ................................................................... 4-82 FIGURE 16. MORE COMPLEX ACTIVITIES ..................................... 4-86 FIGURE 17. THE AGENT VIEWER AND OTHER ACTIVITIES ............................................................................. 4-99 FIGURE 18. WORKFRAME-ACTIVITY HIERARCHY ........................ 4-118 FIGURE 19. STATE-TRANSITION DIAGRAM FOR FRAME INSTANTIATIONS ....................................................... 4-129 FIGURE 20. MULTI-TASKING IN BRAHMS ..................................................................... 4-133 FIGURE 21 - A SCREENSHOT FROM THE COMPLETE ATM SCENARIO ............................. 4-144 FIGURE 22 - A ZOOM IN OF THE COMPLETE ATM SCENARIO ......................................... 4-144 FIGURE 23. SIMULATION MODEL VERIFICATION AND VALIDATION IN THE MODELING PROCESS (BORROWED FROM (ROBINSON, 1999)) ........................................................................................................................... 5-155 FIGURE 24. AN EXAMPLE OF CONCEPTUAL MODEL FOR THE SIMULATION OF AN APOLLO MISSION ............... 5-156 FIGURE 25. BRAHMS COMPILE-DEBUG CYCLE 5-157 FIGURE 26. BRAHMS MODEL DEVELOPMENT CYCLE .................................................................................. 5-157 FIGURE 27 BLACK-BOX VALIDATION: COMPARISON WITH THE REAL SYSTEM (FROM (ROBINSON, 1994)) ........ 5-158 Printed on: This is an uncontrolled copy when printed. 3/31/11 3:08 PM Refer to the NX Brahms location for the latest version. NOTICE: Not for use or disclosure outside of NASA Ames Research Center except under written agreement. © 2001-2011 NASA Ames Research Center. All Rights Reserved.