Prof. Dr. Lars-Erik Cederman ETH - Center for Comparative and International Studies (CIS) Seilergraben 49, Room G.2,

Slides:



Advertisements
Similar presentations
Tutorial 1 Ata Kaban School of Computer Science University of Birmingham.
Advertisements

Based on Java Software Development, 5th Ed. By Lewis &Loftus
Core Java Lecture 4-5. What We Will Cover Today What Are Methods Scope and Life Time of Variables Command Line Arguments Use of static keyword in Java.
Programming Paradigms and languages
Software Engineering Implementation Lecture 3 ASPI8-4 Anders P. Ravn, Feb 2004.
CS18000: Problem Solving and Object-Oriented Programming.
L3:CSC © Dr. Basheer M. Nasef Lecture #3 By Dr. Basheer M. Nasef.
J-Unit Framework.
1 Chapter 8 Objects and Classes Lecture 2 Prepared by Muhanad Alkhalisy.
INTERFACES IN JAVA 1.Java Does not support Multiple Inheritance directly. Multiple inheritance can be achieved in java by the use of interfaces. 2.We need.
1 Microsoft Access 2002 Tutorial 9 – Automating Tasks With Macros.
Further abstraction techniques Abstract classes and interfaces 5.0.
CITS4403 Computational Modelling Agent Based Models.
New Mexico Computer Science for All Agent-based modeling By Irene Lee December 27, 2012.
Programming for Social Scientists Lecture 4 UCLA Political Science 209-1: Programming for Social Scientists Winter 1999 Lars-Erik Cederman & Benedikt Stefansson.
Coye Cheshire & Andrew Fiore June 19, 2015 // Computer-Mediated Communication Iterated Prisoner’s Dilemma.
School of Computing Science CMT1000 Ed Currie © Middlesex University Lecture 4: 1 CMT1000: Introduction to Programming Ed Currie Lecture 5a: Input and.
Department of Computer Science What is NetLogo UH-DMML  Multi-agent programmable modeling environment  Well suited for modeling complex systems evolving.
What is R By: Wase Siddiqui. Introduction R is a programming language which is used for statistical computing and graphics. “R is a language and environment.
ABM: Frameworks Dr Andy Evans. ABM Frameworks What are they? Pieces of software to help people build ABMs. Often offer the functions outlined. Wide range.
Lesson 5 – Looking at the Output MATSim Tutorial, 2011, Shanghai 1.
Design of Bio-Medical Virtual Instrumentation Tutorial 1.
ABM Frameworks Dr Andy Evans With additions from Dr Nick Malleson.
Applets, AWTS CompSci 230 Software Construction.
20-753: Fundamentals of Web Programming Copyright © 1999, Carnegie Mellon. All Rights Reserved. 1 Lecture 16: Java Applets & AWT Fundamentals of Web Programming.
Department of Telecommunications MASTER THESIS Nr. 610 INTELLIGENT TRADING AGENT FOR POWER TRADING BASED ON THE REPAST TOOLKIT Ivana Pranjić.
Prof. Lars-Erik Cederman Center for Comparative and International Studies (CIS) Seilergraben 49, Room G.2, Nils Weidmann,
Object Oriented Programming Lecture 8: Introduction to laboratorial exercise – part II, Introduction to GUI frames in Netbeans, Introduction to threads.
Applets and Frames CS 21a: Introduction to Computing I First Semester,
Advanced Computational Modeling of Social Systems Lars-Erik Cederman and Luc Girardin Center for Comparative and International Studies (CIS) Swiss Federal.
Lecture 2 Object Oriented Programming Basics of Java Language MBY.
L – Modelling and Simulating Social Systems with MATLAB Lesson 5 – Introduction to agent-based simulations A. Johansson & W. Yu ©
Spring 2008 Mark Fontenot CSE 1341 Principles of Computer Science I Note Set 2.
Introduction to Computational Modeling of Social Systems Prof. Lars-Erik Cederman Center for Comparative and International Studies (CIS) Seilergraben 49,
 Executes a block of code repeatedly  A condition controls how often the loop is executed  Most commonly, the statement is a block statement (set of.
Introduction to Computational Modeling of Social Systems Prof. Lars-Erik Cederman Center for Comparative and International Studies (CIS) Seilergraben 49,
Dale Roberts GUI Programming using Java - Introduction Dale Roberts, Lecturer Computer Science, IUPUI Department of Computer.
Tutorial 1 Running JADE Under Eclipse Dr. Fuhua Lin School of Computing and Information Systems Athabasca University, Alberta, Canada Oct. 27, 2009.
Even-Driven Programming and basic Graphical User Interface.
Prof. Dr. Lars-Erik Cederman Swiss Federal Institute of Technology (ETH) Center for Comparative and International Studies (CIS) Seilergraben 49, Room G.2.
Introduction to Computational Modeling of Social Systems Prof. Lars-Erik Cederman Center for Comparative and International Studies (CIS) Seilergraben 49,
Introduction to Computational Modeling of Social Systems Prof. Lars-Erik Cederman Center for Comparative and International Studies (CIS) Seilergraben 49,
Prof. Lars-Erik Cederman ETH - Center for Comparative and International Studies (CIS) Seilergraben 49, Room G.2, Nils.
COP INTERMEDIATE JAVA Designing Classes. Class Template or blueprint for creating objects. Their definition includes the list of properties (fields)
The "8 Queens" problem Consider the problem of trying to place 8 queens on a chess board such that no queen can attack another queen. What are the "choices"?
Introduction to Computational Modeling of Social Systems Prof. Lars-Erik Cederman Center for Comparative and International Studies (CIS) Seilergraben 49,
Introduction to Computational Modeling of Social Systems Prof. Lars-Erik Cederman Center for Comparative and International Studies (CIS) Seilergraben 49,
CMSC 150 METHODS AND CLASSES CS 150: Wed 25 Jan 2012.
CMSC 150 METHODS AND CLASSES CS 150: Wed 25 Jan 2012.
Introduction to Computational Modeling of Social Systems Prof. Lars-Erik Cederman Center for Comparative and International Studies (CIS) Seilergraben 49,
PROGRAMMING TESTING B MODULE 2: SOFTWARE SYSTEMS 22 NOVEMBER 2013.
Introduction to Computational Modeling of Social Systems Prof. Lars-Erik Cederman Center for Comparative and International Studies (CIS) Seilergraben 49,
Introduction to Computational Modeling of Social Systems Nils Weidmann Center for Comparative and International Studies (CIS) Seilergraben 49, Room E.3,
EEL 5937 The Bond Agent System (1) EEL 5937 Multi Agent Systems Lecture 8, Jan 30, 2003 Lotzi Bölöni.
Evolving Strategies for the Prisoner’s Dilemma Jennifer Golbeck University of Maryland, College Park Department of Computer Science July 23, 2002.
Object Oriented Programming Object and Classes Lecture 3 MBY.
1 COS 260 DAY 22 Tony Gauvin. 2 Agenda Questions? 9 th Mini Quiz corrected –Good results Assignment 5 Not corrected yet Assignment 6 Posted (one more)
1 Integrating Repast Library and Running RePast Examples using JBuilder X 07/19/2004 by Deddy Koesrindartoto Department of Economics Iowa State University.
Introduction to Computational Modeling of Social Systems Prof. Lars-Erik Cederman Center for Comparative and International Studies (CIS) Seilergraben 49,
Creating a RePast Model Introduction, (Sim)Model Object, CarryDrop.
1 A Case Study: Percolation Percolation. Pour liquid on top of some porous material. Will liquid reach the bottom? Applications. [ chemistry, materials.
1 Agent-Based Tools: focus on NetLogo Ing. Cristina Ponsiglione University of Naples Federico II Laboratorio di Simulazione ad Agenti.
Modelling and Simulating Social Systems with MATLAB
Working with Java.
Functional Programming with Java
null, true, and false are also reserved.
Prisoner’s Dilemma with N-Participants and Optional Cooperation
Introduction to Java Programming
Further abstraction techniques
Introduction to RePast and Tutorial I
Presentation transcript:

Prof. Dr. Lars-Erik Cederman ETH - Center for Comparative and International Studies (CIS) Seilergraben 49, Room G.2, Nils Weidmann, CIS Room E.3 Lecture, December 7, 2004 Introduction to Computational Modeling of Social Systems RePast Tutorial I

2 Today’s agenda The RePast toolkits and its features The Iterated Prisoner‘s Dilemma How to build a model (1) SimpleIPD

3 What is RePast? Recursive Porous Agent Simulation Toolkit Repast is an open-source software framework for creating agent-based simulations using Java Initially developed by the Social Science Research Computing at the University of Chicago Will be further developed by the RePast Organization for Architecture and Development (ROAD) and Argonne National Laboratory

4 Why RePast? Alternatives: Swarm, Ascape, NetLogo... “RePast is at the moment the most suitable simulation framework for the applied modeling of social interventions based on theories and data” (2004): Modeled on Swarm but easier to use and better documented Important criteria: –abstraction, ease of use and user-friendliness –flexibility and extensibility –performance and scalability –support for modeling, simulation & experimentation –Interoperability (GIS, statistical packages, …)

5 What does RePast offer? Skeletons of agents and their environment Graphical user interface Scheduling of simulations Parameters management Behavior display Charting Data collection Batch and parallel runs Utilities and sample models

6 Tutorial Sequence December 7 SimpleIPD: strategy space December 14 EvolIPD: RWR December 21 GraphIPD: charts and GUI GridIPD: 2DK January 11 ExperIPD : batch runs and parameter sweeps

7 Iterated Prisoner’s Dilemma Cohen, Riolo, and Axelrod “The Emergence of Social Organization in the Prisoner's Dilemma” (SFI Working Paper ) In The Evolution of Cooperation, Robert Axelrod (1984) created a computer tournament of IPD –cooperation sometimes emerges –Tit For Tat a particularly effective strategy

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

9 One-Step Memory Strategies C D C D p q Memory: C D 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 t-1 t

10 The Four Strategies

11 TFT meets ALLD t01234 Row (TFT) Column (ALLD) i=1 i=0 p=1; q= = 8 = D C D C D D D D D D p=0; q=0 Cumulated Payoff

12 Payoffs for 4x4 strategies Own strategy Other‘s strategy ALLCTFTATFTALLD pay/move sum pay/move sum pay/move sum pay/move sum ALLC TFT ATFT ALLD

13 How to build a model (1) Extending the SimpleModel class with our own model class: import uchicago.src.sim.engine.SimpleModel; public class MyModel extends SimpleModel {... }

14 Setting up the simulation import uchicago.src.sim.engine.SimpleModel; public class MyModel extends SimpleModel { public static final int TFT = 1; public static final int ALLD = 3; private int a1Strategy = TFT; private int a2Strategy = ALLD;... public void setup() { super.setup(); a1Strategy = TFT; a2Strategy = ALLD; } public void buildModel() { super.buildModel(); Agent a1 = new Agent(a1Strategy); Agent a2 = new Agent(a2Strategy); agentList.add(a1); agentList.add(a2); } Called when the simulation is first started and when setup button pressed Executed every time the simulation is run SimInit.loadModel()

15 Running the simulation import uchicago.src.sim.engine.SimpleModel; public class MyModel extends SimpleModel {... public void setup() {...} public void buildModel() {...} public void preStep() {...} public void step() { super.step(); for (Iterator it = agentList.iterator(); it.hasNext();) { Agent agent = (Agent) iterator.next(); agent.play(); } public void postStep() {...} } Executed at every time step

16 Model parameters import uchicago.src.sim.engine.SimpleModel; public class MyModel extends SimpleModel { public static final int TFT = 1; public static final int ALLD = 3; private int a1Strategy = TFT; private int a2Strategy = ALLD; public MyModel() { params = new String[] {“A1Strategy”}; name = “Example Model”; }... public void setA1Strategy(int strategy) { this.a1Strategy = strategy; } public int getA1Strategy() { return a1Strategy; } Introspection

17 SimpleModel methods setStoppingTime(long time) set the time at which the current simulation run will stop setRngSeed(long seed) set the seed for the random number generator (default: 1) getNextIntFromTo(int from, int to) returns the next random double between from and to (exclusive) getNextDoubleFromTo(double from,double to) returns the next random double between from and to (exclusive) atPause() will be executed whenever your simulation is paused atEnd() will be executed whenever your simulation ends

18 SimpleModel fields boolean isGui true if the simulation is running in GUI mode, false if running in batch mode long startAt the time step at which to start executing the preStep(), step(), postStep() actions (default: 1) Schedule schedule can be used to add your own actions to the schedule... For the full list, consult the RePast API: