Hello everyone,
First of all, I would like to thank the devs for the great piece of work that is Agents.jl .
In the world of two dimensional lattice, the square one is ubiquitous in numerical simulations. In this package, the square lattice GridSpace
and its one-agent-per-node counterpartGridSpaceSingle
are subtypes of the abstract type AbstractGridSpace
.
Yet, at least in physics and hence for my work, triangular and hexagonal (aka honeycomb) lattices are very useful.
For instance
- the triangular lattice and its 6 nearest neighbours is the closest one to a continuum description. Some artifacts of the square lattice just disappear with the triangular lattice.
- the hexagonal lattice and its 3 nearest neighbours is useful to study simple magnetic frustration for instance.
Question
Does anyone have any idea about how I could easily extend the concept of GridSpace
to TriGridSpace
and HexGridSpace
, as the only crucial function that differs is the search for nearest neighbours ?
Trials
I have tried to define a struct TriGridSpace <: GridSpace
but I get the error invalid subtyping in definition of TriGridSpace
since (if I understood correctly) GridSpace
is a concrete (thus leaf) type.
I have also tried to simply add a weird metric to the already existing chebychev / euclidian / manhattan to transform a square lattice into a triangular one but it would lose the genericity of the whole thing with respect to a 3D space.
Many thanks in advance,
Ylann Rouzaire