如何查找未包含在座席集中的所有座席? [英] How to find all the agents who are not included in an agentset?

查看:89
本文介绍了如何查找未包含在座席集中的所有座席?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个名为Giant-component的代理集,并将所有代理的颜色设置为红色:

I have an agentset named giant-component, and I set all the agents' color to red:

ask giant-component [
    set color red
    ask my-links [
      set color red
    ]
  ]

现在,我需要将所有其他乌龟的颜色设置为蓝色.我知道一个简单的技巧就是先将所有海龟的颜色设置为蓝色,然后将所有巨型组件的颜色设置为红色,但是在仿真过程中,用户可能会感到困惑.有没有办法让所有不在巨人体内的海龟都得到?

Now I need to set all other turtles' color to blue. I know that the easy trick would be to first set all turtles' color to blue, and then colour all the giant component to red, but during the simulation it may get confusing for the user to see it. Is there a way to get all the turtles that are not inside giant-component?

推荐答案

以上答案解决了您的着色问题.一个更笼统的答案可能对该问题的其他访问者有用:

The answer above solves your problem of colouring. A more general answer that may be useful for other visitors to this question:

let not-giant turtles with [not member? self giant-component]

这将创建不在巨型组件agentset中的乌龟的agentset

This creates the agentset of turtles who are not in the giant-component agentset

这篇关于如何查找未包含在座席集中的所有座席?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆