-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathcommon.cpp
36 lines (33 loc) · 1.11 KB
/
common.cpp
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
#include "common.h"
int GRID_COLS = 8;
namespace std
{
std::ostream& operator<<(std::ostream& os, const Constraint& constraint)
{
const auto& [loc1, loc2, timestep, positive_constraint] = constraint;
if (loc2 == -1)
os << "<(" << loc1 / GRID_COLS << "," << loc1 % GRID_COLS << "), " << timestep;
else
os << "<(" << loc1 / GRID_COLS << "," << loc1 % GRID_COLS << "), (" << loc2 / GRID_COLS << ","
<< loc2 % GRID_COLS << "), " << timestep;
if (positive_constraint)
os << ", positive>";
else
os << ", negative>";
return os;
}
}
namespace std
{
std::ostream& operator<<(std::ostream& os, const Conflict& conflict)
{
const auto& [agent1, agent2, loc1, loc2, timestep] = conflict;
if (loc2 == -1)
os << "<" << agent1 << ", " << agent2 << ", (" << loc1 / GRID_COLS << "," << loc1 % GRID_COLS << "), "
<< timestep << ">";
else
os << "<" << agent1 << ", " << agent2 << ", (" << loc1 / GRID_COLS << "," << loc1 % GRID_COLS << "), ("
<< loc2 / GRID_COLS << "," << loc2 % GRID_COLS << "), " << timestep << ">";
return os;
}
}