parent
4e0c018dff
commit
8ba516c17e
@ -12,25 +12,23 @@ namespace contractor
|
|||||||
struct ContractorEdgeData
|
struct ContractorEdgeData
|
||||||
{
|
{
|
||||||
ContractorEdgeData()
|
ContractorEdgeData()
|
||||||
: weight(0), duration(0), distance(0), id(0), originalEdges(0), shortcut(0), forward(0), backward(0)
|
: weight(0), duration(0), id(0), originalEdges(0), shortcut(0), forward(0), backward(0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
ContractorEdgeData(EdgeWeight weight,
|
ContractorEdgeData(EdgeWeight weight,
|
||||||
EdgeWeight duration,
|
EdgeWeight duration,
|
||||||
EdgeDistance distance,
|
|
||||||
unsigned original_edges,
|
unsigned original_edges,
|
||||||
unsigned id,
|
unsigned id,
|
||||||
bool shortcut,
|
bool shortcut,
|
||||||
bool forward,
|
bool forward,
|
||||||
bool backward)
|
bool backward)
|
||||||
: weight(weight), duration(duration), distance(distance), id(id),
|
: weight(weight), duration(duration), id(id),
|
||||||
originalEdges(std::min((1u << 29) - 1u, original_edges)), shortcut(shortcut),
|
originalEdges(std::min((1u << 29) - 1u, original_edges)), shortcut(shortcut),
|
||||||
forward(forward), backward(backward)
|
forward(forward), backward(backward)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
EdgeWeight weight;
|
EdgeWeight weight;
|
||||||
EdgeWeight duration;
|
EdgeWeight duration;
|
||||||
EdgeDistance distance;
|
|
||||||
unsigned id;
|
unsigned id;
|
||||||
unsigned originalEdges : 29;
|
unsigned originalEdges : 29;
|
||||||
bool shortcut : 1;
|
bool shortcut : 1;
|
||||||
|
@ -41,7 +41,6 @@ ContractorGraph toContractorGraph(NodeID number_of_nodes, InputEdgeContainer inp
|
|||||||
input_edge.target,
|
input_edge.target,
|
||||||
std::max(input_edge.data.weight, 1),
|
std::max(input_edge.data.weight, 1),
|
||||||
input_edge.data.duration,
|
input_edge.data.duration,
|
||||||
input_edge.data.distance,
|
|
||||||
1,
|
1,
|
||||||
input_edge.data.turn_id,
|
input_edge.data.turn_id,
|
||||||
false,
|
false,
|
||||||
@ -52,7 +51,6 @@ ContractorGraph toContractorGraph(NodeID number_of_nodes, InputEdgeContainer inp
|
|||||||
input_edge.source,
|
input_edge.source,
|
||||||
std::max(input_edge.data.weight, 1),
|
std::max(input_edge.data.weight, 1),
|
||||||
input_edge.data.duration,
|
input_edge.data.duration,
|
||||||
input_edge.data.distance,
|
|
||||||
1,
|
1,
|
||||||
input_edge.data.turn_id,
|
input_edge.data.turn_id,
|
||||||
false,
|
false,
|
||||||
@ -84,7 +82,6 @@ ContractorGraph toContractorGraph(NodeID number_of_nodes, InputEdgeContainer inp
|
|||||||
forward_edge.data.originalEdges = reverse_edge.data.originalEdges = 1;
|
forward_edge.data.originalEdges = reverse_edge.data.originalEdges = 1;
|
||||||
forward_edge.data.weight = reverse_edge.data.weight = INVALID_EDGE_WEIGHT;
|
forward_edge.data.weight = reverse_edge.data.weight = INVALID_EDGE_WEIGHT;
|
||||||
forward_edge.data.duration = reverse_edge.data.duration = MAXIMAL_EDGE_DURATION;
|
forward_edge.data.duration = reverse_edge.data.duration = MAXIMAL_EDGE_DURATION;
|
||||||
forward_edge.data.distance = reverse_edge.data.distance = MAXIMAL_EDGE_DURATION;
|
|
||||||
// remove parallel edges
|
// remove parallel edges
|
||||||
while (i < edges.size() && edges[i].source == source && edges[i].target == target)
|
while (i < edges.size() && edges[i].source == source && edges[i].target == target)
|
||||||
{
|
{
|
||||||
@ -93,16 +90,12 @@ ContractorGraph toContractorGraph(NodeID number_of_nodes, InputEdgeContainer inp
|
|||||||
forward_edge.data.weight = std::min(edges[i].data.weight, forward_edge.data.weight);
|
forward_edge.data.weight = std::min(edges[i].data.weight, forward_edge.data.weight);
|
||||||
forward_edge.data.duration =
|
forward_edge.data.duration =
|
||||||
std::min(edges[i].data.duration, forward_edge.data.duration);
|
std::min(edges[i].data.duration, forward_edge.data.duration);
|
||||||
forward_edge.data.distance =
|
|
||||||
std::min(edges[i].data.distance, forward_edge.data.distance);
|
|
||||||
}
|
}
|
||||||
if (edges[i].data.backward)
|
if (edges[i].data.backward)
|
||||||
{
|
{
|
||||||
reverse_edge.data.weight = std::min(edges[i].data.weight, reverse_edge.data.weight);
|
reverse_edge.data.weight = std::min(edges[i].data.weight, reverse_edge.data.weight);
|
||||||
reverse_edge.data.duration =
|
reverse_edge.data.duration =
|
||||||
std::min(edges[i].data.duration, reverse_edge.data.duration);
|
std::min(edges[i].data.duration, reverse_edge.data.duration);
|
||||||
reverse_edge.data.distance =
|
|
||||||
std::min(edges[i].data.distance, reverse_edge.data.distance);
|
|
||||||
}
|
}
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
@ -158,7 +151,6 @@ template <class Edge, typename GraphT> inline std::vector<Edge> toEdges(GraphT g
|
|||||||
BOOST_ASSERT_MSG(SPECIAL_NODEID != new_edge.target, "Target id invalid");
|
BOOST_ASSERT_MSG(SPECIAL_NODEID != new_edge.target, "Target id invalid");
|
||||||
new_edge.data.weight = data.weight;
|
new_edge.data.weight = data.weight;
|
||||||
new_edge.data.duration = data.duration;
|
new_edge.data.duration = data.duration;
|
||||||
new_edge.data.distance = data.distance;
|
|
||||||
new_edge.data.shortcut = data.shortcut;
|
new_edge.data.shortcut = data.shortcut;
|
||||||
new_edge.data.turn_id = data.id;
|
new_edge.data.turn_id = data.id;
|
||||||
BOOST_ASSERT_MSG(new_edge.data.turn_id != INT_MAX, // 2^31
|
BOOST_ASSERT_MSG(new_edge.data.turn_id != INT_MAX, // 2^31
|
||||||
|
@ -17,7 +17,7 @@ struct QueryEdge
|
|||||||
struct EdgeData
|
struct EdgeData
|
||||||
{
|
{
|
||||||
explicit EdgeData()
|
explicit EdgeData()
|
||||||
: turn_id(0), shortcut(false), weight(0), duration(0), forward(false), backward(false), distance(0)
|
: turn_id(0), shortcut(false), weight(0), duration(0), forward(false), backward(false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -25,11 +25,10 @@ struct QueryEdge
|
|||||||
const bool shortcut,
|
const bool shortcut,
|
||||||
const EdgeWeight weight,
|
const EdgeWeight weight,
|
||||||
const EdgeWeight duration,
|
const EdgeWeight duration,
|
||||||
const EdgeDistance distance,
|
|
||||||
const bool forward,
|
const bool forward,
|
||||||
const bool backward)
|
const bool backward)
|
||||||
: turn_id(turn_id), shortcut(shortcut), weight(weight), duration(duration),
|
: turn_id(turn_id), shortcut(shortcut), weight(weight), duration(duration),
|
||||||
forward(forward), backward(backward), distance(distance)
|
forward(forward), backward(backward)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -41,7 +40,6 @@ struct QueryEdge
|
|||||||
turn_id = other.id;
|
turn_id = other.id;
|
||||||
forward = other.forward;
|
forward = other.forward;
|
||||||
backward = other.backward;
|
backward = other.backward;
|
||||||
distance = other.distance;
|
|
||||||
}
|
}
|
||||||
// this ID is either the middle node of the shortcut, or the ID of the edge based node (node
|
// this ID is either the middle node of the shortcut, or the ID of the edge based node (node
|
||||||
// based edge) storing the appropriate data. If `shortcut` is set to true, we get the middle
|
// based edge) storing the appropriate data. If `shortcut` is set to true, we get the middle
|
||||||
@ -52,7 +50,6 @@ struct QueryEdge
|
|||||||
EdgeWeight duration : 30;
|
EdgeWeight duration : 30;
|
||||||
std::uint32_t forward : 1;
|
std::uint32_t forward : 1;
|
||||||
std::uint32_t backward : 1;
|
std::uint32_t backward : 1;
|
||||||
EdgeDistance distance;
|
|
||||||
} data;
|
} data;
|
||||||
|
|
||||||
QueryEdge() : source(SPECIAL_NODEID), target(SPECIAL_NODEID) {}
|
QueryEdge() : source(SPECIAL_NODEID), target(SPECIAL_NODEID) {}
|
||||||
@ -72,11 +69,10 @@ struct QueryEdge
|
|||||||
return (source == right.source && target == right.target &&
|
return (source == right.source && target == right.target &&
|
||||||
data.weight == right.data.weight && data.duration == right.data.duration &&
|
data.weight == right.data.weight && data.duration == right.data.duration &&
|
||||||
data.shortcut == right.data.shortcut && data.forward == right.data.forward &&
|
data.shortcut == right.data.shortcut && data.forward == right.data.forward &&
|
||||||
data.backward == right.data.backward && data.turn_id == right.data.turn_id &&
|
data.backward == right.data.backward && data.turn_id == right.data.turn_id);
|
||||||
data.distance == right.data.distance );
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
} // namespace contractor
|
}
|
||||||
} // namespace osrm
|
}
|
||||||
|
|
||||||
#endif // QUERYEDGE_HPP
|
#endif // QUERYEDGE_HPP
|
||||||
|
@ -34,8 +34,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
#include "util/coordinate.hpp"
|
#include "util/coordinate.hpp"
|
||||||
#include "util/typedefs.hpp"
|
#include "util/typedefs.hpp"
|
||||||
|
|
||||||
#include <iostream>
|
|
||||||
|
|
||||||
#include <boost/assert.hpp>
|
#include <boost/assert.hpp>
|
||||||
|
|
||||||
namespace osrm
|
namespace osrm
|
||||||
@ -93,9 +91,6 @@ struct PhantomNode
|
|||||||
// x <-- this is PhantomNode.location
|
// x <-- this is PhantomNode.location
|
||||||
// 0----1----2----3----4 <-- EdgeBasedGraph Node segments
|
// 0----1----2----3----4 <-- EdgeBasedGraph Node segments
|
||||||
BOOST_ASSERT(forward_segment_id.enabled);
|
BOOST_ASSERT(forward_segment_id.enabled);
|
||||||
std::cout << "forward_distance: " << forward_distance;
|
|
||||||
std::cout << " forward_distance_offset: " << forward_distance_offset;
|
|
||||||
std::cout << std::endl;
|
|
||||||
return forward_distance + forward_distance_offset;
|
return forward_distance + forward_distance_offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -107,9 +102,6 @@ struct PhantomNode
|
|||||||
// x <-- this is PhantomNode.location
|
// x <-- this is PhantomNode.location
|
||||||
// 0----1----2----3----4 <-- EdgeBasedGraph Node segments
|
// 0----1----2----3----4 <-- EdgeBasedGraph Node segments
|
||||||
BOOST_ASSERT(reverse_segment_id.enabled);
|
BOOST_ASSERT(reverse_segment_id.enabled);
|
||||||
std::cout << "reverse_distance: " << reverse_distance;
|
|
||||||
std::cout << " reverse_distance_offset: " << reverse_distance_offset;
|
|
||||||
std::cout << std::endl;
|
|
||||||
return reverse_distance + reverse_distance_offset;
|
return reverse_distance + reverse_distance_offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -242,7 +234,7 @@ struct PhantomNodes
|
|||||||
PhantomNode source_phantom;
|
PhantomNode source_phantom;
|
||||||
PhantomNode target_phantom;
|
PhantomNode target_phantom;
|
||||||
};
|
};
|
||||||
} // namespace engine
|
}
|
||||||
} // namespace osrm
|
}
|
||||||
|
|
||||||
#endif // PHANTOM_NODES_H
|
#endif // PHANTOM_NODES_H
|
||||||
|
@ -25,17 +25,15 @@ struct NodeBucket
|
|||||||
unsigned from_clique_arc : 1;
|
unsigned from_clique_arc : 1;
|
||||||
EdgeWeight weight;
|
EdgeWeight weight;
|
||||||
EdgeDuration duration;
|
EdgeDuration duration;
|
||||||
EdgeDistance distance;
|
|
||||||
|
|
||||||
NodeBucket(NodeID middle_node,
|
NodeBucket(NodeID middle_node,
|
||||||
NodeID parent_node,
|
NodeID parent_node,
|
||||||
bool from_clique_arc,
|
bool from_clique_arc,
|
||||||
unsigned column_index,
|
unsigned column_index,
|
||||||
EdgeWeight weight,
|
EdgeWeight weight,
|
||||||
EdgeDuration duration,
|
EdgeDuration duration)
|
||||||
EdgeDistance distance)
|
|
||||||
: middle_node(middle_node), parent_node(parent_node), column_index(column_index),
|
: middle_node(middle_node), parent_node(parent_node), column_index(column_index),
|
||||||
from_clique_arc(from_clique_arc), weight(weight), duration(duration), distance(distance)
|
from_clique_arc(from_clique_arc), weight(weight), duration(duration)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -43,10 +41,9 @@ struct NodeBucket
|
|||||||
NodeID parent_node,
|
NodeID parent_node,
|
||||||
unsigned column_index,
|
unsigned column_index,
|
||||||
EdgeWeight weight,
|
EdgeWeight weight,
|
||||||
EdgeDuration duration,
|
EdgeDuration duration)
|
||||||
EdgeDistance distance)
|
|
||||||
: middle_node(middle_node), parent_node(parent_node), column_index(column_index),
|
: middle_node(middle_node), parent_node(parent_node), column_index(column_index),
|
||||||
from_clique_arc(false), weight(weight), duration(duration), distance(distance)
|
from_clique_arc(false), weight(weight), duration(duration)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,17 +85,13 @@ void insertSourceInHeap(ManyToManyQueryHeap &heap, const PhantomNode &phantom_no
|
|||||||
{
|
{
|
||||||
heap.Insert(phantom_node.forward_segment_id.id,
|
heap.Insert(phantom_node.forward_segment_id.id,
|
||||||
-phantom_node.GetForwardWeightPlusOffset(),
|
-phantom_node.GetForwardWeightPlusOffset(),
|
||||||
{phantom_node.forward_segment_id.id,
|
{phantom_node.forward_segment_id.id, -phantom_node.GetForwardDuration()});
|
||||||
-phantom_node.GetForwardDuration(),
|
|
||||||
-phantom_node.GetForwardDistance()});
|
|
||||||
}
|
}
|
||||||
if (phantom_node.IsValidReverseSource())
|
if (phantom_node.IsValidReverseSource())
|
||||||
{
|
{
|
||||||
heap.Insert(phantom_node.reverse_segment_id.id,
|
heap.Insert(phantom_node.reverse_segment_id.id,
|
||||||
-phantom_node.GetReverseWeightPlusOffset(),
|
-phantom_node.GetReverseWeightPlusOffset(),
|
||||||
{phantom_node.reverse_segment_id.id,
|
{phantom_node.reverse_segment_id.id, -phantom_node.GetReverseDuration()});
|
||||||
-phantom_node.GetReverseDuration(),
|
|
||||||
-phantom_node.GetReverseDistance()});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -106,17 +102,13 @@ void insertTargetInHeap(ManyToManyQueryHeap &heap, const PhantomNode &phantom_no
|
|||||||
{
|
{
|
||||||
heap.Insert(phantom_node.forward_segment_id.id,
|
heap.Insert(phantom_node.forward_segment_id.id,
|
||||||
phantom_node.GetForwardWeightPlusOffset(),
|
phantom_node.GetForwardWeightPlusOffset(),
|
||||||
{phantom_node.forward_segment_id.id,
|
{phantom_node.forward_segment_id.id, phantom_node.GetForwardDuration()});
|
||||||
phantom_node.GetForwardDuration(),
|
|
||||||
phantom_node.GetForwardDistance()});
|
|
||||||
}
|
}
|
||||||
if (phantom_node.IsValidReverseTarget())
|
if (phantom_node.IsValidReverseTarget())
|
||||||
{
|
{
|
||||||
heap.Insert(phantom_node.reverse_segment_id.id,
|
heap.Insert(phantom_node.reverse_segment_id.id,
|
||||||
phantom_node.GetReverseWeightPlusOffset(),
|
phantom_node.GetReverseWeightPlusOffset(),
|
||||||
{phantom_node.reverse_segment_id.id,
|
{phantom_node.reverse_segment_id.id, phantom_node.GetReverseDuration()});
|
||||||
phantom_node.GetReverseDuration(),
|
|
||||||
phantom_node.GetReverseDistance()});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -186,10 +186,9 @@ void routingStep(const DataFacade<Algorithm> &facade,
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <bool UseDuration>
|
template <bool UseDuration>
|
||||||
std::tuple<EdgeWeight,EdgeDistance> getLoopWeight(const DataFacade<Algorithm> &facade, NodeID node)
|
EdgeWeight getLoopWeight(const DataFacade<Algorithm> &facade, NodeID node)
|
||||||
{
|
{
|
||||||
EdgeWeight loop_weight = UseDuration ? MAXIMAL_EDGE_DURATION : INVALID_EDGE_WEIGHT;
|
EdgeWeight loop_weight = UseDuration ? MAXIMAL_EDGE_DURATION : INVALID_EDGE_WEIGHT;
|
||||||
EdgeDistance loop_distance = MAXIMAL_EDGE_DISTANCE;
|
|
||||||
for (auto edge : facade.GetAdjacentEdgeRange(node))
|
for (auto edge : facade.GetAdjacentEdgeRange(node))
|
||||||
{
|
{
|
||||||
const auto &data = facade.GetEdgeData(edge);
|
const auto &data = facade.GetEdgeData(edge);
|
||||||
@ -199,15 +198,11 @@ std::tuple<EdgeWeight,EdgeDistance> getLoopWeight(const DataFacade<Algorithm> &f
|
|||||||
if (to == node)
|
if (to == node)
|
||||||
{
|
{
|
||||||
const auto value = UseDuration ? data.duration : data.weight;
|
const auto value = UseDuration ? data.duration : data.weight;
|
||||||
if (value < loop_weight)
|
loop_weight = std::min(loop_weight, value);
|
||||||
{
|
|
||||||
loop_weight = value;
|
|
||||||
loop_distance = data.distance;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return std::make_tuple(loop_weight, loop_distance);
|
return loop_weight;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -30,11 +30,7 @@ struct HeapData
|
|||||||
struct ManyToManyHeapData : HeapData
|
struct ManyToManyHeapData : HeapData
|
||||||
{
|
{
|
||||||
EdgeWeight duration;
|
EdgeWeight duration;
|
||||||
EdgeDistance distance;
|
ManyToManyHeapData(NodeID p, EdgeWeight duration) : HeapData(p), duration(duration) {}
|
||||||
ManyToManyHeapData(NodeID p, EdgeWeight duration, EdgeDistance distance)
|
|
||||||
: HeapData(p), duration(duration), distance(distance)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
template <> struct SearchEngineData<routing_algorithms::ch::Algorithm>
|
template <> struct SearchEngineData<routing_algorithms::ch::Algorithm>
|
||||||
@ -79,16 +75,12 @@ struct MultiLayerDijkstraHeapData
|
|||||||
struct ManyToManyMultiLayerDijkstraHeapData : MultiLayerDijkstraHeapData
|
struct ManyToManyMultiLayerDijkstraHeapData : MultiLayerDijkstraHeapData
|
||||||
{
|
{
|
||||||
EdgeWeight duration;
|
EdgeWeight duration;
|
||||||
EdgeDistance distance;
|
ManyToManyMultiLayerDijkstraHeapData(NodeID p, EdgeWeight duration)
|
||||||
ManyToManyMultiLayerDijkstraHeapData(NodeID p, EdgeWeight duration, EdgeDistance distance)
|
: MultiLayerDijkstraHeapData(p), duration(duration)
|
||||||
: MultiLayerDijkstraHeapData(p), duration(duration), distance(distance)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
ManyToManyMultiLayerDijkstraHeapData(NodeID p,
|
ManyToManyMultiLayerDijkstraHeapData(NodeID p, bool from, EdgeWeight duration)
|
||||||
bool from,
|
: MultiLayerDijkstraHeapData(p, from), duration(duration)
|
||||||
EdgeWeight duration,
|
|
||||||
EdgeDistance distance)
|
|
||||||
: MultiLayerDijkstraHeapData(p, from), duration(duration), distance(distance)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -120,7 +112,7 @@ template <> struct SearchEngineData<routing_algorithms::mld::Algorithm>
|
|||||||
void InitializeOrClearManyToManyThreadLocalStorage(unsigned number_of_nodes,
|
void InitializeOrClearManyToManyThreadLocalStorage(unsigned number_of_nodes,
|
||||||
unsigned number_of_boundary_nodes);
|
unsigned number_of_boundary_nodes);
|
||||||
};
|
};
|
||||||
} // namespace engine
|
}
|
||||||
} // namespace osrm
|
}
|
||||||
|
|
||||||
#endif // SEARCH_ENGINE_DATA_HPP
|
#endif // SEARCH_ENGINE_DATA_HPP
|
||||||
|
@ -82,7 +82,7 @@ class CompressedEdgeContainer
|
|||||||
std::unordered_map<EdgeID, unsigned> m_reverse_edge_id_to_zipped_index_map;
|
std::unordered_map<EdgeID, unsigned> m_reverse_edge_id_to_zipped_index_map;
|
||||||
std::unique_ptr<SegmentDataContainer> segment_data;
|
std::unique_ptr<SegmentDataContainer> segment_data;
|
||||||
};
|
};
|
||||||
} // namespace extractor
|
}
|
||||||
} // namespace osrm
|
}
|
||||||
|
|
||||||
#endif // GEOMETRY_COMPRESSOR_HPP_
|
#endif // GEOMETRY_COMPRESSOR_HPP_
|
||||||
|
@ -15,25 +15,20 @@ struct EdgeBasedEdge
|
|||||||
public:
|
public:
|
||||||
struct EdgeData
|
struct EdgeData
|
||||||
{
|
{
|
||||||
EdgeData()
|
EdgeData() : turn_id(0), weight(0), duration(0), forward(false), backward(false) {}
|
||||||
: turn_id(0), weight(0), distance(0), duration(0), forward(false), backward(false)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
EdgeData(const NodeID turn_id,
|
EdgeData(const NodeID turn_id,
|
||||||
const EdgeWeight weight,
|
const EdgeWeight weight,
|
||||||
const EdgeDistance distance,
|
|
||||||
const EdgeWeight duration,
|
const EdgeWeight duration,
|
||||||
const bool forward,
|
const bool forward,
|
||||||
const bool backward)
|
const bool backward)
|
||||||
: turn_id(turn_id), weight(weight), distance(distance), duration(duration),
|
: turn_id(turn_id), weight(weight), duration(duration), forward(forward),
|
||||||
forward(forward), backward(backward)
|
backward(backward)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
NodeID turn_id; // ID of the edge based node (node based edge)
|
NodeID turn_id; // ID of the edge based node (node based edge)
|
||||||
EdgeWeight weight;
|
EdgeWeight weight;
|
||||||
EdgeDistance distance;
|
|
||||||
EdgeWeight duration : 30;
|
EdgeWeight duration : 30;
|
||||||
std::uint32_t forward : 1;
|
std::uint32_t forward : 1;
|
||||||
std::uint32_t backward : 1;
|
std::uint32_t backward : 1;
|
||||||
@ -48,7 +43,6 @@ struct EdgeBasedEdge
|
|||||||
const NodeID edge_id,
|
const NodeID edge_id,
|
||||||
const EdgeWeight weight,
|
const EdgeWeight weight,
|
||||||
const EdgeWeight duration,
|
const EdgeWeight duration,
|
||||||
const EdgeDistance distance,
|
|
||||||
const bool forward,
|
const bool forward,
|
||||||
const bool backward);
|
const bool backward);
|
||||||
EdgeBasedEdge(const NodeID source, const NodeID target, const EdgeBasedEdge::EdgeData &data);
|
EdgeBasedEdge(const NodeID source, const NodeID target, const EdgeBasedEdge::EdgeData &data);
|
||||||
@ -59,7 +53,7 @@ struct EdgeBasedEdge
|
|||||||
NodeID target;
|
NodeID target;
|
||||||
EdgeData data;
|
EdgeData data;
|
||||||
};
|
};
|
||||||
static_assert(sizeof(extractor::EdgeBasedEdge) == 24,
|
static_assert(sizeof(extractor::EdgeBasedEdge) == 20,
|
||||||
"Size of extractor::EdgeBasedEdge type is "
|
"Size of extractor::EdgeBasedEdge type is "
|
||||||
"bigger than expected. This will influence "
|
"bigger than expected. This will influence "
|
||||||
"memory consumption.");
|
"memory consumption.");
|
||||||
@ -73,10 +67,9 @@ inline EdgeBasedEdge::EdgeBasedEdge(const NodeID source,
|
|||||||
const NodeID turn_id,
|
const NodeID turn_id,
|
||||||
const EdgeWeight weight,
|
const EdgeWeight weight,
|
||||||
const EdgeWeight duration,
|
const EdgeWeight duration,
|
||||||
const EdgeDistance distance,
|
|
||||||
const bool forward,
|
const bool forward,
|
||||||
const bool backward)
|
const bool backward)
|
||||||
: source(source), target(target), data{turn_id, weight, distance, duration, forward, backward}
|
: source(source), target(target), data{turn_id, weight, duration, forward, backward}
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -96,7 +89,7 @@ inline bool EdgeBasedEdge::operator<(const EdgeBasedEdge &other) const
|
|||||||
return std::tie(source, target, data.weight, unidirectional) <
|
return std::tie(source, target, data.weight, unidirectional) <
|
||||||
std::tie(other.source, other.target, other.data.weight, other_is_unidirectional);
|
std::tie(other.source, other.target, other.data.weight, other_is_unidirectional);
|
||||||
}
|
}
|
||||||
} // namespace extractor
|
} // ns extractor
|
||||||
} // namespace osrm
|
} // ns osrm
|
||||||
|
|
||||||
#endif /* EDGE_BASED_EDGE_HPP */
|
#endif /* EDGE_BASED_EDGE_HPP */
|
||||||
|
@ -49,7 +49,7 @@ struct ByEdgeOrByMeterValue
|
|||||||
using value_type = float;
|
using value_type = float;
|
||||||
value_type value;
|
value_type value;
|
||||||
};
|
};
|
||||||
} // namespace detail
|
}
|
||||||
|
|
||||||
struct InternalExtractorEdge
|
struct InternalExtractorEdge
|
||||||
{
|
{
|
||||||
@ -63,7 +63,7 @@ struct InternalExtractorEdge
|
|||||||
WeightData weight_data,
|
WeightData weight_data,
|
||||||
DurationData duration_data,
|
DurationData duration_data,
|
||||||
util::Coordinate source_coordinate)
|
util::Coordinate source_coordinate)
|
||||||
: result(source, target, 0, 0, 0, {}, -1, {}), weight_data(std::move(weight_data)),
|
: result(source, target, 0, 0, {}, -1, {}), weight_data(std::move(weight_data)),
|
||||||
duration_data(std::move(duration_data)), source_coordinate(std::move(source_coordinate))
|
duration_data(std::move(duration_data)), source_coordinate(std::move(source_coordinate))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -113,7 +113,7 @@ struct InternalExtractorEdge
|
|||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
} // namespace extractor
|
}
|
||||||
} // namespace osrm
|
}
|
||||||
|
|
||||||
#endif // INTERNAL_EXTRACTOR_EDGE_HPP
|
#endif // INTERNAL_EXTRACTOR_EDGE_HPP
|
||||||
|
@ -97,7 +97,6 @@ struct NodeBasedEdge
|
|||||||
NodeID target,
|
NodeID target,
|
||||||
EdgeWeight weight,
|
EdgeWeight weight,
|
||||||
EdgeDuration duration,
|
EdgeDuration duration,
|
||||||
EdgeDistance distance,
|
|
||||||
GeometryID geometry_id,
|
GeometryID geometry_id,
|
||||||
AnnotationID annotation_data,
|
AnnotationID annotation_data,
|
||||||
NodeBasedEdgeClassification flags);
|
NodeBasedEdgeClassification flags);
|
||||||
@ -108,7 +107,6 @@ struct NodeBasedEdge
|
|||||||
NodeID target; // 32 4
|
NodeID target; // 32 4
|
||||||
EdgeWeight weight; // 32 4
|
EdgeWeight weight; // 32 4
|
||||||
EdgeDuration duration; // 32 4
|
EdgeDuration duration; // 32 4
|
||||||
EdgeDistance distance; // 32 4
|
|
||||||
GeometryID geometry_id; // 32 4
|
GeometryID geometry_id; // 32 4
|
||||||
AnnotationID annotation_data; // 32 4
|
AnnotationID annotation_data; // 32 4
|
||||||
NodeBasedEdgeClassification flags; // 32 4
|
NodeBasedEdgeClassification flags; // 32 4
|
||||||
@ -122,7 +120,6 @@ struct NodeBasedEdgeWithOSM : NodeBasedEdge
|
|||||||
OSMNodeID target,
|
OSMNodeID target,
|
||||||
EdgeWeight weight,
|
EdgeWeight weight,
|
||||||
EdgeDuration duration,
|
EdgeDuration duration,
|
||||||
EdgeDistance distance,
|
|
||||||
GeometryID geometry_id,
|
GeometryID geometry_id,
|
||||||
AnnotationID annotation_data,
|
AnnotationID annotation_data,
|
||||||
NodeBasedEdgeClassification flags);
|
NodeBasedEdgeClassification flags);
|
||||||
@ -140,7 +137,7 @@ inline NodeBasedEdgeClassification::NodeBasedEdgeClassification()
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline NodeBasedEdge::NodeBasedEdge()
|
inline NodeBasedEdge::NodeBasedEdge()
|
||||||
: source(SPECIAL_NODEID), target(SPECIAL_NODEID), weight(0), duration(0), distance(0), annotation_data(-1)
|
: source(SPECIAL_NODEID), target(SPECIAL_NODEID), weight(0), duration(0), annotation_data(-1)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -148,12 +145,11 @@ inline NodeBasedEdge::NodeBasedEdge(NodeID source,
|
|||||||
NodeID target,
|
NodeID target,
|
||||||
EdgeWeight weight,
|
EdgeWeight weight,
|
||||||
EdgeDuration duration,
|
EdgeDuration duration,
|
||||||
EdgeDistance distance,
|
|
||||||
GeometryID geometry_id,
|
GeometryID geometry_id,
|
||||||
AnnotationID annotation_data,
|
AnnotationID annotation_data,
|
||||||
NodeBasedEdgeClassification flags)
|
NodeBasedEdgeClassification flags)
|
||||||
: source(source), target(target), weight(weight), duration(duration), distance(distance),
|
: source(source), target(target), weight(weight), duration(duration), geometry_id(geometry_id),
|
||||||
geometry_id(geometry_id), annotation_data(annotation_data), flags(flags)
|
annotation_data(annotation_data), flags(flags)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -179,18 +175,11 @@ inline NodeBasedEdgeWithOSM::NodeBasedEdgeWithOSM(OSMNodeID source,
|
|||||||
OSMNodeID target,
|
OSMNodeID target,
|
||||||
EdgeWeight weight,
|
EdgeWeight weight,
|
||||||
EdgeDuration duration,
|
EdgeDuration duration,
|
||||||
EdgeDistance distance,
|
|
||||||
GeometryID geometry_id,
|
GeometryID geometry_id,
|
||||||
AnnotationID annotation_data,
|
AnnotationID annotation_data,
|
||||||
NodeBasedEdgeClassification flags)
|
NodeBasedEdgeClassification flags)
|
||||||
: NodeBasedEdge(SPECIAL_NODEID,
|
: NodeBasedEdge(
|
||||||
SPECIAL_NODEID,
|
SPECIAL_NODEID, SPECIAL_NODEID, weight, duration, geometry_id, annotation_data, flags),
|
||||||
weight,
|
|
||||||
duration,
|
|
||||||
distance,
|
|
||||||
geometry_id,
|
|
||||||
annotation_data,
|
|
||||||
flags),
|
|
||||||
osm_source_id(std::move(source)), osm_target_id(std::move(target))
|
osm_source_id(std::move(source)), osm_target_id(std::move(target))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -200,12 +189,12 @@ inline NodeBasedEdgeWithOSM::NodeBasedEdgeWithOSM()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
static_assert(sizeof(extractor::NodeBasedEdge) == 32,
|
static_assert(sizeof(extractor::NodeBasedEdge) == 28,
|
||||||
"Size of extractor::NodeBasedEdge type is "
|
"Size of extractor::NodeBasedEdge type is "
|
||||||
"bigger than expected. This will influence "
|
"bigger than expected. This will influence "
|
||||||
"memory consumption.");
|
"memory consumption.");
|
||||||
|
|
||||||
} // namespace extractor
|
} // ns extractor
|
||||||
} // namespace osrm
|
} // ns osrm
|
||||||
|
|
||||||
#endif /* NODE_BASED_EDGE_HPP */
|
#endif /* NODE_BASED_EDGE_HPP */
|
||||||
|
@ -14,8 +14,6 @@
|
|||||||
#include <tbb/parallel_for.h>
|
#include <tbb/parallel_for.h>
|
||||||
#include <tbb/parallel_reduce.h>
|
#include <tbb/parallel_reduce.h>
|
||||||
|
|
||||||
#include <iostream>
|
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
@ -40,23 +38,11 @@ splitBidirectionalEdges(const std::vector<extractor::EdgeBasedEdge> &edges)
|
|||||||
if (edge.data.weight == INVALID_EDGE_WEIGHT)
|
if (edge.data.weight == INVALID_EDGE_WEIGHT)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
std::cout << " EdgeBasedEdge {";
|
|
||||||
std::cout << " source " << edge.source << ", target: " << edge.target;
|
|
||||||
std::cout << " EdgeBasedEdgeData data {";
|
|
||||||
std::cout << " turn_id: " << edge.data.turn_id << ", weight: " << edge.data.weight;
|
|
||||||
std::cout << " distance: " << edge.data.distance << ", duration: " << edge.data.duration;
|
|
||||||
std::cout << " forward: " << (edge.data.forward == 0 ? "false" : "true")
|
|
||||||
<< ", backward: " << (edge.data.backward == 0 ? "false" : "true");
|
|
||||||
std::cout << " }";
|
|
||||||
std::cout << "}" << std::endl;
|
|
||||||
|
|
||||||
|
|
||||||
directed.emplace_back(edge.source,
|
directed.emplace_back(edge.source,
|
||||||
edge.target,
|
edge.target,
|
||||||
edge.data.turn_id,
|
edge.data.turn_id,
|
||||||
std::max(edge.data.weight, 1),
|
std::max(edge.data.weight, 1),
|
||||||
edge.data.duration,
|
edge.data.duration,
|
||||||
edge.data.distance,
|
|
||||||
edge.data.forward,
|
edge.data.forward,
|
||||||
edge.data.backward);
|
edge.data.backward);
|
||||||
|
|
||||||
@ -65,26 +51,10 @@ splitBidirectionalEdges(const std::vector<extractor::EdgeBasedEdge> &edges)
|
|||||||
edge.data.turn_id,
|
edge.data.turn_id,
|
||||||
std::max(edge.data.weight, 1),
|
std::max(edge.data.weight, 1),
|
||||||
edge.data.duration,
|
edge.data.duration,
|
||||||
edge.data.distance,
|
|
||||||
edge.data.backward,
|
edge.data.backward,
|
||||||
edge.data.forward);
|
edge.data.forward);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::cout << "Directed edges" << std::endl;
|
|
||||||
for (const auto &edge : directed)
|
|
||||||
{
|
|
||||||
std::cout << " EdgeBasedEdge {";
|
|
||||||
std::cout << " source " << edge.source << ", target: " << edge.target;
|
|
||||||
std::cout << " EdgeBasedEdgeData data {";
|
|
||||||
std::cout << " turn_id: " << edge.data.turn_id << ", weight: " << edge.data.weight;
|
|
||||||
std::cout << " distance: " << edge.data.distance << ", duration: " << edge.data.duration;
|
|
||||||
std::cout << " forward: " << (edge.data.forward == 0 ? "false" : "true")
|
|
||||||
<< ", backward: " << (edge.data.backward == 0 ? "false" : "true");
|
|
||||||
std::cout << " }";
|
|
||||||
std::cout << "}" << std::endl;
|
|
||||||
}
|
|
||||||
std::cout << "Done directed edges" << std::endl;
|
|
||||||
|
|
||||||
return directed;
|
return directed;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -99,21 +69,6 @@ std::vector<OutputEdgeT> prepareEdgesForUsageInGraph(std::vector<extractor::Edge
|
|||||||
std::tie(rhs.source, rhs.target, lhs.data.forward, rhs.data.weight);
|
std::tie(rhs.source, rhs.target, lhs.data.forward, rhs.data.weight);
|
||||||
});
|
});
|
||||||
|
|
||||||
std::cout << "Directed edges after sorting" << std::endl;
|
|
||||||
for (const auto &edge : edges)
|
|
||||||
{
|
|
||||||
std::cout << " EdgeBasedEdge {";
|
|
||||||
std::cout << " source " << edge.source << ", target: " << edge.target;
|
|
||||||
std::cout << " EdgeBasedEdgeData data {";
|
|
||||||
std::cout << " turn_id: " << edge.data.turn_id << ", weight: " << edge.data.weight;
|
|
||||||
std::cout << " distance: " << edge.data.distance << ", duration: " << edge.data.duration;
|
|
||||||
std::cout << " forward: " << (edge.data.forward == 0 ? "false" : "true")
|
|
||||||
<< ", backward: " << (edge.data.backward == 0 ? "false" : "true");
|
|
||||||
std::cout << " }";
|
|
||||||
std::cout << "}" << std::endl;
|
|
||||||
}
|
|
||||||
std::cout << "Done sorted directed edges" << std::endl;
|
|
||||||
|
|
||||||
std::vector<OutputEdgeT> output_edges;
|
std::vector<OutputEdgeT> output_edges;
|
||||||
output_edges.reserve(edges.size());
|
output_edges.reserve(edges.size());
|
||||||
|
|
||||||
@ -135,18 +90,6 @@ std::vector<OutputEdgeT> prepareEdgesForUsageInGraph(std::vector<extractor::Edge
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::cout << " EdgeBasedEdge2 {";
|
|
||||||
std::cout << " source " << begin_interval->source << ", target: " << begin_interval->target;
|
|
||||||
std::cout << " EdgeBasedEdgeData data {";
|
|
||||||
std::cout << " turn_id: " << begin_interval->data.turn_id
|
|
||||||
<< ", weight: " << begin_interval->data.weight;
|
|
||||||
std::cout << " distance: " << begin_interval->data.distance
|
|
||||||
<< ", duration: " << begin_interval->data.duration;
|
|
||||||
std::cout << " forward: " << (begin_interval->data.forward == 0 ? "false" : "true")
|
|
||||||
<< ", backward: " << (begin_interval->data.backward == 0 ? "false" : "true");
|
|
||||||
std::cout << " }";
|
|
||||||
std::cout << "}" << std::endl;
|
|
||||||
|
|
||||||
BOOST_ASSERT_MSG(begin_interval->data.forward != begin_interval->data.backward,
|
BOOST_ASSERT_MSG(begin_interval->data.forward != begin_interval->data.backward,
|
||||||
"The forward and backward flag need to be mutally exclusive");
|
"The forward and backward flag need to be mutally exclusive");
|
||||||
|
|
||||||
@ -253,7 +196,7 @@ inline DynamicEdgeBasedGraph LoadEdgeBasedGraph(const boost::filesystem::path &p
|
|||||||
return DynamicEdgeBasedGraph(number_of_edge_based_nodes, std::move(tidied), checksum);
|
return DynamicEdgeBasedGraph(number_of_edge_based_nodes, std::move(tidied), checksum);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace partitioner
|
} // ns partition
|
||||||
} // namespace osrm
|
} // ns osrm
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user