`
tiantian911
  • 浏览: 220295 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

RePast笔记

阅读更多

 


REPAST-Recursive Porous Agent Simulation Toolkit

agent-based modeling
Douglas Samuelson and Charles Macal, "Agent-based Simulation Comes of Age," OR/MS Today, Vol. 33, Number 4, pp. 34-38, Lionheart Publishing, Marietta, GA, USA (August 2006).

agent based modeling and simulation

运行仿真:gui:
java -jar c:\repast\lib\repast.jar
或者:command-line:
java -cp path_to_your_model;c:/repast/lib/repast.jar uchicago.src.sim.engine.SimInit fullyQualifiedModelName
eg:

java -cp c:/repast/demo/bugs/bugs.jar;c:/repast/lib/repast.jar uchicago.src.sim.engine.SimInit uchicago.src.sim.heatBugs.HeatBugsModel
加载参数文件:
java -cp c:/repast/demo/bugs/bugs.jar;c:/repast/lib/repast.jar uchicago.src.sim.engine.SimInit uchicago.src.sim.heatBugs.HeatBugsModel c:\params\bugs.pf

1.parameter必须是getInitParam返回的String[]中的
2.必须有accessor

runs正在batch模式下表示多少次?

multi-keywords:start end incr iterator
single-keywords:set 是numerical
 set_list
 set_boolean
 set_string
 set_boolean_list
 set_boolean_string_list
可以嵌套nested

runs: 1
Food {
 start: 10
 end: 30
 incr: 10
 {
   runs: 10
   MaxAge {
     start: 0
     end: 40
     incr: 1
   }
 }
}

 

list是这样的:
set_list: 1.2 3 10 12 84


simple model:


2步:
1st.setup preparing
2nd.actual running

如果是两个player的囚徒困境。setup阶段就是创建两个player,提供初始状态,比较tit-for-tat,每一次选择依赖与stragtegy和上一个tick。

SimpleModel:extends SimpleModel:

setup(),teardowm()
buildModel()
preStep()->step()->postStep()


  public void step() {
    int size = agentList.size();
    for (int i = 0; i < size; i++) {
      Player p = (Player)agentList.get(i);
      p.play();
    }
  }


step每一步做的事情

投票算法中就要用到preStep和postStep

自动的step机制迭代所有的agent调用他们自身的step方法。agent必须实现Stepable接口,这个接口只有step()方法,更复杂的通过schedule来实现。


When the setup button is clicked, the code in the setup() method is executed. When the initialize button is clicked, the code in buildModel() is executed. When the step button is clicked, the code in buildModel() is executed and the preStep(), step(), and postStep() sequence is executed once. When the start button is clicked, buildModel() is executed, and the preStep(), step(), and postStep() sequence is executed repeatedly until the user clicks the stop or pause button.

 

no knobs to twiddle-using parameters

使用accessor,例如:

public void setP1Strategy(int val) {
    p1Strategy = val;
  }

  public int getP1Strategy() {
    return p1Strategy;
  }

public MyModel() {
    params = new String[] {"P1Strategy"};
  }

是model能够aware到参数。

public MyModel() {
    name = "Example Model";
  }
来命名一个model

 


setStoppingTime(long time) can be used set the time step at which the current simulation run will stop.
setRngSeed(long seed) can be used to set the seed for the default random number generator. Note that the seed defaults to 1.
getNextIntFromTo(int from, int to) returns the next random integer between from and to, inclusive of from and to.
getNextDoubleFromTo(double from, double to) returns the next random double between from and to, exclusive of from and to.
atPause() the body of this method will be executed whenever your simulation is paused. You'll need to override this method.
atEnd() the body of this method will be executed whenever your simulation ends. You'll need to override this method.


build a display?

private DisplaySurface dsurf;

  ...

  private void buildDisplay() {
    ...
  }

  public void buildModel() {
    ...
    buildDisplay();
  }

batch-run:整个过程不需要人为的参与,仿真的过程可以自动的进行。
non-batch-run:人为的参与到整个过程中,中间可以图形化的显示和操作agent的状态。
每种类型至少有两个类,model和agent


Repast provides an abstract class SimModelImpl that partialy implements this interface and it is expected that most if not all models will extend this class.


space:作为agent的容器。


social network:

node,edge

edgeFactory
每个节点都是一个node


BasicAction

Scheduling BasicActions for execution is done via the Schedule object. It allows you to schedule actions to occur every tick beginning at some specified tick, once at some specified tick, at intervals, at a pause in the simulation, and at the end of the simulation. (A tick is a single iteration over all the BasicActions scheduled for execution at that time.)

schedule:每一定的间隔就发生,暂停时发生,模拟结束的时候发生。


dataRecoder:record data from a variety of sources and write that data out in tabular format to a file

recorder = new DataRecorder("./data.txt", this, "A Comment");  //header comment~头注释
第二个参数是与他关联的model的引用,这里在model的内部,所以可以用this
recoder会从数据源记录数据当收到record()消息时。

包裹在NumericDataSouce和DataSource中才可以被dataRecoder所接受。


3 kinds of property descriptors:
boolean-checkbox
properties-list
numerical-textbox


A BooleanPropertyDescriptor is typically setup in a model's constructor as follows:

BooleanPropertyDescriptor bd1 = new BooleanPropertyDescriptor("RecordData", false);
descriptors.put("RecordData", bd1);

 

分享到:
评论

相关推荐

    Repast Simphony 官方教程完全版

    Repast Simphony 官方教程完全版。 Repast Simphony Agent仿真的完全版教程。包括入门教程、完全API等资料。 可以快速地利用Repast Simphony提供的api在eclipse下面建立适合需要的各种仿真模型。 Agent Simulation ...

    Repast Java Getting Started.pdf

    标题《Repast Java Getting Started.pdf》和描述中提到的关键知识点主要包括以下几个方面: 1. Repast Simphony简介: - Repast是一个开源的跨平台框架,用于创建和模拟代理(agents)模型。 - 它广泛应用于社会...

    Repast教程中文版

    Repast教程中文版 Repast是一款多主体建模工具,她提供了一系列用以生成、运行、显示和收集数据的类库,并能对运行中的模型进行“快照”,记录某一时刻模型的当前状态,还可以生成模型运行过程中状态动态演化的视频...

    repast完整教程和实例

    Repast 是一个强大的建模和仿真工具,尤其在社会科学、经济学和复杂系统研究领域广泛应用。这个"repast完整教程和实例"提供了英文原版的教材和实践案例,旨在帮助学习者深入理解Repast的使用方法。 Repast...

    Repast使用示例.zip

    Repast(Repast for Agent-Based Modeling)是一种强大的开源框架,用于构建和模拟复杂系统的代理模型。这个"Repast使用示例.zip"压缩包显然包含了学习和理解Repast所需的各种资源,包括从零开始构建项目的教程、...

    gis在repast中的应用

    GIS(Geographic Information System)在Repast中的应用是地理信息系统与多Agent系统(Agent-Based Modeling System,ABMS)结合的一个重要领域。Repast是一个开源的多Agent建模平台,它提供了一种强大的工具来模拟...

    repast官方教程

    【Repast官方教程】主要介绍了如何使用开源项目Repast进行基于主体(Agent-Based)的仿真模型构建。Repast提供了一套预先制作好的编程元素,使得建模过程相对简化。以下是详细的知识点: 1. **RePast简介**: Repast...

    repast学习资料step by step

    Repast(RePast)是一种强大的建模和模拟框架,主要用于社会科学、生物学和复杂系统的建模。这个"repast学习资料step by step"是一份详细的Java教程,旨在引导初学者逐步了解并掌握Repast的使用技巧和特性。通过一个...

    zombie infect human(Repast simphony例子)

    **Repast Simphony僵尸感染人类模型** Repast Simphony是一个强大的多Agent系统(MAS)建模和模拟平台,主要用于社会科学、生物学和社会经济系统的复杂性研究。在这个“zombie infect human”例子中,我们将探讨...

    Repast J 3.1 install

    repast 3.1 java开发包。你懂的!

    repast api

    repast api net 全部的api,整理得,

    Repast使用示例

    Repast Simphony 或者Repast J的使用教程实例,包括环境的配置,具体案例解决的详细过程

Global site tag (gtag.js) - Google Analytics