我创建的ABM实际上是AnyLogic 8.4.0中的一种复杂的SIR(流行病学模型)。一切基本上都可以初始化,但是在初始化状态(在主状态)结束时会出现此错误:
Error during model startup:
root.user[0]:
root.user[0].agentStatechart: trying to start statechart twice
That is followed by a traceback that doesn't really seem too informative.
root.user[0]:
root.user[0].statechart: trying to start statechart twice
java.lang.RuntimeException: root.user[1]:
root.user[1].statechart: trying to start statechart twice
at com.anylogic.engine.Engine.error(Unknown Source)
at com.anylogic.engine.Agent.error(Unknown Source)
at com.anylogic.engine.Utilities.error(Unknown Source)
at com.anylogic.engine.Statechart.start(Unknown Source)
at simsearchprototype_0_3.User.doStart(User.java:2372)
at com.anylogic.engine.Agent.startAsEmbedded(Unknown Source)
at simsearchprototype_0_3.Main.doStart(Main.java:4005)
at com.anylogic.engine.Agent.startAsEmbedded(Unknown Source)
at com.anylogic.engine.Agent.start(Unknown Source)
at com.anylogic.engine.Engine.start(Unknown Source)
at com.anylogic.engine.ExperimentSimulation.m(Unknown Source)
at com.anylogic.engine.ExperimentSimulation.run(Unknown Source)
at com.anylogic.engine.gui.ExperimentHost.k(Unknown Source)
at com.anylogic.engine.gui.ExperimentHost.executeCommand(Unknown Source)
at com.anylogic.engine.internal.webserver.m.onCommand(Unknown Source)
at com.anylogic.executor.basic.rest.BasicAnimationSessionController.lambda$null$9(BasicAnimationSessionController.java:112)
at com.anylogic.engine.internal.webserver.e.acceptToAnimationSvgSession(Unknown Source)
at com.anylogic.executor.basic.rest.BasicAnimationSessionController.lambda$startController$10(BasicAnimationSessionController.java:112)
at spark.ResponseTransformerRouteImpl$1.handle(ResponseTransformerRouteImpl.java:47)
at spark.http.matching.Routes.execute(Routes.java:61)
at spark.http.matching.MatcherFilter.doFilter(MatcherFilter.java:130)
at com.anylogic.engine.internal.y.e$1.e(Unknown Source)
at org.eclipse.jetty.servlets.QoSFilter.doFilter(QoSFilter.java:201)
at com.anylogic.engine.internal.y.e$1.doHandle(Unknown Source)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1568)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
at org.eclipse.jetty.server.Server.handle(Server.java:530)
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:347)
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:256)
at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:279)
at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:102)
at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:124)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:247)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.produce(EatWhatYouKill.java:140)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:131)
at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:382)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:708)
at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:626)
at java.base/java.lang.Thread.run(Unknown Source)
我尝试重建状态图,重命名状态图,重新启动anylogic,以及几乎所有常用的修复程序,以解决它们的错误,但这仍然存在。 我发现,如果我在总体中创建一个代理(然后动态创建所有其他代理),该错误将变为尝试两次启动第一个动态创建的代理的状态图。