设为首页收藏本站

最大的系统仿真与系统优化公益交流社区

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 5906|回复: 2

[求助] 新手发问超简单问题-With 的用法

  [复制链接]
 楼主| 发表于 2013-3-17 12:08:04 | 显示全部楼层 |阅读模式
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序
+ A& _- _$ f. W其中有一段如下9 m: `& B, V: D7 B; x
ask turtles with [ infected? = true ]  / I4 v3 r. p3 D' j; k3 s
我原本以为这句会回传『所有』infected? = true 的 turtle+ ]& s) T+ ^! |& l0 c% Y( ~- `: d* y
但看结果似乎不是这样。
1 D6 R3 V; t/ {% _: H9 h& b
* s& S. [: s* P; I+ J  p; S假设所有符合条件的有 5 笔- q$ |" n4 o8 e, l  x/ A7 Y
有时候回传 1 笔,有时回传 3 笔,是不固定的2 A( t' M! F( ~/ \
回头查语法定义
+ y  K, |2 P. @4 W& j/ W% {6 mwith 7 a  o8 S. @; Q4 p) I
agentset with [reporter]/ J- R+ J# D" v
Takes two inputs: on the left, an agentset (usually "turtles" or "patches"). On the right, a boolean reporter. Reports a new agentset containing only those agents that reported true -- in other words, the agents satisfying the given condition.8 J( F4 I2 `  n
它只说回传 agents satisfying the given condition, d1 d; _6 ?# g1 r  E" I
是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ? 9 }( B& P& B0 _* ?6 J0 o- [

+ Q1 V6 C- J8 W4 B) f$ y% g想确定一下  n; L; W; A) l$ U
谢谢!
9 h$ U6 W6 e/ i: u( C0 t
发表于 2013-11-7 00:02:20 | 显示全部楼层
本人也是刚入手,应该是所有符合条件的新主体集。估计是因为setup的问题,每次符合条件的新主体集不同,造成结果不同。
发表于 2013-12-25 20:50:08 | 显示全部楼层
这里没问题,是『所有符合条件』的数据。
3 q  I: o& G) s; c, d问题应该是出在其他地方。。。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|Archiver|手机版|SimulWay 道于仿真   

GMT+8, 2026-5-13 11:35 , Processed in 0.014672 second(s), 16 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表