taoliner.blogg.se

Agentset netlogo
Agentset netlogo










Set vax-strain one-of * (random ((2 * drift-size) + 1))Īlso, I am not sure if you are doing this intentionally, but you are changing the proportion to blue after creating the vax-turtles agentset. Let vax-turtles turtles with įor that matter, I think the different values are simply different signs of the same value, so you could do: if vaccine = "HEV" [ Looking at your code, I can't see why you need to do the iteration rather than ask and it is much cleaner to stick with ask. ]īut if drift-size is the same for all vax-turtles, it would be pretty unlikely that, given random, JenB's solution below would give the same value for vax-strain for any two turtles, would it not? Assuming that you are using NetLogo 6.x, if vaccine = "HEV" [ let vax-turtles sort turtles with Īs for the problem you describe in the comment below, you need to ask each vax-turtle to set its own vax-strain (which I assume is a turtles-own variable).

agentset netlogo agentset netlogo

let vax-turtles of turtles with Īlternatively, if you wanted the list to be sorted, you could use sort, which also always returns a list. The of reporter is the easiest way to get that as of always returns a list. You instead want a list of the agents in the agentset. Rather it creates a list of its arguments, which in this case is a single angentset. The list primitive creates a list, but not a list of turtles with. The problem is with the line let vax-turtles (list turtles with ) If cross-immunity max-fomite-persistence [Īny advice would be greatly appreciated! Thanks Set cross-immunity (natural-immunity * (1 - (ant-distance / antigenic-distance-limit))) Set ant-distance (abs (immune-label - pflu-strain)) immune-labelling currently first infection To transmit uninfected turtles are infected by fomites (red patches) with some probability. To move-infecteds infected turtles move slower than uninfected ones and always transmit infection to patches before they leave them To move-uninfecteds uninfected turtles move faster than infected onesĪsk turtles with [ Set strain_list_list lput t-sorted-strain-list strain_list_list Set currently-infected (count turtles with )Ĭsv:to-file "strains_each_tick.csv" strain_list_list Set proportion-of-infection (100 - (count turtles with )) Set cumulative-infections (count turtles with + cumulative-infections) Set vax-strain (random ((2 * drift-size) + 1))]Īsk n-of prop-vax turtles with

agentset netlogo

Report map of i] sort turtlesĪsk turtles Īsk one-of turtles Set strain_list_list (list t-sorted-strain-list)

#Agentset netlogo code

My code is below, the "if vaccine = "HEV"" piece of code is what I need help with: extensions However, NetLogo is highlighting "foreach " with an error message that says "Expected a literal value." the flu strain in each vaccine has to be slightly different). I need to do this because the HEV condition has to give a slightly different vaccine to each blue turtle (i.e. What I tried/wanted to do was convert the agentset of blue turtles into a list, that I could then iterate over one turtle at a time. There are two kinds of vaccines (named HOV and HEV in the code) the HOV is already done. I'm writing some code to vaccinate individuals in a population where flu is circulating.










Agentset netlogo