"MethodError: no method matching..." with default agent attribute values.
Closed this issue · 1 comments
jlambvo commented
Following the new 6.0.0 macro for defining agents, I'd like to be able to add agents with default values for all additional attributes. However, I get a no matching method
error unless I supply at least one keyword argument for additional attributes, or positional arguments for all. If I supply one karg, defaults are applied for other attributes.
Is this expected behavior?
Minimum working example mostly copied and pasted from source comments:
using Agents
using Graphs
@agent struct Agent(GraphAgent)
w::Float64 = 0.1
k::Bool = false
end
model = StandardABM(Agent, GraphSpace(complete_digraph(5)))
add_agent!(model; w = 0.5, k = true)
add_agent!(model; w = 0.5)
add_agent!(model; k = true)
add_agent!(model)
See my results: