Help to implement probability - NetLogo 6.2

279 views
Skip to first unread message

Rafaela Lorena

unread,
Aug 18, 2021, 9:06:43 AM8/18/21
to netlogo-users
Hi all,

I am having difficulty implementing the following code. Can someone help me?

Situation: The agent moves according to random walk. At each iteration, it can go in any direction, with the step ranging from 0 to a certain radius. Some patches have a feature that increases the likelihood of attracting the agent. e.g. if there is a patch with the feature, the agent has a 70% chance of going to it and not to others. 
Question: How do I implement this probability in the agent's movement? Attempt: I managed to implement probability when I analyze only the agent's neighbor patches, using the move-to. But I need to implement this probability in a radius using fd.

Thanks in advance

Pradeesh Kumar K V

unread,
Aug 18, 2021, 1:11:30 PM8/18/21
to Rafaela Lorena, netlogo-users
Hi,

Perhaps you can consider the following steps:

1. Identify patches with particular feature (if any) within a given radius. 

ask turtles [ set x patches in-radius ... with [ feature = true]  ; create an agentset x of patches having the feature

2. Select patch with max feature value

;code continued from 1 above
let a max-one-of x [feature]

3. Make the turtle face the patch with certain probability

;code continued from 2 above

if random-float 1 > 0.3 [ facexy [pxcor] of x [pycor] of y ]

4. Move the agent forward

I have not run the code in Netlogo. Hope this helps.

Best,

Pradeesh

--
You received this message because you are subscribed to the Google Groups "netlogo-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to netlogo-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/netlogo-users/CAHs8kB-K3-fdGYPNqU2QvKtsAUmO5RQRig2R5rC0mw0Yi3VvDw%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages