-
Notifications
You must be signed in to change notification settings - Fork 1
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
Use estimated travel distances instead of euclidian distance #80
Open
Hussein-Mahfouz
wants to merge
8
commits into
main
Choose a base branch
from
79-checking-and-validating-travel-distance-assumptions
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Use estimated travel distances instead of euclidian distance #80
Hussein-Mahfouz
wants to merge
8
commits into
main
from
79-checking-and-validating-travel-distance-assumptions
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 tasks
2 tasks
Added a test for _adjust_distance here: 18aecb4 TODO: Add a warning to say "default decay rate only works well if the distances are in meters". |
sgreenbury
reviewed
Jan 24, 2025
@@ -94,6 +98,11 @@ def calculate_od_distances( | |||
projected_epsg: int | |||
EPSG code for the projected CRS (default is 3857). We need a metric crs | |||
to calculte distances in meters. | |||
detour_factor: float | |||
Factor to adjust the estimated distance. | |||
decay_rate: float |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As discussed, for the decay rate, two things that might be worth adding to config docs:
- Add description around the decay rate being the inverse of the distance (in units of the data, e.g. metres) at which the scaling from using the detour factor to Euclidean distance reduces by
$\exp(-1)$ - Add link with interactive plot for exploring setting the decay rate
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Introduces a new feature to account for detour factors and decay rates when calculating travel distances. These travel distances are used in estimating feasible zones, and in plotting actual vs reported distances. Related to #79
Key changes:
Utility Function Updates:
src/acbm/assigning/utils.py
: Added_adjust_distance
function and updatedzones_to_time_matrix
to include detour and decay adjustments when calculting travel distance from euclidean distances. To check parameters, see this interactive wolfram alpha plotsrc/acbm/assigning/feasible_zones_primary.py
: Updatedget_possible_zones
to includedetour_factor
anddecay_rate
parameters and adjusted the travel time matrix accordingly.src/acbm/validating/utils.py
: Updatedcalculate_od_distances
to include the detour and decay adjustments.Configuration Updates:
config/base.toml
: Addeddetour_factor
anddecay_rate
parameters under the new[feasible_assignment]
section.src/acbm/config.py
: IntroducedFeasibleAssignmentParams
class and added it to theConfig
class.Script Updates:
scripts/3.1_assign_primary_feasible_zones.py
: Updated theget_possible_zones
function to passdetour_factor
anddecay_rate
to the travel time matrix and filtering functions.scripts/3.3_assign_facility_all.py
: Updated theplot_scatter_actual_reported
function to use the new parameters when plotting. The distance is calculated from the euclidian distance.scripts/4_validation.py
: Addeddetour_factor
anddecay_rate
parameters to the distance validation plots.