Hello guys,
I have a question regarding Agents.jl GridSpace does it allow coordinates that are negative or zero like (0,0) or (-5,-1).
In the test I’ve done (See code below) when I put a zero coordinates it returns an error but when checking the model I find the agent have been added to that position.
using Agents
@agent struct Customer(GridAgent{2})
age
end
space = GridSpace((100,100); periodic = false, metric = :euclidean)
model = StandardABM(Customer, space)
add_agent!((0,0), model,25)
When executing this it gives a BoundsError:
BoundsError: attempt to access 100×100 Matrix{Vector{Int64}} at index [0, 0]
However when I check I find that the agent has been added:
allagents(model)
It gives the output:
ValueIterator for a Dict{Int64, Customer} with 1 entry. Values:
Customer(1, (0, 0), 25)
The same behavior is observed for the negative position coordinates:
add_agent!((-1,-1), model,25)
Output:
BoundsError: attempt to access 100×100 Matrix{Vector{Int64}} at index [-1, -1]
And when I check the agent is added:
ValueIterator for a Dict{Int64, Customer} with 2 entries. Values:
Customer(2, (-1, -1), 25)
Customer(1, (0, 0), 25)
How does this happen is there any explanation of what going on ?
Thanks in advance for your help ![]()