ModelEvent in continous time model?


I have been working with discrete model type in agents.jl. There we have agent_step and model_step functions to work at model or agent level. Now I want to switch to continous time models. i was checking example for same on Agents.jl page. I came across AgentEvent function to influence each agent how we want but how to do something at model level like model_step in StandardABM and not at each agent level? Is there an option?

Thank you :slight_smile:

There is no model event in EventQueueABM so far, no. Initially we didn’t implement any model step because there wasn’t a time “before all” or “after all” agents have acted for it to trigger.

You should open a feature request at Agents.jl github page. It is actually easy to implement a ModelEvent that is a wrapper around AgentEvent with a reference to special internal type so that the internal code can understand that the event action acts only on the model.

Until this feature is implemented, keep in mind that all agent events also have the model as argument so you can add one more event that applies to all agents and just modifies the model. (the downside is that such an event won’t trigger if the assigned agent gets remove, hence why the suggestion is good).

The best would even be if you try to implement this of course! :smiley:

In my case there is no agent removal but I will be using interaction_pair() function which is much better to use at model level rather then agent I believe and thats why I was wondering if AgentEvent() could take all agents in account at a given time?

To be clear what I really want - I’m trying to implement this model in continuous time. :slight_smile:

Any suggestion will be helpful.

Any function f(model would take all agents into account if you use the model. E.g. in an event

function attack!(agent, model)
aa = allagents(model) # these are all agents.
1 Like

ahh thats perfect then :slight_smile: I will try to implement a small model first and will post here will be helpful for others. :).

Also, I believe it will be really nice if we could have more example for continuous time models too like StandardABM :sweat_smile:. Maybe when I complete this, it can be added :grinning: because although things are pretty straightforward but for someone new its always kind of puzzling while transferring things from one type to other type of model.

You are very welcomed to contribute more examples to Introduction · Agents.jl Example Zoo !

1 Like