I have a netlogo gis model. The model consists of a road network and on the roads I have created vertices (nodes). I have placed two types of agents, red and blue. The blue agents are stationary while the red agents find the closest blue agents (using in-radius), go to them and collect them (red agents are able to collect a maximum of 2 blue agents). The way the red agents travel, is by travelling from node to node till they reach the node with the blue agents. I have done this through using nw:turtles-on-weighted-path-to function which finds a list of nodes between the red and blue agents. i.e vertex-1 (red agent position) vertex-2 vertex-3 vertex-4(1st-blue-agent-position)
The next step is once they collect their first blue agent, they need to find the 2nd closest blue agent from that point, then similarly travel to that position and collect. This is where i get problems. My list gets appended with the location of the 2nd blue-agent but the red-agent doesn't travel that location. i.e
vertex-1 vertex-2 vertex-3 vertex-4(red-agent-position (blue-collected)) vertex-5 vertex-6 vertex-7 (2nd-blue-agent -position)
Any ideas how to solve?
connect-find: variable consisting the closest agent (i.e blue-agent 2)
breed [red-agents red-agent] breed [blue-agents blue-agent] globals [current-node-red] red-agents-own [current-node next-node vertex-blue-agents-at connect-find blue-agents-own [current-node-red node-blue red-agent-pos ask red-agents[ set connect-find min-one-of blue-agents in-radius 9 [distance myself] ask connect-find[ set connect-vertex min-one-of vertices in-radius 1 [distance myself] ] set vertex-blue-agents-at connect-vertex ] ;;Assigning Destination ask red-agents [ set initial-node min-one-of vertices in-radius 1 [distance myself] set collected-agents 0 set current-node initial-node set previous-node current-node set next-node current-node let end-location vertex-blue-agents-at let path  ask initial-node [set path nw:turtles-on-weighted-path-to end-location dist_m] set commute-path path ask red-agents [ let route-length (length commute-path) let next-pos ((position (current-node) commute-path) + 1) if next-pos < route-length [set next-node item (next-pos) commute-path] ;global variable holding red-agent position set current-node-red current-node ;red-agent position passed on to blue-agent-own ask blue-agents [set red-agent-pos current-node-red] ;To make turtles move from one node to another set current-node next-node move-to current-node ;To kill blue-agents when red-agent reaches destination ask blue-agents[ if red-agent-pos = node-blue [die]] ;To update blue-agents collected if current-node = vertex-blue-agents-at and connect-find = nobody[set collected-agents (collected-agents + 1)] ;To find next blue agent (2nd) if current-node = vertex-blue-agents-at [ set connect-find (min-one-of blue-agents in-radius 9 [distance myself]) ;finds the 2nd closest agent ask connect-find [ set connect-vertex min-one-of vertices in-radius 0.0001 [distance myself] ;closest agent find the vertex they are on ] ;Assigns red agents the vertex location of the closest blue-agent set vertex-blue-agents-at connect-vertex ;set the path to the new agent let path  let end-location vertex-blue-agents-at set initial-node current-node ask initial-node [set path nw:turtles-on-weighted-path-to end-location dist_m] foreach path[ i -> set commute-path lput i commute-path ] ]