Using metric_tsp_approx with bundled properties

Hi,
I am trying to use metric_tsp_approx on a graph defined as :
typedef adjacency_list

On 13/04/14 22:02, Alexis Praga wrote:
Are City and Road really properties?
get() looks up properties by tag.
Supply your adjacency list properties rather than the classes
themselves. For instance:
typedef property

On Mon, Apr 14, 2014 at 10:50:52AM +0100, Albert Yiamakis wrote:
Thanks for the answer. I am a bit confused about properties. From the documentation, I understood you could use any class to create the graph, as long as you use bundled property and as long as you create the property map when needed. I thought it would suffice to create a property map for vertices index and for the edge index. In my case : vertex_index_map(get(&City::id, g_init)), and weight_map(get(&Road::length, g_init)), From your answer, I think you want me to use internal properties, instead of bundled properties. Am I missing something ? -- Alexis Praga, PhD Student (CERFACS) GPG key : AD4A AF6D BB5C 042F 9422 1223 06E1 C1BF E287 65D0

On 14/04/14 13:58, Alexis Praga wrote:
From your answer, I think you want me to use internal properties, instead of bundled properties.
Correct - apologies for the confusion. Clearly not familiar enough with bundled properties; might be of more help if you could post a complete and minimal example. Albert

Jeremiah : could you explain why you need named arguments ? I find that very confusing ! Also, I'm having trouble creating a visitor. I tried : metric_tsp_approx(g_init, weight_map(get(&Road::length, g_init)).vertex_index_map(get(&City::id, g_init)) .make_tsp_tour_visitor(back_inserter(c))); But compiling raises the error : has no member named ‘make_tsp_tour_visitor’ Should I create a class for the visitor ? Albert : I have included a small example as an attached file. -- Alexis Praga, PhD Student (CERFACS) GPG key : AD4A AF6D BB5C 042F 9422 1223 06E1 C1BF E287 65D0

Interestingly, I don't see a named parameter overload in metric_tsp_approx.hpp.
No, the call should be metric_tsp_approx(g_init, weight_map(get(&Road::length, g_init)).vertex_index_map(get(&City::id, g_init)) .visitor(make_tsp_tour_visitor(back_inserter(c)))); However that doesn't compile either; I suspect because there is no named parameter overload and it tries to call metric_tsp_approx(VertexListGraph& g, TSPVertexVisitor vis) instead. Albert
participants (3)
-
Albert Yiamakis
-
Alexis Praga
-
Jeremiah Willcock