Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Figure out where to have calculate_travel_time #48

Open
SeanMcOwen opened this issue Jul 4, 2024 · 2 comments
Open

Figure out where to have calculate_travel_time #48

SeanMcOwen opened this issue Jul 4, 2024 · 2 comments
Labels

Comments

@SeanMcOwen
Copy link
Collaborator

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 SeanMcOwen added the DIPR label Jul 4, 2024
@SeanMcOwen
Copy link
Collaborator Author

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
Copy link
Collaborator Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant