Algorithms Library Toolkit
A toolkit for algorithms, especially for algorithms on formal languages
ChebyshevDistance.hpp
Go to the documentation of this file.
1
6// Copyright (c) 2017 Czech Technical University in Prague | Faculty of Information Technology. All rights reserved.
7
8#pragma once
9
10#include <cmath>
11#include <alib/pair>
12#include <functional>
13
14namespace graph {
15
16namespace heuristic {
17
19// ---------------------------------------------------------------------------------------------------------------------
20
21 public:
22 template<typename TCoordinate>
23 static TCoordinate chebyshevDistance(const ext::pair<TCoordinate, TCoordinate> &goal,
25
26// ---------------------------------------------------------------------------------------------------------------------
27
28 template<typename TCoordinate>
29 static std::function<TCoordinate(const ext::pair<TCoordinate, TCoordinate> &,
31
32// ---------------------------------------------------------------------------------------------------------------------
33
34};
35
36// =====================================================================================================================
37
38template<typename TCoordinate>
41 return std::max(node.first - goal.first, node.second - goal.second);
42}
43
44// ---------------------------------------------------------------------------------------------------------------------
45
46template<typename TCoordinate>
47std::function<TCoordinate(const ext::pair<TCoordinate, TCoordinate> &,
49 return chebyshevDistance < TCoordinate >;
50}
51
52// ---------------------------------------------------------------------------------------------------------------------
53
54} // namespace heuristic
55
56} // namespace graph
57
Class extending the pair class from the standard library. Original reason is to allow printing of the...
Definition: pair.hpp:43
Definition: ChebyshevDistance.hpp:18
static std::function< TCoordinate(const ext::pair< TCoordinate, TCoordinate > &, const ext::pair< TCoordinate, TCoordinate > &)> chebyshevDistanceFunction()
Definition: ChebyshevDistance.hpp:48
static TCoordinate chebyshevDistance(const ext::pair< TCoordinate, TCoordinate > &goal, const ext::pair< TCoordinate, TCoordinate > &node)
Definition: ChebyshevDistance.hpp:39
constexpr const T & max(const T &a)
Root case of maximum computation. The maximum from one value is the value itself.
Definition: algorithm.hpp:278
Definition: ReconstructPath.hpp:14
Definition: Node.cpp:11