Agents.jl: Update data collection aspect of step! for v2.0

Created on 6 Nov 2019  ยท  5Comments  ยท  Source: JuliaDynamics/Agents.jl

Based on the changes of #42 we need to update step!. While doing this we should also take into account the discussion of #38 , which (I think) concludes that there shouldn't be both aggregators and propagators, as one superseeds the other.

(don't forget to branch the v2.0 branch instead of the master branch)

All 5 comments

98fc315 simplifies the step!, data collectors, batch runners, and parallel functions. The code is now much shorter and easier to read. Important changes are in step.jl, data_collector.jl, and parallel.jl.

I had to keep the properties argument of the step! function positional because Julia does not dispatch on keyword arguments.

Great! I'll have a closer look once I resume working on 2.0 as well, probably on Sunday.

This does not seem to work, Running the tutorial example gives me:

julia> data = step!(model, agent_step!, 2, properties, when=when)
370ร—7 DataFrames.DataFrame
โ”‚ Row โ”‚ id     โ”‚ pos_1  โ”‚ mood_1 โ”‚ group_1 โ”‚ pos_2  โ”‚ mood_2 โ”‚ group_2 โ”‚
โ”‚     โ”‚ Int64โฐ โ”‚ Int64โฐ โ”‚ Boolโฐ  โ”‚ Int64โฐ  โ”‚ Int64โฐ โ”‚ Boolโฐ  โ”‚ Int64โฐ  โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ 1   โ”‚ 1      โ”‚ 394    โ”‚ 0      โ”‚ 1       โ”‚ 394    โ”‚ 1      โ”‚ 1       โ”‚
โ”‚ 2   โ”‚ 2      โ”‚ 380    โ”‚ 0      โ”‚ 1       โ”‚ 174    โ”‚ 1      โ”‚ 1       โ”‚
โ”‚ 3   โ”‚ 3      โ”‚ 141    โ”‚ 0      โ”‚ 1       โ”‚ 141    โ”‚ 1      โ”‚ 1       โ”‚
โ”‚ 4   โ”‚ 4      โ”‚ 348    โ”‚ 0      โ”‚ 1       โ”‚ 348    โ”‚ 1      โ”‚ 1       โ”‚
โ”‚ 5   โ”‚ 5      โ”‚ 272    โ”‚ 0      โ”‚ 1       โ”‚ 272    โ”‚ 1      โ”‚ 1       โ”‚
โ”‚ 6   โ”‚ 6      โ”‚ 21     โ”‚ 0      โ”‚ 1       โ”‚ 21     โ”‚ 1      โ”‚ 1       โ”‚
โ”‚ 7   โ”‚ 7      โ”‚ 313    โ”‚ 0      โ”‚ 1       โ”‚ 313    โ”‚ 1      โ”‚ 1       โ”‚
โ”‚ 8   โ”‚ 8      โ”‚ 292    โ”‚ 0      โ”‚ 1       โ”‚ 292    โ”‚ 1      โ”‚ 1       โ”‚
โ”‚ 9   โ”‚ 9      โ”‚ 61     โ”‚ 0      โ”‚ 1       โ”‚ 175    โ”‚ 1      โ”‚ 1       โ”‚
โ”‚ 10  โ”‚ 10     โ”‚ 171    โ”‚ 0      โ”‚ 1       โ”‚ 171    โ”‚ 1      โ”‚ 1       โ”‚
โ”‚ 11  โ”‚ 11     โ”‚ 315    โ”‚ 0      โ”‚ 1       โ”‚ 315    โ”‚ 1      โ”‚ 1       โ”‚
โ”‚ 12  โ”‚ 12     โ”‚ 245    โ”‚ 0      โ”‚ 1       โ”‚ 355    โ”‚ 1      โ”‚ 1       โ”‚
โ”‚ 13  โ”‚ 13     โ”‚ 290    โ”‚ 0      โ”‚ 1       โ”‚ 290    โ”‚ 1      โ”‚ 1       โ”‚
โ”‚ 14  โ”‚ 14     โ”‚ 130    โ”‚ 0      โ”‚ 1       โ”‚ 130    โ”‚ 1      โ”‚ 1       โ”‚
โ”‚ 15  โ”‚ 15     โ”‚ 347    โ”‚ 0      โ”‚ 1       โ”‚ 347    โ”‚ 1      โ”‚ 1       โ”‚
โ”‚ 16  โ”‚ 16     โ”‚ 54     โ”‚ 0      โ”‚ 1       โ”‚ 16     โ”‚ 1      โ”‚ 1       โ”‚
โ”‚ 17  โ”‚ 17     โ”‚ 108    โ”‚ 0      โ”‚ 1       โ”‚ 108    โ”‚ 1      โ”‚ 1       โ”‚
โ”‚ 18  โ”‚ 18     โ”‚ 240    โ”‚ 0      โ”‚ 1       โ”‚ 374    โ”‚ 1      โ”‚ 1       โ”‚
โ”‚ 19  โ”‚ 19     โ”‚ 22     โ”‚ 0      โ”‚ 1       โ”‚ 22     โ”‚ 1      โ”‚ 1       โ”‚
โ”‚ 20  โ”‚ 20     โ”‚ 151    โ”‚ 0      โ”‚ 1       โ”‚ 151    โ”‚ 1      โ”‚ 1       โ”‚
โ‹ฎ
โ”‚ 350 โ”‚ 350    โ”‚ 247    โ”‚ 0      โ”‚ 2       โ”‚ 247    โ”‚ 1      โ”‚ 2       โ”‚

i.e. there are several groups and moods instead of there existing only one.

This is what is expected. We are recording the moods and groups in two steps.

ops, yeap sorry.

Was this page helpful?
0 / 5 - 0 ratings