Closed mjcortejo closed 1 year ago
The edge_list should now have a new data structure:
edge_list = [
(1, 2, 300)
]
Which would also require changing this
self.edges = {i: {'cars_occupied': [], 'weight': 0} for i in self.edge_list}
to possibly
self.edges = {(i[0], i[1]): {'cars_occupied': [], 'weight': 0, 'max_capacity': i[2]} for i in self.edge_list}
Because now we have to make sure it doesnt read the last tuple. Or maybe we don't have to? But we could check it out
Initialized edges with their corresponding max capacities from edge_list
Next step: Recomputing weights by using cars_occupied / max_capacities to force the weight range from 0 to 1.
Next step: Recomputing weights by using cars_occupied / max_capacities to force the weight range from 0 to 1.
Also done,
Next step: Make cars respect their next edge by observing the cars_occupied > max_capacity
Could be better to create another function from traffic manager to return edge capacity
FINALLY DONE BOIS. Cars are now able to respect capacity of their next edge.
This solution actually opened up the other flaws of the implementations
The issue here is that the cars do not have a visibility of the capacity of their next edge path.
What happens is that, with the next edge being already full. The cars from the previous edge would still be able to go through the intersection but upon entering the next edge, they overlap because they only have visibility of the cars in front of them upon entering the new edge which causes the car canvasses to be overlap each other. I think this is why it's hard to observe the general impact of the congestion due to this issue.
Might have to implement something like: