学习路径与资源整合 入门阶段:
通过NetLogo教程理解ABM核心概念(如Emergence、Agent规则设计)。 用Mesa复现经典模型(如Schelling Segregation Model),熟悉API调用。
进阶阶段:
在Mesa中集成机器学习库(如用Scikit-learn模拟Agent的预测行为)。 学习Julia语法后,用Agents.jl重写Mesa模型,对比性能差异。
高阶应用:
研究ABM与计量经济学结合(如用Agent模型验证经济政策效果4)。 探索混合仿真(ABM+系统动力学)解决多尺度问题(如宏观经济与微观企业交互11)。
NetLogo
目录- NetLogo
Simple Case: Party Model
在NetLogo中选择File - Models Library
选择模型:Social Science - Party - 打开
左侧试图中找到setup按扭初始化模型
Party模型中每条线代表聚会中的小团组,男性为蓝色,粉色为女性
按go按扭开始运行模型
speed滑块可以调整模型运行速度
背景:一场鸡尾酒聚会,参与者会聚成给定数量的团体
模型设定:与会者若发现团体中有过多的异性就会感到不开心,进而转入其他团体
参数: - number: 参加者数量 - group: 聚成的团体数量 - tolerance:允许的异性比例
观测指标: - number happy: 开心的参与者数量 - single sex group: 单性别团体数量
拓展: - 增加属性类别,如年龄、职业等 - 异质个体容忍度 - 复杂的容忍规则 - 允许子群组存在 - 增加对群组的规模限制
Models
Interface Elements
功能模块
- 按扭
- 一次性按扭
- 通常有setup、step once
- 永久按扭
- 类似While,再次按下停止运行
- 一次性按扭
- 滑块Sliders
- 速度滑块滑到最快会导致视图停止更新,但plots和monitors会
- 开关Switches
- 候选框Choosers
- 可以调整整套的模型设定用于探索不同的情景或假设
监视器
- 图像Plots
- 监视器Monitors
图像等可以导出
视图views
完全关闭视图view更新后,模型会在后台运行,绘图plots和监视器monitors会继续更新
当视图完全关闭后,许多模型会运行得更快
视图的大小由5个独立的参数决定的:
- min-pxcor最小横坐标
- max-pxcor最大横坐标
- min-pycor最小纵坐标
- max-pycor最大纵坐标
- patch size像素块大小
按工具栏-设置按键会打开设置窗口
- 水平/竖直方向世界回绕 (智能体在地图边界时是否回绕)
默认情况下,中心的像素块会被标记为(0,0)
地图中一行的像素块数量称为world-width,一列的像素块数量称为world-height
最左/下的像素块坐标为min-pxcor/min-pycor
Models Library
Sample Models
该模型库会持续更新
其中的一些模型被标记为unverified,表示该模型是功能齐全完整的,但是内容、准确性和代码质量尚未被审查
Curricular Models
由Northwestern University的CCL实验室开发的课程模型
Code Examples
代码示例
HubNet Activities
HubNet系统允许众多真实人类参与者充当智能体参与模型交互
Commands
Commands Center
NetLogo窗口底部提供Commands Center命令中心,用于向 turtles (agents), patches, links, ovserver发布指令。
在模型中按下setup按扭初始化,在命令中心底部输出命令
NetLogo环境是由turtles, patches, links, ovserver组成的.
patches是turtles的活动环境,links是turtles的连接,观察者是监视事件发生的实验者
在Command Center中可以想智能体的任何类型发布命令
可以通过左边菜单或tab键选择类型types
Observer可以通过ask xx [command]
向其他类型发布命令
按下setup按扭后,样式会恢复Code tab中代码设定的样式
commands center的命令是临时的
Colors
color
是turtle变量pcolor
是patch变量
NetLogo使用颜色值或16个预设颜色名称来表示颜色
如:set color 15
也可以使用颜色进行运算,如set color red - 2
Agent Monitors and Agent Commanders
右键选中指定agent,可以观察watch或跟踪follow agent
选中inspect turtle会显示turtle monitor,它会弹出一个小框可以zoom in/out智能体
按watch按扭可以在主窗口看到该智能体,窗口可以设置该智能体的属性,或传递命令
也可通过Tools menu选择Turtle Monitor,之后who属性处输入编号指定智能体
在monitor ask命令中也可指定who编号,如set turtle 0 [set color blue]
patches不具有who编号,但可以通过pxcor和pycor指定坐标
如ask patch -19 18 [set color blue]
Procedures
Procedure是一系列NetLogo命令的组合,可以定义为函数
创建model
File menu -> New
点击Add按扭,右侧下拉菜单选择Button
在任意地点点击即可创建对象
在弹出菜单中的Commands输入命令procedure,如setup
按下这个按扭会运行名为setup的procedure
若不存在setup porcedure,按扭文字会是红色
在Code Tab中创建procedure
to setup
clear-all
create-turtles 100 [ setxy random-xcor random-ycor ]
reset-ticks
end
procedure被to-end包裹
在交互页面,顶部工具栏默认选择continuous
连续更新,若使用tick counter (reset-ticks),
应该手动将continuous
下拉菜单改为on ticks
创建go
命令按扭,在创建中勾选Disable until ticks start让它在初始化之后才能用,勾选Forever让它按下后保持运行
变量
除了color等内置变量外,也可以为turtles添加自定义变量
在Code Tab顶部添加turtules-own变量
如turtles-own [happy]
支持if
语句,set
语句对变量进行赋值,如set energy energy + 1
Monitors
在交互界面的Add按扭下拉菜单中选择Monitor
放置Monitor后,在对话框的Reporter中输入命令,Display Name为其在界面中展示的文字
Switches
在交互界面的Add按扭下拉菜单中选择Switch
放置Switch后,会在对话框中创建一个全局变量,不要与自定义变量重名,需要带❔,该变量可以直接在Code Tab中使用
智能体繁殖与死亡
- [ die ]
- hatch n [commands]
Plotting
在交互页面放置plot并设定一些命令后,当setup程序调用reset-ticks或go程序调用tick时,这些命令会被自动执行
在plot对话框中,修改default Pen name及其对应的color和commands,可以额外添加其他pen
选择框可以设置Auto Scale自动缩放和Show Legend显示图例
Tick counter
通过控制时间步,可以让不同模型可比
- reset-ticks 重置时间步
- tick 运行一个时间步
Interface Guide
Menus
- File
- Upload to Modeling Commons
- Modeling Commons 是NetLogo 用户共享中心,可以分享或复显模型
- Save As NetLogo Web导出为可执行的HTML,基于NetLogo Web网络执行服务
- Export World… 导出所有变量值到csv
- Export Plot… 导出图表数值到csv
- Export View… 导出当前图像状态到png
- Export Interface… 导出当前交互界面图像到png
- Export Output… 导出当前output区域内容到txt
- Export Code… 导出code到HTML
- Import World… 导入world导出csv
- Import Patch Colors… 导入图像作为整个地图(被切割为色块)
- 即命令
import-pcolors
- 即命令
- Import Patch Colors RGB…
- 即命令
import-pcolors-rgb
- 即命令
- Import Drawing… 导入图像到drawing中
- 即命令
import-drawing
- 即命令
- Upload to Modeling Commons
- Tools
- Color Swatches
- Turtle Shapes Editor
- Link Shapes Editor
- BehaviorSpace使用一系列参数多次运行模型
- System Dynamics Modeler 使用System Dynamics Modeler使用系统动力学图进行建模
- Preview Commands Editor 编辑用于预览图的命令
- Help
- Look Up In Dictionary 在NetLogo字典中查找命令
2D & 3D
patch size 影响2D像素块大小,但不影响3D
Smooth edges平滑边缘仅适用3D,取消勾选会让对象出现锯齿状,但渲染速度会提升
一些形状具有默认映射的3D形状,包括default, circle, dot, square, triangle, line, cylinder, line-half, car
其他的2D形状,若形状可旋转则展示其俯视图,否则展示其边视图
Command Center
可以复制命令,查看历史
Plot
在plot对话框中Plot setup commands和Plot update commands可以输入命令,使其在 初始化和更新时执行
Plot Pen中每一行都是一个pen,默认只有一个default pen
Pen Update Commands会在reset-ticks, tick或update-plots命令运行时执行
点击每个pen的笔图表会打开一个对话框,Mode可以选择line, bar, point;Interval是每次x更新时 的前进量;Show in legend选择是否展示图例;Setup commands在reset-ticks或setup-plots时运行; Update commands在tick或update-plots时运行
Info Tab
使用Markdown语法 (github-flavored-markdown,非标准Markdown)
无序列表使用*开头
本地资源name
<sub>上标</sub>
<sup>下标</sup>
Code Tab
Code Tab工具栏Procedure可以检索命令,它接受模糊匹配
使用__includes [ "file.nls"]
可以加载其他NetLogo Source Files (它是一个实验功能),
使用__includes后Code Tab工具栏会多出一个Includes下拉菜单
Programming Guide
NetLogo由turtles, patches, links, the observer四种Agent组成
turtles
xcor
,ycor
坐标color
颜色heading
方向
patches
pxcor
和pycor
坐标min-pxcor
,max-pxcor
,min-pycor
,max-pycor
地图范围pcolor
颜色
links
color
颜色
Breeds
NetLogo可以对turtles和links自定义族群
定义breads后,可以让不同族群具有不同的行为
turtle breeds
;; 语法bread [<breeds> <breed>]第一个参数为agentset,第二个为单数形式
breed [wolves wolf]
breed [sheep a-sheep]
breed定义的顺序即为view的分层顺序,后定义的族群会覆盖先定义的上面
定义breed后会自动创建一系列属性
create-<breeds>
创建n个breed的智能体hatch-<breeds>
繁衍新智能体sprout-<breeds>
在当前位置创建新智能体<breeds>-here
返回当前位置的breed智能体<breeds>-at
返回指定位置的breed智能体<breeds>-on
返回指定agent或agentset (如turtles, patches)位置上的agentsetis-<breed>?
是否为breed智能体<breeds>-own
breed智能体自定义变量
turtle的breed agentset存储在breed turtle变量中
修改turtles breed:
ask one-of wolves [set breed sheep]
注意智能体编号与breed无关,所有的turtle统一编号
Code Example: Breeds and Shapes Example
link breeds
directed-link-breed [streets street]
undirected-link-breed [streets street]
若定义了一个breeded link就不能再创建unbreeded link
创建了breeded link后也会自动创建相关属性
Code Example: Link Breeds Example
Procedures
注释语法: ;; 这是注释
commands
commands是让agent执行的指令,它会产生指定的结果
commands通常由动词开头
自定义command procedure:
to my-command [var_a var_b] ;; []为输入参数,可选
end
set variable value
global变量赋值ask turtles [set variable value]
turtles/patches/links variable赋值ask turtles [ set pcolor green]
会将turtles脚下的patches的颜色变成green, 因为patches变量会共享给上面的turtles
show [command] of turtle id
展示指定turtle的变量值- ex.
show [xcor + ycor] of turtle 5
- ex.
show [color] of turtle 5
- ex.
ask turtles [command]
ask像turtles, patches, links传递命令ask turtle 0 [command]
turtle idask patch 0 0 [command]
地图坐标ask link 0 1 [command]
两个turtle id- patch-at用于获取当前turtle指定偏移量的patch的属性
ask turtle 0 [ask patch-at 1 0 [set color red]]
reporters
reporters是计算值的指令,它会汇报一个值
reporters通常由名词开头
自定义reporter procedure:
to-report my-reporter [var_a var_b] ;; []为输入参数,可选
end
Variables
NetLogo有global variable, turtle variable, patch variable, link variable
global variable是在全局共享的,而其他的则是每个智能体都有自己的值
自定义Variables:
当创建switch, slider, chooser或input box时会自动创建一个global variable
global [score] ;; 使用code创建global variable
turtles-own [happy energy] ;; turtles variable
patches-own [grass] ;; patches variable
links-own [strength] ;; links variable
Local Variables
若在一个procedure顶部使用let
语法定义局部变量,则它会存在于定义的procedure中
若在一个[]中定义局部变量,则它只会存在于这个[]中
let variable value
to swap-colors [turtle1 turtle2]
let temp-color [color] of turtle1
ask turtle1 [set color [color] of turtle2]
ask turtle2 [set color temp-color]
Tick Counter
ticks
报告当前时间步tick
指令当前时间步前进1clear-all
指令清空所有变量和时间步 (之后必须重置时间步)reset-ticks
指令重置时间步为0
通常在setup程序的末尾使用reset-ticks
指令,在go指令末尾使用tick
指令
一般情况下时间步是整数,若希望使用小数时间步使用tick-advance
命令
Colors
颜色可选0-140数值,部分颜色具名
若使用的数值超出0-140范围,则会通过加减140的倍数调整至范围内
使用1位小数可以使用离散色值中间的颜色
也可使用RGB和RGBA颜色值
extensions [palette] ;; 调色盘插件提供了更复杂的颜色控制
Agentsets
向一个agentsets执行多个命令时,NetLogo会对一个agent执行所有的命令,然后才会让下一个agent执行
agentsets可以包括turtles, patches, links类型,它是随机顺序的
turtles
,patches
,links
ohter
创建与输入的agentset相同但不包括当前agent的agentsetturtles-here
当前patch上的所有turtlesturtles with [color = red]
基于属性查询的子基turtles-here with [color = red]
patches with [pxcor > 0]
turtles in-radius 3
距离当前agent 3个patches的所有turtlespatches at-points [[1 0] [0 1] [-1 0] [0 -1]]
根据坐标获取一组patchesneighbors4
当前agent的4个邻居patchesturtles with [(xcor > 0) and (ycor > 0) and (pcolor = green)]
第一象限绿色patches上的turtlesturtles-on neighbors4
当前agent的4个邻居patches上的turtles[my-links] of turtle 0
turtle 0的所有links
获取agentset后的命令:
ask
传递命令any?
检查是否是空agentsetall?
检查是否所有agentset的元素都满足条件count
获取agentset的元素个数one-of
随机选取一个agentset的元素ask one-of turtles [set color red]
ask one-of patches [ sprout 1 ]
随机选择一个patch产出一个新agent
max-one-of
/min-one-of
选取最大/最小的agentset的元素ask max-one-of turtles [sum assets] [die]
histogram
创建直方图histogram [sum assets] of turtles
of
使用of命令获取agentset的元素的一列值show mean [sum assets] of turtles
turtle-set
,patch-set
,link-set
创建agentsetno-turtles
,no-patches
,no-links
创建空agentset- 使用
=
或!=
检查两个agentset是否相等 member?
检查特定Agent是否属于agentset
turtles
和links
是两个特殊的agentset,它们的规模会实时变动,即便将其赋值到一个变量中
set g turtles
print count g
若希望创建有序的Agentset,需要使用list,见代码示例Ask Ordering Example
Button
Forever按扭中的程序若停止,则按扭也会被停止
List
list使用[]包裹,可以嵌套,如set myList [[2 5][3 8]]
若希望创建基于reporter的list,则使用list
命令
两个元素的list:set random-list list (random 10) (random 20)
多个元素的list:set random-list (list random 10 random 20 random 30)
替换元素使用replace-item
命令,如replace-item 1 random-list 100
第一个编号为索引号
嵌套替换:set mylist (replace-item 3 mylist (replace-item 2(item 3 mylist) 100))
lput
命令在末尾追加元素,fput
命令在开头追加元素
but-last
(bl
)将list恢复到上次修改set mylist but-last mylist
foreach [list] [command]
遍历列表
如foreach [1 2 3] show
,foreach [2 3 4] [n -> crt n show (word "created " n " turtles")]
map
与foreach
类似,但它是一个reporter,如show map round [1.2 2.2 3.2]
,show map [ x -> x < 0] [1 -1 3]
其他方法:filter
, reduce
, sort
, sort-by
, repeat
, while
sort
和sort-by
可以接收agentset作为参数
sort
turtles会根据who
属性排序,sort
patches根据从左到右,自上而下排序,sort
links根据end1
和end2
属性升序排序
reverse
命令反转list
ex. sort-by [ [a b] -> [size] of a < [size] of b ] turtles
Math
Code Example: Random Seed Example
Shape
turtles Shapes
turtle形状采用矢量形状,它们由基本的几何形状组成。
turtle的形状存储在它的shape
变量中,可以通过set
命令设置
新的turtle采用default形状,可以通过set-default-shape
命令设置
shapes
会返回所有可用的形状,如ask turtles [set shape one-of shapes]
set-line-thickness
命令设置线宽
Code Examples: Breeds and Shapes Example, Shape Animation Example
Link Shapes
与turtle shapes基本一致,link-shapes
汇报所有当前模型的link形状
View Update
NetLogo提供continuous和tick-based更新视图
默认采用continuous更新,但绝大多数模型都采用tick-based更新
continuous更新非常简单,默认每秒更新30次
no-display
命令可以关闭连续更新,display
命令恢复更新并强制更新
顶部工具栏settings…中Frame rate = 30帧/秒限定了tick-based更新的最快速度,若显示时间过短NetLogo会暂停更新
Ploting
绘图常用plot
和plotxy
命令
plot
命令只需指定y值,x轴自动设置为时间(plot pen的interval设置了时间轴间隔)
如plot count turtles
plotxy
命令需要指定x和y值,如plotxy time count-turtles
运行reset-ticks
/setup-plots
命令时会运行plot和pen的setup命令,则pen setup命令不会运行
运行reset-ticks
/tick
/update-plots
命令时,plot和pen update命令,同样可以stop
Code Example: Plotting Example
plot pen的mode可以修改line, bar, point
histogram
histogram
命令创建一个直方图,如histogram [sum assets] of turtles
Code Example: Histogram Example
可以通过clear-plot
命令清除绘图,clear-all-plots
命令清除所有绘图点
set-plot-x-range
和set-plot-y-range
命令可以设置绘图范围
set-current-plot
和set-current-plot-pen
命令可以设置当前绘图和绘图笔
Code Examples: Plot Axis Example, Plot Smoothing Example, Rolling Plot Example
String
but-first "string"
返回”tring”即去除第一个字符but-last "string"
返回”strin”即去除最后一个字符empty? "string"
判断字符串是否为空first "string"
返回第一个字符sitem 2"string"
返回第二个字符tlast "string"
返回最后一个字符glength "string"
返回字符串长度member? "str" "string"
判断字符串s是否在string中position "rin" "string"
返回rin在string中的开头索引,若不存在则返回falseremove "r" "string"
返回string中r去掉后的字符串replace-item 3 "string" "o"
返回strongreverse "string"
返回string的倒序is-string? "string"
判断是否为字符串substring "string" 2 5
返回string中从索引2到4的字符串rinword "str" "ing"
返回两个字符串的拼接,如”str” “ing”返回”string”- 转义
\n
,\t
,\"
,\\
Output
print
show
展示哪个agent打印了什么type
在同一行打印write
可将打印值通过file-read
命令读取
若NetLogo中存在output area命令,则通过output-print
, output-show
, output-type
, output-write
命令输出,
使用clear-output
命令清除,使用export-output
导出到文件
output area内容存储在export-world
命令中
import-world
命令会清空当前output area内容并设置为导入内容
若使用这些output命令但没有设置output area,则输出到控制台
File I/O
file-open
打开文件file-read
读取文件file-read-line
读取文件一行file-read-character
读取文件一个字符file-at-end?
file-print
file-show
file-type
file-write
file-delete
只有delete会删除原文件数据,所有的写入都是追加模式file-close
必须与file-open配对使用file-close-all
user-directory
user-file
user-new-file
Code Examples: File Input Example, File Output Example
Movies
需要加载extension vid
使用vid:start-recorder
命令打开视频录制器
Code Example: Movie Example
Drawing
Drawing是显示turtules移动轨迹的画层
pen-down
命令画线,pen-up
命令停止划线,pen-erase
擦除画线
pen-size
设置线宽
clear-drawing
命令清除画层
Topology
对于non-wrapping有一些可选方案:让turtles对称或随机折返、删除turtles、隐藏turtles
can-move?
方法判断turtle是否可以移动
if not can-move? distance [ rt 180 ]
原路折返
if not can-move? distance [ die ]
Link
layout-circle
在给定半径内围绕世界中心平均分布agentslayout-radial
处理树状结构layout-tutte
给定一组锚节点,将其他节点放在这些节点连接的中心layout-spring
适用于多种网络,但迭代时间较慢
Code Examples: Network Example, Network Import Example, Giant Component, Small Worlds, Preferential Attachment
匿名程序Anonymous Programs
->
创建匿名程序
Code Example: State Machine Example
Shapes Editor
可以从library或其他model中导入shapes
library包含了大多常用的shapes
BehaviorSpace Guide
BehaviorSpace运行一个模型多边,系统性地改变模型参数并记录结果
Tools -> BehaviorSpace
按new键创建一个新的环境设置,没有必要设置所有内容,在一些环节可以保留空白或使用默认值, 若属性名带下划线则可悬浮查看细节
Experiment name: 同一个模型中所有实验名称必须唯一
Vary variables as follows: 设置希望变化的变量,这些变量可以包括sliders, switches, choosers和所有global varibales
变量还包括max-pxcor, min-pxcor, max-pycor, min-pycor, world-width, world-height, random-seed
两种设置变化的方法:
["number" [100 50 1000]]
从100到1000,步长为50["number" 100 200 300]
指定值
变量名必须使用双引号
值的组合:[["a" 1 2] ["b" [2 3 5]]]
会产生6个组合
子实验语法:部分变量的组合
["c" 5] ;; 规定一个常量,它会适用于每个没有覆写它的实验
[["a" 1 2]["b" 1]]
[["a" 3 4]["b" 2]]
[["a" 5 7]["b" 3]["c" 6]]
Execute combinations in sequential order:若勾选则后定义的变量变化更快,否则先定义的变量变化快
Repetitions: 不改变模型参数重复实验次数
Measure runs using these reporters: 每次运行时收集的值
使用多个reporters每个单独一行
Run metrics every step: 是否每步都进行测量
Run metrics when: 若取消每步测量,则指定测量条件
ex.ticks mod 10 = 0
无论如何在模型结束时都会进行一次测量。
Pre experiment commands: 在每次实验开始前执行的命令
Setup commands: 每次实验开始前执行的命令,通常是setup
程序
若希望固定随机数,则使用random-seed 42 setup
,若希望每次存在差别使用
random-seed (42 + behaviorspace-run-number) setup
Go commands: 通常是go
程序
Stop condition: 可选停止实验的条件,ex.not any? turtles
Post run commands: 每次实验结束后执行,通常为空,但可使用export-world
等命令记录结果
Post experiment commands: 在实验最后执行
Time limit: 每次运行的时间限制
BehaviorSpace experiment具有两个特殊属性
- behaviorspace-run-number: 当前实验的编号
- behaviorspace-experiment-name
完成设定后,按OK
键,之后按Run
键按钮会弹出Run Options对话框出现
对话框中可选择数据保存格式
- Spreadsheet output
- Table output
若二者至少被选中一个,则可选择补充内容
- Lists output
- Statistics output
取消使用update plots and monitors会使程序效率更高
Spreadsheet output
列出每步序号及其对于的测量
Table output
该格式适合使用其他工具进行进一步分析
Statistics output
会计算Table output或Spreadsheet output中的所有测量值的均值,标准差
Lists output
它是Spreadsheet output和Table output的补充,对于一些list格式的输出,两种主要格式会将其压缩到 一个单元格中,Lists output会将其展开到多个单元格中
System Dynamics
System Dynamics diagram由4种元素组成:
- Stock: 对象的集和,如羊群规模、工件总数量等
- Flow: Stock的变化
- Variable: diagram中使用的值,可以是变量或常量
- Link: 将数字从Variable或Stock链接到另一个Stock或Flow
模型使用迭代法估计,dt值越小模型估计越精准,但迭代更慢
NetLogo提供了4个案例:Exponential Growth
, Logistic Growth
, Wolf Sheep Predation (System Dynamics)
, Wolf Sheep Predation (Docked Hybrid)
Tools -> System Dynamics Modeler
Diagram Tab
在图中可以绘制4种元素
每个Strock都需要一个唯一的名称用于创建全局变量,同时需要一个初始值,它可以是数字、变量、表达式或调用函数
Variable同样需要唯一名称作为procedure或全局变量的名称,同时它也需要一个表达式,可以是数字、变量、表达式或调用函数
Flow需要一个表达式作为输入到输出的流速,它可以是数字、变量、表达式或调用函数,若值为负即反向流动
当一个Stock有多个Flow连接时,需要考虑Flow之间的交互关系,NetLogo不会对此有任何假设,需要在Expression中自行限制,如Stock不足以流出时的行为等
工具栏可以设置dt值
Code Tab
Diagram Tab会将绘图元素自动转换为Code Tab代码
Code Tab不可编辑,只能编辑Diagram Tab
Code Tab中的variables和procedures可以在NetLogo主窗口、command center或交互界面buttons中调用
3个重要precodures:system-dynamics-setup
, system-dynamics-go
, system-dynamics-do-plot
system-dynamics-setup
: 初始化聚合模型,它设置了dt,reset-ticks
system-dynamics-go
: 运行聚合模型dt时间单位
system-dynamics-do-plot
: 绘制聚合模型的Stocks值,它会在NetLogo主窗口创建一个plot,之后需要定义一个plot pen给每个Stock,可以使用set-current-plot
命令设置
用户手册中有详细案例