多主体建模工具Netlogo的介绍

上传人:xmg****18 文档编号:117178185 上传时间:2019-11-18 格式:PPT 页数:37 大小:2.23MB
返回 下载 相关 举报
多主体建模工具Netlogo的介绍_第1页
第1页 / 共37页
多主体建模工具Netlogo的介绍_第2页
第2页 / 共37页
多主体建模工具Netlogo的介绍_第3页
第3页 / 共37页
多主体建模工具Netlogo的介绍_第4页
第4页 / 共37页
多主体建模工具Netlogo的介绍_第5页
第5页 / 共37页
点击查看更多>>
资源描述

《多主体建模工具Netlogo的介绍》由会员分享,可在线阅读,更多相关《多主体建模工具Netlogo的介绍(37页珍藏版)》请在金锄头文库上搜索。

1、多主体建模工具Netlogo介绍 张江 北京师范大学管理学院系统科学系 北师大复杂系统暑期学校2010 多主体模拟 计算机模拟v.s.数学分析 多主体模拟v.s.计算机模拟 多主体模拟的特性: 每个主体都是一个独立的对象; 主体运行于一个虚拟的宇宙 主体之间可以通过相互作用产生涌现 二个实例 Game of Life 生命游戏 1970年,John Conway 提出了一个有趣的 计算机程序:生命 游戏 这是一个方格世界, 每个方格仅仅有黑 、白两种颜色 生命游戏的规则 想象一个外星空间存活者很多方格生命,如果一个方格是黑色的,那 么这里就有一个生命,如果是白色的就没有 每个方格周围都有8个邻

2、居 诞生规则 如果某时刻,一个空方格(白色)周围邻居中有三个活的生命(黑 色方格),那么该方格就会诞生一个新生生命(白色黑色) 死亡规则 在某时刻,对于已经占领某方格的生命体(黑色)只有当它的邻居中有2个或 者3个是活的(黑色),它才会继续存活,否则不是因为过分拥挤就是因为过 分孤独而死亡(黑色白色) Boid模型 每只鸟的邻域 A birds Neighborhood 规则1靠近 Cohesion: steer to move toward the average position of neighbors 规则2对齐 Alignment: steer towards the average

3、 heading of neighbors 规则3避免碰撞 Separation: steer to avoid crowding neighbors Swarm Repast Processing Netlogo Netlogo的历史 Logo语言最早是为了乐高机器人玩具 设计的,这些机器人被称为: Turtle( 海龟). 之后,Mitchel Resnick, Eric Klopfer 等 人把 Logo语言扩展成为Star-Logo工具 NetLogo是Star-Logo的最新版本 NetLogo是一个很容以上手的高级建模玩具。 一个简单实例:气体模型 Step by step 打开N

4、etlogo界面,添加2个按钮setup和 go,注意把go上面的Forever勾上 选择Procedure选项卡,编写代码 写下代码: to setup create-turtles 50 setxy random-xcor random-ycor set heading random 360 End 运行看一下效果,在create-turtles前面 加一行clear-all 再为go按钮添加一下代码 to go ask turtles forward 1 End 运行看一下效果 可以在clear-all后面添加:set-default- shape turtles “circle”语句

5、试着调节视图的大小 试着调节边界条件 仿真的基本框架 初始化to setup 每一个仿 真周期to go 是否结 束? 结束 对所有Turtle循环 ask turtles 每个Turtle做出决策 forward 1 是 否 Boid模型 在Models Library中Biology菜单下找到Flocking 手动建立Game of Life Tips 新的对象:Patch (一个方格) 对象的属性:patches-own x,y, Ask patches:对所有的patch对象循环 Ask turtles:对所有的Turtles对象循环 set living count neighbor

6、s with pcolor = black living=0; for each agent in neighbors if agent.pcolor=black living=living+1; 相当于: 一个简单生态系统 Tips Turtle可以在各个Patch上游走 每个Turtle可以直接访问Patch对象 Observer对象:一个可以操纵全局的观察者, 例如Plot 偏好依附模型 每个周期添加一个节点 这个节点将以较大的概率连接 度数较大的节点 调用Netlogo中的算法自动将网 络排序 Tips Links(网络连接):与Turtles, Patches并列的 系统对象 cre

7、ate-link-with:创建连接语句 count link-neighbors:计算当前Turtle的连接数 layout-spring按照一定的算法自动排布网络节点 更多的NetLogo模型 “Party Model” A big party with 10 rooms Boys and girls distribute in different rooms Boy (girl) feels uncomfortable if there are too many girls(boys) They move to other rooms What distribution will for

8、m? Segregation and Pattern Formation Two types of people living in a city Each person can Move around within a given range Settle down if the number of same type neighbors is big enough Otherwise, keep moving Pattern formation Thomas C. Schelling In 1960, he found the phenomenon of segregation of bl

9、ack and white. One day in flight, a simple game with coins came up his mind He invented this segregation model He won Nobels prize in 2005 A Toy Model of Urban Road Network Growth The traffic flow is determined by the road network The network is shaped by flows in a long time Growth of urban road ne

10、tworks Co- evolution of road network and traffic flow Implementation in Netlogo Given a green landscape with N*N cells W: Number of cars ever visiting this cell Cars travel around in this landscape, a car will repeat the cell with bigger W mostly explore new cells with a small probability The roads that never been repeated are deleted every 100 time steps 更多的Netlogo特征 3D视图 Java Applet HubNet 更多资源 NetLogo 中文手册 A Chinese version Model library 习惯NetLogo 谢谢! 知识回顾知识回顾 Knowledge Knowledge ReviewReview

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 大杂烩/其它

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号