LEMUR Packages: ompl_lemur or_lemur pr_bgl prpy_lemur
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends Groups Pages
lazysp_log_visitor.h
Go to the documentation of this file.
1 
7 namespace ompl_lemur
8 {
9 
10 template <class VertexIndexMap, class EdgeIndexMap>
12 {
13 public:
14 
15  VertexIndexMap vertex_index_map;
16  EdgeIndexMap edge_index_map;
17  std::ostream & stream;
19  VertexIndexMap vertex_index_map,
20  EdgeIndexMap edge_index_map,
21  std::ostream & stream):
22  vertex_index_map(vertex_index_map),
23  edge_index_map(edge_index_map),
24  stream(stream)
25  {
26  }
27 
28  template <class Vertex, class Edge>
29  inline void lazy_path(double length,
30  std::vector<Vertex> & vpath,
31  std::vector< std::pair<Edge,bool> > & eepath)
32  {
33  stream << "lazy_path_length " << length << std::endl;
34  stream << "lazy_path";
35  for (unsigned int ui=0; ui<vpath.size(); ui++)
36  stream << " " << get(vertex_index_map,vpath[ui]);
37  stream << std::endl;
38  stream << "lazy_path_edge";
39  for (unsigned int ui=0; ui<eepath.size(); ui++)
40  stream << " " << get(edge_index_map,eepath[ui].first);
41  stream << std::endl;
42  stream << "lazy_path_edge_evaled";
43  for (unsigned int ui=0; ui<eepath.size(); ui++)
44  if (eepath[ui].second)
45  stream << " true";
46  else
47  stream << " false";
48  stream << std::endl;
49  }
50 
51  inline void no_path()
52  {
53  stream << "no_path" << std::endl;
54  }
55 
56  inline void path_found()
57  {
58  stream << "path_found" << std::endl;
59  }
60 
61  template <class Edge>
62  inline void edge_evaluate(Edge & e, double e_weight)
63  {
64  stream << "eval_edge " << get(edge_index_map,e)
65  << " " << e_weight << std::endl;
66  }
67 };
68 
69 template <class VertexIndexMap, class EdgeIndexMap>
71 make_lazysp_log_visitor(
72  VertexIndexMap vertex_index_map, EdgeIndexMap edge_index_map, std::ostream & stream)
73 {
75  vertex_index_map, edge_index_map, stream);
76 }
77 
78 
79 
80 
82 {
83 public:
84  boost::chrono::high_resolution_clock::duration & dur_search;
85  boost::chrono::high_resolution_clock::duration & dur_eval;
86  boost::chrono::high_resolution_clock::duration & dur_selector;
87  boost::chrono::high_resolution_clock::duration & dur_selector_notify;
88  boost::chrono::high_resolution_clock::time_point time_begin;
90  boost::chrono::high_resolution_clock::duration & dur_search,
91  boost::chrono::high_resolution_clock::duration & dur_eval,
92  boost::chrono::high_resolution_clock::duration & dur_selector,
93  boost::chrono::high_resolution_clock::duration & dur_selector_notify):
94  dur_search(dur_search), dur_eval(dur_eval),
95  dur_selector(dur_selector), dur_selector_notify(dur_selector_notify)
96  {
97  }
98  inline void search_begin()
99  {
100  time_begin = boost::chrono::high_resolution_clock::now();
101  }
102  inline void search_end()
103  {
104  dur_search += boost::chrono::high_resolution_clock::now() - time_begin;
105  }
106  inline void eval_begin()
107  {
108  time_begin = boost::chrono::high_resolution_clock::now();
109  }
110  inline void eval_end()
111  {
112  dur_eval += boost::chrono::high_resolution_clock::now() - time_begin;
113  }
114 
115  inline void selector_begin()
116  {
117  time_begin = boost::chrono::high_resolution_clock::now();
118  }
119 
120  inline void selector_end()
121  {
122  dur_selector += boost::chrono::high_resolution_clock::now() - time_begin;
123  }
124 
125  inline void selector_notify_begin()
126  {
127  time_begin = boost::chrono::high_resolution_clock::now();
128  }
129 
130  inline void selector_notify_end()
131  {
132  dur_selector_notify += boost::chrono::high_resolution_clock::now() - time_begin;
133  }
134 };
135 
136 
137 
138 } // namespace ompl_lemur
Definition: lazysp_log_visitor.h:11
Definition: lazysp_log_visitor.h:81