Adding multiple agent types to an AgentBasedModel (in Agents.jl)

Hey @imantha,

The RescAgent[] syntax is a short form of creating an empty Vector{RescAgent}. So you can do

r1 = RescAgent(1, true, [])
r2 = RescAgent(2, true, [])

push!(model.resc, r1)
push!(model.resc, r2)

model.resc[1] #r1
model.resc[2] #r2

Model properties can be a tuple like this example, or a Dict or a Struct, so feel free to align this however you like.

properties = Dict(:r1 => RescAgent(1, true, []), :r2 => RescAgent(2, true, []))
#...
model.r1
model.r2
1 Like