World

EvoId.WorldMethod

World(agents, s, D, mu, NMax; t=0.)

Constructs a world.

Arguments

  • w a vector of agents,
  • s a tuple of evolutionary spaces,
  • mu a vector that contains the increment rate. If mu[i] has dimension greater than 1, then mutations happen independently at each dimension of s[i].
  • D, a vector that contains the increment ranges. Only nothing is supported for GraphSpace, equivalent to a random walk of length 1.
  • NMax the 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)
source
EvoId.get_xMethod
get_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.

Warning

Geotrait might be deprecated in the future.

source
EvoId.get_xarrayFunction
get_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}.

Warning

It does not work with subspace where ndims(subspace) > 1.

source
EvoId.give_birthMethod
give_birth(mum_idx::Int,w::World)

Copies agent within index mum_idx, and increment it by dx. Return new agent (offspring).

source