Allow specifing a weight for routing that is independent of duration
This commit is contained in:
committed by
Patrick Niklaus
parent
e463733138
commit
279f8aabfb
@@ -82,7 +82,9 @@ class Contractor
|
||||
std::vector<extractor::EdgeBasedEdge> &edge_based_edge_list,
|
||||
std::vector<EdgeWeight> &node_weights,
|
||||
const std::string &edge_segment_lookup_path,
|
||||
const std::string &edge_penalty_path,
|
||||
const std::string &turn_weight_penalties_path,
|
||||
const std::string &turn_duration_penalties_path,
|
||||
const std::string &turn_penalties_index_path,
|
||||
const std::vector<std::string> &segment_speed_path,
|
||||
const std::vector<std::string> &turn_penalty_path,
|
||||
const std::string &nodes_filename,
|
||||
|
||||
@@ -49,7 +49,9 @@ struct ContractorConfig
|
||||
graph_output_path = osrm_input_path.string() + ".hsgr";
|
||||
edge_based_graph_path = osrm_input_path.string() + ".ebg";
|
||||
edge_segment_lookup_path = osrm_input_path.string() + ".edge_segment_lookup";
|
||||
edge_penalty_path = osrm_input_path.string() + ".edge_penalties";
|
||||
turn_weight_penalties_path = osrm_input_path.string() + ".turn_weight_penalties";
|
||||
turn_duration_penalties_path = osrm_input_path.string() + ".turn_duration_penalties";
|
||||
turn_penalties_index_path = osrm_input_path.string() + ".turn_penalties_index";
|
||||
node_based_graph_path = osrm_input_path.string() + ".nodes";
|
||||
geometry_path = osrm_input_path.string() + ".geometry";
|
||||
rtree_leaf_path = osrm_input_path.string() + ".fileIndex";
|
||||
@@ -66,7 +68,9 @@ struct ContractorConfig
|
||||
std::string edge_based_graph_path;
|
||||
|
||||
std::string edge_segment_lookup_path;
|
||||
std::string edge_penalty_path;
|
||||
std::string turn_weight_penalties_path;
|
||||
std::string turn_duration_penalties_path;
|
||||
std::string turn_penalties_index_path;
|
||||
std::string node_based_graph_path;
|
||||
std::string geometry_path;
|
||||
std::string rtree_leaf_path;
|
||||
|
||||
@@ -16,7 +16,7 @@ struct ContractorEdgeData
|
||||
is_original_via_node_ID(false)
|
||||
{
|
||||
}
|
||||
ContractorEdgeData(unsigned weight,
|
||||
ContractorEdgeData(EdgeWeight weight,
|
||||
unsigned original_edges,
|
||||
unsigned id,
|
||||
bool shortcut,
|
||||
@@ -26,7 +26,7 @@ struct ContractorEdgeData
|
||||
shortcut(shortcut), forward(forward), backward(backward), is_original_via_node_ID(false)
|
||||
{
|
||||
}
|
||||
unsigned weight;
|
||||
EdgeWeight weight;
|
||||
unsigned id;
|
||||
unsigned originalEdges : 28;
|
||||
bool shortcut : 1;
|
||||
|
||||
@@ -18,8 +18,11 @@ struct ContractorHeapData
|
||||
bool target = false;
|
||||
};
|
||||
|
||||
using ContractorHeap = util::
|
||||
BinaryHeap<NodeID, NodeID, int, ContractorHeapData, util::XORFastHashStorage<NodeID, NodeID>>;
|
||||
using ContractorHeap = util::BinaryHeap<NodeID,
|
||||
NodeID,
|
||||
EdgeWeight,
|
||||
ContractorHeapData,
|
||||
util::XORFastHashStorage<NodeID, NodeID>>;
|
||||
|
||||
} // namespace contractor
|
||||
} // namespace osrm
|
||||
|
||||
@@ -200,7 +200,7 @@ class GraphContractor
|
||||
|
||||
dijkstra.Clear();
|
||||
dijkstra.Insert(source, 0, ContractorHeapData{});
|
||||
int max_weight = 0;
|
||||
EdgeWeight max_weight = 0;
|
||||
unsigned number_of_targets = 0;
|
||||
|
||||
for (auto out_edge : contractor_graph->GetAdjacentEdgeRange(node))
|
||||
@@ -294,8 +294,8 @@ class GraphContractor
|
||||
const NodeID target = contractor_graph->GetTarget(out_edge);
|
||||
if (target == node)
|
||||
continue;
|
||||
const int path_weight = in_data.weight + out_data.weight;
|
||||
const int weight = dijkstra.GetKey(target);
|
||||
const EdgeWeight path_weight = in_data.weight + out_data.weight;
|
||||
const EdgeWeight weight = dijkstra.GetKey(target);
|
||||
if (path_weight < weight)
|
||||
{
|
||||
if (RUNSIMULATION)
|
||||
|
||||
@@ -32,7 +32,7 @@ std::vector<ContractorEdge> adaptToContractorInput(InputEdgeContainer input_edge
|
||||
#endif
|
||||
edges.emplace_back(input_edge.source,
|
||||
input_edge.target,
|
||||
static_cast<unsigned int>(std::max(input_edge.weight, 1)),
|
||||
std::max(input_edge.weight, 1),
|
||||
1,
|
||||
input_edge.edge_id,
|
||||
false,
|
||||
@@ -41,7 +41,7 @@ std::vector<ContractorEdge> adaptToContractorInput(InputEdgeContainer input_edge
|
||||
|
||||
edges.emplace_back(input_edge.target,
|
||||
input_edge.source,
|
||||
static_cast<unsigned int>(std::max(input_edge.weight, 1)),
|
||||
std::max(input_edge.weight, 1),
|
||||
1,
|
||||
input_edge.edge_id,
|
||||
false,
|
||||
|
||||
@@ -31,7 +31,7 @@ struct QueryEdge
|
||||
// node. Otherwise we see the edge based node to access node data.
|
||||
NodeID id : 31;
|
||||
bool shortcut : 1;
|
||||
int weight : 30;
|
||||
EdgeWeight weight : 30;
|
||||
bool forward : 1;
|
||||
bool backward : 1;
|
||||
} data;
|
||||
|
||||
Reference in New Issue
Block a user