Boost logo

Boost Users :

Subject: Re: [Boost-users] Default weight map doesn't work for weighted grid graph in A-star search
From: Jeremiah Willcock (jewillco_at_[hidden])
Date: 2010-07-01 10:04:48


On Thu, 1 Jul 2010, W.P. McNeill wrote:

> 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.

Could you please try with the trunk version of astar_search.hpp? That
will allow me to line up your line numbers with my copy.

-- Jeremiah Willcock


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