Continuous time (EventQueueABM) Agent based model - Method Error

Hello, Im working on this following example where I want particles to just move around and thats all to get started. Though I got Error even before a proper start. Will be helpful if someone can point cause. Im sure its coming during model event description but it seems all good to me.

Code

using Agents

@multiagent struct CELL(ContinuousAgent{2, Float64})
    @subagent struct CELL_1 
        radius::Int64
    end
    @subagent struct CELL_2 
        radius::Int64
    end
end



function move!(agent, model)

    move_agent!(agent, model)

    return
end

movement_propensity = 0.5

function movement_time(agent, model, propensity = 1)
    # `agent` is the agent the event will be applied to,
    # which we do not use in this function!
    t = 0.1 * randn(abmrng(model)) + 1
    return clamp(t, 0, Inf)
end

movement_event = AgentEvent(
    action! = move!, propensity = movement_propensity,
    kinds = (:CELL_1, :CELL_2), timing = movement_time
)

events = ( movement_event)

space2d = ContinuousSpace((1,1); periodic=true)

using Random: Xoshiro
rng = Xoshiro(42)

model = EventQueueABM(CELL, events, space2d; rng, warn = false)

for p in positions(model)
    type = rand(abmrng(model), (CELL_1, CELL_2))
    radius = rand(0.01:0.1, 1)
    add_agent!(p, type, model, radius)
end


abmqueue(model)

Error:

ERROR: MethodError: no method matching keytype(::AgentEvent{typeof(move!), Float64, Tuple{Symbol, Symbol}, typeof(movement_time)})

Closest candidates are:
  keytype(::Type{Union{}}, Any...)
   @ Base abstractarray.jl:189
  keytype(::Type{DataStructures.SDMIncludeLast{T}}) where T<:Union{DataStructures.SortedDict, DataStructures.SortedMultiDict, DataStructures.SortedSet}
   @ DataStructures ~/.julia/packages/DataStructures/95DJa/src/container_loops.jl:64
  keytype(::Type{<:QuickHeaps.AbstractPriorityQueue{K, V, T} where T<:QuickHeaps.AbstractNode{K, V}}) where {K, V}
   @ QuickHeaps ~/.julia/packages/QuickHeaps/5N0o8/src/priorityqueues.jl:253
  ...

Stacktrace:
 [1] EventQueueABM(::Type{…}, events::AgentEvent{…}, space::ContinuousSpace{…}; container::Type, properties::Nothing, rng::Xoshiro, warn::Bool, autogenerate_on_add::Bool, autogenerate_after_action::Bool)
   @ Agents ~/.julia/packages/Agents/8JW8b/src/core/model_event_queue.jl:168
 [2] top-level scope
   @ Untitled-2:42

do events = (movement_event, ) instead. Events need to be a tuple.

2 Likes