Hello,

I hope you are having a nice day.

I am stuck in developing my NetLogo code.

I am trying to move my citizens from one node (slocation) to another node

(new-location) calculating the shortest path.

I could only calculate the distance from slocation to new-location using set

total-expected-path [distance [slocation] of myself] of new-location.

However, I am pretty sure that the next following lines in blue are not

correct.

*How can I define this distance calculate in the total-expected-path as the

minimum between nodes using the link connection between nodes?*

*and after that, how can I move the turtles following this short path?*

I attached an image of my work in NetLogo. Any help will be very useful!

Thank you so much,

Sara

to go

set-timekeeper

ask citizens

[find-day-activities]

end

to set-timekeeper

tick

let counter ticks

if (counter = 2)

[set timekeeper 2]

end

to find-day-activities

if (timekeeper = 2)

[Do_7AM_9AM]

end

to Do_7AM_9AM

if (sex = 0 and age = 1 and employment = 0 and household-size = 0

[move-work]

end

to move-work

set slocation min-one-of nodes [distance myself]

let new-location min-one-of nodes [distance one-of workbuildings]

set total-expected-path [distance [slocation] of myself] of new-location

*ask min-one-of (citizens) [total-expected-path]*

*[ask [link-neighbors] of slocation*

*[let connection link-with slocation*

*let length-path [link-length] of connection]]*

*[move-to new-location]*

*end*