When Lipschitz Walks Your Dog: Algorithm Engineering of the Discrete Fr´ echet Distance under Translation
Karl Bringmann, Marvin K¨ unnemann, and Andr´ e Nusser
Lipschitz
Wau! Wau! Woof! Woof!
translated dog
When Lipschitz Walks Your Dog: Algorithm Engineering of the - - PowerPoint PPT Presentation
When Lipschitz Walks Your Dog: Algorithm Engineering of the Discrete Fr echet Distance under Translation Karl Bringmann, Marvin K unnemann, and Andr e Nusser Woof! Woof! Lipschitz Wau! Wau! translated dog Teaser Karl Bringmann,
Karl Bringmann, Marvin K¨ unnemann, and Andr´ e Nusser
Lipschitz
Wau! Wau! Woof! Woof!
translated dog
Karl Bringmann, Marvin K¨ unnemann, and Andr´ e Nusser Algorithm Engineering of the Discrete Fr´ echet Distance under Translation
Karl Bringmann, Marvin K¨ unnemann, and Andr´ e Nusser Algorithm Engineering of the Discrete Fr´ echet Distance under Translation
Teaser
Fr´ echet Distance Under Translation:
human dog
Trajectory Similarity: Fr´ echet Distance:
Pigeon GPS Trajectories Handwritten Characters
algorithms (before)
Karl Bringmann, Marvin K¨ unnemann, and Andr´ e Nusser Algorithm Engineering of the Discrete Fr´ echet Distance under Translation
Teaser
Best algorithm: O(n4.66) Conditional lower bound: n4−o(1) All algorithms build O(n4) arrangement! Lipschitz Meets Fr´ echet: Fr´ echet under translation is 1-Lipschitz in τ! τ1 τ2 Use continuous
τ1 τ2
Karl Bringmann, Marvin K¨ unnemann, and Andr´ e Nusser Algorithm Engineering of the Discrete Fr´ echet Distance under Translation
Teaser
Take-Home Message:
arrangement-based geometric algorithm methods from continuous optimization
fast practical algorithm :)
exact approximation exact expensive
Karl Bringmann, Marvin K¨ unnemann, and Andr´ e Nusser Algorithm Engineering of the Discrete Fr´ echet Distance under Translation
Karl Bringmann, Marvin K¨ unnemann, and Andr´ e Nusser Algorithm Engineering of the Discrete Fr´ echet Distance under Translation
Why Trajectory Similarity?
Pigeons’ GPS Trajectories: Handwritten Character Trajectories:
Karl Bringmann, Marvin K¨ unnemann, and Andr´ e Nusser Algorithm Engineering of the Discrete Fr´ echet Distance under Translation
Discrete Fr´ echet Distance
Intuition
human dog
Karl Bringmann, Marvin K¨ unnemann, and Andr´ e Nusser Algorithm Engineering of the Discrete Fr´ echet Distance under Translation
Discrete Fr´ echet Distance
Intuition
human dog
Karl Bringmann, Marvin K¨ unnemann, and Andr´ e Nusser Algorithm Engineering of the Discrete Fr´ echet Distance under Translation
Discrete Fr´ echet Distance
Intuition
human dog
Karl Bringmann, Marvin K¨ unnemann, and Andr´ e Nusser Algorithm Engineering of the Discrete Fr´ echet Distance under Translation
Discrete Fr´ echet Distance
Intuition
human dog
Karl Bringmann, Marvin K¨ unnemann, and Andr´ e Nusser Algorithm Engineering of the Discrete Fr´ echet Distance under Translation
Discrete Fr´ echet Distance
Intuition
human dog
Karl Bringmann, Marvin K¨ unnemann, and Andr´ e Nusser Algorithm Engineering of the Discrete Fr´ echet Distance under Translation
Discrete Fr´ echet Distance
Intuition
human dog
What is the traversal that achieves the shortest leash length? Question:
Karl Bringmann, Marvin K¨ unnemann, and Andr´ e Nusser Algorithm Engineering of the Discrete Fr´ echet Distance under Translation
Discrete Fr´ echet Distance
Formal Definition
δF (π, σ) := minf,g∈T maxt∈[0,1]
T = set of monotone and surjective functions from [0, 1] to {1, . . . , n}
Karl Bringmann, Marvin K¨ unnemann, and Andr´ e Nusser Algorithm Engineering of the Discrete Fr´ echet Distance under Translation
Discrete Fr´ echet Distance under Translation
δT (π, σ) := minτ∈R2δF (π, σ+τ)
Definition
Intuition: Allow arbitrary translations τ ∈ R2 of curve σ.
Karl Bringmann, Marvin K¨ unnemann, and Andr´ e Nusser Algorithm Engineering of the Discrete Fr´ echet Distance under Translation
Discrete Fr´ echet Distance under Translation
δT (π, σ) := minτ∈R2δF (π, σ+τ)
Definition
Intuition: Allow arbitrary translations τ ∈ R2 of curve σ.
σ π
Karl Bringmann, Marvin K¨ unnemann, and Andr´ e Nusser Algorithm Engineering of the Discrete Fr´ echet Distance under Translation
Discrete Fr´ echet Distance under Translation
δT (π, σ) := minτ∈R2δF (π, σ+τ)
Definition
Intuition: Allow arbitrary translations τ ∈ R2 of curve σ.
σ π σ + τ
Karl Bringmann, Marvin K¨ unnemann, and Andr´ e Nusser Algorithm Engineering of the Discrete Fr´ echet Distance under Translation
Discrete Fr´ echet Distance under Translation
δT (π, σ) := minτ∈R2δF (π, σ+τ)
Definition
Intuition: Allow arbitrary translations τ ∈ R2 of curve σ.
σ π σ + τ Decision Problem:
Karl Bringmann, Marvin K¨ unnemann, and Andr´ e Nusser Algorithm Engineering of the Discrete Fr´ echet Distance under Translation
Discrete Fr´ echet Distance under Translation
δT (π, σ) := minτ∈R2δF (π, σ+τ)
Definition
Intuition: Allow arbitrary translations τ ∈ R2 of curve σ.
σ π σ + τ Decision Problem:
Focus on this in the talk!
Karl Bringmann, Marvin K¨ unnemann, and Andr´ e Nusser Algorithm Engineering of the Discrete Fr´ echet Distance under Translation
Performant implementation computing the discrete Fr´ echet distance under translation
Karl Bringmann, Marvin K¨ unnemann, and Andr´ e Nusser Algorithm Engineering of the Discrete Fr´ echet Distance under Translation
Related Work
Theory:
echet distance under translation in ˜ O(n5) [Agarwal, Ben Avraham, Kaplan, Sharir arXiv’15]
echet distance under translation in ˜ O(n4.66) [Bringmann, K¨ unnemann, N. SODA’19]
echet distance under translation [Bringmann, K¨ unnemann, N. SODA’19]
curve length
Karl Bringmann, Marvin K¨ unnemann, and Andr´ e Nusser Algorithm Engineering of the Discrete Fr´ echet Distance under Translation
Related Work
Theory: Practice:
echet distance near neighbors search [Werner, Oliver; Baldus et al.; Buchin et al.; D¨ utsch et al. SIGSPATIAL’17]
echet distance implementation [Bringmann, K¨ unnemann, N. SoCG’19]
echet distance under translation in ˜ O(n5) [Agarwal, Ben Avraham, Kaplan, Sharir arXiv’15]
echet distance under translation in ˜ O(n4.66) [Bringmann, K¨ unnemann, N. SODA’19]
echet distance under translation [Bringmann, K¨ unnemann, N. SODA’19]
curve length
Karl Bringmann, Marvin K¨ unnemann, and Andr´ e Nusser Algorithm Engineering of the Discrete Fr´ echet Distance under Translation
Approach I: Discrete Algorithms
Arrangement
π σ δ τ1 τ2
Karl Bringmann, Marvin K¨ unnemann, and Andr´ e Nusser Algorithm Engineering of the Discrete Fr´ echet Distance under Translation
Approach I: Discrete Algorithms
Arrangement
π σ δ τ1 τ2
Karl Bringmann, Marvin K¨ unnemann, and Andr´ e Nusser Algorithm Engineering of the Discrete Fr´ echet Distance under Translation
Approach I: Discrete Algorithms
Arrangement
π σ δ τ1 τ2
Karl Bringmann, Marvin K¨ unnemann, and Andr´ e Nusser Algorithm Engineering of the Discrete Fr´ echet Distance under Translation
Approach I: Discrete Algorithms
Arrangement
π σ δ τ1 τ2
Karl Bringmann, Marvin K¨ unnemann, and Andr´ e Nusser Algorithm Engineering of the Discrete Fr´ echet Distance under Translation
Approach I: Discrete Algorithms
Arrangement
π σ δ τ1 τ2
Karl Bringmann, Marvin K¨ unnemann, and Andr´ e Nusser Algorithm Engineering of the Discrete Fr´ echet Distance under Translation
Approach I: Discrete Algorithms
Arrangement
π σ δ τ1 τ2
Karl Bringmann, Marvin K¨ unnemann, and Andr´ e Nusser Algorithm Engineering of the Discrete Fr´ echet Distance under Translation
Approach I: Discrete Algorithms
Arrangement
π σ δ τ1 τ2
Karl Bringmann, Marvin K¨ unnemann, and Andr´ e Nusser Algorithm Engineering of the Discrete Fr´ echet Distance under Translation
Approach I: Discrete Algorithms
Arrangement
π σ δ τ1 τ2
Karl Bringmann, Marvin K¨ unnemann, and Andr´ e Nusser Algorithm Engineering of the Discrete Fr´ echet Distance under Translation
Approach I: Discrete Algorithms
Arrangement
π σ δ τ1 τ2 Observation: All translations in a cell of the arrangement have the same closeness relation.
Karl Bringmann, Marvin K¨ unnemann, and Andr´ e Nusser Algorithm Engineering of the Discrete Fr´ echet Distance under Translation
Approach I: Discrete Algorithms
Arrangement
π σ δ τ1 τ2 Observation: All translations in a cell of the arrangement have the same closeness relation. for each cell, pick some τ and check dF (π, σ + τ)
Karl Bringmann, Marvin K¨ unnemann, and Andr´ e Nusser Algorithm Engineering of the Discrete Fr´ echet Distance under Translation
Approach I: Discrete Algorithms
Arrangement
π σ δ τ1 τ2 Observation: All translations in a cell of the arrangement have the same closeness relation. O(n4) complexity for each cell, pick some τ and check dF (π, σ + τ)
Karl Bringmann, Marvin K¨ unnemann, and Andr´ e Nusser Algorithm Engineering of the Discrete Fr´ echet Distance under Translation
Approach I: Discrete Algorithms
Karl Bringmann, Marvin K¨ unnemann, and Andr´ e Nusser Algorithm Engineering of the Discrete Fr´ echet Distance under Translation
Approach I: Discrete Algorithms
Karl Bringmann, Marvin K¨ unnemann, and Andr´ e Nusser Algorithm Engineering of the Discrete Fr´ echet Distance under Translation
Approach I: Discrete Algorithms
Karl Bringmann, Marvin K¨ unnemann, and Andr´ e Nusser Algorithm Engineering of the Discrete Fr´ echet Distance under Translation
Approach I: Discrete Algorithms
Karl Bringmann, Marvin K¨ unnemann, and Andr´ e Nusser Algorithm Engineering of the Discrete Fr´ echet Distance under Translation
Approach II: Continuous Optimization
Karl Bringmann, Marvin K¨ unnemann, and Andr´ e Nusser Algorithm Engineering of the Discrete Fr´ echet Distance under Translation
Approach II: Continuous Optimization
τ1 τ2
Karl Bringmann, Marvin K¨ unnemann, and Andr´ e Nusser Algorithm Engineering of the Discrete Fr´ echet Distance under Translation
Approach II: Continuous Optimization |dF(π, σ + τ) − dF(π, σ + τ ′)| ≤ τ − τ ′
Observation: Fr´ echet under Translation is 1-Lipschitz, i.e.,
Karl Bringmann, Marvin K¨ unnemann, and Andr´ e Nusser Algorithm Engineering of the Discrete Fr´ echet Distance under Translation
Approach II: Continuous Optimization
Lipschitz Optimization Approach:
For each box:
Karl Bringmann, Marvin K¨ unnemann, and Andr´ e Nusser Algorithm Engineering of the Discrete Fr´ echet Distance under Translation
Approach II: Continuous Optimization
Lipschitz Optimization Approach:
For each box:
) ≤ δ – return LESS
Karl Bringmann, Marvin K¨ unnemann, and Andr´ e Nusser Algorithm Engineering of the Discrete Fr´ echet Distance under Translation
Approach II: Continuous Optimization
Lipschitz Optimization Approach:
For each box:
) ≤ δ – return LESS
) > δ+ – skip box
Karl Bringmann, Marvin K¨ unnemann, and Andr´ e Nusser Algorithm Engineering of the Discrete Fr´ echet Distance under Translation
Approach II: Continuous Optimization
Lipschitz Optimization Approach:
For each box:
) ≤ δ – return LESS
) > δ+ – skip box
Karl Bringmann, Marvin K¨ unnemann, and Andr´ e Nusser Algorithm Engineering of the Discrete Fr´ echet Distance under Translation
Approach II: Continuous Optimization
Issues
Karl Bringmann, Marvin K¨ unnemann, and Andr´ e Nusser Algorithm Engineering of the Discrete Fr´ echet Distance under Translation
Approach II: Continuous Optimization
Issues
Karl Bringmann, Marvin K¨ unnemann, and Andr´ e Nusser Algorithm Engineering of the Discrete Fr´ echet Distance under Translation
Approach II: Continuous Optimization
Issues
Karl Bringmann, Marvin K¨ unnemann, and Andr´ e Nusser Algorithm Engineering of the Discrete Fr´ echet Distance under Translation
Approach II: Continuous Optimization
Issues
Karl Bringmann, Marvin K¨ unnemann, and Andr´ e Nusser Algorithm Engineering of the Discrete Fr´ echet Distance under Translation
Core Idea
Karl Bringmann, Marvin K¨ unnemann, and Andr´ e Nusser Algorithm Engineering of the Discrete Fr´ echet Distance under Translation
Core Idea
1) Use Lipschitz optimization to identify important regions
Karl Bringmann, Marvin K¨ unnemann, and Andr´ e Nusser Algorithm Engineering of the Discrete Fr´ echet Distance under Translation
Core Idea
1) Use Lipschitz optimization to identify important regions 2) Use arrangement algorithm inside these regions
Karl Bringmann, Marvin K¨ unnemann, and Andr´ e Nusser Algorithm Engineering of the Discrete Fr´ echet Distance under Translation
Contribution I: Exact Decider
Karl Bringmann, Marvin K¨ unnemann, and Andr´ e Nusser Algorithm Engineering of the Discrete Fr´ echet Distance under Translation
Contribution I: Exact Decider
Approach:
– estimate arrangement size
exact decision!
Karl Bringmann, Marvin K¨ unnemann, and Andr´ e Nusser Algorithm Engineering of the Discrete Fr´ echet Distance under Translation
Contribution I: Exact Decider
Approach:
– estimate arrangement size
exact decision!
Karl Bringmann, Marvin K¨ unnemann, and Andr´ e Nusser Algorithm Engineering of the Discrete Fr´ echet Distance under Translation
Contribution I: Exact Decider
Approach:
– estimate arrangement size
exact decision!
Karl Bringmann, Marvin K¨ unnemann, and Andr´ e Nusser Algorithm Engineering of the Discrete Fr´ echet Distance under Translation
Contribution I: Exact Decider
Approach:
– estimate arrangement size
exact decision!
Karl Bringmann, Marvin K¨ unnemann, and Andr´ e Nusser Algorithm Engineering of the Discrete Fr´ echet Distance under Translation
Contribution I: Exact Decider
Approach:
– estimate arrangement size
exact decision!
Karl Bringmann, Marvin K¨ unnemann, and Andr´ e Nusser Algorithm Engineering of the Discrete Fr´ echet Distance under Translation
Contribution I: Exact Decider
Approach:
– estimate arrangement size
exact decision!
Karl Bringmann, Marvin K¨ unnemann, and Andr´ e Nusser Algorithm Engineering of the Discrete Fr´ echet Distance under Translation
Contribution I: Exact Decider
Approach:
– estimate arrangement size
exact decision! Issue: When to build the arrangement? Main Ingredients:
Karl Bringmann, Marvin K¨ unnemann, and Andr´ e Nusser Algorithm Engineering of the Discrete Fr´ echet Distance under Translation
Contribution I: Exact Decider
Approach:
– estimate arrangement size
exact decision! Issue: When to build the arrangement? Main Ingredients:
modified kd-tree
Karl Bringmann, Marvin K¨ unnemann, and Andr´ e Nusser Algorithm Engineering of the Discrete Fr´ echet Distance under Translation
Contribution I: Exact Decider
Approach:
– estimate arrangement size
exact decision! Issue: When to build the arrangement? Main Ingredients:
empirically choose modified kd-tree
Karl Bringmann, Marvin K¨ unnemann, and Andr´ e Nusser Algorithm Engineering of the Discrete Fr´ echet Distance under Translation
Contribution I: Exact Decider
Implementation Details
Karl Bringmann, Marvin K¨ unnemann, and Andr´ e Nusser Algorithm Engineering of the Discrete Fr´ echet Distance under Translation
Contribution II: From Decider to Value Computation
Karl Bringmann, Marvin K¨ unnemann, and Andr´ e Nusser Algorithm Engineering of the Discrete Fr´ echet Distance under Translation
Contribution II: From Decider to Value Computation
Approaches Epsilon-approximate Set:
O(ǫ) O(ǫ)
Karl Bringmann, Marvin K¨ unnemann, and Andr´ e Nusser Algorithm Engineering of the Discrete Fr´ echet Distance under Translation
Contribution II: From Decider to Value Computation
Approaches Epsilon-approximate Set: Binary Search via Decision Problem:
O(ǫ) O(ǫ)
Karl Bringmann, Marvin K¨ unnemann, and Andr´ e Nusser Algorithm Engineering of the Discrete Fr´ echet Distance under Translation
Contribution II: From Decider to Value Computation
Approaches Epsilon-approximate Set: Binary Search via Decision Problem: Lipschitz-only Optimization:
O(ǫ) O(ǫ)
Karl Bringmann, Marvin K¨ unnemann, and Andr´ e Nusser Algorithm Engineering of the Discrete Fr´ echet Distance under Translation
Contribution II: From Decider to Value Computation
Approaches Epsilon-approximate Set: Binary Search via Decision Problem: Lipschitz-only Optimization:
O(ǫ) O(ǫ)
Lipschitz-meets-Fr´ echet: next slide
Karl Bringmann, Marvin K¨ unnemann, and Andr´ e Nusser Algorithm Engineering of the Discrete Fr´ echet Distance under Translation
Contribution II: From Decider to Value Computation
Lipschitz-meets-Fr´ echet For each box: Approach:
adapt!
Karl Bringmann, Marvin K¨ unnemann, and Andr´ e Nusser Algorithm Engineering of the Discrete Fr´ echet Distance under Translation
Contribution II: From Decider to Value Computation
Lipschitz-meets-Fr´ echet For each box:
– min{ub, dF (π, σ+ )} Approach:
adapt!
Karl Bringmann, Marvin K¨ unnemann, and Andr´ e Nusser Algorithm Engineering of the Discrete Fr´ echet Distance under Translation
Contribution II: From Decider to Value Computation
Lipschitz-meets-Fr´ echet For each box:
– min{ub, dF (π, σ+ )}
– max{lb, dF (π, σ+ )− } Approach:
adapt!
Karl Bringmann, Marvin K¨ unnemann, and Andr´ e Nusser Algorithm Engineering of the Discrete Fr´ echet Distance under Translation
Contribution II: From Decider to Value Computation
Lipschitz-meets-Fr´ echet For each box:
– min{ub, dF (π, σ+ )}
– max{lb, dF (π, σ+ )− }
Approach:
adapt!
Karl Bringmann, Marvin K¨ unnemann, and Andr´ e Nusser Algorithm Engineering of the Discrete Fr´ echet Distance under Translation
Contribution II: From Decider to Value Computation
Lipschitz-meets-Fr´ echet For each box:
– min{ub, dF (π, σ+ )}
– max{lb, dF (π, σ+ )− }
Approach:
adapt!
b i n a r y s e a r c h
e r a r r a n g e m e n t !
Karl Bringmann, Marvin K¨ unnemann, and Andr´ e Nusser Algorithm Engineering of the Discrete Fr´ echet Distance under Translation
Contribution II: From Decider to Value Computation
Lipschitz-meets-Fr´ echet: Implementation Details
Karl Bringmann, Marvin K¨ unnemann, and Andr´ e Nusser Algorithm Engineering of the Discrete Fr´ echet Distance under Translation
Experiments
Data Sets
Data set Type #Curves Mean #vertices Sigspatial synthetic GPS-like 20199 247.8 Characters 20 handwritten chars 2858 120.9 (142.9 per character)
Karl Bringmann, Marvin K¨ unnemann, and Andr´ e Nusser Algorithm Engineering of the Discrete Fr´ echet Distance under Translation
Experiments
Running Times
Karl Bringmann, Marvin K¨ unnemann, and Andr´ e Nusser Algorithm Engineering of the Discrete Fr´ echet Distance under Translation
Experiments
Running Times
Karl Bringmann, Marvin K¨ unnemann, and Andr´ e Nusser Algorithm Engineering of the Discrete Fr´ echet Distance under Translation
Experiments
Running Times
slightly less than actual distance
in the order of 100ms
Karl Bringmann, Marvin K¨ unnemann, and Andr´ e Nusser Algorithm Engineering of the Discrete Fr´ echet Distance under Translation
Experiments
Black box calls vs. arrangement size
Karl Bringmann, Marvin K¨ unnemann, and Andr´ e Nusser Algorithm Engineering of the Discrete Fr´ echet Distance under Translation
Experiments
Black box calls vs. arrangement size
Karl Bringmann, Marvin K¨ unnemann, and Andr´ e Nusser Algorithm Engineering of the Discrete Fr´ echet Distance under Translation
Experiments
Black box calls vs. arrangement size
magnitudes less calls to black-box decider
Karl Bringmann, Marvin K¨ unnemann, and Andr´ e Nusser Algorithm Engineering of the Discrete Fr´ echet Distance under Translation
Experiments
Approach Time Black-Box Calls LMF 148,032 ms 13,323,232 (141.0 ms per instance) (12,688.8 per instance) Binary Search 536,853 ms 45,909,628 (511.3 ms per instance) (43,723.5 per instance) Lipschitz-only 4,204,521 ms 820,468,224 (4,004.3 ms per instance) (781,398.3 per instance) Value Computation Times
Karl Bringmann, Marvin K¨ unnemann, and Andr´ e Nusser Algorithm Engineering of the Discrete Fr´ echet Distance under Translation
Experiments
Binary Search vs. LMF
Karl Bringmann, Marvin K¨ unnemann, and Andr´ e Nusser Algorithm Engineering of the Discrete Fr´ echet Distance under Translation
Experiments
Binary Search vs. LMF
hard instances
Karl Bringmann, Marvin K¨ unnemann, and Andr´ e Nusser Algorithm Engineering of the Discrete Fr´ echet Distance under Translation
Summary
arrangement-based geometric algorithm methods from continuous optimization
e x a c t a p p r
i m a t i
expensive
Karl Bringmann, Marvin K¨ unnemann, and Andr´ e Nusser Algorithm Engineering of the Discrete Fr´ echet Distance under Translation
Summary
arrangement-based geometric algorithm methods from continuous optimization
fast practical algorithm :)
e x a c t a p p r
i m a t i
exact expensive
Karl Bringmann, Marvin K¨ unnemann, and Andr´ e Nusser Algorithm Engineering of the Discrete Fr´ echet Distance under Translation
Summary
arrangement-based geometric algorithm methods from continuous optimization
fast practical algorithm :)
e x a c t a p p r
i m a t i
exact expensive
Future Directions:
problems
building the arrangement
Karl Bringmann, Marvin K¨ unnemann, and Andr´ e Nusser Algorithm Engineering of the Discrete Fr´ echet Distance under Translation
Summary
arrangement-based geometric algorithm methods from continuous optimization
fast practical algorithm :)
e x a c t a p p r
i m a t i
exact expensive
Future Directions:
problems
building the arrangement
Code: https://gitlab.com/anusser/frechet distance under translation
Thanks!