Repast - PropertyGreaterThanEquals/PropertyLessThanEquals cause slow running speed

删除回忆录丶 提交于 2020-05-16 05:53:14

问题


I found that using the query methods “PropertyGreaterThanEquals” or "PropertyLessThanEquals" runs very much slower than using the method “PropertyEquals”. below is a simple example about query a suitable dock for truck to unload goods.

    public void match_dock() {

//      Query<Object> pre_fit = new PropertyGreaterThanEquals(context,  "unload_speed", 240);
//      Query<Object> pre_fit = new PropertyLessThanEquals(context,  "unload_speed", 240);
        Query<Object> pre_fit = new PropertyEquals(context,  "unload_speed", 240);

        for (Object o : pre_fit.query()) {
            if (o instanceof Dock) {
            System.out.println("this dock's id is: " + ((Dock)o).getId());
            }
        }
}

There are only 3 docks. it took me less than one second to run total of 1920 ticks if using "PropertyEquals"; however, it took me more than 1 minute to run total of 1920 ticks if choosing the query methods “PropertyGreaterThanEquals” or "PropertyLessThanEquals". what's the underlying cause of this slow execution problem?

来源:https://stackoverflow.com/questions/61606900/repast-propertygreaterthanequals-propertylessthanequals-cause-slow-running-spe

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!