2

さまざまな種類の他のエージェント (オブジェクト) 間に多くのエッジ (リンク) を持つモデルがあります。これらのエッジを、属性を追加してアクションをスケジュールできるエージェントとしてモデル化したいと考えています。この仕事をする方法の簡単な例を見るのは役に立ちますか?

更新:私はあなたの指示に従いましたが、モデルの実行時にエラーが発生しました:

FATAL [Thread-2] 12:45:02,901 repast.simphony.ui.GUIScheduleRunner - RunTimeException when running the schedule
Current tick (1.0)
java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
    at repast.simphony.engine.schedule.DynamicTargetAction.execute(DynamicTargetAction.java:72)
    at repast.simphony.engine.controller.ScheduledMethodControllerAction$ScheduleMethodAllAction.execute(ScheduledMethodControllerAction.java:333)
    at repast.simphony.engine.schedule.DefaultAction.execute(DefaultAction.java:38)
    at repast.simphony.engine.schedule.ScheduleGroup.executeList(ScheduleGroup.java:205)
    at repast.simphony.engine.schedule.ScheduleGroup.execute(ScheduleGroup.java:231)
    at repast.simphony.engine.schedule.Schedule.execute(Schedule.java:352)
    at repast.simphony.ui.GUIScheduleRunner$ScheduleLoopRunnable.run(GUIScheduleRunner.java:52)
    at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.lang.reflect.InvocationTargetException
    at jzombies.Zombie$$FastClassByCGLIB$$6141f31.invoke(<generated>)
    at net.sf.cglib.reflect.FastMethod.invoke(FastMethod.java:53)
    at repast.simphony.engine.schedule.DynamicTargetAction.execute(DynamicTargetAction.java:69)
    ... 7 more
Caused by: java.lang.NullPointerException
    at repast.simphony.query.PropertyGreaterThan.createPredicate(PropertyGreaterThan.java:72)
    at repast.simphony.query.AbstractPropertyQuery.query(AbstractPropertyQuery.java:83)
    at jzombies.Zombie.query_energy(Zombie.java:141)
    at jzombies.Zombie.step(Zombie.java:67)
    ... 10 more

Zombie のこのメソッドの影響を受けていると思います: (ただし、エラー メッセージに具体的な指示がないため、どこが間違っているのかわかりません)

    public void query_energy() {
//      Zombie this_zombie = new Zombie (space, grid, 9999);
        Context<Object> context = ContextUtils.getContext(this);
        Query<Object> query = new PropertyGreaterThan<Object>(context, "id", 2);
        for (Object o : query.query()) {
            Zombie h = (Zombie)o;
            System.out.println("zombie id: " + h.getID());
        }

    }
4

1 に答える 1