-
Notifications
You must be signed in to change notification settings - Fork 52
/
heuristic.h
34 lines (29 loc) · 1.03 KB
/
heuristic.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
34
#ifndef HEURISTIC_H
#define HEURISTIC_H
#include "structs.h"
#include "const.h"
#include <vector>
#include <unordered_map>
#include "map.h"
typedef multi_index_container<
Node,
indexed_by<
//ordered_non_unique<tag<cost>, BOOST_MULTI_INDEX_MEMBER(Open_Elem, double, cost)>,
ordered_non_unique<BOOST_MULTI_INDEX_MEMBER(Node, double, g)>,
hashed_unique<BOOST_MULTI_INDEX_MEMBER(Node, int, id)>
>
> Open_Container;
class Heuristic
{
std::vector<std::vector<double>> h_values;
Open_Container open;
Node find_min();
double dist(const Node& a, const Node& b){ return std::sqrt(pow(a.i - b.i, 2) + pow(a.j - b.j, 2)); }
public:
Heuristic(){}
void init(unsigned int size, unsigned int agents);
void count(const Map &map, Agent agent);
unsigned int get_size() const {return h_values[0].size();}
double get_value(int id_node, int id_agent) { return h_values[id_node][id_agent]; }
};
#endif // HEURISTIC_H