Boost logo

Boost Users :

Subject: Re: [Boost-users] Default weight map doesn't work for weighted grid graph in A-star search
From: W.P. McNeill (billmcn_at_[hidden])
Date: 2010-07-01 03:52:26


The new grid_graph.hpp header gets me a little farther.

The trivial program complies when I use the grid_graph.hpp (r63333)
version you pointed me too.

I still can't compile my weighted_grid graph program with the new grid_graph
header, but I do think I'm getting further along. After making various
minor changes (documented on github), I am trying to compile

  dimension_array dimensions = { {3, 4} };
  weighted_grid g(dimensions);
  vertex_descriptor source = vertex(0, g), goal = vertex(3, g);
  astar_search(g,
               source,
               euclidean_heuristic(goal),
               visitor(astar_goal_visitor(goal)) );

The top of the error spew looks like this

g++ -g -I/opt/local/include -c -o main.o main.cpp
/opt/local/include/boost/graph/named_function_params.hpp: In static member
function ‘static typename boost::detail::choose_default_param::bind_<P,
Graph, Tag>::const_result_type
boost::detail::choose_default_param::const_apply(const P&, const Graph&,
Tag) [with P = boost::detail::error_property_not_found, Graph =
boost::weighted_grid, Tag = boost::vertex_index_t]’:
/opt/local/include/boost/graph/named_function_params.hpp:304: instantiated
from ‘typename boost::detail::choose_pmap_helper<Param, Graph,
Tag>::const_result_type boost::choose_const_pmap(const Param&, const Graph&,
PropertyTag) [with Param = boost::detail::error_property_not_found, Graph =
boost::weighted_grid, PropertyTag = boost::vertex_index_t]’
/opt/local/include/boost/graph/astar_search.hpp:372: instantiated from
‘void boost::astar_search(VertexListGraph&, typename
boost::graph_traits<G>::vertex_descriptor, AStarHeuristic, const
boost::bgl_named_params<P, T, R>&) [with VertexListGraph =
boost::weighted_grid, AStarHeuristic = boost::euclidean_heuristic, P =
boost::astar_goal_visitor, T = boost::graph_visitor_t, R =
boost::no_property]’
main.cpp:23: instantiated from here
*/opt/local/include/boost/graph/named_function_params.hpp:253: error:
conversion from ‘boost::grid_graph_index_map<boost::grid_graph<2ul, size_t,
size_t>, boost::array<size_t, 2ul>, size_t>’ to non-scalar type
‘boost::typed_identity_property_map<size_t>’ requested*

The named_function_params.hpp is calling get(), I think to acquire a
vertex_index_map. The default vertex_index_map is being created
incorrectly, but I can't figure out how.

Note that I can acquire and use the vertex index. For example, the
following call in main() function

  get(vertex_index, g)[source]

returns (size_t) 0 as it should.

I'm stuck again, though I am getting better at reading the big template
compiler error spew.
On Wed, Jun 30, 2010 at 9:59 PM, Jeremiah Willcock <jewillco_at_[hidden]>wrote:

> On Wed, 30 Jun 2010, W.P. McNeill wrote:
>
> Digging through the error stack it looked like the problem may have been
>> with a vertex_iterator declaration at the top of astar_search()
>> function (astar_search.hpp line 285), so I tried to compile the following
>> trivial program with grid_graph:
>> #include <boost/graph/grid_graph.hpp>
>>
>> int main(int argc, char* argv[]) {
>> using namespace boost;
>> graph_traits< grid_graph<2> >::vertex_iterator vi;
>> return 0;
>> }
>>
>> Note that it is just vanilla grid_graph, with no edge weights or other
>> code defined by me.
>>
>> I get the following compilation error:
>>
>> g++ -g -I/opt/local/include -c -o main.o main.cpp
>> /opt/local/include/boost/iterator/transform_iterator.hpp: In constructor
>> ‘boost::transform_iterator<UnaryFunction, Iterator, Reference,
>> Value>::transform_iterator() [with UnaryFunc =
>> boost::detail::grid_graph_vertex_at<boost::grid_graph<2ul, size_t, size_t>
>> >, Iterator =
>> boost::counting_iterator<size_t, boost::use_default, boost::use_default>,
>> Reference = boost::use_default, Value = boost::use_default]’:
>> main.cpp:7: instantiated from here
>> /opt/local/include/boost/iterator/transform_iterator.hpp:100: error: no
>> matching function for call to
>> ‘boost::detail::grid_graph_vertex_at<boost::grid_graph<2ul, size_t,
>> size_t> >::grid_graph_vertex_at()’
>> /opt/local/include/boost/graph/grid_graph.hpp:104: note: candidates are:
>> boost::detail::grid_graph_vertex_at<Graph>::grid_graph_vertex_at(const
>> Graph*) [with Graph = boost::grid_graph<2ul, size_t, size_t>]
>> /opt/local/include/boost/graph/grid_graph.hpp:100: note:
>> boost::detail::grid_graph_vertex_at<boost::grid_graph<2ul,
>> size_t, size_t> >::grid_graph_vertex_at(const
>> boost::detail::grid_graph_vertex_at<boost::grid_graph<2ul, size_t, size_t>
>> >&)
>> make: *** [main.o] Error 1
>>
>> This looks wrong to me. I thought the fact that grid_graph models the
>> VertexList concept would ensure that I could declare a default
>> vertex_iterator.
>>
>
> This is a bug; it's been fixed in the trunk for a few days. Could you
> please see if that version (
> https://svn.boost.org/svn/boost/trunk/boost/graph/grid_graph.hpp) works?
>
> -- Jeremiah Willcock
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net