Hi, I am trying to increment a few pieces of data on every model step in Agents.jl. Data are structured as Dict entries. The code appears to be incrementing appropriately when I examine the values from within model_step! using @infiltrate.
However, the corresponding variable in the model dataframe is constant for each time step.
I’ve replicated this issue by adding a couple of snippets to the Schelling model. Any suggestions on how to recover the appropriate values at each time step? Thanks!
Here is the code:
function model_step!(model)
model.foo["baz"] += 1
model.foo["bar"] += 5
end
@kwdef mutable struct Parameters
min_to_be_happy::Int = 3
foo::Dict{String,Int16} = Dict("baz" => 0, "bar" => 0)
end
And the output from mdf
0 Dict{String, Int16}(“bar”=>25, "…
1 Dict{String, Int16}(“bar”=>25, "…
2 Dict{String, Int16}(“bar”=>25, "…
3 Dict{String, Int16}(“bar”=>25, "…
4 Dict{String, Int16}(“bar”=>25, "…
5 Dict{String, Int16}(“bar”=>25, "…