diff --git a/include/engine/routing_algorithms/many_to_many.hpp b/include/engine/routing_algorithms/many_to_many.hpp index cd5fe9c1c..281844abd 100644 --- a/include/engine/routing_algorithms/many_to_many.hpp +++ b/include/engine/routing_algorithms/many_to_many.hpp @@ -21,8 +21,8 @@ struct NodeBucket { NodeID middle_node; NodeID parent_node; - bool from_clique_arc; - unsigned column_index; // a column in the weight/duration matrix + unsigned column_index : 31; // a column in the weight/duration matrix + unsigned from_clique_arc : 1; EdgeWeight weight; EdgeDuration duration; @@ -32,8 +32,18 @@ struct NodeBucket unsigned column_index, EdgeWeight weight, EdgeDuration duration) - : middle_node(middle_node), parent_node(parent_node), from_clique_arc(from_clique_arc), - column_index(column_index), weight(weight), duration(duration) + : middle_node(middle_node), parent_node(parent_node), column_index(column_index), + from_clique_arc(from_clique_arc), weight(weight), duration(duration) + { + } + + NodeBucket(NodeID middle_node, + NodeID parent_node, + unsigned column_index, + EdgeWeight weight, + EdgeDuration duration) + : middle_node(middle_node), parent_node(parent_node), column_index(column_index), + from_clique_arc(false), weight(weight), duration(duration) { } @@ -75,7 +85,7 @@ struct NodeBucket } }; }; -} +} // namespace template std::pair, std::vector> diff --git a/include/engine/routing_algorithms/routing_base_mld.hpp b/include/engine/routing_algorithms/routing_base_mld.hpp index 0070be1b4..ce9b23d70 100644 --- a/include/engine/routing_algorithms/routing_base_mld.hpp +++ b/include/engine/routing_algorithms/routing_base_mld.hpp @@ -446,21 +446,6 @@ UnpackedPath search(SearchEngineData &engine_working_data, // Get packed path as edges {from node ID, to node ID, from_clique_arc} auto packed_path = retrievePackedPathFromHeap(forward_heap, reverse_heap, middle); - // if (!packed_path.empty()) - // { - // std::cout << "packed_path: "; - // for (auto edge : packed_path) - // { - // std::cout << std::get<0>(edge) << ","; - // } - // std::cout << std::get<1>(packed_path.back()); - // std::cout << std::endl; - // } - // else - // { - // std::cout << "no packed_path!" << std::endl; - // } - // Beware the edge case when start, middle, end are all the same. // In this case we return a single node, no edges. We also don't unpack. const NodeID source_node = !packed_path.empty() ? std::get<0>(packed_path.front()) : middle; @@ -520,12 +505,7 @@ UnpackedPath search(SearchEngineData &engine_working_data, unpacked_edges.insert(unpacked_edges.end(), subpath_edges.begin(), subpath_edges.end()); } } - // std::cout << "unpacked_nodes: "; - // for (auto node : unpacked_nodes) - // { - // std::cout << node << ", "; - // } - // std::cout << std::endl; + return std::make_tuple(weight, std::move(unpacked_nodes), std::move(unpacked_edges)); } diff --git a/profiles/testbot.lua b/profiles/testbot.lua index ed2e9ade6..691e57617 100644 --- a/profiles/testbot.lua +++ b/profiles/testbot.lua @@ -135,8 +135,6 @@ function process_turn (profile, turn) if turn.has_traffic_light then turn.duration = turn.duration + profile.properties.traffic_light_penalty end - - io.write("after penalty turn.duration: ", turn.duration, "turn.weight: ", turn.weight, "\n") end return { diff --git a/src/engine/routing_algorithms/direct_shortest_path.cpp b/src/engine/routing_algorithms/direct_shortest_path.cpp index 4c6435ade..08ca3249e 100644 --- a/src/engine/routing_algorithms/direct_shortest_path.cpp +++ b/src/engine/routing_algorithms/direct_shortest_path.cpp @@ -74,15 +74,6 @@ InternalRouteResult directShortestPathSearch(SearchEngineData &e auto &reverse_heap = *engine_working_data.reverse_heap_1; insertNodesInHeaps(forward_heap, reverse_heap, phantom_nodes); - std::cout << "source_phantom.forward_segment_id.id: " - << phantom_nodes.source_phantom.forward_segment_id.id - << " source_phantom.reverse_segment_id.id: " - << phantom_nodes.source_phantom.reverse_segment_id.id << std::endl; - std::cout << "target_phantom.forward_segment_id.id: " - << phantom_nodes.target_phantom.forward_segment_id.id - << " target_phantom.reverse_segment_id.id: " - << phantom_nodes.target_phantom.reverse_segment_id.id << std::endl; - // TODO: when structured bindings will be allowed change to // auto [weight, source_node, target_node, unpacked_edges] = ... EdgeWeight weight = INVALID_EDGE_WEIGHT; diff --git a/src/engine/routing_algorithms/many_to_many_ch.cpp b/src/engine/routing_algorithms/many_to_many_ch.cpp index 8c59c9173..8ee02b5ec 100644 --- a/src/engine/routing_algorithms/many_to_many_ch.cpp +++ b/src/engine/routing_algorithms/many_to_many_ch.cpp @@ -148,11 +148,10 @@ void backwardRoutingStep(const DataFacade &facade, const auto target_weight = query_heap.GetKey(node); const auto target_duration = query_heap.GetData(node).duration; const auto parent = query_heap.GetData(node).parent; - const bool INVALID_CLIQUE_ARC_TYPE = false; // Store settled nodes in search space bucket search_space_with_buckets.emplace_back( - node, parent, INVALID_CLIQUE_ARC_TYPE, column_index, target_weight, target_duration); + node, parent, column_index, target_weight, target_duration); relaxOutgoingEdges( facade, node, target_weight, target_duration, query_heap, phantom_node); diff --git a/src/engine/routing_algorithms/many_to_many_mld.cpp b/src/engine/routing_algorithms/many_to_many_mld.cpp index 0461e116f..901d02b56 100644 --- a/src/engine/routing_algorithms/many_to_many_mld.cpp +++ b/src/engine/routing_algorithms/many_to_many_mld.cpp @@ -275,18 +275,19 @@ oneToManySearch(SearchEngineData &engine_working_data, for (auto edge : facade.GetAdjacentEdgeRange(node)) { const auto &data = facade.GetEdgeData(edge); + const auto to = facade.GetTarget(edge); if ((DIRECTION == FORWARD_DIRECTION ? facade.IsForwardEdge(edge) : facade.IsBackwardEdge(edge)) && - !query_heap.WasInserted(facade.GetTarget(edge))) + !query_heap.WasInserted(to)) { const auto turn_id = data.turn_id; - const auto node_id = DIRECTION == FORWARD_DIRECTION ? node : facade.GetTarget(edge); + const auto node_id = DIRECTION == FORWARD_DIRECTION ? node : to; const auto edge_weight = initial_weight + facade.GetNodeWeight(node_id) + facade.GetWeightPenaltyForEdgeID(turn_id); const auto edge_duration = initial_duration + facade.GetNodeDuration(node_id) + facade.GetDurationPenaltyForEdgeID(turn_id); - query_heap.Insert(facade.GetTarget(edge), edge_weight, {node, edge_duration}); + query_heap.Insert(to, edge_weight, {node, edge_duration}); } } };