I have an empirical network that I loaded. I have nodes that are stationary. I have edges that connect the nodes(say these are roads). Each tick is a day. There is an edge attribute called time. If the edge attribute matches the current time in the program, then those edges are loaded onto the network. I have ~1900 cars that are all loaded but hidden until it is time for them to move. they also have a time attribute and an vehID attribute. The edges also have a vehicle ID attribute so that a specific car travels along only the edges where the vehicle ID attributes match. I have things almost working.
The problem comes in when I have one care that is traveling along multple edges within one day. Right now, my code randomly picks an edge and the car follows that. I need the car to travel along every edge in order in that day.
Here is my move code:
to move-cars
ask cars with [vtime = current-time] [
show-turtle
; choose-road/link to follow
let vid vehid
set current-link one-of [my-out-links with [veh = vid ] ] of current-node ; picks one of the links coming out of the current node for this car that match the vehicle ID
let cn current-node ; need to set a local variable so can use w/in the ask link.
if current-link != nobody [
set target-node [end2] of current-link
face target-node
move-to target-node
; check if car gets infected by current-node
infect-from-nodes
;set current-node target-node ; update the current-node - needs to go AFTER checking if node infects car or vice versa so it's on the right node
; check if node gets infected by car
infect-cars-to-nodes
]
if current-link = nobody [
hide-turtle ]
]
end
Here is a copy of the edge list:
1288,18927,7,8,US005477,1
2373,18984,12,13,GPS000063,1
2374,18985,13,14,GPS000063,1
2375,18985,14,15,GPS000063,1
13844,18993,12,29,GPS000043,1
13845,18993,29,13,GPS000043,1
13846,18993,13,12,GPS000043,1
25366,18993,13,32,GPS000031,1
25367,18993,32,13,GPS000031,1
25368,18993,13,33,GPS000031,1
25369,18993,33,16,GPS000031,1
32981,18993,40,44,US001422,1
13513,18994,21,91,US004560,1
19806,18994,27,33,US006493,1
31630,18994,40,44,US001275,1
32982,18994,44,40,US001422,1
32983,18994,40,45,US001422,1
32984,18994,45,40,US001422,1
34289,18994,48,47,US004337,1
34290,18994,47,48,US004337,1
34716,18994,44,40,US002992,1
34717,18994,40,45,US002992,1
34718,18994,45,40,US002992,1
You can see how the vehicles are traveling back and forth between nodes in the same time period. how can i make it so that the move along all the edges in the same day in order of the edge list? The edge list is loaded into netlogo as a list of lists (each row being the inner list). The vehicles are loaded in the same way. All the nodes are loaded in at the begining.
Thank you for any advice you can give.