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

✨ Added additional distance functions and distance maps #250

Merged
merged 20 commits into from
Jul 19, 2023
Merged

Conversation

marcelwa
Copy link
Collaborator

@marcelwa marcelwa commented Jul 11, 2023

Description

This PR adds several features to the distance functions used for path-finding:

  • A distance function for the 2DDWave clocking scheme that considers that it is impossible to make moves in northern and western directions. Ideally, this provides better guidance for A* path-finding on 2DDWave-clocked layouts.
  • distance_map and sparse_distance_map data types, that can cache distance values for faster access. This is particularly useful for complex distance functions that must be frequently queried.
  • distance_map_functor and sparse_distance_map_functor, which are distance_functors that query a distance map object instead of a distance function. These can be used in path-finding algorithms that require distance_functor arguments. Thereby, these algorithms don't need to recompute complex distance functions.
  • smart_distance_cache_functor which is a drop-in replacement for other distance_functors and uses a sparse_distance_map internally to cache distance function values.

Furthermore, a convenient playground for Catch2's micro-benchmarking feature is added. Via the CMake flag -DFICTION_BENCHMARK, all .cpp files placed into test/benchmark are linked against libfiction and compiled as stand-alone binaries. Micro-benchmarks are helpful to evaluate the performance of certain code constructs.

Checklist:

  • The pull request only contains commits that are related to it.
  • I have added appropriate tests and documentation.
  • I have made sure that all CI jobs on GitHub pass.
  • The pull request introduces no new warnings and follows the project's style guidelines.

…cache distance values for faster access. This is particularly useful for complex distance functions that must be queried many times. Additionally, `distance_map_functor` and `sparse_distance_map_functor` are introduced, which are `distance_functors` that query a distance map type instead of a distance function. They can be used in path-finding algorithms that require `distance_functor` arguments
@marcelwa marcelwa added the enhancement New feature or request label Jul 11, 2023
@marcelwa marcelwa self-assigned this Jul 11, 2023
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

include/fiction/algorithms/path_finding/distance_map.hpp Outdated Show resolved Hide resolved
include/fiction/algorithms/path_finding/distance_map.hpp Outdated Show resolved Hide resolved
include/fiction/algorithms/path_finding/distance_map.hpp Outdated Show resolved Hide resolved
test/algorithms/path_finding/distance.cpp Show resolved Hide resolved
test/algorithms/path_finding/distance.cpp Show resolved Hide resolved
test/algorithms/path_finding/distance_map.cpp Show resolved Hide resolved
test/algorithms/path_finding/distance_map.cpp Show resolved Hide resolved
test/algorithms/path_finding/distance_map.cpp Show resolved Hide resolved
test/algorithms/path_finding/distance_map.cpp Show resolved Hide resolved
test/algorithms/path_finding/distance_map.cpp Show resolved Hide resolved
@codecov
Copy link

codecov bot commented Jul 12, 2023

Codecov Report

Merging #250 (8a20859) into main (4f58425) will decrease coverage by 0.02%.
The diff coverage is 91.30%.

@@            Coverage Diff             @@
##             main     #250      +/-   ##
==========================================
- Coverage   94.51%   94.49%   -0.02%     
==========================================
  Files          84       85       +1     
  Lines        7616     7662      +46     
==========================================
+ Hits         7198     7240      +42     
- Misses        418      422       +4     
Impacted Files Coverage Δ
...e/fiction/algorithms/path_finding/distance_map.hpp 90.47% <90.47%> (ø)
...clude/fiction/algorithms/path_finding/distance.hpp 100.00% <100.00%> (ø)

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

@marcelwa marcelwa merged commit 276d0d1 into main Jul 19, 2023
54 of 56 checks passed
@marcelwa marcelwa deleted the distances branch July 19, 2023 16:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant