Skip to content

Commit

Permalink
Document heuristic switching
Browse files Browse the repository at this point in the history
  • Loading branch information
Jake-Moss committed Nov 23, 2023
1 parent 840724c commit 480f377
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions aequilibrae/paths/results/path_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ def reset(self) -> None:
self.milepost = None
self._early_exit = self.early_exit = False
self._a_star = self.a_star = False
self._heuristic = "equirectangular"

else:
raise ValueError("Exception: Path results object was not yet prepared/initialized")
Expand Down
13 changes: 12 additions & 1 deletion docs/source/examples/trip_distribution/plot_path_computation.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,20 @@
res.compute_path(32343, 22041, early_exit=True)

# If you'd prefer to find a potentially non-optimal path to the destination faster provide `a_star=True` to use A* with a
# equirectangular heuristic. This method is not compatible with `update_trace` and will always recompute the path.
# heuristic. With this method `update_trace` will always recompute the path.
res.compute_path(32343, 22041, a_star=True)



# By default a equirectangular heuristic is used. We can view the available heuristics via
res.get_heuristics()

# If you'd like the more accurate, but slower, but more accurate haversine heuristic you can set it using
res.set_heuristic("haversine")

# or
res.compute_path(32343, 22041, a_star=True, heuristic="haversine")

# If we want to compute the path for a different destination and the same origin, we can just do this
# It is way faster when you have large networks
# Here we'll adjust our path to the University of La Serena. Our previous early exit and A* settings will persist with calls
Expand Down

0 comments on commit 480f377

Please sign in to comment.