英文:
Forced Resources release
问题
我有两个并行流:第一个通过生成一个属于种群2的代理来驱动第二个流,通过分裂来实现。复制代理与原始代理共享一个识别码。
我希望当原始代理离开流1时,立即将复制从流2中移除。
我想要做的是强制从种群2中移除复制代理(手动执行remove_pop2()),迫使它释放到目前为止占用的所有资源。
是否可以通过“On_remove”函数来实现这一点,还是需要代理切换到seize块?
附上两个流的图片。
谢谢!
英文:
I have two parallel streams: the first drives the second by generating an agent belonging to population 2 via a split. The copy agent shares an identification code with the original agent.
In this way I would like that the moment the original agent leaves stream 1, immediately the copy is removed from flow 2.
What I would like to do is force the removal of the copy agent from population 2 (manually remove_pop2()), forcing it to release all the resources taken up to that point.
There is the possibility to do this with a "On_remove" function or it is necessary for the agent to switch to a block of seize.
Attached image of the two streams.
Thank you!
答案1
得分: 0
你可以在销毁之前将其发送到一个单独的流程图中。在其中添加一个释放所有占用资源的“释放”模块。之后,在“接收器”中终止代理。
拖入这些模块:进入
,释放
,接收器
。
无论你现在在哪里终止代理,都不要这样做。相反,使用类似 enter.take(agent);
的方式将其发送到进入
模块。
英文:
You can send it to a separate flow chart before destroying it. In it, add a Release
block that releases all seized resources. After that, kill the agent in a Sink
.
Drag in these blocks: Enter
, Release
, Sink
.
Where ever you kill the agent now, don't. Instead, make it go to to the Enter
block using something like enter.take(agent);
.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论