Hi there,
Last year i start to replicate the famous “Ants” model using Agents.jl with version 4.x
The result was not bad, see the video and original repo :
This year, to finish integration of Julia with Agents.jl into OpenMole distributed HPC marketplace examples, i try to update to Agents.jl 5.x
I have some difficulties with evolution of !step
method :
In my previous code i use step like this to update my graphics : step!(abmstepper,model, ants_agent_step!, ants_model_step!, 1)
with
fig, abmstepper, abmobs = init_fig(model, observable)
and init_fig
running abmplot :
function init_fig(model, observable)
function ants_marker(b::Ants)
φ = atan(b.vel[2], b.vel[1]) #+ π/2 + π
scale(rotate2D(ants_polygon, φ), 2)
end
function ants_color(b::Ants)
return b.color
end
fig, abmstepper, abmobs = abmplot(model; ac=ants_color, am=ants_marker)
ax, hm = heatmap(fig[1,2], observable[1]; colormap= :thermal, nan_color= :red)
ax.aspect = AxisAspect(1)
ax2, hm2 = heatmap(fig[2,1], observable[2]; colormap= :thermal, nan_color= :red)
ax2.aspect = AxisAspect(1)
ax3, hm3 = heatmap(fig[2,2], observable[3]; colormap= :thermal, nan_color= :red)
ax3.aspect = AxisAspect(1)
s = Observable(0) # counter of current step, also observable
Colorbar(fig[1, 3], hm, width = 20,tellheight=false)
rowsize!(fig.layout, 1 , ax.scene.px_area[].widths[2])
return (fig, abmstepper, abmobs)
end
So the first update here was to understand if it’s possible to do the same thing with agents.jl v5, because !step
signature change.
I also need some info of Agent.js dev to know if there is a more simple way to manage the double step for grid space : continuous (ants move) and discrete (food patches).
Actually i use a double step method to manage that :
step!(abmstepper, model, ants_agent_step!, ants_model_step!, 1)
step!(model.sugar_model, sugar_agent_step!, sugar_model_step!, 1)
I’m very interested to push a documented / updated version of this model, already implemented in python and netlogo) to use on HPC with OpenMOLE.