英文:
Seize block, controlling agent location depending resource used
问题
以下是翻译好的部分:
我知道在下面的示例中,有一种更优雅的方法来处理它(例如,使用Service块)。但是,我想更好地理解Seize/Delay/Release块。
下面示例的目标:
- 当Seize块从资源池normalRooms中获取资源时,代理应该从节点nodeWaitingArea重新定位到节点nodeNormalRooms。
- 当Seize块从资源池largeRooms中获取资源时,代理应该从节点nodeWaitingArea重新定位到节点nodeLargeRooms。
我没有问题找到正确的目标位置,但我不知道如何控制从“等候区”到正确位置(nodeNormalRooms或nodeLargeRooms)的重新定位。
我认为这是通过延迟块中的“代理位置”来实现的,但这仅接受静态值。最佳解决方法是什么?
英文:
I am aware that in the following example there is a more elegant way to go about it (e.g. using Service block. However, I want to understand the Seize/Delay/Release blocks a bit better.
Objective of example shown below:
- When seize block takes from resource pool normalRooms, agent is to be relocated from nodeWaitingArea to node nodeNormalRooms.
- When seize block takes from resource pool largeRooms, agent is to be relocated from node nodeWaitingArea to node nodeLargeRooms.
I have no problem finding correct target location - but I don't know how to control the relocation from the "Waiting area" to the correct location (nodeNormalRooms or nodeLargeRooms).
I assume it is by "Agent Location" in the delay block - but this only accepts static values. What is the best way to solve this?
答案1
得分: 0
我认为最好在延迟之前添加一个“moveTo”块...这样你可以控制新位置。
此外,在延迟块的“on enter”操作中,你可以使用 agent.jumpTo(newNode);
。
英文:
I think it's better to just add a moveTo block before the delay... in which case you can control the new location.
Also on the on enter action of the delay block you can use agent.jumpTo(newNode);
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论