You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to return nearby_positions() of an agent, searching different distances for each of the dimensions in my GridSpace. When I change r = 3 to r = (1, 3) I get an error. I also get an error with nearby_ids().
Minimal Working Example
using Agents
space = GridSpace((20, 20))
@agent struct test_ag(GridAgent{2})
end
function test_step!(agent, model)
move_agent_single!(agent, model)
end
model = StandardABM(
test_ag, # type of agents
space; # space they live in
agent_step! = test_step!
)
for n in 1:5
add_agent_single!(model)
end
# works fine
nearby_positions(model[1], model, 3)
# does not work
nearby_positions(model[1], model, (1,3))
# does not work, but returns a different error
nearby_ids(model[1], model, (1,3))
Right, yeah this is a bug. It must have crept in somewhere during the transition to v6, as it required a lot of refactoring. The reason this bug exists is because we haven't tested this particular function in the test suite.
If you would like to have a crack at fixing the bug via a Pull Request, it would be appreciated. From the error messages we just have to make sure offsets_within_radius_no_0(::GridSpace{2, true}, ::Tuple{Int64, Int64}) works.
I had a look at the code, but it is a little over my head. I'm new to Julia and Agents, and I am not confident I could fix the bug without creating more issues.
I'm trying to return
nearby_positions()
of an agent, searching different distances for each of the dimensions in my GridSpace. When I changer = 3
tor = (1, 3)
I get an error. I also get an error withnearby_ids()
.Minimal Working Example
nearby_positions()
error:ERROR: MethodError: no method matching offsets_within_radius_no_0(::GridSpace{2, true}, ::Tuple{Int64, Int64})
nearby_ids()
error:ERROR: MethodError: no method matching bound_range(::UnitRange{Int64}, ::Int64, ::GridSpace{2, true})
Agents.jl version 6.0.16
Julia version 1.10.4
The text was updated successfully, but these errors were encountered: