Same output message in the same layer with different agents types #1124
Replies: 2 comments
-
We intentionally prevent messages being output to the same message list by multiple agent functions within a concurrently executing layer to avoid a concurrency issue as you've correctly suggested. This is regardless of what type of agent is executing the function, as message lists are independent of agent type. It would be possible to implement concurrent message output from multiple agent functions to the same message list in the same layer, but it would require additional memory and an additional post-processing step. For now, this means you will have to schedule these agent functions in sepearet layers, reducing agent function concurrency within your model, which will likely make your simualtions a take a small amount of extra time (unless you have very large agent populations, where the same serialisation would occur). Alternatively, rather than explicitly manageing agent function layers yourself you can use the Dependency Graph interface to define the execution order of your model. In this case, the order of execution of agent functions is defined by dependencies between agent / host layer functions. At runtime, the directed acyclic graph (DAG) is used to generate the layers. https://docs.flamegpu.com/guide/defining-execution-order/dependency-graph.html |
Beta Was this translation helpful? Give feedback.
-
Thank you for the suggestions, for now I solved using separated layers, although the performance gets a lot worse. In my model, this FLAMEGPU/FLAMEGPU2-visualiser#130 will help a lot because I need different agents types only for purposes related to visualization. |
Beta Was this translation helpful? Give feedback.
-
Hi,
looking at your code, I found a doubt related to the LayerDescription.cpp file, row 167:
if ((a_message_out && b_message_out && a_message_out == b_message_out) || ...
If we have something like this:
where
outputPedestrianLocation_agentx
is a function that outputs a particular type of message (e.g. BucketMessage), I get an error due to the previous check. But, actually, this is correct, right? Do you need to modify the previous check taking into account also the types of agents? Or maybe are there some problems with concurrency with output messages?Thank you!
Beta Was this translation helpful? Give feedback.
All reactions