-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathconstraint.h
45 lines (39 loc) · 1.29 KB
/
constraint.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
#ifndef CONSTRAINT_H
#define CONSTRAINT_H
#include <unordered_set>
#include <tuple>
struct Constraint
{
int i, j; //grid cell coordinates
int time;
int dur;
int agentId;
int prev_i, prev_j;
bool goalNode;
bool positive;
Constraint(int x = 0, int y = 0, int Time = 0, int AgentId = 0, int PrevI = -1, int PrevJ = -1, bool GoalNode = false) {
i = x;
j = y;
time = Time;
agentId = AgentId;
prev_i = PrevI;
prev_j = PrevJ;
goalNode = GoalNode;
positive = false;
dur = 1;
}
bool operator== (const Constraint &other) const {
return i == other.i && j == other.j && time == other.time &&
prev_i == other.prev_i && prev_j == other.prev_j &&
goalNode == other.goalNode && agentId == other.agentId;
}
bool operator!= (const Constraint &other) const {
return !(*this == other);
}
bool operator< (const Constraint &other) const {
return std::tuple<int, int, int, int, int, bool, int>(i, j, prev_i, prev_j, time, goalNode, agentId) <
std::tuple<int, int, int, int, int, bool, int>(
other.i, other.j, other.prev_i, other.prev_j, other.time, other.goalNode, other.agentId);
}
};
#endif // CONSTRAINT_H