How to create a checkpoint in flow

61 Views Asked by At

My team and I are trying to determine the throughput of vehicles in a road network for each training iteration. Our plan is to count the number of vehicles that reach an end state(end of road) by the end of the iteration. Is there existing functionality for this in flow ?

1

There are 1 best solutions below

1
On

Do they actually exit the road? If so, then there is. This is self.k.vehicle.get_outflow_rate() which returns the outflow over that many seconds. You can divide this by 3600 to get the number of vehicles which exited. You can also call self.k.vehicle.get_arrived_ids() which returns the IDs of the vehicles that have exited the system.

If you want to know how many vehicles have reached a given edge the easiest thing to do is loop through the vehicles and call self.k.vehicle.get_edge() and check how many counts of that edge you get.