Gridspace search different distance in each dimension

I’m using agents.jl to create an ABM. Looking at the help for GridSpace I should be able to search different distances for each of the dimensions in my GridSpace (assuming metric = :chebyshev) with functions nearby_ids() and nearby_positions(). For example, in the wolf-sheep-grass example model I should be able to get all the positions within distance 1 of a given agent in the first dimension and distance 2 in the second dimension with the following:

sheepwolfgrass = initialize_model()
nearby_positions(sheepwolfgrass[1], sheepwolfgrass, (1, 2))

But the above returns the error ERROR: MethodError: no method matching bound_range(::UnitRange{Int64}, ::Int64, ::GridSpace{2, true})

If I just want to search the same distance in all dimensions it works fine, e.g.:

nearby_positions(sheepwolfgrass[1], sheepwolfgrass, 2)

I’ve obviously got something wrong, any tips as to how I can search a GridSpace using different distances across dimensions?

Seems like a bug, but without runnable code or pkg versions I can’t say much. Please open an issue at Agents.jl github repo providing a MWE that reproduces the error, the full error stacktrace, and the package versions you used. If you use Agents.jl version that is not the current latest stable, first update.

1 Like

Apologies it took me awhile to get back to this. After updating to the latest version of Agents I was still getting the error so have now opened an issue with MWE.