Fix help texts and .nbg_to_ebg -> .cnbg_to_ebg

This commit is contained in:
Patrick Niklaus 2017-03-01 01:02:58 +00:00 committed by Patrick Niklaus
parent e20cbf673f
commit 886421b43a
8 changed files with 24 additions and 43 deletions

View File

@ -114,9 +114,8 @@ class EdgeBasedGraphFactory
const std::string &turn_weight_penalties_filename, const std::string &turn_weight_penalties_filename,
const std::string &turn_duration_penalties_filename, const std::string &turn_duration_penalties_filename,
const std::string &turn_penalties_index_filename, const std::string &turn_penalties_index_filename,
const bool generate_edge_lookup, const std::string &cnbg_ebg_mapping_path,
const bool generate_nbg_ebg_mapping, const bool generate_edge_lookup);
const std::string &nbg_ebg_mapping_path);
// The following get access functions destroy the content in the factory // The following get access functions destroy the content in the factory
void GetEdgeBasedEdges(util::DeallocatingVector<EdgeBasedEdge> &edges); void GetEdgeBasedEdges(util::DeallocatingVector<EdgeBasedEdge> &edges);
@ -176,8 +175,7 @@ class EdgeBasedGraphFactory
unsigned RenumberEdges(); unsigned RenumberEdges();
void GenerateEdgeExpandedNodes(const bool generate_nbg_ebg_mapping, void GenerateEdgeExpandedNodes(const std::string &nbg_ebg_mapping_path);
const std::string &nbg_ebg_mapping_path);
void GenerateEdgeExpandedEdges(ScriptingEnvironment &scripting_environment, void GenerateEdgeExpandedEdges(ScriptingEnvironment &scripting_environment,
const std::string &original_edge_data_filename, const std::string &original_edge_data_filename,

View File

@ -78,7 +78,7 @@ struct ExtractorConfig
profile_properties_output_path = basepath + ".osrm.properties"; profile_properties_output_path = basepath + ".osrm.properties";
intersection_class_data_output_path = basepath + ".osrm.icd"; intersection_class_data_output_path = basepath + ".osrm.icd";
compressed_node_based_graph_output_path = basepath + ".osrm.cnbg"; compressed_node_based_graph_output_path = basepath + ".osrm.cnbg";
nbg_ebg_graph_mapping_output_path = basepath + ".osrm.nbg_to_ebg"; cnbg_ebg_graph_mapping_output_path = basepath + ".osrm.cnbg_to_ebg";
} }
boost::filesystem::path input_path; boost::filesystem::path input_path;
@ -101,6 +101,8 @@ struct ExtractorConfig
std::string intersection_class_data_output_path; std::string intersection_class_data_output_path;
std::string turn_weight_penalties_path; std::string turn_weight_penalties_path;
std::string turn_duration_penalties_path; std::string turn_duration_penalties_path;
std::string compressed_node_based_graph_output_path;
std::string cnbg_ebg_graph_mapping_output_path;
unsigned requested_num_threads; unsigned requested_num_threads;
unsigned small_component_size; unsigned small_component_size;
@ -110,11 +112,6 @@ struct ExtractorConfig
std::string edge_segment_lookup_path; std::string edge_segment_lookup_path;
bool use_metadata; bool use_metadata;
// Auxiliary data for osrm-partition
bool dump_compressed_node_based_graph;
std::string compressed_node_based_graph_output_path;
std::string nbg_ebg_graph_mapping_output_path;
}; };
} }
} }

View File

@ -32,7 +32,7 @@ struct PartitionConfig
edge_based_graph_path = basepath + ".osrm.ebg"; edge_based_graph_path = basepath + ".osrm.ebg";
compressed_node_based_graph_path = basepath + ".osrm.cnbg"; compressed_node_based_graph_path = basepath + ".osrm.cnbg";
nbg_ebg_mapping_path = basepath + ".osrm.nbg_to_ebg"; cnbg_ebg_mapping_path = basepath + ".osrm.cnbg_to_ebg";
partition_path = basepath + ".osrm.partition"; partition_path = basepath + ".osrm.partition";
} }
@ -40,7 +40,7 @@ struct PartitionConfig
boost::filesystem::path base_path; boost::filesystem::path base_path;
boost::filesystem::path edge_based_graph_path; boost::filesystem::path edge_based_graph_path;
boost::filesystem::path compressed_node_based_graph_path; boost::filesystem::path compressed_node_based_graph_path;
boost::filesystem::path nbg_ebg_mapping_path; boost::filesystem::path cnbg_ebg_mapping_path;
boost::filesystem::path partition_path; boost::filesystem::path partition_path;
unsigned requested_num_threads; unsigned requested_num_threads;

View File

@ -196,9 +196,8 @@ void EdgeBasedGraphFactory::Run(ScriptingEnvironment &scripting_environment,
const std::string &turn_weight_penalties_filename, const std::string &turn_weight_penalties_filename,
const std::string &turn_duration_penalties_filename, const std::string &turn_duration_penalties_filename,
const std::string &turn_penalties_index_filename, const std::string &turn_penalties_index_filename,
const bool generate_edge_lookup, const std::string &cnbg_ebg_mapping_path,
const bool generate_nbg_ebg_mapping, const bool generate_edge_lookup)
const std::string &nbg_ebg_mapping_path)
{ {
TIMER_START(renumber); TIMER_START(renumber);
m_max_edge_id = RenumberEdges() - 1; m_max_edge_id = RenumberEdges() - 1;
@ -206,7 +205,7 @@ void EdgeBasedGraphFactory::Run(ScriptingEnvironment &scripting_environment,
TIMER_START(generate_nodes); TIMER_START(generate_nodes);
m_edge_based_node_weights.reserve(m_max_edge_id + 1); m_edge_based_node_weights.reserve(m_max_edge_id + 1);
GenerateEdgeExpandedNodes(generate_nbg_ebg_mapping, nbg_ebg_mapping_path); GenerateEdgeExpandedNodes(cnbg_ebg_mapping_path);
TIMER_STOP(generate_nodes); TIMER_STOP(generate_nodes);
TIMER_START(generate_edges); TIMER_START(generate_edges);
@ -260,15 +259,12 @@ unsigned EdgeBasedGraphFactory::RenumberEdges()
} }
/// Creates the nodes in the edge expanded graph from edges in the node-based graph. /// Creates the nodes in the edge expanded graph from edges in the node-based graph.
void EdgeBasedGraphFactory::GenerateEdgeExpandedNodes(const bool generate_nbg_ebg_mapping, void EdgeBasedGraphFactory::GenerateEdgeExpandedNodes(const std::string &cnbg_ebg_mapping_path)
const std::string &nbg_ebg_mapping_path)
{ {
// Optional writer, for writing out a mapping. Neither default ctor not boost::optional work // Optional writer, for writing out a mapping. Neither default ctor not boost::optional work
// with the underlying FileWriter, so hack around that limitation with a unique_ptr. // with the underlying FileWriter, so hack around that limitation with a unique_ptr.
std::unique_ptr<NodeBasedGraphToEdgeBasedGraphMappingWriter> writer; std::unique_ptr<NodeBasedGraphToEdgeBasedGraphMappingWriter> writer;
if (generate_nbg_ebg_mapping) writer = std::make_unique<NodeBasedGraphToEdgeBasedGraphMappingWriter>(cnbg_ebg_mapping_path);
writer =
std::make_unique<NodeBasedGraphToEdgeBasedGraphMappingWriter>(nbg_ebg_mapping_path);
util::Log() << "Generating edge expanded nodes ... "; util::Log() << "Generating edge expanded nodes ... ";
{ {
@ -311,8 +307,7 @@ void EdgeBasedGraphFactory::GenerateEdgeExpandedNodes(const bool generate_nbg_eb
mapping = InsertEdgeBasedNode(node_u, node_v); mapping = InsertEdgeBasedNode(node_u, node_v);
} }
if (generate_nbg_ebg_mapping) writer->WriteMapping(mapping->u, mapping->v, mapping->head, mapping->tail);
writer->WriteMapping(mapping->u, mapping->v, mapping->head, mapping->tail);
} }
} }
} }

View File

@ -484,9 +484,8 @@ Extractor::BuildEdgeExpandedGraph(ScriptingEnvironment &scripting_environment,
config.turn_weight_penalties_path, config.turn_weight_penalties_path,
config.turn_duration_penalties_path, config.turn_duration_penalties_path,
config.turn_penalties_index_path, config.turn_penalties_index_path,
config.generate_edge_lookup, config.cnbg_ebg_graph_mapping_output_path,
config.dump_compressed_node_based_graph, config.generate_edge_lookup);
config.nbg_ebg_graph_mapping_output_path);
// The osrm-partition tool requires the compressed node based graph with an embedding. // The osrm-partition tool requires the compressed node based graph with an embedding.
// //
@ -505,14 +504,11 @@ Extractor::BuildEdgeExpandedGraph(ScriptingEnvironment &scripting_environment,
compressed_node_based_graph_writing.wait(); compressed_node_based_graph_writing.wait();
}; };
if (config.dump_compressed_node_based_graph) compressed_node_based_graph_writing = std::async(std::launch::async, [&] {
{ WriteCompressedNodeBasedGraph(config.compressed_node_based_graph_output_path,
compressed_node_based_graph_writing = std::async(std::launch::async, [&] { *node_based_graph,
WriteCompressedNodeBasedGraph(config.compressed_node_based_graph_output_path, internal_to_external_node_map);
*node_based_graph, });
internal_to_external_node_map);
});
}
WriteTurnLaneData(config.turn_lane_descriptions_file_name); WriteTurnLaneData(config.turn_lane_descriptions_file_name);
compressed_edge_container.SerializeInternalVector(config.geometry_output_path); compressed_edge_container.SerializeInternalVector(config.geometry_output_path);

View File

@ -144,7 +144,7 @@ int Partitioner::Run(const PartitionConfig &config)
// Then loads the edge based graph tanslates the partition and modifies it. // Then loads the edge based graph tanslates the partition and modifies it.
// For details see #3205 // For details see #3205
auto mapping = LoadNodeBasedGraphToEdgeBasedGraphMapping(config.nbg_ebg_mapping_path.string()); auto mapping = LoadNodeBasedGraphToEdgeBasedGraphMapping(config.cnbg_ebg_mapping_path.string());
util::Log() << "Loaded node based graph to edge based graph mapping"; util::Log() << "Loaded node based graph to edge based graph mapping";
auto edge_based_graph = LoadEdgeBasedGraph(config.edge_based_graph_path.string()); auto edge_based_graph = LoadEdgeBasedGraph(config.edge_based_graph_path.string());

View File

@ -46,11 +46,6 @@ return_code parseArguments(int argc, char *argv[], extractor::ExtractorConfig &e
->implicit_value(true) ->implicit_value(true)
->default_value(false), ->default_value(false),
"Generate a lookup table for internal edge-expanded-edge IDs to OSM node pairs")( "Generate a lookup table for internal edge-expanded-edge IDs to OSM node pairs")(
"dump-partition-graph",
boost::program_options::bool_switch(&extractor_config.dump_compressed_node_based_graph)
->implicit_value(true)
->default_value(false),
"Generate a partitionable graph file (.cnbg) for use with osrm-partition")(
"small-component-size", "small-component-size",
boost::program_options::value<unsigned int>(&extractor_config.small_component_size) boost::program_options::value<unsigned int>(&extractor_config.small_component_size)
->default_value(1000), ->default_value(1000),

View File

@ -60,7 +60,7 @@ return_code parseArguments(int argc, char *argv[], partition::PartitionConfig &p
("small-component-size", ("small-component-size",
boost::program_options::value<std::size_t>(&partition_config.small_component_size) boost::program_options::value<std::size_t>(&partition_config.small_component_size)
->default_value(1000), ->default_value(1000),
"Number of cuts to use for optimizing a single bisection"); "Size threshold for small components.");
// hidden options, will be allowed on command line, but will not be // hidden options, will be allowed on command line, but will not be
// shown to the user // shown to the user
@ -161,7 +161,7 @@ int main(int argc, char *argv[]) try
}; };
if (!check_file(partition_config.edge_based_graph_path) || if (!check_file(partition_config.edge_based_graph_path) ||
!check_file(partition_config.nbg_ebg_mapping_path) || !check_file(partition_config.cnbg_ebg_mapping_path) ||
!check_file(partition_config.compressed_node_based_graph_path)) !check_file(partition_config.compressed_node_based_graph_path))
{ {
return EXIT_FAILURE; return EXIT_FAILURE;