0

I'm asking this question in reference to a previous question answered here: Is there a way to create impassable barriers in NetLogo?

A user helpfully suggested a way to generate off-limits patches (i.e. barriers) in NetLogo. However, as he mentioned, agents will still possess the ability to occasionally 'jump' over these barriers if they approach from particular angles. This is an undesirable behavior for my model, as I'm modeling fences and movement, so jumping barriers is unrealistic.

I have attempted to alter this code:

ask patches in-radius 1
[if f = 1
[ask myself

  [set heading towards min-one-of patches [distance myself] + 180 - random 10 + random 10 ]

]
]

by decreasing the "in-radius" to less than one, in hopes that it would prevent the agent from seeing far enough to move across barriers, but this does not work. The "f = 1" is just a patch variable used to denote which patches are fences.

Is there any method of preventing this behavior?

Here is the behavior I want - navigation around barriers

Here is the behavior I don't want - jumping barriers if approached from certain angles

The actual movement procedure that agents are following is as follows:

ask turtles[
let moveset patches in-radius 30 with [f = 0 and n > 0]

 pen-down

 let target max-one-of moveset [n]

 ifelse patch-here != target
 [set heading towards target]
 []

 ask patches in-radius 1
 [if f = 1
 [ask myself
  [set heading towards min-one-of patches [distance myself] + 180 - random 10 + random 10]

 fd 1]
SC7
  • 3
  • 2
  • 1
    you can use the look ahead answer you already have (or the Look Ahead model in the NetLogo library), and make the resolution finer. For example, check every 0.1 distance instead of 1 distance. It will still be able to go past a patch corner, but you can make the resolution small enough that it's not really noticeable. – JenB Apr 24 '19 at 18:12
  • Can you show the actual movement component of your code? I suspect that the problem lies with the agents movement behavior – Luke C Apr 24 '19 at 18:14
  • @Luke C, I've added the full procedure above. Your additional code on the other post should prove helpful. Thank you! – SC7 Apr 24 '19 at 18:56
  • @JenB, Thank you, I've not considered that option. It may not fully solve my issue, but it is interesting to know that it's a possibility. – SC7 Apr 24 '19 at 18:59

0 Answers0