user2359494
user2359494

Reputation: 733

NetLogo ask turtles to move with respect to randomly sized home ranges

In NetLogo I setup a model such that male predators create a home range that varies within some bounds. I previously asked for help on stackoverflow on how to do that.

Selecting values from bounded normal distribution in NetLogo

This worked great. When the predator moves around the landscape I ask the predator to check whether it is outside its specific home range (these are different sizes because of the random process), and if so to face the center of the home range my-base. I can ask the predator to check whether it is outside of a circle with a specific radius, however, I'm having trouble asking the predator to detect its specific home range created at setup. I figure I could have "home range" be a predator characteristic and then ask them to look at their own home range, but again I'm having trouble with that. Any suggestions? A snippet of my code with the setup and "random-movement" procedure is below.

to setup
ca
clear-all-plots
clear-output
clear-turtles
create-males 20  
    [
      move-to one-of patches with [is-park?] ;inside a National Park
      if any? males in-radius (((sqrt ((54.4 * 1000000)/ pi))/ 100) * 0.4) ;avoid other males
      [move-to one-of patches with [is-park?] ] 
      set size 4
      set shape "harimau"
      set my-base patch-here
      set homerange patches in-radius (((sqrt ((random-normal-in-bounds 54.4 35.8 19 151 * 1000000)/ pi))/ 100) * 0.4)
      set numberofAdultMale ( numberofAdultMale + 1)
      ]
reset-ticks
end

to-report random-normal-in-bounds [mid dev mmin mmax]
  let result random-normal mid dev
  if result < mmin or result > mmax
     [report random-normal-in-bounds mid dev mmin mmax] 
  report result
end

to random-movement
if-else my-base != no-patches[if distance my-base > (((sqrt ((54.4 * 1000000)/ pi))/ 100) * 0.4) ;this checks within a certain radius but not within the specific home range of the male 
                                                                                  [ face my-base]
                                                                                  ]
                                                                                  [ ] 
rt random 180
lt random 180
fd time-step * random-gamma((meansRandomMove * meansRandomMove)/((deltaRandomMove)^ 2)) (1 / (((deltaRandomMove)^ 2) / meansRandomMove))
end

In above code I have the predators distribute themselves based on a predefined home range size (((sqrt ((54.4 * 1000000)/ pi))/ 100) * 0.4). A related question is how to have predators distribute themselves based on the actual home ranges homerange patches in-radius (((sqrt ((random-normal-in-bounds 54.4 35.8 19 151 * 1000000)/ pi))/ 100) * 0.4) created from the random distribution?

Upvotes: 4

Views: 985

Answers (1)

user2359494
user2359494

Reputation: 733

I think I figured it out. First I set homerange as an attribute of males. Then, at setup, set homerange patches in-radius (((sqrt ((random-normal-in-bounds HomerangeSizeMales 35.8 19 151 * 1000000)/ pi))/ 100) * 0.4). Then, in the movement procedure, used sqrt (count homerange / pi)

Upvotes: 1

Related Questions