21 cerr <<
"dpMain error: start node not set" << endl;
27 if(q->
node->
open(_max_nodes, _max_goals))
break;
39 cerr <<
"dpMain error: start node not set" << endl;
43 LongInteger start_tick = GetTick();
49 LongInteger cur_tick = GetTick();
50 if(ExpiredTime(start_tick, cur_tick) > max_time)
return 1;
60 cerr <<
"dpMain error: start node not set" << endl;
67 if(node->
open(_max_nodes, _max_goals))
break;
78 cerr <<
"dpMain error: start node not set" << endl;
84 if(node->
open(_max_nodes, _max_goals))
break;
96 n_nodes = create_child_nodes(nodes);
97 if(n_nodes == 0)
return 0;
110 if(!dp_main->is_best(dp_main->start_node, n))
119 dp_main->add_node(n);
121 if(n->
is_goal()) dp_main->n_goals++;
124 if(_max_nodes >= 0 && dp_main->n_nodes >= _max_nodes){
127 if(_max_goals >= 0 && dp_main->n_goals >= _max_goals){
135 if(!ref)
return true;
175 dp_main->add_node(n);
181 queue->active =
false;
189 queue->active =
false;
dpNode * next_depth(dpNode *first_child=0)
void DumpTrajectory(ostream &ost, dpNode *goal)
void remove_node(dpNode *node)
dpNode * next_breadth(dpNode *refnode)
RTC::ReturnCode_t ret(RTC::Local::ReturnCode_t r)
int SearchBreadthFirst(int _max_nodes=-1, int _max_goals=-1)
Breadth-first search.
int Search(int _max_nodes=-1, int _max_goals=-1)
Dijkstra or A* search: find the node with the smallest cost.
dpQueue * smallest_queue()
Base class for generic discrete search.
virtual int same_state(dpNode *refnode)=0
Check if the node's state is the same as refnode. (to remove duplicates)
int is_best(dpNode *ref, dpNode *target)
virtual int is_goal()=0
Check if the state is goal.
int open(int _max_nodes, int _max_goals)
void remove_node_single(dpNode *node)
void add_child(dpNode *n)
void DumpAll(ostream &ost)
virtual double calc_astar_cost(dpNode *potential_parent)
Compute the A-star cost at the node (optional).
virtual double calc_cost()=0
Compute the local cost at the node.
int SearchDepthFirst(int _max_nodes=-1, int _max_goals=-1)
Depth-first search.
void dump_trajectory(ostream &ost)