8/21/2023 0 Comments Let netlogo![]() One way you could accomplish what you are after is to use while so that your turtle stays within the procedure until whatever criteria you designate are reached. So, since highest-value is dependent on distance, and the turtle's spatial coordinates change as it moves, some other patch might have the highest-value from the turtle's new position. Once all other turtles have done so, your original turtle will again set its destination to a freshly assessed highest value. At that point, whether or not it has reached its destination, the other turtles (if there are any) will have a chance to run pick-patch. Then, it'll move forward one and check if it has arrived. You're right- every time a turtle runs pick-patch, it goes through the step of setting destination to highest-value. So it still goes back to the original problem of having the turtle set and keep a destination until it is reached. If there is a tie among patches with highest-value, the turtle still switches destination midway to its selected patch. Second update: I think that the change I made in the previous update ( report distance of myself) fixed part of my problem (assuming that line makes sense?), but left one issue. I'm new to this thanks in advance for any help! Something like this doesn't work (they just stop moving): to travel I'm not sure how to code that out if I go that route. I tried the "while" loop idea recommended below (thanks!) and that seems to introduce a new host of odd behavior. The other idea I've had is that "pick-patch" or "travel" may need something along the lines of "ifelse patch-here != destination " but that doesn't seem to work either. Should this accomplish what I'm after? It would take away the "distance myself" part so that this cost remains constant. Update: I think the issue could be addressed within the "cost-to-me" reporter? I tried making this change: to-report cost-to-me ( Note: instead of "forward 1," I realize I could just use "move-to." I will eventually build in obstacles, however, and turtles will need to walk towards the destination to check for obstacles.) Report mean of patches in-radius 1 i.e., moving window to find high-benefit cluster Report max-one-of available-destinations To-report highest-value this appears to be changing while turtle moves.how fix this? Move-to start-patch ] return to the start-patch, and should only NOW assess new destination. ![]() (will reposition start-patch to a new site if no destinations available.)įace destination forward 1 **should** keep original destination, but it doesn't. Set destination highest-value calculated in reporters, below.Īsk destination reveals that destination changes occasionally before original destination is reached. ![]() Start-patch the territory center turtle returns here after reaching destination.ĭestination the patch turtle wants to claim for its territory. Owner once part of a territory, owner becomes the turtle.īenefit i.e., food available in a patch used to assess "highest-value" to the turtle. How can I fix this so a turtle assesses highest-value while standing on the start-patch, sets a destination, and moves towards it until reached? patches-own They shouldn't do this-highest-value must be assessed while standing on the start-patch. I think turtles are constantly reassessing cost-to-me while walking, however. Destination is based on the patch with "highest-value" where value should be the patch's benefit ("benefit-to-me") divided by the distance away from the start-patch ("cost-to-me"). They have a territory center-point ("start-patch") from which they choose a destination to walk to and claim. I need some means of telling the turtle to hold the original destination until it reaches it.ĭetails: Here is my relevant code. Issue: The selected destination sometimes changes while the turtle is walking towards it. At that point, the turtle returns to its original patch and picks another destination, walks towards it, repeat. ![]() Goal: I am attempting to make a turtle pick a destination, then continue walking towards it until the destination is reached.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |