vastsafari.blogg.se

Netlogo random
Netlogo random








netlogo random

If that's true, you have the turtles that have var = 0 do nothing, but all other turtles will ask 6 other turtles to set their var to 0.

NETLOGO RANDOM CODE

Since you have ifelse var = 0 in your code, I assume that code is called by an ask turtles. There is a mistake somewhere in the above code, as it assign almost the total population with var = 0 after tick 2 or 3, however I cannot find the error. If the current total population rises at tick 2 to 200 turtles in total with 1 turtles having var = 0, the code is allowed to randomly assign 0 to 9 turtles with a value of 0 for var. If 5 turtles have var = 0 while the current total population is 100, the code does not assign any turtle with that value. If less then 5 % of the current total population of turtles have var = 0, it assigns a random amount of turtles to var = 0 so that there are still only 5 % or less of the current total population with var = 0.įor example, if we have at tick 1, 100 turtles with 1 having var = 0, then the code can randomly assign between 0 to 4 turtles with var = 0. Select alpha 0. Make the network undirected, with 1000 vertices and an average degree of 4. Let %N (abs (count turtles * 0.05) - number-novar) count number of turtles with var = 0, subtract from 5 % of the total turtlesĪsk n-of (1 + random %N) turtles set random number turtles with var = 0 (less than or equal to 5 % of total population)Įach tick, the code shall check how many turtles have var = 0. Generate a scalefree random network using Pajek's Net>Random Network>Scale Free command.

netlogo random

If number-novar > (count turtles * 0.05) [ check if more then 5 % are with var = 0 ] otherwise take random turtles and assign 0 to their var Let us consider the following snippet: ifelse var = 0 if var already 0, do nothing With regards to this question ( NetLogo - no more than 5 % of population has a certain value of variable), I would like to have a binary variable randomly assigned to a population where 5% or less of the population have a value of 0 for variable var.










Netlogo random