SlideShare ist ein Scribd-Unternehmen logo
1 von 67
一步一步学  RePast 建模 Introduction, (Sim)Model Object, CarryDrop
The CarryDrop Model  A RePast Tutorial by John Murphy by Junjie Sun Department of Economics Iowa State University
RePast 模型的元素 ,[object Object],[object Object],[object Object]
The (Sim)Model Object ,[object Object],[object Object],[object Object],[object Object]
The SimModel Object—getName() ,[object Object],[object Object],import uchicago.src.sim.engine.SimModelImpl; public class MyFirstRePastModel extends SimModelImpl { public String getName(){ return “ 第一个  RePast 模型” ; } }
The SimModel Object—begin() ,[object Object],import uchicago.src.sim.engine.SimModelImpl; public class MyFirstRePastModel extends SimModelImpl { public String getName(){ return “ 第一个  RePast  模型” ; } public void begin(){ } }
The SimModel Object— 惯例 ,[object Object],[object Object],public void begin(){ buildModel();// 模型初始化 buildSchedule();// 规划表初始化 buildDisplay();// 显示初始化 } public void buildModel(){ } public void buildSchedule(){ } public void buildDisplay(){ }
The SimModel Object—current code  ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
The SimModel Object—setup() ,[object Object],public class MyFirstRePastModel extends SimModelImpl { public String getName(){ return “My First RePast Model”; } public void setup(){ } public void begin(){ […]
The SimModel Object—Schedule ,[object Object],[object Object],[object Object],[object Object],[object Object]
The SimObject Model--Schedule import uchicago.src.sim.engine.SimModelImpl; import uchicago.src.sim.engine.Schedule; public class MyFirstRePastModel extends SimModelImpl { private Schedule schedule; public String getName(){ return “My First RePast Model”; } public void begin(){ buildModel(); buildSchedule(); buildDisplay(); } public void buildModel(){ } public void buildSchedule(){ } public void buildDisplay(){ } public Schedule getSchedule(){ return schedule; } }
The SimModel Object--getInitParam ,[object Object],[object Object],[object Object],[object Object],[object Object]
The SimModel Object--numAgents ,[object Object],import uchicago.src.sim.engine.SimModelImpl; import uchicago.src.sim.engine.Schedule; public class MyFirstRePastModel extends SimModelImpl { private Schedule schedule; private int numAgents; public String getName(){ return “My First Repast Model”; } […]
The SimModel Object--numAgents ,[object Object],public Schedule getSchedule(){ return schedule; } public int getNumAgents(){ return numAgents; } public void setNumAgents (int na){ numAgents=na; } }
The SimModel Object--numAgents ,[object Object],public Schedule getSchedule(){ return schedule; } public String[] getInitParam(){ String[] initParams = {“NumAgents”}; return initParams; } public int getNumAgents(){ return numAgents; }
The CarryDrop Model--Introduction ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
The CarryDrop model ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
前面已经完成的代码 ,[object Object],[object Object],[object Object],[object Object],[object Object]
增加用户可以设置的参数 ,[object Object],[object Object],[object Object]
把参数设置为类变量 ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
编译运行模型 ,[object Object],[object Object],[object Object],[object Object]
Codes to be Added in main Method ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Default Values for User-Settable Parameters (Step 6) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Alerts in Subroutines (Step 7) ,[object Object],[object Object],[object Object],[object Object]
The Space Object (Step 8-1) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Q: How can you know the args in  the methods / constructors?  A: See RePast/Java API (Step 8-2) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Need another parameter, the amount of money (Step 8-3) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
I ntegrate the Space Object into the Model (Step 9-1) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Overview :  What’s been done in Step 1-9 ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
前面已经完成以下工作 ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Step 10  –   初始化空间类 ,[object Object],[object Object]
Step 11 - Extracting reusuable code ,[object Object],[object Object],[object Object]
可视化界面设计 ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Step 12  –  Using the DisplaySurface ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Step 13  –  A splash of color ,[object Object],[object Object],[object Object],[object Object]
Step 13 cont.  ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Step 14  –  Generating the Display ,[object Object],[object Object],[object Object],[object Object]
Step 15  –  The Agents ,[object Object],[object Object],[object Object],[object Object],[object Object]
Step 15 cont.  –  Modifying CarryDropModel for Agents ,[object Object],[object Object],[object Object],[object Object],[object Object]
Step 16  –  Adding Agents to the model ,[object Object],[object Object]
Step 16 cont. ,[object Object],[object Object]
Step 17  –  A Space for Agents ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Step 17 cont. ,[object Object],[object Object]
Step 18  –  Adding Agents to the space ,[object Object],[object Object]
What’s been done in Step 1-18 ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Reporting (Step 19-1) ,[object Object],[object Object],[object Object]
'Report' function (Step 19-2) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Unique 'ID' variable (Step 19-3) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Displaying Agents (Step 20-1) ,[object Object],[object Object],[object Object],[object Object],[object Object]
Codes for Displaying Agents (Step 20-2)    -- Create an Object2DDisplay object,  add it to the display surface, etc. ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Codes for Displaying Agents (Step 20-3)    -- Make the agents able to be drawn  by implementing 'Drawable' ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Adding a Schedule and Some Action (Step 21-1) - Motivation ,[object Object],[object Object],[object Object]
Adding a Schedule and Some Action (Step 21-2) – Three things to do ,[object Object],[object Object],[object Object]
Codes for creating a 'step' method  and a Schedule object (Step 21-3)   ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Codes for creating an inner class 'CarryDropStep' (Step 21-4) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Notes on 'shuffle' and 'scheduleAction Beginning' routine (Step 21-5) ,[object Object],[object Object]
Another Schedule Example (Step 22-1) ,[object Object],[object Object],[object Object],[object Object],[object Object]
Codes for creating 'countLivingAgents' in CarryDropModel (Step 22-2) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Codes for 'CarryDropCountLiving' and how to add it to the Schedule object (Step 22-3) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Displays and Schedules (Step 23-1) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Displays and Schedules (Step 23-2) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
The Circle of Life: Agents Dying and Being Born (Step 24-1) - Motivation ,[object Object],[object Object]
The Circle of Life: Agents Dying and Being Born (Step 24-2) – Things to do ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Codes for adding 'reapDeadAgents()' to the model (Step 24-3) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Codes for adding 'removeAgentAt()' to the space object and agent reborning (Step 24-4) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
What’s been done in Step 1-24 ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]

Weitere ähnliche Inhalte

Was ist angesagt?

深入浅出Jscex
深入浅出Jscex深入浅出Jscex
深入浅出Jscex
jeffz
 
Jscex: Write Sexy JavaScript (中文)
Jscex: Write Sexy JavaScript (中文)Jscex: Write Sexy JavaScript (中文)
Jscex: Write Sexy JavaScript (中文)
jeffz
 
The Evolution of Async-Programming (SD 2.0, JavaScript)
The Evolution of Async-Programming (SD 2.0, JavaScript)The Evolution of Async-Programming (SD 2.0, JavaScript)
The Evolution of Async-Programming (SD 2.0, JavaScript)
jeffz
 
J S B6 Ref Booklet
J S B6 Ref BookletJ S B6 Ref Booklet
J S B6 Ref Booklet
51 lecture
 

Was ist angesagt? (20)

Dynamic C++ ACCU 2013
Dynamic C++ ACCU 2013Dynamic C++ ACCU 2013
Dynamic C++ ACCU 2013
 
Advanced JavaScript
Advanced JavaScript Advanced JavaScript
Advanced JavaScript
 
深入浅出Jscex
深入浅出Jscex深入浅出Jscex
深入浅出Jscex
 
Jscex: Write Sexy JavaScript (中文)
Jscex: Write Sexy JavaScript (中文)Jscex: Write Sexy JavaScript (中文)
Jscex: Write Sexy JavaScript (中文)
 
Android UI Development: Tips, Tricks, and Techniques
Android UI Development: Tips, Tricks, and TechniquesAndroid UI Development: Tips, Tricks, and Techniques
Android UI Development: Tips, Tricks, and Techniques
 
The Evolution of Async-Programming (SD 2.0, JavaScript)
The Evolution of Async-Programming (SD 2.0, JavaScript)The Evolution of Async-Programming (SD 2.0, JavaScript)
The Evolution of Async-Programming (SD 2.0, JavaScript)
 
서버 개발자가 바라 본 Functional Reactive Programming with RxJava - SpringCamp2015
서버 개발자가 바라 본 Functional Reactive Programming with RxJava - SpringCamp2015서버 개발자가 바라 본 Functional Reactive Programming with RxJava - SpringCamp2015
서버 개발자가 바라 본 Functional Reactive Programming with RxJava - SpringCamp2015
 
Lecture1 classes3
Lecture1 classes3Lecture1 classes3
Lecture1 classes3
 
(3) cpp abstractions more_on_user_defined_types
(3) cpp abstractions more_on_user_defined_types(3) cpp abstractions more_on_user_defined_types
(3) cpp abstractions more_on_user_defined_types
 
YUI Tidbits
YUI TidbitsYUI Tidbits
YUI Tidbits
 
J S B6 Ref Booklet
J S B6 Ref BookletJ S B6 Ref Booklet
J S B6 Ref Booklet
 
Node Anti-Patterns and Bad Practices
Node Anti-Patterns and Bad PracticesNode Anti-Patterns and Bad Practices
Node Anti-Patterns and Bad Practices
 
The Ring programming language version 1.7 book - Part 83 of 196
The Ring programming language version 1.7 book - Part 83 of 196The Ring programming language version 1.7 book - Part 83 of 196
The Ring programming language version 1.7 book - Part 83 of 196
 
OpenXR 0.90 Overview Guide
OpenXR 0.90 Overview GuideOpenXR 0.90 Overview Guide
OpenXR 0.90 Overview Guide
 
Clojure And Swing
Clojure And SwingClojure And Swing
Clojure And Swing
 
Using Reflections and Automatic Code Generation
Using Reflections and Automatic Code GenerationUsing Reflections and Automatic Code Generation
Using Reflections and Automatic Code Generation
 
Obvious Secrets of JavaScript
Obvious Secrets of JavaScriptObvious Secrets of JavaScript
Obvious Secrets of JavaScript
 
The Ring programming language version 1.8 book - Part 90 of 202
The Ring programming language version 1.8 book - Part 90 of 202The Ring programming language version 1.8 book - Part 90 of 202
The Ring programming language version 1.8 book - Part 90 of 202
 
The Ring programming language version 1.5.1 book - Part 12 of 180
The Ring programming language version 1.5.1 book - Part 12 of 180The Ring programming language version 1.5.1 book - Part 12 of 180
The Ring programming language version 1.5.1 book - Part 12 of 180
 
Computer Vision using Ruby and libJIT - RubyConf 2009
Computer Vision using Ruby and libJIT - RubyConf 2009Computer Vision using Ruby and libJIT - RubyConf 2009
Computer Vision using Ruby and libJIT - RubyConf 2009
 

Andere mochten auch (7)

Interactive vertical benchmarks
Interactive vertical benchmarksInteractive vertical benchmarks
Interactive vertical benchmarks
 
8.2第八章 win dynamo
8.2第八章 win dynamo8.2第八章 win dynamo
8.2第八章 win dynamo
 
[Harvard CS264] 11a - Programming the Memory Hierarchy with Sequoia (Mike Bau...
[Harvard CS264] 11a - Programming the Memory Hierarchy with Sequoia (Mike Bau...[Harvard CS264] 11a - Programming the Memory Hierarchy with Sequoia (Mike Bau...
[Harvard CS264] 11a - Programming the Memory Hierarchy with Sequoia (Mike Bau...
 
Unlocking Android
Unlocking AndroidUnlocking Android
Unlocking Android
 
[Harvard CS264] 15a - The Onset of Parallelism, Changes in Computer Architect...
[Harvard CS264] 15a - The Onset of Parallelism, Changes in Computer Architect...[Harvard CS264] 15a - The Onset of Parallelism, Changes in Computer Architect...
[Harvard CS264] 15a - The Onset of Parallelism, Changes in Computer Architect...
 
Tom Gonzalez - Adv Data Visualization
Tom Gonzalez - Adv Data VisualizationTom Gonzalez - Adv Data Visualization
Tom Gonzalez - Adv Data Visualization
 
High-Performance Computing Needs Machine Learning... And Vice Versa (NIPS 201...
High-Performance Computing Needs Machine Learning... And Vice Versa (NIPS 201...High-Performance Computing Needs Machine Learning... And Vice Versa (NIPS 201...
High-Performance Computing Needs Machine Learning... And Vice Versa (NIPS 201...
 

Ähnlich wie 6.1.1一步一步学repast代码解释

DESIGNING A PERSISTENCE FRAMEWORK WITH PATTERNS.ppt
DESIGNING A PERSISTENCE FRAMEWORK WITH PATTERNS.pptDESIGNING A PERSISTENCE FRAMEWORK WITH PATTERNS.ppt
DESIGNING A PERSISTENCE FRAMEWORK WITH PATTERNS.ppt
AntoJoseph36
 
Converting Db Schema Into Uml Classes
Converting Db Schema Into Uml ClassesConverting Db Schema Into Uml Classes
Converting Db Schema Into Uml Classes
Kaniska Mandal
 
Sustaining Test-Driven Development
Sustaining Test-Driven DevelopmentSustaining Test-Driven Development
Sustaining Test-Driven Development
AgileOnTheBeach
 

Ähnlich wie 6.1.1一步一步学repast代码解释 (20)

Copy of repast javagettingstarted
Copy of repast javagettingstartedCopy of repast javagettingstarted
Copy of repast javagettingstarted
 
Tricks to Making a Realtime SurfaceView Actually Perform in Realtime - Maarte...
Tricks to Making a Realtime SurfaceView Actually Perform in Realtime - Maarte...Tricks to Making a Realtime SurfaceView Actually Perform in Realtime - Maarte...
Tricks to Making a Realtime SurfaceView Actually Perform in Realtime - Maarte...
 
DESIGNING A PERSISTENCE FRAMEWORK WITH PATTERNS.ppt
DESIGNING A PERSISTENCE FRAMEWORK WITH PATTERNS.pptDESIGNING A PERSISTENCE FRAMEWORK WITH PATTERNS.ppt
DESIGNING A PERSISTENCE FRAMEWORK WITH PATTERNS.ppt
 
Android UI Tips, Tricks and Techniques
Android UI Tips, Tricks and TechniquesAndroid UI Tips, Tricks and Techniques
Android UI Tips, Tricks and Techniques
 
How to Write Node.js Module
How to Write Node.js ModuleHow to Write Node.js Module
How to Write Node.js Module
 
Java design patterns
Java design patternsJava design patterns
Java design patterns
 
Useful Tools for Making Video Games - XNA (2008)
Useful Tools for Making Video Games - XNA (2008)Useful Tools for Making Video Games - XNA (2008)
Useful Tools for Making Video Games - XNA (2008)
 
Vaadin 7
Vaadin 7Vaadin 7
Vaadin 7
 
Workshop 26: React Native - The Native Side
Workshop 26: React Native - The Native SideWorkshop 26: React Native - The Native Side
Workshop 26: React Native - The Native Side
 
Converting Db Schema Into Uml Classes
Converting Db Schema Into Uml ClassesConverting Db Schema Into Uml Classes
Converting Db Schema Into Uml Classes
 
Sustaining Test-Driven Development
Sustaining Test-Driven DevelopmentSustaining Test-Driven Development
Sustaining Test-Driven Development
 
Rhino Mocks
Rhino MocksRhino Mocks
Rhino Mocks
 
Chap2 class,objects
Chap2 class,objectsChap2 class,objects
Chap2 class,objects
 
Twins: OOP and FP
Twins: OOP and FPTwins: OOP and FP
Twins: OOP and FP
 
Object Oriented JavaScript
Object Oriented JavaScriptObject Oriented JavaScript
Object Oriented JavaScript
 
From C++ to Objective-C
From C++ to Objective-CFrom C++ to Objective-C
From C++ to Objective-C
 
Uncommon Design Patterns
Uncommon Design PatternsUncommon Design Patterns
Uncommon Design Patterns
 
Classes1
Classes1Classes1
Classes1
 
React Native One Day
React Native One DayReact Native One Day
React Native One Day
 
Design pattern - part 3
Design pattern - part 3Design pattern - part 3
Design pattern - part 3
 

Mehr von zhang shuren

8.1第八章系统动力学与dynamo模型
8.1第八章系统动力学与dynamo模型8.1第八章系统动力学与dynamo模型
8.1第八章系统动力学与dynamo模型
zhang shuren
 
7 第七章 学习与进化模型ann
7 第七章 学习与进化模型ann7 第七章 学习与进化模型ann
7 第七章 学习与进化模型ann
zhang shuren
 
6.1.2 用eclipse环境调试一步一步学repast操作
6.1.2 用eclipse环境调试一步一步学repast操作6.1.2 用eclipse环境调试一步一步学repast操作
6.1.2 用eclipse环境调试一步一步学repast操作
zhang shuren
 
4.2第四章 swarm代码剖析 可选补充课程
4.2第四章 swarm代码剖析 可选补充课程4.2第四章 swarm代码剖析 可选补充课程
4.2第四章 swarm代码剖析 可选补充课程
zhang shuren
 
4.1第四章 多主体系统仿真的软件工具
4.1第四章 多主体系统仿真的软件工具4.1第四章 多主体系统仿真的软件工具
4.1第四章 多主体系统仿真的软件工具
zhang shuren
 
3第三章 多主体模型与社会科学复杂性研究
3第三章 多主体模型与社会科学复杂性研究3第三章 多主体模型与社会科学复杂性研究
3第三章 多主体模型与社会科学复杂性研究
zhang shuren
 
2第二章 多主体模型与社会科学复杂性研究
2第二章 多主体模型与社会科学复杂性研究2第二章 多主体模型与社会科学复杂性研究
2第二章 多主体模型与社会科学复杂性研究
zhang shuren
 
网络营销第4章 张树人
网络营销第4章 张树人网络营销第4章 张树人
网络营销第4章 张树人
zhang shuren
 
网络营销 第3章 张树人
网络营销 第3章 张树人网络营销 第3章 张树人
网络营销 第3章 张树人
zhang shuren
 
网络营销 第1章 张树人
网络营销 第1章 张树人网络营销 第1章 张树人
网络营销 第1章 张树人
zhang shuren
 
第4章 数据库管理
第4章 数据库管理第4章 数据库管理
第4章 数据库管理
zhang shuren
 
第2章 服务器管理
第2章 服务器管理第2章 服务器管理
第2章 服务器管理
zhang shuren
 
第10章 权限管理
第10章 权限管理第10章 权限管理
第10章 权限管理
zhang shuren
 

Mehr von zhang shuren (13)

8.1第八章系统动力学与dynamo模型
8.1第八章系统动力学与dynamo模型8.1第八章系统动力学与dynamo模型
8.1第八章系统动力学与dynamo模型
 
7 第七章 学习与进化模型ann
7 第七章 学习与进化模型ann7 第七章 学习与进化模型ann
7 第七章 学习与进化模型ann
 
6.1.2 用eclipse环境调试一步一步学repast操作
6.1.2 用eclipse环境调试一步一步学repast操作6.1.2 用eclipse环境调试一步一步学repast操作
6.1.2 用eclipse环境调试一步一步学repast操作
 
4.2第四章 swarm代码剖析 可选补充课程
4.2第四章 swarm代码剖析 可选补充课程4.2第四章 swarm代码剖析 可选补充课程
4.2第四章 swarm代码剖析 可选补充课程
 
4.1第四章 多主体系统仿真的软件工具
4.1第四章 多主体系统仿真的软件工具4.1第四章 多主体系统仿真的软件工具
4.1第四章 多主体系统仿真的软件工具
 
3第三章 多主体模型与社会科学复杂性研究
3第三章 多主体模型与社会科学复杂性研究3第三章 多主体模型与社会科学复杂性研究
3第三章 多主体模型与社会科学复杂性研究
 
2第二章 多主体模型与社会科学复杂性研究
2第二章 多主体模型与社会科学复杂性研究2第二章 多主体模型与社会科学复杂性研究
2第二章 多主体模型与社会科学复杂性研究
 
网络营销第4章 张树人
网络营销第4章 张树人网络营销第4章 张树人
网络营销第4章 张树人
 
网络营销 第3章 张树人
网络营销 第3章 张树人网络营销 第3章 张树人
网络营销 第3章 张树人
 
网络营销 第1章 张树人
网络营销 第1章 张树人网络营销 第1章 张树人
网络营销 第1章 张树人
 
第4章 数据库管理
第4章 数据库管理第4章 数据库管理
第4章 数据库管理
 
第2章 服务器管理
第2章 服务器管理第2章 服务器管理
第2章 服务器管理
 
第10章 权限管理
第10章 权限管理第10章 权限管理
第10章 权限管理
 

Kürzlich hochgeladen

1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
QucHHunhnh
 
Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.
MateoGardella
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
negromaestrong
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdf
Chris Hunter
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
heathfieldcps1
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
PECB
 

Kürzlich hochgeladen (20)

Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docx
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdf
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writing
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 

6.1.1一步一步学repast代码解释

  • 1. 一步一步学 RePast 建模 Introduction, (Sim)Model Object, CarryDrop
  • 2. The CarryDrop Model A RePast Tutorial by John Murphy by Junjie Sun Department of Economics Iowa State University
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11. The SimObject Model--Schedule import uchicago.src.sim.engine.SimModelImpl; import uchicago.src.sim.engine.Schedule; public class MyFirstRePastModel extends SimModelImpl { private Schedule schedule; public String getName(){ return “My First RePast Model”; } public void begin(){ buildModel(); buildSchedule(); buildDisplay(); } public void buildModel(){ } public void buildSchedule(){ } public void buildDisplay(){ } public Schedule getSchedule(){ return schedule; } }
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
  • 27.
  • 28.
  • 29.
  • 30.
  • 31.
  • 32.
  • 33.
  • 34.
  • 35.
  • 36.
  • 37.
  • 38.
  • 39.
  • 40.
  • 41.
  • 42.
  • 43.
  • 44.
  • 45.
  • 46.
  • 47.
  • 48.
  • 49.
  • 50.
  • 51.
  • 52.
  • 53.
  • 54.
  • 55.
  • 56.
  • 57.
  • 58.
  • 59.
  • 60.
  • 61.
  • 62.
  • 63.
  • 64.
  • 65.
  • 66.
  • 67.

Hinweis der Redaktion

  1. Actions scheduled in a specified order should be added to ActionGroup set, which can be added to the Schedule.
  2. The word WorldXSize and WorldYSize as well as other parameters such as NumAgents will appear in the Parameters window along with the RePast control toolbar. The string that tells RePast what parameter can be used is ‘NumAgents’ because RePast will look (automatically) for methods named "get" + the string and "set" + the string, hence "getNumAgents" and "setNumAgents."
  3. The first line creates a new object of type 'SimInit'- note that this object has been imported as: import uchicago.src.sim.engine.SimInit;
  4. Notice when the model is run that the values in the GUI are all zeros. It is good coding practice to have default values defined as constant variables.
  5. Note that when the model runs, the 'Setup' routine runs. Press ‘Step' and the Build subroutine runs, calling successively BuildModel, BuildSchedule, and BuildDisplay. Keep this sequence in mind as we move forward. We can leave those lines of code in- they're harmless.
  6. (1). import uchicago.src.sim.space.Object2DGrid; (2). Note that an integer (with a small i) is a data type, while an Integer (with a capital I) is a Java object. The value of the Integer object will be the amount of money found 'on the ground' at that point in the grid space. (3).CarryDropSpace(int xSize, int ySize) is the constructor to initialize the space object.
  7. We now need to deposit some money on the landscape. To do this we will create a method of the CarryDropSpace object that will deposit an amount of money randomly around the objectSpace. We will then call that method right after the space object is created, in the buildModel method of the CarryDropModel object.
  8. Actually, some of the lines of code that we have placed in the 'spreadMoney' method of the CarryDropSpace object will be useful for several reasons; thus we will pull them out into their own method (note also some variable name changes- this is just for style and limited improvements in clarity. As an added technical note, we check for a 'null' condition, but one should never occur because we initialize the whole grid to include values):
  9. Makes 10 times the size of the space attempts to add the agent
  10. Schedule object is important in RePast. But if we don’t use it, we can switch to extend SimpleModel instead of SimModelImpl.
  11. When you run this code and step through it, the model is created, agents are green for a while, then turn blue and the disappear. For each one that disappears, however, another one appears. If you press 'play' you will see that the number of agents living, as reported every 10 timesteps, never changes.