How to prevent agents' ability to 'jump

2019-08-22 02:28发布

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]

0条回答
登录 后发表回答