Skip to content

iter_agent_groups broken in v7 #1210

Description

@Jonas-a-Zimmermann

Update 7 broke the iter_agent_groups functionallity.
works fine in 6.2.10.

Minimal Working Example

using Agents, StaticArrays
TESTSYSTEMSIZE = 10.

@kwdef mutable struct TestAgent <: AbstractAgent
    id::Int
    pos::SVector{2,Float64}
    vel::SVector{2,Float64} = SVector(0., 0.)
end

test_space = ContinuousSpace((TESTSYSTEMSIZE, TESTSYSTEMSIZE))
model_step!(model) = nothing
test_model = StandardABM(TestAgent, test_space; model_step!)

#direct adding leads to correct position
add_agent!(SVector(0.5, 0.5), TestAgent, test_model)
add_agent!(SVector(0.5, 0.1), TestAgent, test_model)

iter_agent_groups(2, test_model)

Errors with:

ERROR: LoadError: map is not defined on sets
Stacktrace:
 [1] error(s::String)
   @ Base ./error.jl:35
 [2] map(f::Function, ::Base.KeySet{Int64, Dict{Int64, TestAgent}})
   @ Base ./abstractarray.jl:3402
 [3] (::Agents.var"#65#67"{typeof(Agents.Schedulers.fastest), StandardABM{…}})(::Int64)
   @ Agents ./none:0
 [4] iterate
   @ ./generator.jl:48 [inlined]
 [5] iter_agent_groups(order::Int64, model::StandardABM{…})
   @ Agents ~/.julia/packages/Agents/5W3YX/src/core/higher_order_iteration.jl:12
 [6] top-level scope
   @ ~/***/iter_agent_groups.jl:19
 [7] include(fname::String)
   @ Main ./sysimg.jl:38
 [8] top-level scope
   @ REPL[2]:1

Agents.jl version
[46ada45e] Agents v7.0.2

Julia version
1.11.5

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions