JuliaDynamics/Agents.jl

Models.jl removed from main in current build?

Closed this issue · 6 comments

Some code examples in the documentation rely on pulling from the model zoo, e.g., for visualizing graphspace models:

sir_model, sir_agent_step!, sir_model_step! = Models.sir()
But it appears that the Models.jl submodule and folder is missing from "src" in the main branch. Is there an alternative way to reference these canonical models in 6.0.0?

We moved the definitions to AgentsExampleZoo, which works with version 6.0. So if you are using those models, you can refer to the definitions there: https://github.com/JuliaDynamics/AgentsExampleZoo.jl/tree/main/src

Ah ha. Got that. Is expected usage the same here, e.g. in the call above when I attempt to use:

sir_model, sir_agent_step!, sir_model_step! = AgentsExampleZoo.sir()

I get an error

MethodError: no method matching iterate(::StandardABM{…}) Closest candidates are: iterate(::Permutations.Permutation)...

When I attempt to pass AgentsExampleZoo.sir() directly to abmplot I get:

ERROR: KeyError: key :space not found

Tried, it works fine when I tested it. Are you sure you are using Agents 6.0?

Ah ok ok, AgentsExampleZoo.sir() does only return the model now since the steps are contained in it from v6, so you need to do:

sir_model = AgentsExampleZoo.sir()

Try to execute https://github.com/JuliaDynamics/Agents.jl/blob/main/examples/agents_visualizations.jl where you can see that the sir model is plotted, it works fine on my machine

Got it, took some fiddling but this does work for me. I see that along with some other small changes to syntax there are now functions to get to the model space object, etc. rather than directly access them as fields, e.g.

model.space.graph -> abmspace(model).graph

I'll close this for now. Appreciate your hand holding!