BlockScience / rideshare-model

0 stars 0 forks source link

Figure out where to have calculate_travel_time #48

Open SeanMcOwen opened 3 months ago

SeanMcOwen commented 3 months ago
def calculate_travel_time(self, zone1, zone2):
    try:
        return self.grid.shortest_paths[(zone1.x, zone1.y)][(zone2.x, zone2.y)]
    except KeyError:
        return float('inf')
SeanMcOwen commented 3 months ago

Might be better to not allow the key error since that hypothetically shouldn't be possible. I.e. if that happens then something in the simulation might be broken

SeanMcOwen commented 3 months ago

I.e. have the error raised or add an assertion like assert the shortest path is there and if not then stop sim