我在一个简单的上下文(地理包)中有一个简单的代理,它使用纬度和经度来表示空间。代理应该在模型的第 10 次迭代中死亡。然后将其从上下文中删除。在模拟的第 10 次迭代中,代理停止执行其他方法(例如四处移动),因此我假设它已成功从上下文中删除/死亡,但它没有从模拟显示中删除(只是坐在那里)。
为什么它会留在显示器中,我如何在它死后将其从显示器中移除?
更新:就餐显示代码中存在错误。可以通过 repast-interest@lists.sourceforge.net 联系 Eric Tatara 获得修复文件,尽管所有错误都将在下一个版本中删除。
public class Agent {
public Geography<Object> geography;
public Context<Object> context;
public int id;
public Agent (Context<Object>context, Geography<Object>geography) {
this.geography= geography;
this.context=context;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
@ScheduledMethod(start = 1, pick = 1, interval = 1)
public void otherMethods() {
}
@ScheduledMethod(start = 10, pick = 1, interval = 1)
public void die() {
Context context = ContextUtils.getContext(this);
context.remove(this);
}
}