Hi,
First of all thank you for providign the boost BGL library. I use it
extensively.
I am having some problems with some code, that works just fine using
boost version 1.46, but cannot compile using version 1.48 and higher.
I have a Bidirectional Graph using bundled properties defined as:
struct Port
{
Port(int index=-1, int type=-1, int port_code=0, string UN="NN",
string name="NN", int service_id=-1 ): m_index(index), m_type(type),
m_port_code( port_code), UNLOCODE(UN), m_name(name),
m_service_id(service_id) {}
int m_index;
int m_type;//0 port, 1 port call
int m_port_code;
string UNLOCODE;
string m_name;
int m_service_id;
};
struct Edge
{
Edge( int id=-1, int type=-1, double weight=0.0, double cost=0.0,
double dual_cost=0.0, double util=0.0, double cap=0.0, double r_cap=0.0
) : m_idx(id), m_type(type), m_weight(weight) , m_cost(cost),
m_dual_cost(dual_cost), m_utilization(util), m_capacity(cap),
m_res_cap(r_cap) {}
unsigned int m_idx;
int m_type;//0 is load edge, 1 is voyage edge, 2 forfeited edge
(commodity link)
double m_weight; //distance
double m_cost; //cost - only on load/unload/transhipment edges
double m_dual_cost;
double m_utilization;
double m_capacity;
double m_res_cap; //residual capacity
};
//Graph
typedef adjacency_list<
vecS ,
vecS ,
bidirectionalS,
Port,
Edge>
mcf_graph;
I am trying to make a call to dijkstra on a reversed graph as follows:
(the reversed graph is also a filtered graph, but I do not think this is
an issue:
dijkstra_shortest_paths (make_reverse_graph(fg), before_p,
predecessor_map ( &p[0] ).distance_map ( &d[0] ).weight_map ( get (
&Edge::m_weight, fg) ).vertex_index_map ( get ( vertex_index,fg ) ) );
which works fine in 1.46, but it seems in 1.48 I can no longer use
make_reverse_graph() (returning a reverse graph) with the
bundled properties from fg. and I get the error (compressed summary -
full details attached)
usr/include/boost/property_map/property_map.hpp:354:56: error: no match
for 'operator[]' in '((const
boost::bundle_property_map,
boost::detail::edge_desc_impl, Edge, double>&)pa)[k]'
/usr/include/boost/property_map/property_map.hpp:354:56: note: candidate is:
In file included from /usr/include/boost/graph/adjacency_list.hpp:44:0,
from /home/chrkr/git/lsndp/include/ipheuristic.h:36,
from /home/chrkr/git/lsndp/src/ipheuristic.cpp:29:
/usr/include/boost/graph/properties.hpp:399:15: note: T&
boost::bundle_property_map::operator[](boost::bundle_property_map::key_type) const [with Graph = boost::adjacency_list; Descriptor =
boost::detail::edge_desc_impl; Bundle = Edge; T = double; boost::bundle_property_map::reference = double&;
boost::bundle_property_map::key_type =
boost::detail::edge_desc_impl]
/usr/include/boost/graph/properties.hpp:399:15: note: no known
conversion for argument 1 from 'const
boost::detail::reverse_graph_edge_descriptor >' to
'boost::bundle_property_map,
boost::detail::edge_desc_impl, Edge, double>::key_type {aka
boost::detail::edge_desc_impl}'
From various sources I understand that as of 1.48 reverse graph is no
longer an image of the graph, but another object, where I need the
actual property maps and the property maps of the reversed graph, but I
did not get much wiser on how to call dijkstra with the reversed graph
given these new description. I tried defining the reverse graph as a
separate object
reverse_graph r_fg=reverse_graph(fg);
dijkstra_shortest_paths (r_fg), before_p, predecessor_map ( &p[0]
).distance_map ( &d[0] ).weight_map ( get ( &Edge::m_weight, r_fg)
).vertex_index_map ( get ( vertex_index, r_fg ) ) );
indicating that I am not getting the right properties for the reverse graph:
equired from here
/usr/include/boost/graph/properties.hpp:420:44: error: no type named
'vertex_bundled' in 'class
boost::reverse_graph >'
/usr/include/boost/graph/properties.hpp:421:42: error: no type named
'edge_bundled' in 'class
boost::reverse_graph >'
/usr/include/boost/graph/properties.hpp:425:7: error: no type named
'vertex_bundled' in 'class
boost::reverse_graph >'
/usr/include/boost/graph/properties.hpp:429:7: error: no type named
'vertex_bundled' in 'class
boost::reverse_graph >'
/usr/include/boost/graph/properties.hpp:432:70: error: no type named
'vertex_bundled' in 'class
boost::reverse_graph >'
/usr/include/boost/graph/properties.hpp:434:7: error: no type named
'vertex_bundled' in 'class
boost::reverse_graph >'
/home/chrkr/git/lsndp/src/ipheuristic.cpp:939:132: error: no matching
function for call to 'get(double Edge::*,
boost::reverse_graph >&)'
/home/chrkr/git/lsndp/src/ipheuristic.cpp:939:132: note: candidates are:
In file included from /usr/include/boost/graph/adjacency_list.hpp:36:0,
from /home/chrkr/git/lsndp/include/ipheuristic.h:36,
from /home/chrkr/git/lsndp/src/ipheuristic.cpp:29:
/usr/include/boost/property_map/property_map.hpp:179:19: note:
template<class T> const T& get(const T*, std::ptrdiff_t)
/usr/include/boost/property_map/property_map.hpp:179:19: note: template
argument deduction/substitution failed:
/home/chrkr/git/lsndp/src/ipheuristic.cpp:939:132: note: mismatched
types 'const T*' and 'double Edge::*'
In file included from /usr/include/boost/graph/graphviz.hpp:25:0,
from /home/chrkr/git/lsndp/include/data.h:19,
from /home/chrkr/git/lsndp/include/ipheuristic.h:46,
from /home/chrkr/git/lsndp/src/ipheuristic.cpp:29:
/usr/include/boost/property_map/dynamic_property_map.hpp:322:1: note:
template<class Key> std::string boost::get(const string&, const
boost::dynamic_properties&, const Key&)
/usr/include/boost/property_map/dynamic_property_map.hpp:322:1: note:
template argument deduction/substitution failed:
Is the problem the bundled properties from the original graph or ?
--
Best Regards,
Ph.D. Berit Dangaard Brouer
Post Doc.
DTU Management Engineering, Management Science
Technical University of Denmark
Department of Management Engineering
Produktionstorvet, Bygning 426
2800 Kgs. Lyngby
blof@dtu.dk mailto:blof@man.dtu.dk
www.ms.man.dtu.dk http://www.ms.man.dtu.dk
http://www.maersk.com/innovation/leadingthroughinnovation/enerplan/
Please read about the ENERPLAN project here
http://www.maersk.com/innovation/leadingthroughinnovation/enerplan/