forked from NitzanMadar/exPBS-exRHCR
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathGICBSNode.cpp
92 lines (80 loc) · 2.19 KB
/
GICBSNode.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#include "GICBSNode.h"
//GICBSNode::GICBSNode()
//{
// agent_id = -1;
// g_val = 0;
// h_val = 0;
// f_val = 0;
// conflict = NULL; //make_tuple(0,0,0,0,-1);
// num_of_collisions = 0;
// time_expanded = -1;
//}
//GICBSNode::GICBSNode(int agent_id, int numAgents, double g_val, double num_of_collisions, int time_expanded, double sum_min_f_vals)
//{
// this->agent_id = agent_id;
// this->g_val = g_val;
// this->h_val = 0;
// conflict = NULL; //make_tuple(0,0,0,0,-1);
// this->num_of_collisions = num_of_collisions;
// this->time_expanded = time_expanded;
// this->sum_min_f_vals = sum_min_f_vals;
// //this->cardinal.resize(numAgents);
// this->parent = NULL;
// //this->constraintCost.resize(numAgents, 0);
//}
void GICBSNode::clear()
{
//Clear expanded node's conflicts lists. in order to save some memory
/*if (cons_strategy == constraint_strategy::R_CBSH)
{
for (int i = 0; i < curr->mdds.size(); i++)
{
if (curr->mdds[i] != NULL)
{
curr->mdds[i]->numPointers--;
if (curr->mdds[i]->numPointers == 0)
delete curr->mdds[i];
}
}
}*/
//single.clear();
//conflict.reset();
//paths.clear();
//agents_updated.clear();
}
/*GICBSNode::GICBSNode(int agent_id, GICBSNode* parent, double g_val, double num_of_collisions, int time_expanded, double sum_min_f_vals)
:parent(parent)
{
this->agent_id = agent_id;
this->g_val = g_val;
this->h_val = 0;
conflict = make_tuple(0,0,0,0,-1);
this->num_of_collisions = num_of_collisions;
this->time_expanded = time_expanded;
this->sum_min_f_vals = sum_min_f_vals;
cardinal.resize(parent->cardinal.size());
for (int i = 0; i < cardinal.size(); i++)
{
if(cardinal[i].empty())
continue;
cardinal[i].resize(parent->cardinal[i].size());
cardinal[i].assign(parent->cardinal[i].begin(), parent->cardinal[i].end());
}
mdds.resize(parent->mdds.size());
for (int i = 0; i < mdds.size(); i++)
{
mdds[i] = parent->mdds[i];
if (mdds[i] != NULL)
mdds[i]->numPointers++;
}
//this->constraintCost.resize(parent->constraintCost.size());
//constraintCost.assign(parent->constraintCost.begin(), parent->constraintCost.end());
}*/
/*GICBSNode::~GICBSNode()
{
if(mdds.empty())
return;
for(int i = 0; i < mdds.size(); i++)
if(mdds[i] != NULL)
delete mdds[i];
}*/