-
Notifications
You must be signed in to change notification settings - Fork 13
/
astar.h
33 lines (27 loc) · 1.11 KB
/
astar.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#ifndef ASTAR_H
#define ASTAR_H
#include "dijkstra.h"
//A* search.
template <typename NodeType = Node>
class Astar : public Dijkstra<NodeType>
{
public:
Astar(bool WithTime = false, double HW = 1.0, bool BT = true);
Astar(Astar& other) = default;
Astar& operator=(Astar& other) = default;
Astar(Astar&& other) = default;
Astar& operator=(Astar&& other) = default;
virtual ~Astar() {}
void setPerfectHeuristic(std::unordered_map<std::pair<Node, Node>, int, NodePairHash>* PerfectHeuristic) {
perfectHeuristic = PerfectHeuristic;
}
double computeHFromCellToCell(int i1, int j1, int i2, int j2) override;
std::unordered_map<std::pair<Node, Node>, int, NodePairHash>* perfectHeuristic = nullptr;
protected:
double euclideanDistance(int x1, int y1, int x2, int y2);
double manhattanDistance(int x1, int y1, int x2, int y2);
double chebyshevDistance(int x1, int y1, int x2, int y2);
double diagonalDistance(int x1, int y1, int x2, int y2);
double metric(int x1, int y1, int x2, int y2);
};
#endif