设为首页收藏本站

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

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 5764|回复: 2

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

  [复制链接]
 楼主| 发表于 2013-3-17 12:08:04 | 显示全部楼层 |阅读模式
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序
2 F& f3 g1 T. M. \. L( X' e) a其中有一段如下9 n3 \6 ]& ^' m* i" Q" S: s
ask turtles with [ infected? = true ]  
4 R$ |* o. U( ^2 F我原本以为这句会回传『所有』infected? = true 的 turtle
6 o; t" K& d0 `* B% c# u2 e但看结果似乎不是这样。
% F, \+ p; c3 N, y8 t' C: E# f" b. w  h0 Y! L+ L/ F, C! ]
假设所有符合条件的有 5 笔, k" j- K2 E) W# f; |: o
有时候回传 1 笔,有时回传 3 笔,是不固定的
: {. R) N5 h% A1 [5 z回头查语法定义6 d+ L) Y8 |, `9 a0 @# \
with 0 x  f2 {2 w8 r9 j$ O7 ]
agentset with [reporter]
" U. t5 I0 Y9 \4 j1 M7 a: j4 M9 H: QTakes 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.2 n  ~4 b. N% [
它只说回传 agents satisfying the given condition' t% `/ o) _7 H: T9 g2 T" L5 X7 W
是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ? : z# A4 n# w1 m6 t* L1 u0 R8 g

$ K: |* R' U2 n# }$ C6 v$ f2 g想确定一下' d1 `  ]3 p" K
谢谢!  ~2 R3 Z6 J) S4 g- Q
发表于 2013-11-7 00:02:20 | 显示全部楼层
本人也是刚入手,应该是所有符合条件的新主体集。估计是因为setup的问题,每次符合条件的新主体集不同,造成结果不同。
发表于 2013-12-25 20:50:08 | 显示全部楼层
这里没问题,是『所有符合条件』的数据。6 S: G2 o' y7 q. z/ j- O% |; S7 x
问题应该是出在其他地方。。。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2026-4-30 09:06 , Processed in 0.025654 second(s), 16 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2017 Comsenz Inc.

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