问题描述
我正在尝试扫描一只乌龟附近的所有乌龟,如果它们符合条件,并且如果大小大于10只乌龟的集群中不同品种的比率还可以,那么我将乌龟与集群的领导者。
但是我很难确定agentset“候选人”中每个项目的品种,这是我要问的乌龟附近所有乌龟的列表。根据项目/乌龟的种类,我要执行命令块。
有人可以帮忙吗?
let candidates turtles in-radius radius_scan with [ leader != [leader] of myself and exempt_from_immobilisation = false and aggregated = false]
if (any? candidates) ;; if there are candidates around and the cluster is too small,then proceed to increase the size of the cluster without taking into account any ratios
[
ifelse
length(aggregate-list) < 10 [
if who not member? aggregate-list [ set aggregate-list lput myself aggregate-list ]
create-links-with candidates [show-link ]
ask candidates [
set aggregated true
if who not member? aggregate-list [ set aggregate-list lput myself aggregate-list ]
;set aggregate-list lput myself aggregate-list
merge ]
]
[ ;; if cluster is big enough,start checking if the ratios are approximately making sense
(foreach candidates [ t ->
;let t-breed breed of t
(ifelse
breed = sykfactive [
ifelse ( ( (length(filter is-monomer1? aggregate-list)) + (length(filter is-dimer2? aggregate-list)) + (length(filter is-monomer2syk1active_crosslink? aggregate-list))) <= ( (length(filter is-sykfactive? aggregate-list)) + 5 ))
[
if who not member? aggregate-list [ set aggregate-list lput myself aggregate-list ]
create-links-with t [show-link ]
ask t [
set aggregated true
if who not member? aggregate-list [ set aggregate-list lput myself aggregate-list ]
;set aggregate-list lput myself aggregate-list
merge ]
]
[;;else commands
print "nothing to print or do"
]
]
is-monomersykactive? [
if ( (length(filter is-monomersykactive? aggregate-list)) <= ( (length(filter is-monomer1? aggregate-list)) + 5 ))
[
if who not member? aggregate-list [ set aggregate-list lput myself aggregate-list ]
create-links-with t [show-link ]
ask t [
set aggregated true
if who not member? aggregate-list [ set aggregate-list lput myself aggregate-list ]
;set aggregate-list lput myself aggregate-list
merge ]
]
]
is-dimer2syk1active? [
if ( ( (length(filter is-monomer1? aggregate-list)) + (length(filter is-dimer2? aggregate-list)) ) >= ( (length(filter is-dimer2syk1active? aggregate-list) + 5 )) )
[
if who not member? aggregate-list [ set aggregate-list lput myself aggregate-list ]
create-links-with t [show-link ]
ask t [
set aggregated true
if who not member? aggregate-list [ set aggregate-list lput myself aggregate-list ]
;set aggregate-list lput myself aggregate-list
merge ]
]
]
[;;else commands
print "nothing to print or do"
])
]
)
]
]
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)