JuliaDynamics / ABMFrameworksComparison

Benchmarks and comparisons of leading ABM frameworks
Other
9 stars 7 forks source link

Faster ForestFire.jl #65

Closed Tortar closed 10 months ago

Tortar commented 10 months ago

This is faster (3x), even if a bit more involved. Inspired by #64

Tortar commented 10 months ago

I kind of feel like ForestFire in the current way is not a good model to test for cellular automata (it should at least start the fire from random points on the grid, not all in a line)

Tortar commented 10 months ago

it is just a property of the model, even if it has a bad name :D

Il Dom 6 Ago 2023, 21:52 George Datseris @.***> ha scritto:

@.**** commented on this pull request.

In ForestFire/Agents/ForestFire.jl https://github.com/JuliaDynamics/ABM_Framework_Comparisons/pull/65#discussion_r1285256188 :

 return forest, dummystep, tree_step!

end

function tree_step!(forest)

  • Find trees that are burning (coded as 2)

  • @inbounds for I in findall(isequal(2), forest.trees)
  • for idx in nearby_positions(I.I, forest)
  • If a neighbor is Green (1), set it on fire (2)

  • k = 0
  • for pos in @view forest.on_fire[1:forest.n[]]

What's going on here? Implementations should only use public API. What is this n[]?

— Reply to this email directly, view it on GitHub https://github.com/JuliaDynamics/ABM_Framework_Comparisons/pull/65#pullrequestreview-1564195674, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQH6VXY5TGRB3JVFHNT4OODXT7YY3ANCNFSM6AAAAAA3GDD6QY . You are receiving this because you authored the thread.Message ID: @.*** com>

Datseris commented 10 months ago

See #60 I don't think merging this makes sense. The source code is alien when compared to example codes of ABM implementations in Agents.jl.