Java 尝试在层次模型中移动代理时出现AnyLogic错误
任务描述:模型包含两种类型的代理,一种类型的代理生活在另一种类型的代理中。为了在高阶代理之间移动代理,我使用了以下代码(查找随机连接的代理,然后尝试增加其数量,然后定义内部位置): 代码已成功编译,但是Java 尝试在层次模型中移动代理时出现AnyLogic错误,java,anylogic,Java,Anylogic,任务描述:模型包含两种类型的代理,一种类型的代理生活在另一种类型的代理中。为了在高阶代理之间移动代理,我使用了以下代码(查找随机连接的代理,然后尝试增加其数量,然后定义内部位置): 代码已成功编译,但是anylogic本身会引发错误: java.lang.RuntimeException: root.cities[0].population[40]: INTERNAL ERROR: moving shape from one owner directly to another: com.anyl
anylogic
本身会引发错误:
java.lang.RuntimeException: root.cities[0].population[40]:
INTERNAL ERROR: moving shape from one owner directly to another: com.anylogic.engine.presentation.ShapeEmbeddedObjectPresentation@566dc332 -> com.anylogic.engine.presentation.ShapeEmbeddedObjectPresentation@f8b9090
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.Utilities.error(Unknown Source)
at com.anylogic.engine.internal.ac.l(Unknown Source)
at com.anylogic.engine.presentation.Shape.l(Unknown Source)
at com.anylogic.engine.presentation.Shape3D.l(Unknown Source)
at com.anylogic.engine.presentation.ShapeTopLevelPresentationGroup.setOwner_xjal(Unknown Source)
at com.anylogic.engine.Agent.setOwnerShape_xjal(Unknown Source)
at com.anylogic.engine.presentation.ShapeEmbeddedObjectPresentation.setEmbeddedObject_xjal(Unknown Source)
at com.anylogic.engine.presentation.ShapeEmbeddedObjectPresentation.<init>(Unknown Source)
at hierarchicalmodel__mobility_.City._population_presentation_createShapeWithStaticProperties_xjal(City.java:366)
at hierarchicalmodel__mobility_.City$1.createShapeWithStaticProperties_xjal(City.java:388)
at com.anylogic.engine.presentation.ShapeAgentPopulationGroup.createShapes(Unknown Source)
at com.anylogic.engine.presentation.ShapeAgentPopulationGroup.updateDynamicProperties(Unknown Source)
at com.anylogic.engine.presentation.ShapeGroup.updateDynamicProperties(Unknown Source)
at com.anylogic.engine.Presentable.l(Unknown Source)
at com.anylogic.engine.Presentable.updateShapeDynamicProperties(Unknown Source)
at com.anylogic.engine.presentation.ShapeEmbeddedObjectPresentation.updateDynamicProperties(Unknown Source)
at com.anylogic.engine.presentation.ShapeAgentPopulationGroup.updateDynamicProperties(Unknown Source)
at com.anylogic.engine.presentation.ShapeGroup.updateDynamicProperties(Unknown Source)
at com.anylogic.engine.Presentable.l(Unknown Source)
at com.anylogic.engine.Presentable.updateShapeDynamicProperties(Unknown Source)
at com.anylogic.engine.presentation.Panel.d(Unknown Source)
at com.anylogic.engine.presentation.Panel.j(Unknown Source)
at com.anylogic.engine.presentation.Panel$c.run(Unknown Source)
非常感谢您的帮助(可能您知道在高阶代理之间移动代理的不同方式) 这是AnyLogic 8.0-8.2的一个bug。好的,如果目标种群位于主节点,则会出现错误。有一个解决方法:将目标群体放在主代理的虚拟代理中(参见屏幕截图):
这个错误应该在AnyLogic 8.3或8.4中修复。我模拟的结构不同:主要、城市、人。城市人口占主要地位。人口是每个县的人口。我想把人们转移到不同的城市。我不知道如何使用虚拟解决方案。Sebastian,尝试创建辅助代理类型(如所有者),将其置于Main。在所有者内部,创建城市人口。在城市代理类型中,创建人口。在修复错误之前,我一直使用版本7:)
java.lang.RuntimeException: root.cities[0].population[40]:
INTERNAL ERROR: moving shape from one owner directly to another: com.anylogic.engine.presentation.ShapeEmbeddedObjectPresentation@566dc332 -> com.anylogic.engine.presentation.ShapeEmbeddedObjectPresentation@f8b9090
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.Utilities.error(Unknown Source)
at com.anylogic.engine.internal.ac.l(Unknown Source)
at com.anylogic.engine.presentation.Shape.l(Unknown Source)
at com.anylogic.engine.presentation.Shape3D.l(Unknown Source)
at com.anylogic.engine.presentation.ShapeTopLevelPresentationGroup.setOwner_xjal(Unknown Source)
at com.anylogic.engine.Agent.setOwnerShape_xjal(Unknown Source)
at com.anylogic.engine.presentation.ShapeEmbeddedObjectPresentation.setEmbeddedObject_xjal(Unknown Source)
at com.anylogic.engine.presentation.ShapeEmbeddedObjectPresentation.<init>(Unknown Source)
at hierarchicalmodel__mobility_.City._population_presentation_createShapeWithStaticProperties_xjal(City.java:366)
at hierarchicalmodel__mobility_.City$1.createShapeWithStaticProperties_xjal(City.java:388)
at com.anylogic.engine.presentation.ShapeAgentPopulationGroup.createShapes(Unknown Source)
at com.anylogic.engine.presentation.ShapeAgentPopulationGroup.updateDynamicProperties(Unknown Source)
at com.anylogic.engine.presentation.ShapeGroup.updateDynamicProperties(Unknown Source)
at com.anylogic.engine.Presentable.l(Unknown Source)
at com.anylogic.engine.Presentable.updateShapeDynamicProperties(Unknown Source)
at com.anylogic.engine.presentation.ShapeEmbeddedObjectPresentation.updateDynamicProperties(Unknown Source)
at com.anylogic.engine.presentation.ShapeAgentPopulationGroup.updateDynamicProperties(Unknown Source)
at com.anylogic.engine.presentation.ShapeGroup.updateDynamicProperties(Unknown Source)
at com.anylogic.engine.Presentable.l(Unknown Source)
at com.anylogic.engine.Presentable.updateShapeDynamicProperties(Unknown Source)
at com.anylogic.engine.presentation.Panel.d(Unknown Source)
at com.anylogic.engine.presentation.Panel.j(Unknown Source)
at com.anylogic.engine.presentation.Panel$c.run(Unknown Source)
this.goToPopulation(destinationCity.population);