Commit 2e59063c authored by Victor's avatar Victor
Browse files

small fixes

parent 3ef1db32
Pipeline #93241 failed with stage
in 18 minutes and 19 seconds
...@@ -101,10 +101,10 @@ w0 = World(myagents,evolspace,p) # the initial world, defined at time 0. ...@@ -101,10 +101,10 @@ w0 = World(myagents,evolspace,p) # the initial world, defined at time 0.
### 5. Run ### 5. Run
Simulation time, and callback function Simulation time, and callback function
``` ```julia
tend = 500 tend = 500
t_saving_cb = collect(range(0.,tend,length=300)) t_saving_cb = collect(range(0.,tend,length=300))
cb() = Dict("N" => size(w)) cb(w) = Dict("N" => size(w))
``` ```
...@@ -129,13 +129,6 @@ plot(sim.tspan, sim["N"]) ...@@ -129,13 +129,6 @@ plot(sim.tspan, sim["N"])
With a few more tricks, one can also plot the population trait density over time, for example the local trait density for individuals living on vertex 1. With a few more tricks, one can also plot the population trait density over time, for example the local trait density for individuals living on vertex 1.
```julia
sim = run!(w0,
Gillepsie(), # gillepsie algorithm
tend,
b,
d,
dt_saving = 2.0)
```
![](docs/src/assets/ABM_local_trait_dens_adapt.png) ![](docs/src/assets/ABM_local_trait_dens_adapt.png)
Check out the folder `examples` in the git repo to see this tutorial in a julia file, as well as plenty others!
...@@ -35,6 +35,7 @@ println("Running simulation with callback") ...@@ -35,6 +35,7 @@ println("Running simulation with callback")
Plots.plot(sim.tspan, sim["N"]) Plots.plot(sim.tspan, sim["N"])
println("Running simulation with `dt_saving`") println("Running simulation with `dt_saving`")
myagents = [Agent(evolspace,[rand(1:nodes),randn() * D[2]]) for i in 1:K]
w0 = World(myagents,evolspace,p) w0 = World(myagents,evolspace,p)
@time sim = run!(w0,Gillepsie(),tend,b,d,dt_saving=2.0) @time sim = run!(w0,Gillepsie(),tend,b,d,dt_saving=2.0)
Plots.plot(sim,trait=2) Plots.plot(sim,trait=2)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment