-
Notifications
You must be signed in to change notification settings - Fork 13
/
agent_set.h
52 lines (46 loc) · 1.77 KB
/
agent_set.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#ifndef AGENT_SET_H
#define AGENT_SET_H
#include <vector>
#include <map>
#include <list>
#include <set>
#include <iostream>
#include "agent.h"
#include "tinyxml2.h"
#include "gl_const.h"
#include "node.h"
#include "agent_move.h"
class AgentSet
{
private:
int width;
int height;
std::map<std::pair<int, int>, int> occupiedNodes;
std::map<std::pair<int, int>, int> connectivityComponents;
std::vector<int> componentSizes;
std::multimap<std::pair<int, int>, int> subgraphNodes;
std::set<std::pair<int, int>> subgraphPriorities;
std::vector<Agent> agents;
public:
bool readAgents(const char *FileName);
void clear();
void addAgent(int start_i, int start_j, int goal_i, int goal_j);
void moveAgent(Node& from, Node& to, std::vector<AgentMove>& result);
void setAgentPosition(int agentId, Node pos);
void setPriority(int first, int second);
void setAgentSubgraph(int agentId, int subgraphNum);
void setConnectedComponent(int i, int j, int compNum);
void addComponentSize(int compSize);
void setNodeSubgraph(int i, int j, int subgraphNum);
void removeSubgraphs(int i, int j);
int getAgentCount() const;
Agent getAgent(int id) const;
int getAgentId(int i, int j) const;
bool isOccupied(int i, int j) const;
bool hasPriority(int first, int second) const;
std::vector<int> getSubgraphs(int i, int j) const;
int getConnectedComponentsCount() const;
int getConnectedComponent(int i, int j);
int getComponentSize(int i, int j);
};
#endif // AGENT_SET_H