【发布时间】:2016-11-24 10:16:59
【问题描述】:
在我的研究中,我试图建立一个模拟真实工作环境的模拟,目的是创造有关如何让人们在工作中感觉更好的知识。 特别是,我正在模拟一个人们为多个团队工作的场景(您一次只从事一个项目吗?很多人不...)。为此,我正在使用 NetLogo。
我在向自定义链接海龟集的特定代理询问时遇到问题。关键是它有时会报告一个错误,说“ASK 期望输入是一个代理或代理集,但没有得到 NOBODY”,但它不应该在没有代理存在的情况下到达那个“ASK”!我做错了什么?
函数如下:
to TeamRecruiting
;; I ask non-complete teams to...
ask teams with [ teamsize != (count membership-neighbors) ]
[
;; ... count how many individuals they have...
let actualteammembers count membership-neighbors
;; ... to save locally how many individuals they can share...
let teamoverlap overlap
;; ... their target size...
let neededsize teamsize
;; ... and their identity.
let teamwho who
;; then I ask those individuals that have not yet more things than they can handle...
ask individuals with [ indMTM != (count membership-neighbors) ]
[
;; ... to save locally who they are...
let indwho who
let createdalink 0
;; ... then if some conditions have been met ...
if(some conditions)
[
;; I create a link (of my specific type) with the team...
create-membership-with team teamwho
;; I do the following because more than one individual could join the team teamwho in the same run of the function
ask team teamwho [ set actualteammembers (actualteammembers + 1) ]
set createdalink 1
]
;; if the association occurred, ...
if(createdalink = 1)
[
;; we ask all other teams to evaluate if the new connection violates their maximum overlap constraint between the team I am considering from the beginning of the function, and all other teams, in other words...
ask teams with [ who != teamwho ]
[
let numpaths 0
let team2who who
;; I count how many individuals say that they are shared by the two teams
ask individuals
[
if((membership-neighbor? team teamwho) and (membership-neighbor? team team2who)) [ set numpaths (numpaths + 1) ]
]
;; ... and if the number of paths is more than the maximum allowed overlap...
if(numpaths > teamoverlap)
[
;; I take the connection away...
ask membership teamwho indwho [ die ]
;; and I reduce the actual number of team members
set actualteammembers (actualteammembers - 1)
]
]
]
]
]
end
感谢您的宝贵帮助!
【问题讨论】:
-
注意:问题发生在:询问会员团队谁 indwho [ die ]
标签: netlogo