diff --git a/CMakeLists.txt b/CMakeLists.txt index 3099fc0bc..dfc4c1459 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -668,7 +668,7 @@ target_link_libraries(osrm_update ${UPDATER_LIBRARIES}) target_link_libraries(osrm_contract ${CONTRACTOR_LIBRARIES} osrm_update) target_link_libraries(osrm_extract ${EXTRACTOR_LIBRARIES}) target_link_libraries(osrm_partition ${PARTITIONER_LIBRARIES}) -target_link_libraries(osrm_customize ${CUSTOMIZER_LIBRARIES}) +target_link_libraries(osrm_customize ${CUSTOMIZER_LIBRARIES} osrm_update) target_link_libraries(osrm_store ${STORAGE_LIBRARIES}) # BUILD_COMPONENTS diff --git a/include/customizer/cell_customizer.hpp b/include/customizer/cell_customizer.hpp index cda079601..99eafa71d 100644 --- a/include/customizer/cell_customizer.hpp +++ b/include/customizer/cell_customizer.hpp @@ -10,7 +10,7 @@ namespace osrm { -namespace customize +namespace customizer { class CellCustomizer diff --git a/include/customizer/customizer.hpp b/include/customizer/customizer.hpp index db42d3d01..a7716cf1b 100644 --- a/include/customizer/customizer.hpp +++ b/include/customizer/customizer.hpp @@ -5,7 +5,7 @@ namespace osrm { -namespace customize +namespace customizer { class Customizer @@ -14,7 +14,7 @@ class Customizer int Run(const CustomizationConfig &config); }; -} // namespace customize +} // namespace customizer } // namespace osrm #endif // OSRM_CUSTOMIZE_CUSTOMIZER_HPP diff --git a/include/customizer/customizer_config.hpp b/include/customizer/customizer_config.hpp index 1d8bad984..7e51c9503 100644 --- a/include/customizer/customizer_config.hpp +++ b/include/customizer/customizer_config.hpp @@ -1,6 +1,8 @@ #ifndef OSRM_CUSTOMIZE_CUSTOMIZER_CONFIG_HPP #define OSRM_CUSTOMIZE_CUSTOMIZER_CONFIG_HPP +#include "updater/updater_config.hpp" + #include #include @@ -8,7 +10,7 @@ namespace osrm { -namespace customize +namespace customizer { struct CustomizationConfig @@ -33,6 +35,10 @@ struct CustomizationConfig edge_based_graph_path = basepath + ".osrm.ebg"; mld_partition_path = basepath + ".osrm.partition"; mld_storage_path = basepath + ".osrm.cells"; + mld_graph_path = basepath + ".osrm.mldgr"; + + updater_config.osrm_input_path = basepath + ".osrm"; + updater_config.UseDefaultOutputNames(); } // might be changed to the node based graph at some point @@ -40,8 +46,11 @@ struct CustomizationConfig boost::filesystem::path edge_based_graph_path; boost::filesystem::path mld_partition_path; boost::filesystem::path mld_storage_path; + boost::filesystem::path mld_graph_path; unsigned requested_num_threads; + + updater::UpdaterConfig updater_config; }; } } diff --git a/include/customizer/edge_based_graph.hpp b/include/customizer/edge_based_graph.hpp new file mode 100644 index 000000000..b45081b07 --- /dev/null +++ b/include/customizer/edge_based_graph.hpp @@ -0,0 +1,49 @@ +#ifndef OSRM_CUSTOMIZE_EDGE_BASED_GRAPH_HPP +#define OSRM_CUSTOMIZE_EDGE_BASED_GRAPH_HPP + +#include "extractor/edge_based_edge.hpp" +#include "partition/edge_based_graph.hpp" +#include "util/static_graph.hpp" +#include "util/typedefs.hpp" + +#include + +namespace osrm +{ +namespace customizer +{ + +struct StaticEdgeBasedGraph; + +namespace io +{ +void read(const boost::filesystem::path &path, StaticEdgeBasedGraph &graph); +void write(const boost::filesystem::path &path, const StaticEdgeBasedGraph &graph); +} + +using EdgeBasedGraphEdgeData = partition::EdgeBasedGraphEdgeData; + +struct StaticEdgeBasedGraph : util::StaticGraph +{ + using Base = util::StaticGraph; + using Base::Base; + + friend void io::read(const boost::filesystem::path &path, StaticEdgeBasedGraph &graph); + friend void io::write(const boost::filesystem::path &path, const StaticEdgeBasedGraph &graph); +}; + +struct StaticEdgeBasedGraphView : util::StaticGraph +{ + using Base = util::StaticGraph; + using Base::Base; +}; + +struct StaticEdgeBasedGraphEdge : StaticEdgeBasedGraph::InputEdge +{ + using Base = StaticEdgeBasedGraph::InputEdge; + using Base::Base; +}; +} +} + +#endif diff --git a/include/customizer/io.hpp b/include/customizer/io.hpp new file mode 100644 index 000000000..782548cc5 --- /dev/null +++ b/include/customizer/io.hpp @@ -0,0 +1,36 @@ +#ifndef OSRM_CUSTOMIZER_IO_HPP +#define OSRM_CUSTOMIZER_IO_HPP + +#include "customizer/edge_based_graph.hpp" + +#include "storage/io.hpp" + +namespace osrm +{ +namespace customizer +{ +namespace io +{ + +inline void read(const boost::filesystem::path &path, StaticEdgeBasedGraph &graph) +{ + const auto fingerprint = storage::io::FileReader::VerifyFingerprint; + storage::io::FileReader reader{path, fingerprint}; + + reader.DeserializeVector(graph.node_array); + reader.DeserializeVector(graph.edge_array); +} + +inline void write(const boost::filesystem::path &path, const StaticEdgeBasedGraph &graph) +{ + const auto fingerprint = storage::io::FileWriter::GenerateFingerprint; + storage::io::FileWriter writer{path, fingerprint}; + + writer.SerializeVector(graph.node_array); + writer.SerializeVector(graph.edge_array); +} +} +} +} + +#endif diff --git a/include/engine/datafacade/contiguous_internalmem_datafacade.hpp b/include/engine/datafacade/contiguous_internalmem_datafacade.hpp index 6d88de727..ab3b05540 100644 --- a/include/engine/datafacade/contiguous_internalmem_datafacade.hpp +++ b/include/engine/datafacade/contiguous_internalmem_datafacade.hpp @@ -8,6 +8,8 @@ #include "engine/algorithm.hpp" #include "engine/geospatial_query.hpp" +#include "customizer/edge_based_graph.hpp" + #include "extractor/datasources.hpp" #include "extractor/guidance/turn_instruction.hpp" #include "extractor/guidance/turn_lane_types.hpp" @@ -1017,7 +1019,7 @@ class ContiguousInternalMemoryDataFacade public ContiguousInternalMemoryAlgorithmDataFacade { private: - using QueryGraph = util::StaticGraph; + using QueryGraph = customizer::StaticEdgeBasedGraphView; using GraphNode = QueryGraph::NodeArrayEntry; using GraphEdge = QueryGraph::EdgeArrayEntry; diff --git a/include/partition/edge_based_graph.hpp b/include/partition/edge_based_graph.hpp new file mode 100644 index 000000000..06d197954 --- /dev/null +++ b/include/partition/edge_based_graph.hpp @@ -0,0 +1,43 @@ +#ifndef OSRM_EDGE_BASED_GRAPH_HPP +#define OSRM_EDGE_BASED_GRAPH_HPP + +#include "extractor/edge_based_edge.hpp" +#include "storage/io.hpp" +#include "util/coordinate.hpp" +#include "util/dynamic_graph.hpp" +#include "util/typedefs.hpp" + +#include + +#include +#include +#include +#include + +namespace osrm +{ +namespace partition +{ + +struct EdgeBasedGraphEdgeData : extractor::EdgeBasedEdge::EdgeData +{ + // We need to write out the full edge based graph again. + + // TODO: in case we want to modify the graph we need to store a boundary_arc flag here +}; + +struct DynamicEdgeBasedGraph : util::DynamicGraph +{ + using Base = util::DynamicGraph; + using Base::Base; +}; + +struct DynamicEdgeBasedGraphEdge : DynamicEdgeBasedGraph::InputEdge +{ + using Base = DynamicEdgeBasedGraph::InputEdge; + using Base::Base; +}; +} +} + +#endif diff --git a/include/partition/edge_based_graph_reader.hpp b/include/partition/edge_based_graph_reader.hpp index 39f0afe73..c79f0673d 100644 --- a/include/partition/edge_based_graph_reader.hpp +++ b/include/partition/edge_based_graph_reader.hpp @@ -1,6 +1,8 @@ #ifndef OSRM_EDGE_BASED_GRAPH_READER_HPP #define OSRM_EDGE_BASED_GRAPH_READER_HPP +#include "partition/edge_based_graph.hpp" + #include "extractor/edge_based_edge.hpp" #include "storage/io.hpp" #include "util/coordinate.hpp" @@ -19,25 +21,6 @@ namespace osrm namespace partition { -struct EdgeBasedGraphEdgeData : extractor::EdgeBasedEdge::EdgeData -{ - // We need to write out the full edge based graph again. - - // TODO: in case we want to modify the graph we need to store a boundary_arc flag here -}; - -struct EdgeBasedGraph : util::DynamicGraph -{ - using Base = util::DynamicGraph; - using Base::Base; -}; - -struct EdgeBasedGraphEdge : EdgeBasedGraph::InputEdge -{ - using Base = EdgeBasedGraph::InputEdge; - using Base::Base; -}; - // Bidirectional (s,t) to (s,t) and (t,s) std::vector splitBidirectionalEdges(const std::vector &edges) @@ -67,12 +50,12 @@ splitBidirectionalEdges(const std::vector &edges) return directed; } -std::vector -prepareEdgesForUsageInGraph(std::vector edges) +template +std::vector prepareEdgesForUsageInGraph(std::vector edges) { std::sort(begin(edges), end(edges)); - std::vector graph_edges; + std::vector graph_edges; graph_edges.reserve(edges.size()); for (NodeID i = 0; i < edges.size();) @@ -87,8 +70,8 @@ prepareEdgesForUsageInGraph(std::vector edges) continue; } - EdgeBasedGraphEdge forward_edge; - EdgeBasedGraphEdge reverse_edge; + OutputEdgeT forward_edge; + OutputEdgeT reverse_edge; forward_edge.source = reverse_edge.source = source; forward_edge.target = reverse_edge.target = target; forward_edge.data.edge_id = reverse_edge.data.edge_id = edges[i].data.edge_id; @@ -161,7 +144,7 @@ struct EdgeBasedGraphReader // FIXME: wrapped in unique_ptr since dynamic_graph is not move-able - std::unique_ptr BuildEdgeBasedGraph() + std::unique_ptr BuildEdgeBasedGraph() { // FIXME: The following is a rough adaption from: // - adaptToContractorInput @@ -170,9 +153,9 @@ struct EdgeBasedGraphReader // FIXME: edges passed as a const reference, can be changed pass-by-value if can be moved auto directed = splitBidirectionalEdges(edges); - auto tidied = prepareEdgesForUsageInGraph(std::move(directed)); + auto tidied = prepareEdgesForUsageInGraph(std::move(directed)); - return std::make_unique(num_nodes, std::move(tidied)); + return std::make_unique(num_nodes, std::move(tidied)); } private: @@ -180,7 +163,7 @@ struct EdgeBasedGraphReader std::size_t num_nodes; }; -inline std::unique_ptr LoadEdgeBasedGraph(const std::string &path) +inline std::unique_ptr LoadEdgeBasedGraph(const std::string &path) { const auto fingerprint = storage::io::FileReader::VerifyFingerprint; storage::io::FileReader reader(path, fingerprint); diff --git a/include/partition/io.hpp b/include/partition/io.hpp index bdfe5867b..ec01c1af7 100644 --- a/include/partition/io.hpp +++ b/include/partition/io.hpp @@ -2,6 +2,7 @@ #define OSRM_PARTITION_IO_HPP #include "partition/cell_storage.hpp" +#include "partition/edge_based_graph.hpp" #include "partition/multi_level_partition.hpp" #include "storage/io.hpp" diff --git a/include/storage/storage_config.hpp b/include/storage/storage_config.hpp index d241e249a..9967eca92 100644 --- a/include/storage/storage_config.hpp +++ b/include/storage/storage_config.hpp @@ -71,7 +71,7 @@ struct StorageConfig final boost::filesystem::path turn_lane_description_path; boost::filesystem::path mld_partition_path; boost::filesystem::path mld_storage_path; - boost::filesystem::path edge_based_graph_path; + boost::filesystem::path mld_graph_path; }; } } diff --git a/include/updater/updater.hpp b/include/updater/updater.hpp index f12e86d9e..550f4e7f8 100644 --- a/include/updater/updater.hpp +++ b/include/updater/updater.hpp @@ -16,6 +16,9 @@ class Updater public: Updater(UpdaterConfig config_) : config(std::move(config_)) {} + using NumNodesAndEdges = std::tuple>; + NumNodesAndEdges LoadAndUpdateEdgeExpandedGraph() const; + EdgeID LoadAndUpdateEdgeExpandedGraph(std::vector &edge_based_edge_list, std::vector &node_weights) const; diff --git a/include/util/static_graph.hpp b/include/util/static_graph.hpp index 7f552064e..690b8d639 100644 --- a/include/util/static_graph.hpp +++ b/include/util/static_graph.hpp @@ -52,6 +52,8 @@ template <> struct SortableEdgeWithData NodeIterator source; NodeIterator target; + SortableEdgeWithData() = default; + SortableEdgeWithData(NodeIterator source, NodeIterator target) : source(source), target(target) { } @@ -73,6 +75,8 @@ template struct SortableEdgeWithData : SortableEdgeWithData EdgeDataT data; + SortableEdgeWithData() = default; + template SortableEdgeWithData(NodeIterator source, NodeIterator target, Ts &&... data) : Base{source, target}, data{std::forward(data)...} @@ -85,6 +89,7 @@ template struct SortableEdgeWithData : SortableEdgeWithData template class StaticGraph { public: + using InputEdge = static_graph_details::SortableEdgeWithData; using NodeIterator = static_graph_details::NodeIterator; using EdgeIterator = static_graph_details::EdgeIterator; using EdgeRange = range; @@ -241,7 +246,7 @@ template class StaticGraph const NodeArrayEntry &GetNode(const NodeID nid) const { return node_array[nid]; } const EdgeArrayEntry &GetEdge(const EdgeID eid) const { return edge_array[eid]; } - private: + protected: template void CopyDataIfAvailable(EdgeArrayEntry &into, const OtherEdge &from, std::true_type) { diff --git a/src/customize/customizer.cpp b/src/customize/customizer.cpp index 3e01dc8be..3723ce742 100644 --- a/src/customize/customizer.cpp +++ b/src/customize/customizer.cpp @@ -1,17 +1,22 @@ #include "customizer/customizer.hpp" #include "customizer/cell_customizer.hpp" -#include "partition/edge_based_graph_reader.hpp" -#include "partition/io.hpp" +#include "customizer/edge_based_graph.hpp" +#include "customizer/io.hpp" #include "partition/cell_storage.hpp" +#include "partition/edge_based_graph_reader.hpp" +#include "partition/io.hpp" #include "partition/io.hpp" #include "partition/multi_level_partition.hpp" + +#include "updater/updater.hpp" + #include "util/log.hpp" #include "util/timing_util.hpp" namespace osrm { -namespace customize +namespace customizer { template @@ -66,14 +71,32 @@ void CellStorageStatistics(const Graph &graph, } } -int Customizer::Run(const CustomizationConfig &config) +auto LoadAndUpdateEdgeExpandedGraph(const CustomizationConfig &config) { - TIMER_START(loading_data); - auto edge_based_graph = partition::LoadEdgeBasedGraph(config.edge_based_graph_path.string()); + updater::Updater updater(config.updater_config); + + EdgeID num_nodes; + std::vector edge_based_edge_list; + std::tie(num_nodes, edge_based_edge_list) = updater.LoadAndUpdateEdgeExpandedGraph(); + + auto directed = partition::splitBidirectionalEdges(edge_based_edge_list); + auto tidied = + partition::prepareEdgesForUsageInGraph(std::move(directed)); + auto edge_based_graph = std::make_unique(num_nodes, std::move(tidied)); + util::Log() << "Loaded edge based graph for mapping partition ids: " << edge_based_graph->GetNumberOfEdges() << " edges, " << edge_based_graph->GetNumberOfNodes() << " nodes"; + return edge_based_graph; +} + +int Customizer::Run(const CustomizationConfig &config) +{ + TIMER_START(loading_data); + + auto edge_based_graph = LoadAndUpdateEdgeExpandedGraph(config); + partition::MultiLevelPartition mlp; partition::io::read(config.mld_partition_path, mlp); @@ -93,10 +116,15 @@ int Customizer::Run(const CustomizationConfig &config) TIMER_STOP(writing_mld_data); util::Log() << "MLD customization writing took " << TIMER_SEC(writing_mld_data) << " seconds"; + TIMER_START(writing_graph); + io::write(config.mld_graph_path, *edge_based_graph); + TIMER_STOP(writing_graph); + util::Log() << "Graph writing took " << TIMER_SEC(writing_graph) << " seconds"; + CellStorageStatistics(*edge_based_graph, mlp, storage); return 0; } -} // namespace customize +} // namespace customizer$ } // namespace osrm diff --git a/src/storage/storage.cpp b/src/storage/storage.cpp index 3d631194b..bf3634962 100644 --- a/src/storage/storage.cpp +++ b/src/storage/storage.cpp @@ -1,5 +1,6 @@ #include "storage/storage.hpp" #include "contractor/query_edge.hpp" +#include "customizer/edge_based_graph.hpp" #include "extractor/compressed_edge_container.hpp" #include "extractor/edge_based_edge.hpp" #include "extractor/guidance/turn_instruction.hpp" @@ -441,23 +442,26 @@ void Storage::PopulateLayout(DataLayout &layout) layout.SetBlockSize(DataLayout::MLD_CELL_LEVEL_OFFSETS, 0); } - if (boost::filesystem::exists(config.edge_based_graph_path)) + if (boost::filesystem::exists(config.mld_graph_path)) { - io::FileReader ebg_file(config.edge_based_graph_path, - io::FileReader::VerifyFingerprint); + io::FileReader reader(config.mld_graph_path, io::FileReader::VerifyFingerprint); - const auto num_edges = ebg_file.ReadElementCount64(); - const auto num_nodes = ebg_file.ReadOne() + 1; + const auto num_nodes = + reader.ReadVectorSize(); + const auto num_edges = + reader.ReadVectorSize(); - layout.SetBlockSize(DataLayout::MLD_GRAPH_NODE_LIST, - num_nodes + 1); - layout.SetBlockSize(DataLayout::MLD_GRAPH_EDGE_LIST, - 2 * num_edges); + layout.SetBlockSize( + DataLayout::MLD_GRAPH_NODE_LIST, num_nodes); + layout.SetBlockSize( + DataLayout::MLD_GRAPH_EDGE_LIST, num_edges); } else { - layout.SetBlockSize(DataLayout::MLD_GRAPH_NODE_LIST, 0); - layout.SetBlockSize(DataLayout::MLD_GRAPH_EDGE_LIST, 0); + layout.SetBlockSize( + DataLayout::MLD_GRAPH_NODE_LIST, 0); + layout.SetBlockSize( + DataLayout::MLD_GRAPH_EDGE_LIST, 0); } } } @@ -929,39 +933,21 @@ void Storage::PopulateData(const DataLayout &layout, char *memory_ptr) reader.ReadInto(mld_cell_level_offsets_ptr, size); } - if (boost::filesystem::exists(config.edge_based_graph_path)) + if (boost::filesystem::exists(config.mld_graph_path)) { - io::FileReader reader(config.edge_based_graph_path, io::FileReader::VerifyFingerprint); + io::FileReader reader(config.mld_graph_path, io::FileReader::VerifyFingerprint); - const auto number_of_edges = reader.ReadElementCount64(); - const auto number_of_nodes = reader.ReadOne() + 1; - std::vector original_edges(number_of_edges); - reader.ReadInto(original_edges); + auto nodes_ptr = + layout.GetBlockPtr( + memory_ptr, DataLayout::MLD_GRAPH_NODE_LIST); + auto edges_ptr = + layout.GetBlockPtr( + memory_ptr, DataLayout::MLD_GRAPH_EDGE_LIST); - // FIXME: move graph pre-processing to a pre-processing tool #3783 - original_edges = partition::splitBidirectionalEdges(std::move(original_edges)); - auto edges = partition::prepareEdgesForUsageInGraph(std::move(original_edges)); - BOOST_ASSERT(edges.size() <= 2 * number_of_edges); - - auto nodes_ptr = layout.GetBlockPtr( - memory_ptr, DataLayout::MLD_GRAPH_NODE_LIST); - auto edges_ptr = layout.GetBlockPtr( - memory_ptr, DataLayout::MLD_GRAPH_EDGE_LIST); - - EdgeBasedGraph::EdgeIterator edge = 0; - for (const auto node : util::irange(0u, number_of_nodes + 1)) - { - EdgeBasedGraph::EdgeIterator last_edge = edge; - while (edge < edges.size() && edges[edge].source == node) - { - edges_ptr[edge].target = edges[edge].target; - edges_ptr[edge].data = edges[edge].data; - ++edge; - } - nodes_ptr[node].first_edge = last_edge; - } - - BOOST_ASSERT(edge == edges.size()); + auto num_nodes = reader.ReadElementCount64(); + reader.ReadInto(nodes_ptr, num_nodes); + auto num_edges = reader.ReadElementCount64(); + reader.ReadInto(edges_ptr, num_edges); } } } diff --git a/src/storage/storage_config.cpp b/src/storage/storage_config.cpp index 800a7756a..bb2e40a53 100644 --- a/src/storage/storage_config.cpp +++ b/src/storage/storage_config.cpp @@ -36,7 +36,7 @@ StorageConfig::StorageConfig(const boost::filesystem::path &base) intersection_class_path{base.string() + ".icd"}, turn_lane_data_path{base.string() + ".tld"}, turn_lane_description_path{base.string() + ".tls"}, mld_partition_path{base.string() + ".partition"}, mld_storage_path{base.string() + ".cells"}, - edge_based_graph_path{base.string() + ".ebg"} + mld_graph_path{base.string() + ".mldgr"} { } @@ -65,7 +65,7 @@ bool StorageConfig::IsValid() const CheckFileList({hsgr_data_path, core_data_path}); // MLD files - CheckFileList({mld_partition_path, mld_storage_path, edge_based_graph_path}); + CheckFileList({mld_partition_path, mld_storage_path, mld_graph_path}); return true; } diff --git a/src/tools/customize.cpp b/src/tools/customize.cpp index e06e366a4..ee3befca4 100644 --- a/src/tools/customize.cpp +++ b/src/tools/customize.cpp @@ -21,7 +21,7 @@ enum class return_code : unsigned }; return_code -parseArguments(int argc, char *argv[], customize::CustomizationConfig &customization_config) +parseArguments(int argc, char *argv[], customizer::CustomizationConfig &customization_config) { // declare a group of options that will be allowed only on command line boost::program_options::options_description generic_options("Options"); @@ -34,7 +34,24 @@ parseArguments(int argc, char *argv[], customize::CustomizationConfig &customiza ("threads,t", boost::program_options::value(&customization_config.requested_num_threads) ->default_value(tbb::task_scheduler_init::default_num_threads()), - "Number of threads to use"); + "Number of threads to use")( + "segment-speed-file", + boost::program_options::value>( + &customization_config.updater_config.segment_speed_lookup_paths) + ->composing(), + "Lookup files containing nodeA, nodeB, speed data to adjust edge weights")( + "turn-penalty-file", + boost::program_options::value>( + &customization_config.updater_config.turn_penalty_lookup_paths) + ->composing(), + "Lookup files containing from_, to_, via_nodes, and turn penalties to adjust turn " + "weights")("edge-weight-updates-over-factor", + boost::program_options::value( + &customization_config.updater_config.log_edge_updates_factor) + ->default_value(0.0), + "Use with `--segment-speed-file`. Provide an `x` factor, by which Extractor " + "will log edge " + "weights updated by more than this factor"); // hidden options, will be allowed on command line, but will not be // shown to the user @@ -99,7 +116,7 @@ parseArguments(int argc, char *argv[], customize::CustomizationConfig &customiza int main(int argc, char *argv[]) try { util::LogPolicy::GetInstance().Unmute(); - customize::CustomizationConfig customization_config; + customizer::CustomizationConfig customization_config; const auto result = parseArguments(argc, argv, customization_config); @@ -131,7 +148,7 @@ int main(int argc, char *argv[]) try tbb::task_scheduler_init init(customization_config.requested_num_threads); - auto exitcode = customize::Customizer().Run(customization_config); + auto exitcode = customizer::Customizer().Run(customization_config); util::DumpMemoryStats(); diff --git a/src/updater/updater.cpp b/src/updater/updater.cpp index bfdf9f8f9..6a411e512 100644 --- a/src/updater/updater.cpp +++ b/src/updater/updater.cpp @@ -162,6 +162,14 @@ void CheckWeightsConsistency( } #endif +Updater::NumNodesAndEdges Updater::LoadAndUpdateEdgeExpandedGraph() const +{ + std::vector edge_based_edge_list; + std::vector node_weights; + auto max_edge_id = Updater::LoadAndUpdateEdgeExpandedGraph(edge_based_edge_list, node_weights); + return std::make_tuple(max_edge_id + 1, std::move(edge_based_edge_list)); +} + EdgeID Updater::LoadAndUpdateEdgeExpandedGraph(std::vector &edge_based_edge_list, std::vector &node_weights) const @@ -525,7 +533,8 @@ Updater::LoadAndUpdateEdgeExpandedGraph(std::vector &e // Update the node-weight cache. This is the weight of the edge-based-node only, // it doesn't include the turn. We may visit the same node multiple times, but // we should always assign the same value here. - node_weights[inbuffer.source] = new_weight; + if (node_weights.size() > 0) + node_weights[inbuffer.source] = new_weight; // We found a zero-speed edge, so we'll skip this whole edge-based-edge which // effectively removes it from the routing network. diff --git a/test/data/Makefile b/test/data/Makefile index dd35dfead..da3c5f3ca 100755 --- a/test/data/Makefile +++ b/test/data/Makefile @@ -7,6 +7,7 @@ SCRIPT_ROOT:=../../scripts OSRM_EXTRACT:=$(OSRM_BUILD_DIR)/osrm-extract OSRM_CONTRACT:=$(OSRM_BUILD_DIR)/osrm-contract OSRM_PARTITION:=$(OSRM_BUILD_DIR)/osrm-partition +OSRM_CUSTOMIZE:=$(OSRM_BUILD_DIR)/osrm-customize OSRM_ROUTED:=$(OSRM_BUILD_DIR)/osrm-routed POLY2REQ:=$(SCRIPT_ROOT)/poly2req.js MD5SUM:=$(SCRIPT_ROOT)/md5sum.js @@ -48,6 +49,7 @@ $(DATA_NAME)_MLD.osrm.partition: $(DATA_NAME)_MLD.osrm $(PROFILE) $(OSRM_PARTITI @echo "Running osrm-partition..." $(TIMER) "osrm-contract" $(OSRM_CONTRACT) $< $(TIMER) "osrm-partition" $(OSRM_PARTITION) $< + $(TIMER) "osrm-customize" $(OSRM_CUSTOMIZE) $< $(DATA_NAME).requests: $(DATA_NAME).poly $(POLY2REQ) $(DATA_NAME).poly > $(DATA_NAME).requests diff --git a/unit_tests/library/options.cpp b/unit_tests/library/options.cpp index e03ae8a64..50eb9f534 100644 --- a/unit_tests/library/options.cpp +++ b/unit_tests/library/options.cpp @@ -34,7 +34,7 @@ BOOST_AUTO_TEST_CASE(test_mld) using namespace osrm; EngineConfig config; config.use_shared_memory = false; - config.storage_config = storage::StorageConfig(OSRM_TEST_DATA_DIR "/monaco_CoreCH.osrm"); + config.storage_config = storage::StorageConfig(OSRM_TEST_DATA_DIR "/monaco_MLD.osrm"); config.algorithm = EngineConfig::Algorithm::MLD; OSRM osrm{config}; } diff --git a/unit_tests/util/cell_customization.cpp b/unit_tests/util/cell_customization.cpp index 24b52ffb4..ea4f0eb6f 100644 --- a/unit_tests/util/cell_customization.cpp +++ b/unit_tests/util/cell_customization.cpp @@ -6,7 +6,7 @@ #include "util/static_graph.hpp" using namespace osrm; -using namespace osrm::customize; +using namespace osrm::customizer; using namespace osrm::partition; using namespace osrm::util;