1 / 24

Integrating Repast Library and Running RePast Examples using JBuilder X 07/19/2004

Integrating Repast Library and Running RePast Examples using JBuilder X 07/19/2004 . by Deddy Koesrindartoto Department of Economics Iowa State University. (2). Configuring RePast Library in Jbuilder X. Fig 1.A. (1).

maj
Télécharger la présentation

Integrating Repast Library and Running RePast Examples using JBuilder X 07/19/2004

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Integrating Repast Library and Running RePast Examples using JBuilder X07/19/2004 by Deddy Koesrindartoto Department of Economics Iowa State University

  2. (2) Configuring RePast Library in Jbuilder X Fig 1.A (1) To be able to be called in the program, we have to create references to RePast library. After launching Jbuilder, choose Tools | Configure Libraries (1) as shown in Fig. 1A. Configure Libraries dialog box, as in Fig. 1.B will appear. Select New button (2) New LibraryWizard as in Fig. 1.C will appear. Fill in Name and Location fields as shown (3). Then select Add to add this library to the JBuilderX (4). (3) (4) Fig 1.B Fig 1.C

  3. (3) Navigate through your file browser, and go to RePast-2.2/lib directory, and select the repast.jar file (1) and click the OK button (2). The New Library Wizard will look like Fig.2.B, then select the OK button (3). When Repast library is successfully added in Jbuilder, Configure Library dialog box will look like Fig. 2.C. Click OK to complete (4). (1) select repast.jar file (2) RePast library is successfully added Fig. 2.A (4) Fig. 2.B Fig. 2.C

  4. Download RePast source code examples Navigate to the following link: • http://www.courses.fas.harvard.edu/~gov2015/Tutorial/ Choose and download the source code of any example you want in a working directory. Proceed with unzipping the files.

  5. Running RePast examples using Jbuilder X IDE After launching Jbuilder, select File | Open Project (1)as shown in Fig.3.A.It will bring up to the Open Projector Project Group dialog box as shown in Fig. 3.B. Navigate through your file browser and select the working directory of the example that you downloaded and unzipped earlier and select the file with .jpx or .jpr extension (2). (In this tutorial I select GraphIPD.jar) Proceed by selecting OK button (3). (1) (2) (3) Fig. 3.A Fig. 3.B

  6. Errors, why ? Fig 4.

  7. (1) Incorporating Repast-2.2 Library to a project Errors are caused by an undefined library. To fix this, click Project | Project Properties from the main menu (1) Fig 5.

  8. Select the Required Libraries folder (1). The dialog box in Fig 6.A will show up. Select the Repast-2.0 library (with red letters) (2) and select Remove (3). (1) (4) (3) (5) Fig 6.A. (2) The next step is to incorporate the RePast-2.2 library into this project. Click Add (4) button in Fig 6.A. The dialog box as shown in Fig 6.B will appear. Select RePast-2.2 library (we defined earlier) (5), and click the OK button (6). Once this process done, the error messages shown in Fig 4. will disappear when the program is compiled and run. (6) Fig 6.B.

  9. Fig 7

  10. To compile and run this program, select ModelGUI.java(1)from the project pane click the right Mouse button, and select Run using GraphIPD (2). It will show the RePast standard GUI. An explanation of how to use the RePast GUI can be found in an earlier tutorial. (6/21/2004). It can be downloaded at : http://www.econ.iastate.edu/tesfatsi/RePastTutorial.I.DK.ppt

  11. Additional info on Jbuilder IDE A complete tutorial on JBuilder X can be freely downloaded as a zip file at: (this file is included in the commercial version but not in the Foundation version). ftp://ftpc.borland.com/pub/jbuilder/techpubs/jbuilderx/jbxpdfdocs_f.zip A “compact” explanation of how to use Jbuilder ver. 9.0 can be seen at Prof. Andrew Rau-Chaplin of Dalhousie University, Canada. http://www.cs.dal.ca/~arc/teaching/CS2110/Tutorials/introToJBuilderTutorial.htm I found “Learn Jbuilder” by Charlie Calvert and Margie Calvert, WordWare publishing, 2002, to be very easy to follow even for a beginner. Get it cheap at http://addall.com

  12. Gov 2015 Introduction to Computational Modeling for Social Scientists Most of these slides are taken from http://www.courses.fas.harvard.edu/~gov2015/ March 5, 2003 Lars-Erik Cederman

  13. Iterated Prisoner’s Dilemma • Cohen, Riolo, and Axelrod. 1999. “The Emergence of Social Organization in the Prisoner's Dilemma” (SFI Working Paper 99-01-002) http://www.santafe.edu/sfi/publications/99wplist.html • In The Evolution of Cooperation, Robert Axelrod (1984) created a computer tournament of IPD • cooperation sometimes emerges • Tit For Tat a particularly effective strategy

  14. Prisoner’s Dilemma Game Column: C D C 3,3 0,5 Row: D 5,0 1,1

  15. One-Step Memory Strategies Strategy = (i, p, q) i = prob. of cooperating at t = 0 p = prob. of cooperating if opponent cooperated q = prob. of cooperating if opponent defected C p Memory: C D q C D D t t-1

  16. The Four Strategies

  17. D D D D D D TFT meets ALLD Cumulated Payoff p=1; q=0 0 + 1 + 1 + 1 = 3 i=1 Row (TFT) C D C Column (ALLD) D i=0 1 5 + 1 + 1 + = 8 p=0; q=0 0 1 2 3 4 t

  18. Payoffs for 4 x 4 Strategies

  19. “Soup-like” topology In each time period, a player interacts with four other randomly selected players. ATFT ALLC ALLD ALLD TFT TFT ALLC

  20. Adaptation through imitation Imitation ATFT ALLC ALLD ALLD TFT TFT? ALLC Neighbors at t

  21. Initialization Setting parameters Object/ Entities Creation Creating players with different strategy Activities Sequencing resetPlayers();// Reset the agents’statistics interactions();// Let them interact with each other adaptation(); // Let them adapt reportResults();// Calculate and report some statistics Setup() buildModel() step()

  22. Public Access: My methods reset(); Protocols : play(int Time); remember(); Evaluations : getAveragePayoff(); addPayOff(); Adaptations : adapt(); updateType(); Private Access My attributes (data) PlayerID; Type; CumulPayoff; memory ; actions ; prefs; Type; newType; numPlays; otherList; etc. A Virtual Player

  23. HW : Add New Strategy

  24. Next Week : Get your hands dirty !!

More Related