astar_search.hpp 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566
  1. //
  2. //=======================================================================
  3. // Copyright (c) 2004 Kristopher Beevers
  4. //
  5. // Distributed under the Boost Software License, Version 1.0. (See
  6. // accompanying file LICENSE_1_0.txt or copy at
  7. // http://www.boost.org/LICENSE_1_0.txt)
  8. //=======================================================================
  9. //
  10. #ifndef BOOST_GRAPH_ASTAR_SEARCH_HPP
  11. #define BOOST_GRAPH_ASTAR_SEARCH_HPP
  12. #include <functional>
  13. #include <vector>
  14. #include <boost/limits.hpp>
  15. #include <boost/throw_exception.hpp>
  16. #include <boost/graph/named_function_params.hpp>
  17. #include <boost/graph/relax.hpp>
  18. #include <boost/graph/exception.hpp>
  19. #include <boost/graph/breadth_first_search.hpp>
  20. #include <boost/graph/iteration_macros.hpp>
  21. #include <boost/graph/detail/d_ary_heap.hpp>
  22. #include <boost/graph/property_maps/constant_property_map.hpp>
  23. #include <boost/property_map/property_map.hpp>
  24. #include <boost/property_map/vector_property_map.hpp>
  25. #include <boost/property_map/function_property_map.hpp>
  26. #include <boost/concept/assert.hpp>
  27. namespace boost {
  28. template <class Heuristic, class Graph>
  29. struct AStarHeuristicConcept {
  30. void constraints()
  31. {
  32. BOOST_CONCEPT_ASSERT(( CopyConstructibleConcept<Heuristic> ));
  33. h(u);
  34. }
  35. Heuristic h;
  36. typename graph_traits<Graph>::vertex_descriptor u;
  37. };
  38. template <class Graph, class CostType>
  39. class astar_heuristic
  40. {
  41. public:
  42. typedef typename graph_traits<Graph>::vertex_descriptor Vertex;
  43. typedef Vertex argument_type;
  44. typedef CostType result_type;
  45. astar_heuristic() {}
  46. CostType operator()(Vertex u) { return static_cast<CostType>(0); }
  47. };
  48. template <class Visitor, class Graph>
  49. struct AStarVisitorConcept {
  50. void constraints()
  51. {
  52. BOOST_CONCEPT_ASSERT(( CopyConstructibleConcept<Visitor> ));
  53. vis.initialize_vertex(u, g);
  54. vis.discover_vertex(u, g);
  55. vis.examine_vertex(u, g);
  56. vis.examine_edge(e, g);
  57. vis.edge_relaxed(e, g);
  58. vis.edge_not_relaxed(e, g);
  59. vis.black_target(e, g);
  60. vis.finish_vertex(u, g);
  61. }
  62. Visitor vis;
  63. Graph g;
  64. typename graph_traits<Graph>::vertex_descriptor u;
  65. typename graph_traits<Graph>::edge_descriptor e;
  66. };
  67. template <class Visitors = null_visitor>
  68. class astar_visitor : public bfs_visitor<Visitors> {
  69. public:
  70. astar_visitor() {}
  71. astar_visitor(Visitors vis)
  72. : bfs_visitor<Visitors>(vis) {}
  73. template <class Edge, class Graph>
  74. void edge_relaxed(Edge e, const Graph& g) {
  75. invoke_visitors(this->m_vis, e, g, on_edge_relaxed());
  76. }
  77. template <class Edge, class Graph>
  78. void edge_not_relaxed(Edge e, const Graph& g) {
  79. invoke_visitors(this->m_vis, e, g, on_edge_not_relaxed());
  80. }
  81. private:
  82. template <class Edge, class Graph>
  83. void tree_edge(Edge e, const Graph& g) {}
  84. template <class Edge, class Graph>
  85. void non_tree_edge(Edge e, const Graph& g) {}
  86. };
  87. template <class Visitors>
  88. astar_visitor<Visitors>
  89. make_astar_visitor(Visitors vis) {
  90. return astar_visitor<Visitors>(vis);
  91. }
  92. typedef astar_visitor<> default_astar_visitor;
  93. namespace detail {
  94. template <class AStarHeuristic, class UniformCostVisitor,
  95. class UpdatableQueue, class PredecessorMap,
  96. class CostMap, class DistanceMap, class WeightMap,
  97. class ColorMap, class BinaryFunction,
  98. class BinaryPredicate>
  99. struct astar_bfs_visitor
  100. {
  101. typedef typename property_traits<CostMap>::value_type C;
  102. typedef typename property_traits<ColorMap>::value_type ColorValue;
  103. typedef color_traits<ColorValue> Color;
  104. typedef typename property_traits<DistanceMap>::value_type distance_type;
  105. astar_bfs_visitor(AStarHeuristic h, UniformCostVisitor vis,
  106. UpdatableQueue& Q, PredecessorMap p,
  107. CostMap c, DistanceMap d, WeightMap w,
  108. ColorMap col, BinaryFunction combine,
  109. BinaryPredicate compare, C zero)
  110. : m_h(h), m_vis(vis), m_Q(Q), m_predecessor(p), m_cost(c),
  111. m_distance(d), m_weight(w), m_color(col),
  112. m_combine(combine), m_compare(compare), m_zero(zero) {}
  113. template <class Vertex, class Graph>
  114. void initialize_vertex(Vertex u, const Graph& g) {
  115. m_vis.initialize_vertex(u, g);
  116. }
  117. template <class Vertex, class Graph>
  118. void discover_vertex(Vertex u, const Graph& g) {
  119. m_vis.discover_vertex(u, g);
  120. }
  121. template <class Vertex, class Graph>
  122. void examine_vertex(Vertex u, const Graph& g) {
  123. m_vis.examine_vertex(u, g);
  124. }
  125. template <class Vertex, class Graph>
  126. void finish_vertex(Vertex u, const Graph& g) {
  127. m_vis.finish_vertex(u, g);
  128. }
  129. template <class Edge, class Graph>
  130. void examine_edge(Edge e, const Graph& g) {
  131. if (m_compare(get(m_weight, e), m_zero))
  132. BOOST_THROW_EXCEPTION(negative_edge());
  133. m_vis.examine_edge(e, g);
  134. }
  135. template <class Edge, class Graph>
  136. void non_tree_edge(Edge, const Graph&) {}
  137. template <class Edge, class Graph>
  138. void tree_edge(Edge e, const Graph& g) {
  139. using boost::get;
  140. bool m_decreased =
  141. relax(e, g, m_weight, m_predecessor, m_distance,
  142. m_combine, m_compare);
  143. if(m_decreased) {
  144. m_vis.edge_relaxed(e, g);
  145. put(m_cost, target(e, g),
  146. m_combine(get(m_distance, target(e, g)),
  147. m_h(target(e, g))));
  148. } else
  149. m_vis.edge_not_relaxed(e, g);
  150. }
  151. template <class Edge, class Graph>
  152. void gray_target(Edge e, const Graph& g) {
  153. using boost::get;
  154. bool m_decreased =
  155. relax(e, g, m_weight, m_predecessor, m_distance,
  156. m_combine, m_compare);
  157. if(m_decreased) {
  158. put(m_cost, target(e, g),
  159. m_combine(get(m_distance, target(e, g)),
  160. m_h(target(e, g))));
  161. m_Q.update(target(e, g));
  162. m_vis.edge_relaxed(e, g);
  163. } else
  164. m_vis.edge_not_relaxed(e, g);
  165. }
  166. template <class Edge, class Graph>
  167. void black_target(Edge e, const Graph& g) {
  168. using boost::get;
  169. bool m_decreased =
  170. relax(e, g, m_weight, m_predecessor, m_distance,
  171. m_combine, m_compare);
  172. if(m_decreased) {
  173. m_vis.edge_relaxed(e, g);
  174. put(m_cost, target(e, g),
  175. m_combine(get(m_distance, target(e, g)),
  176. m_h(target(e, g))));
  177. m_Q.push(target(e, g));
  178. put(m_color, target(e, g), Color::gray());
  179. m_vis.black_target(e, g);
  180. } else
  181. m_vis.edge_not_relaxed(e, g);
  182. }
  183. AStarHeuristic m_h;
  184. UniformCostVisitor m_vis;
  185. UpdatableQueue& m_Q;
  186. PredecessorMap m_predecessor;
  187. CostMap m_cost;
  188. DistanceMap m_distance;
  189. WeightMap m_weight;
  190. ColorMap m_color;
  191. BinaryFunction m_combine;
  192. BinaryPredicate m_compare;
  193. C m_zero;
  194. };
  195. } // namespace detail
  196. template <typename VertexListGraph, typename AStarHeuristic,
  197. typename AStarVisitor, typename PredecessorMap,
  198. typename CostMap, typename DistanceMap,
  199. typename WeightMap, typename ColorMap,
  200. typename VertexIndexMap,
  201. typename CompareFunction, typename CombineFunction,
  202. typename CostInf, typename CostZero>
  203. inline void
  204. astar_search_no_init
  205. (const VertexListGraph &g,
  206. typename graph_traits<VertexListGraph>::vertex_descriptor s,
  207. AStarHeuristic h, AStarVisitor vis,
  208. PredecessorMap predecessor, CostMap cost,
  209. DistanceMap distance, WeightMap weight,
  210. ColorMap color, VertexIndexMap index_map,
  211. CompareFunction compare, CombineFunction combine,
  212. CostInf /*inf*/, CostZero zero)
  213. {
  214. typedef typename graph_traits<VertexListGraph>::vertex_descriptor
  215. Vertex;
  216. typedef boost::vector_property_map<std::size_t, VertexIndexMap> IndexInHeapMap;
  217. IndexInHeapMap index_in_heap(index_map);
  218. typedef d_ary_heap_indirect<Vertex, 4, IndexInHeapMap, CostMap, CompareFunction>
  219. MutableQueue;
  220. MutableQueue Q(cost, index_in_heap, compare);
  221. detail::astar_bfs_visitor<AStarHeuristic, AStarVisitor,
  222. MutableQueue, PredecessorMap, CostMap, DistanceMap,
  223. WeightMap, ColorMap, CombineFunction, CompareFunction>
  224. bfs_vis(h, vis, Q, predecessor, cost, distance, weight,
  225. color, combine, compare, zero);
  226. breadth_first_visit(g, s, Q, bfs_vis, color);
  227. }
  228. namespace graph_detail {
  229. template <typename A, typename B>
  230. struct select1st {
  231. typedef std::pair<A, B> argument_type;
  232. typedef A result_type;
  233. A operator()(const std::pair<A, B>& p) const {return p.first;}
  234. };
  235. }
  236. template <typename VertexListGraph, typename AStarHeuristic,
  237. typename AStarVisitor, typename PredecessorMap,
  238. typename CostMap, typename DistanceMap,
  239. typename WeightMap,
  240. typename CompareFunction, typename CombineFunction,
  241. typename CostInf, typename CostZero>
  242. inline void
  243. astar_search_no_init_tree
  244. (const VertexListGraph &g,
  245. typename graph_traits<VertexListGraph>::vertex_descriptor s,
  246. AStarHeuristic h, AStarVisitor vis,
  247. PredecessorMap predecessor, CostMap cost,
  248. DistanceMap distance, WeightMap weight,
  249. CompareFunction compare, CombineFunction combine,
  250. CostInf /*inf*/, CostZero zero)
  251. {
  252. typedef typename graph_traits<VertexListGraph>::vertex_descriptor
  253. Vertex;
  254. typedef typename property_traits<DistanceMap>::value_type Distance;
  255. typedef d_ary_heap_indirect<
  256. std::pair<Distance, Vertex>,
  257. 4,
  258. null_property_map<std::pair<Distance, Vertex>, std::size_t>,
  259. function_property_map<graph_detail::select1st<Distance, Vertex>, std::pair<Distance, Vertex> >,
  260. CompareFunction>
  261. MutableQueue;
  262. MutableQueue Q(
  263. make_function_property_map<std::pair<Distance, Vertex> >(graph_detail::select1st<Distance, Vertex>()),
  264. null_property_map<std::pair<Distance, Vertex>, std::size_t>(),
  265. compare);
  266. vis.discover_vertex(s, g);
  267. Q.push(std::make_pair(get(cost, s), s));
  268. while (!Q.empty()) {
  269. Vertex v;
  270. Distance v_rank;
  271. boost::tie(v_rank, v) = Q.top();
  272. Q.pop();
  273. vis.examine_vertex(v, g);
  274. BGL_FORALL_OUTEDGES_T(v, e, g, VertexListGraph) {
  275. Vertex w = target(e, g);
  276. vis.examine_edge(e, g);
  277. Distance e_weight = get(weight, e);
  278. if (compare(e_weight, zero))
  279. BOOST_THROW_EXCEPTION(negative_edge());
  280. bool decreased =
  281. relax(e, g, weight, predecessor, distance,
  282. combine, compare);
  283. combine(get(distance, v), e_weight);
  284. if (decreased) {
  285. vis.edge_relaxed(e, g);
  286. Distance w_rank = combine(get(distance, w), h(w));
  287. put(cost, w, w_rank);
  288. vis.discover_vertex(w, g);
  289. Q.push(std::make_pair(w_rank, w));
  290. } else {
  291. vis.edge_not_relaxed(e, g);
  292. }
  293. }
  294. vis.finish_vertex(v, g);
  295. }
  296. }
  297. // Non-named parameter interface
  298. template <typename VertexListGraph, typename AStarHeuristic,
  299. typename AStarVisitor, typename PredecessorMap,
  300. typename CostMap, typename DistanceMap,
  301. typename WeightMap, typename VertexIndexMap,
  302. typename ColorMap,
  303. typename CompareFunction, typename CombineFunction,
  304. typename CostInf, typename CostZero>
  305. inline void
  306. astar_search
  307. (const VertexListGraph &g,
  308. typename graph_traits<VertexListGraph>::vertex_descriptor s,
  309. AStarHeuristic h, AStarVisitor vis,
  310. PredecessorMap predecessor, CostMap cost,
  311. DistanceMap distance, WeightMap weight,
  312. VertexIndexMap index_map, ColorMap color,
  313. CompareFunction compare, CombineFunction combine,
  314. CostInf inf, CostZero zero)
  315. {
  316. typedef typename property_traits<ColorMap>::value_type ColorValue;
  317. typedef color_traits<ColorValue> Color;
  318. typename graph_traits<VertexListGraph>::vertex_iterator ui, ui_end;
  319. for (boost::tie(ui, ui_end) = vertices(g); ui != ui_end; ++ui) {
  320. put(color, *ui, Color::white());
  321. put(distance, *ui, inf);
  322. put(cost, *ui, inf);
  323. put(predecessor, *ui, *ui);
  324. vis.initialize_vertex(*ui, g);
  325. }
  326. put(distance, s, zero);
  327. put(cost, s, h(s));
  328. astar_search_no_init
  329. (g, s, h, vis, predecessor, cost, distance, weight,
  330. color, index_map, compare, combine, inf, zero);
  331. }
  332. // Non-named parameter interface
  333. template <typename VertexListGraph, typename AStarHeuristic,
  334. typename AStarVisitor, typename PredecessorMap,
  335. typename CostMap, typename DistanceMap,
  336. typename WeightMap,
  337. typename CompareFunction, typename CombineFunction,
  338. typename CostInf, typename CostZero>
  339. inline void
  340. astar_search_tree
  341. (const VertexListGraph &g,
  342. typename graph_traits<VertexListGraph>::vertex_descriptor s,
  343. AStarHeuristic h, AStarVisitor vis,
  344. PredecessorMap predecessor, CostMap cost,
  345. DistanceMap distance, WeightMap weight,
  346. CompareFunction compare, CombineFunction combine,
  347. CostInf inf, CostZero zero)
  348. {
  349. typename graph_traits<VertexListGraph>::vertex_iterator ui, ui_end;
  350. for (boost::tie(ui, ui_end) = vertices(g); ui != ui_end; ++ui) {
  351. put(distance, *ui, inf);
  352. put(cost, *ui, inf);
  353. put(predecessor, *ui, *ui);
  354. vis.initialize_vertex(*ui, g);
  355. }
  356. put(distance, s, zero);
  357. put(cost, s, h(s));
  358. astar_search_no_init_tree
  359. (g, s, h, vis, predecessor, cost, distance, weight,
  360. compare, combine, inf, zero);
  361. }
  362. // Named parameter interfaces
  363. template <typename VertexListGraph,
  364. typename AStarHeuristic,
  365. typename P, typename T, typename R>
  366. void
  367. astar_search
  368. (const VertexListGraph &g,
  369. typename graph_traits<VertexListGraph>::vertex_descriptor s,
  370. AStarHeuristic h, const bgl_named_params<P, T, R>& params)
  371. {
  372. using namespace boost::graph::keywords;
  373. typedef bgl_named_params<P, T, R> params_type;
  374. BOOST_GRAPH_DECLARE_CONVERTED_PARAMETERS(params_type, params)
  375. // Distance type is the value type of the distance map if there is one,
  376. // otherwise the value type of the weight map.
  377. typedef
  378. typename detail::override_const_property_result<
  379. arg_pack_type, tag::weight_map, edge_weight_t, VertexListGraph>::type
  380. weight_map_type;
  381. typedef typename boost::property_traits<weight_map_type>::value_type W;
  382. typedef
  383. typename detail::map_maker<VertexListGraph, arg_pack_type, tag::distance_map, W>::map_type
  384. distance_map_type;
  385. typedef typename boost::property_traits<distance_map_type>::value_type D;
  386. const D inf = arg_pack[_distance_inf || detail::get_max<D>()];
  387. astar_search
  388. (g, s, h,
  389. arg_pack[_visitor | make_astar_visitor(null_visitor())],
  390. arg_pack[_predecessor_map | dummy_property_map()],
  391. detail::make_property_map_from_arg_pack_gen<tag::rank_map, D>(D())(g, arg_pack),
  392. detail::make_property_map_from_arg_pack_gen<tag::distance_map, W>(W())(g, arg_pack),
  393. detail::override_const_property(arg_pack, _weight_map, g, edge_weight),
  394. detail::override_const_property(arg_pack, _vertex_index_map, g, vertex_index),
  395. detail::make_color_map_from_arg_pack(g, arg_pack),
  396. arg_pack[_distance_compare | std::less<D>()],
  397. arg_pack[_distance_combine | closed_plus<D>(inf)],
  398. inf,
  399. arg_pack[_distance_zero | D()]);
  400. }
  401. // Named parameter interfaces
  402. template <typename VertexListGraph,
  403. typename AStarHeuristic,
  404. typename P, typename T, typename R>
  405. void
  406. astar_search_tree
  407. (const VertexListGraph &g,
  408. typename graph_traits<VertexListGraph>::vertex_descriptor s,
  409. AStarHeuristic h, const bgl_named_params<P, T, R>& params)
  410. {
  411. using namespace boost::graph::keywords;
  412. typedef bgl_named_params<P, T, R> params_type;
  413. BOOST_GRAPH_DECLARE_CONVERTED_PARAMETERS(params_type, params)
  414. // Distance type is the value type of the distance map if there is one,
  415. // otherwise the value type of the weight map.
  416. typedef
  417. typename detail::override_const_property_result<
  418. arg_pack_type, tag::weight_map, edge_weight_t, VertexListGraph>::type
  419. weight_map_type;
  420. typedef typename boost::property_traits<weight_map_type>::value_type W;
  421. typedef
  422. typename detail::map_maker<VertexListGraph, arg_pack_type, tag::distance_map, W>::map_type
  423. distance_map_type;
  424. typedef typename boost::property_traits<distance_map_type>::value_type D;
  425. const D inf = arg_pack[_distance_inf || detail::get_max<D>()];
  426. astar_search_tree
  427. (g, s, h,
  428. arg_pack[_visitor | make_astar_visitor(null_visitor())],
  429. arg_pack[_predecessor_map | dummy_property_map()],
  430. detail::make_property_map_from_arg_pack_gen<tag::rank_map, D>(D())(g, arg_pack),
  431. detail::make_property_map_from_arg_pack_gen<tag::distance_map, W>(W())(g, arg_pack),
  432. detail::override_const_property(arg_pack, _weight_map, g, edge_weight),
  433. arg_pack[_distance_compare | std::less<D>()],
  434. arg_pack[_distance_combine | closed_plus<D>(inf)],
  435. inf,
  436. arg_pack[_distance_zero | D()]);
  437. }
  438. template <typename VertexListGraph,
  439. typename AStarHeuristic,
  440. typename P, typename T, typename R>
  441. void
  442. astar_search_no_init
  443. (const VertexListGraph &g,
  444. typename graph_traits<VertexListGraph>::vertex_descriptor s,
  445. AStarHeuristic h, const bgl_named_params<P, T, R>& params)
  446. {
  447. using namespace boost::graph::keywords;
  448. typedef bgl_named_params<P, T, R> params_type;
  449. BOOST_GRAPH_DECLARE_CONVERTED_PARAMETERS(params_type, params)
  450. typedef
  451. typename detail::override_const_property_result<
  452. arg_pack_type, tag::weight_map, edge_weight_t, VertexListGraph>::type
  453. weight_map_type;
  454. typedef typename boost::property_traits<weight_map_type>::value_type D;
  455. const D inf = arg_pack[_distance_inf || detail::get_max<D>()];
  456. astar_search_no_init
  457. (g, s, h,
  458. arg_pack[_visitor | make_astar_visitor(null_visitor())],
  459. arg_pack[_predecessor_map | dummy_property_map()],
  460. detail::make_property_map_from_arg_pack_gen<tag::rank_map, D>(D())(g, arg_pack),
  461. detail::make_property_map_from_arg_pack_gen<tag::distance_map, D>(D())(g, arg_pack),
  462. detail::override_const_property(arg_pack, _weight_map, g, edge_weight),
  463. detail::make_color_map_from_arg_pack(g, arg_pack),
  464. detail::override_const_property(arg_pack, _vertex_index_map, g, vertex_index),
  465. arg_pack[_distance_compare | std::less<D>()],
  466. arg_pack[_distance_combine | closed_plus<D>(inf)],
  467. inf,
  468. arg_pack[_distance_zero | D()]);
  469. }
  470. template <typename VertexListGraph,
  471. typename AStarHeuristic,
  472. typename P, typename T, typename R>
  473. void
  474. astar_search_no_init_tree
  475. (const VertexListGraph &g,
  476. typename graph_traits<VertexListGraph>::vertex_descriptor s,
  477. AStarHeuristic h, const bgl_named_params<P, T, R>& params)
  478. {
  479. using namespace boost::graph::keywords;
  480. typedef bgl_named_params<P, T, R> params_type;
  481. BOOST_GRAPH_DECLARE_CONVERTED_PARAMETERS(params_type, params)
  482. typedef
  483. typename detail::override_const_property_result<
  484. arg_pack_type, tag::weight_map, edge_weight_t, VertexListGraph>::type
  485. weight_map_type;
  486. typedef typename boost::property_traits<weight_map_type>::value_type D;
  487. const D inf = arg_pack[_distance_inf || detail::get_max<D>()];
  488. astar_search_no_init_tree
  489. (g, s, h,
  490. arg_pack[_visitor | make_astar_visitor(null_visitor())],
  491. arg_pack[_predecessor_map | dummy_property_map()],
  492. detail::make_property_map_from_arg_pack_gen<tag::rank_map, D>(D())(g, arg_pack),
  493. detail::make_property_map_from_arg_pack_gen<tag::distance_map, D>(D())(g, arg_pack),
  494. detail::override_const_property(arg_pack, _weight_map, g, edge_weight),
  495. arg_pack[_distance_compare | std::less<D>()],
  496. arg_pack[_distance_combine | closed_plus<D>(inf)],
  497. inf,
  498. arg_pack[_distance_zero | D()]);
  499. }
  500. } // namespace boost
  501. #endif // BOOST_GRAPH_ASTAR_SEARCH_HPP