AStarHeuristic.html 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. <HTML>
  2. <!--
  3. Copyright (c) 2004 Kris Beevers
  4. Distributed under the Boost Software License, Version 1.0.
  5. (See accompanying file LICENSE_1_0.txt or copy at
  6. http://www.boost.org/LICENSE_1_0.txt)
  7. -->
  8. <Head>
  9. <Title>Boost Graph Library: AStarHeuristic</Title>
  10. <BODY BGCOLOR="#ffffff" LINK="#0000ee" TEXT="#000000" VLINK="#551a8b"
  11. ALINK="#ff0000">
  12. <IMG SRC="../../../boost.png"
  13. ALT="C++ Boost" width="277" height="86">
  14. <BR Clear>
  15. <H1>AStar Heuristic Concept</H1>
  16. This concept defines the interface for the heuristic function of an A*
  17. search, which is responsible for estimating the remaining cost from
  18. some vertex to a goal. The user can create a class that matches this
  19. interface, and then pass objects of the class into <a
  20. href="./astar_search.html"><tt>astar_search()</tt></a> to guide the
  21. order of vertex examination of the search. The heuristic instance
  22. must incorporate any necessary information about goal vertices in the
  23. graph.
  24. For further discussion of the use of heuristics in an A* search, see
  25. the documentation of <a
  26. href="./astar_search.html">astar_search()</a>.
  27. <h3>Refinement of</h3>
  28. <a href="http://www.boost.org/sgi/stl/UnaryFunction.html">Unary
  29. Function</a> (must take a single argument -- a graph vertex -- and
  30. return a cost value) and <a
  31. href="../../utility/CopyConstructible.html">Copy Constructible</a>
  32. (copying a heuristic should be a lightweight operation).
  33. <h3>Notation</h3>
  34. <Table>
  35. <TR>
  36. <TD><tt>H</tt></TD>
  37. <TD>A type that is a model of AStar Heuristic.</TD>
  38. </TR>
  39. <TR>
  40. <TD><tt>h</tt></TD>
  41. <TD>An object of type <tt>H</tt>.</TD>
  42. </TR>
  43. <TR>
  44. <TD><tt>G</tt></TD>
  45. <TD>A type that is a model of Graph.</TD>
  46. </TR>
  47. <TR>
  48. <TD><tt>g</tt></TD>
  49. <TD>An object of type <tt>G</tt>.</TD>
  50. </TR>
  51. <TR>
  52. <TD><tt>u</tt></TD>
  53. <TD>An object of type <tt>boost::graph_traits&lt;G&gt;::vertex_descriptor</tt>.</TD>
  54. </TR>
  55. <TR>
  56. <TD><tt>CostType</tt></TD>
  57. <TD>A type that can be used with the <tt>compare</tt> and
  58. <tt>combine</tt> functions passed to A*.</TD>
  59. </TR>
  60. <TR>
  61. <TD><tt>c</tt></TD>
  62. <TD>An object of type <tt>CostType</tt>.</TD>
  63. </TR>
  64. </table>
  65. <h3>Associated Types</h3>
  66. none
  67. <p>
  68. <h3>Valid Expressions</h3>
  69. <table border>
  70. <tr>
  71. <th>Name</th><th>Expression</th><th>Return Type</th><th>Description</th>
  72. </tr>
  73. <tr>
  74. <td>Call Heuristic</td>
  75. <td><tt>CostType c = h(u)</tt></td>
  76. <td><tt>CostType</tt></td>
  77. <td>
  78. Called for the target of every out edge of a vertex being examined.
  79. </td>
  80. </tr>
  81. </table>
  82. <h3>Models</h3>
  83. <ul>
  84. <li><a href="./astar_heuristic.html"><tt>astar_heuristic</tt></a>
  85. </ul>
  86. <h3>Concept Checking Class</h3>
  87. <pre>
  88. template &lt;class Heuristic, class Graph&gt;
  89. struct AStarHeuristicConcept {
  90. void constraints()
  91. {
  92. BOOST_CONCEPT_ASSERT(( CopyConstructibleConcept&lt;Heuristic&gt; ));
  93. h(u);
  94. }
  95. Heuristic h;
  96. typename graph_traits&lt;Graph&gt;::vertex_descriptor u;
  97. };
  98. </pre>
  99. <br>
  100. <HR>
  101. <TABLE>
  102. <TR valign=top>
  103. <TD nowrap>Copyright &copy; 2004</TD><TD>
  104. <A HREF="http://cs.krisbeevers.com/">Kristopher Beevers</A>,
  105. Rensselaer Polytechnic Institute (<A
  106. HREF="mailto:beevek@cs.rpi.edu">beevek@cs.rpi.edu</A>)
  107. </TD></TR></TABLE>
  108. </BODY>
  109. </HTML>