I tried forest1.jl in JuliaBox. I could not find anywhere the package Random. Running the script without using Random I got the following error:
UndefVarError: findall not defined
Stacktrace:
[1] go(::Array{Int64,2}) at ./In[1]:7
[2] go_repeat(::Float64) at ./In[1]:24
[3] collect(::Base.Generator{UnitRange{Int64},##5#6}) at ./array.jl:475
The scripts are for Julia 0.7/1.0. Unfortunately a lot of changes since Julia 0.6 are introduced (you are probably using it). Here is an example how you can rewrite the first code to run under Julia 0.6.4:
function setup(density)
[x == 1 ? 2 : rand() < density ? 1 : 0 for x in 1:251, y in 1:251]
end
function go(grid)
any(x -> x == 2, grid) || return true
for pos in shuffle!(find(x -> x == 2, grid))
x, y = ind2sub(grid, pos)
for (dx, dy) in ((0, 1), (0, -1), (1, 0), (-1, 0))
nx, ny = x + dx, y + dy
if all((0,0) .< (nx, ny) .≤ size(grid)) && grid[nx, ny] == 1
grid[nx, ny] = 2
end
end
grid[pos] = 3
end
return false
end
function go_repeat(density)
grid = setup(density)
init_green = count(x -> x == 1, grid)
while true
go(grid) && return count(x -> x == 3, grid) / init_green * 100
end
end
@time [go_repeat(0.55) for i in 1:100];
@time [go_repeat(0.75) for i in 1:100];
Thank you. Now it works fine in JuliaBox (Julia 0.6.2).
I will try the original version of forest1.jl in Julia 1.0.
What about the package Random? Is it not necessary?
I tried with 0.7. It works but gives the following warning:
WARNING: Base.shuffle! is deprecated: it has been moved to the standard library package `Random`.
Add `using Random` to your imports.
I tried also with 1.0 and it gives the following error: UndefVarError: shuffle! not defined
In Julia 0.6 shuffle! is imported from Random by default so you do not have to write anything;
In Julia 0.7 you should import it using using Random or a warning will be thrown;
In Julia 1.0 you must use using Random or an error will be thrown as shuffle! is not imported by default.
Julia 0.7 is a kind of “in transition” version of Julia - having the same functionality as 1.0 but trying to print warnings where possible to make life easier for people migrating the code from 0.6 to 1.0.
Are you referring to the number of contributors to this package? I have only registered it a few days ago. Hopefully, people will find it useful and contribute to it.
Agents has already most of the functionalities of Mesa. But I am not familiar with other Mesa packages. Nevertheless, it should be easy to add more functionalities to Agents, since it is in Julia.
HARK is not really an ABM package as the focus is exclusively on behavior coming from optimizing behavior, and more specifically models whose solutions can be characterized by Bellman equations. This means a lot wrt the tools it tries to expose and support.
Maybe we should discuss some of the CA components you are using. I’m mid way through writing this:
Which is a base framework and bunch of visualisation outputs (like Interact/Blink, even REPL ) for writing more specific simulation packages like this:
Apologies the docs aren’t updating at the moment, so they’re a bit out of date.