World
EvoId.World — MethodWorld(agents, s, D, mu, NMax; t=0.)
Constructs a world.
Arguments
wa vector of agents,sa tuple of evolutionary spaces,mua vector that contains the increment rate. Ifmu[i]has dimension greater than 1, then mutations happen independently at each dimension ofs[i].D, a vector that contains the increment ranges. Onlynothingis supported forGraphSpace, equivalent to a random walk of length 1.NMaxthe maximum number of individuals allowed during the simulation
Examples
nodes = 7
g = star_graph(nodes)
landscape = GraphSpace(g)
θ = [rand([-1,1]) for i in 1:nodes]
traitspace = RealSpace(1)
evolspace = (landscape,traitspace)
D = [nothing,5e-2]
mu = [1f-1,1f-1]
p = Dict("NMax" => 2000,
"D" => D,
"mu" => mu)
myagents = [Agent(evolspace,[rand(1:nodes),randn() * D[2]]) for i in 1:K]
w0 = World(myagents,evolspace,p)Base.getindex — MethodBase.getindex(w::World,i)Get x of world without geotrait.
EvoId.get_geo — Methodget_geo(w)EvoId.get_x — Methodget_x(w, trait)
Returns trait of every agents of world in the form of an array which dimensions corresponds to the input. If trait = 0 , we return the geotrait.
Geotrait might be deprecated in the future.
EvoId.get_xarray — Functionget_xarray(world)
get_xarray(world, geotrait)
Returns every traits of every agents of world in the form of a one dimensional array (in contrast to get_x). If geotrait=true the geotrait is also added to the set of trait, in the last column. If you do not want to specify t (only useful for geotrait), it is also possible to use get_xarray(world::Array{T,1}) where {T <: Agent}.
It does not work with subspace where ndims(subspace) > 1.
EvoId.give_birth — Methodgive_birth(mum_idx::Int,w::World)Copies agent within index mum_idx, and increment it by dx. Return new agent (offspring).