-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathICBSSingleAgentLLNode.cpp
41 lines (34 loc) · 1.56 KB
/
ICBSSingleAgentLLNode.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
37
38
39
40
41
#include "ICBSSingleAgentLLNode.h"
#include <iostream>
#include <iomanip>
#include <cmath>
#include <limits>
ICBSSingleAgentLLNode::ICBSSingleAgentLLNode() : loc(0), g_val(0), h_val(0), parent(NULL), timestep(0), num_internal_conf(0), in_openlist(false) {
}
ICBSSingleAgentLLNode::ICBSSingleAgentLLNode(int loc, int g_val, int h_val, ICBSSingleAgentLLNode* parent, int timestep, int num_internal_conf, bool in_openlist) :
loc(loc), g_val(g_val), h_val(h_val), parent(parent), timestep(timestep),
num_internal_conf(num_internal_conf), in_openlist(in_openlist) {
}
ICBSSingleAgentLLNode::ICBSSingleAgentLLNode(const ICBSSingleAgentLLNode& other) {
loc = other.loc;
g_val = other.g_val;
h_val = other.h_val;
parent = other.parent;
timestep = other.timestep;
in_openlist = other.in_openlist;
open_handle = other.open_handle;
focal_handle = other.focal_handle;
num_internal_conf = other.num_internal_conf;
}
ICBSSingleAgentLLNode::~ICBSSingleAgentLLNode() {
}
std::ostream& operator<<(std::ostream& os, const ICBSSingleAgentLLNode& n) {
if (n.parent != nullptr)
os << "LOC=" << n.loc << " ; TIMESTEP=" << n.timestep << " ; GVAL=" << n.g_val << " ; HVAL=" << std::setprecision(4) << n.h_val
<< " ; #CONF=" << n.num_internal_conf << " ; PARENT=" << (n.parent)->loc
<< " ; IN_OPEN?" << std::boolalpha << n.in_openlist;
else
os << "LOC=" << n.loc << " ; TIMESTEP=" << n.timestep << " ; GVAL=" << n.g_val << " ; HVAL=" << std::setprecision(4) << n.h_val
<< " ; #CONF=" << n.num_internal_conf << " ; ROOT (NO PARENT)";
return os;
}