在任何logic中,如何在发送功能中的特定代理发送消息?
通常,我将随机选择作为第二个参数,但通过这样做,无论其类型如何,消息都可能会发送给任何代理。例如,在模型中,有教师和学生,其中的毕业生和本科都是国家。我想指派老师向州本科生的学生发送消息。我应该在老师的行动中写什么?
Usually I select RANDOM as second parameter but by doing so the message is likely to be sent to any agent regardless of its type. For example, in the model there are teachers and students, of which graduate and undergraduate are both states. And I'd like to assign teachers to send messages to students whose state is undergraduate. What should I write in teachers' action?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
基于您更新的问题,您可以执行以下操作:
send(“ msg”,RandomWhere(Main.Students,S-≫ S.instate(s.undergradute)));
>Based on your updated question, you can do the following:
send("msg", randomWhere(main.students, s->s.inState(s.Undergraduate)));