mjcortejo / csc931m-complex-systems

This repository contains the projects done for the CSC931M class
0 stars 0 forks source link

Cars do not respect edge capacity #35

Closed mjcortejo closed 1 year ago

mjcortejo commented 1 year ago

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:

  1. Checking car capacity in next edge, and see if they can enter.
  2. If they can, they should enter.
  3. If capacity is full, they will stay at previous edge.
mjcortejo commented 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

mjcortejo commented 1 year ago

Initialized edges with their corresponding max capacities from edge_list

https://github.com/mjcortejo/csc931m-complex-systems/pull/41/commits/58868287d35e90c253bbcfd95aa7af5e29d6af01

mjcortejo commented 1 year ago

Next step: Recomputing weights by using cars_occupied / max_capacities to force the weight range from 0 to 1.

mjcortejo commented 1 year ago

Next step: Recomputing weights by using cars_occupied / max_capacities to force the weight range from 0 to 1.

Also done,

https://github.com/mjcortejo/csc931m-complex-systems/pull/41/commits/de52f53271daf1c3da49301b9349f585488f40bd

Next step: Make cars respect their next edge by observing the cars_occupied > max_capacity

mjcortejo commented 1 year ago

Could be better to create another function from traffic manager to return edge capacity

mjcortejo commented 1 year ago

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