Skip to content

Commit c459530

Browse files
TheMarexPatrick Niklaus
authored andcommitted
Address PR comments
1 parent 2a15e6d commit c459530

File tree

6 files changed

+21
-42
lines changed

6 files changed

+21
-42
lines changed

include/engine/routing_algorithms/many_to_many.hpp

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ struct NodeBucket
2121
{
2222
NodeID middle_node;
2323
NodeID parent_node;
24-
bool from_clique_arc;
25-
unsigned column_index; // a column in the weight/duration matrix
24+
unsigned column_index : 31; // a column in the weight/duration matrix
25+
unsigned from_clique_arc : 1;
2626
EdgeWeight weight;
2727
EdgeDuration duration;
2828

@@ -32,8 +32,18 @@ struct NodeBucket
3232
unsigned column_index,
3333
EdgeWeight weight,
3434
EdgeDuration duration)
35-
: middle_node(middle_node), parent_node(parent_node), from_clique_arc(from_clique_arc),
36-
column_index(column_index), weight(weight), duration(duration)
35+
: middle_node(middle_node), parent_node(parent_node), column_index(column_index),
36+
from_clique_arc(from_clique_arc), weight(weight), duration(duration)
37+
{
38+
}
39+
40+
NodeBucket(NodeID middle_node,
41+
NodeID parent_node,
42+
unsigned column_index,
43+
EdgeWeight weight,
44+
EdgeDuration duration)
45+
: middle_node(middle_node), parent_node(parent_node), column_index(column_index),
46+
from_clique_arc(false), weight(weight), duration(duration)
3747
{
3848
}
3949

@@ -75,7 +85,7 @@ struct NodeBucket
7585
}
7686
};
7787
};
78-
}
88+
} // namespace
7989

8090
template <typename Algorithm>
8191
std::pair<std::vector<EdgeDuration>, std::vector<EdgeDistance>>

include/engine/routing_algorithms/routing_base_mld.hpp

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -446,21 +446,6 @@ UnpackedPath search(SearchEngineData<Algorithm> &engine_working_data,
446446
// Get packed path as edges {from node ID, to node ID, from_clique_arc}
447447
auto packed_path = retrievePackedPathFromHeap(forward_heap, reverse_heap, middle);
448448

449-
// if (!packed_path.empty())
450-
// {
451-
// std::cout << "packed_path: ";
452-
// for (auto edge : packed_path)
453-
// {
454-
// std::cout << std::get<0>(edge) << ",";
455-
// }
456-
// std::cout << std::get<1>(packed_path.back());
457-
// std::cout << std::endl;
458-
// }
459-
// else
460-
// {
461-
// std::cout << "no packed_path!" << std::endl;
462-
// }
463-
464449
// Beware the edge case when start, middle, end are all the same.
465450
// In this case we return a single node, no edges. We also don't unpack.
466451
const NodeID source_node = !packed_path.empty() ? std::get<0>(packed_path.front()) : middle;
@@ -520,12 +505,7 @@ UnpackedPath search(SearchEngineData<Algorithm> &engine_working_data,
520505
unpacked_edges.insert(unpacked_edges.end(), subpath_edges.begin(), subpath_edges.end());
521506
}
522507
}
523-
// std::cout << "unpacked_nodes: ";
524-
// for (auto node : unpacked_nodes)
525-
// {
526-
// std::cout << node << ", ";
527-
// }
528-
// std::cout << std::endl;
508+
529509
return std::make_tuple(weight, std::move(unpacked_nodes), std::move(unpacked_edges));
530510
}
531511

profiles/testbot.lua

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,6 @@ function process_turn (profile, turn)
135135
if turn.has_traffic_light then
136136
turn.duration = turn.duration + profile.properties.traffic_light_penalty
137137
end
138-
139-
io.write("after penalty turn.duration: ", turn.duration, "turn.weight: ", turn.weight, "\n")
140138
end
141139

142140
return {

src/engine/routing_algorithms/direct_shortest_path.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -74,15 +74,6 @@ InternalRouteResult directShortestPathSearch(SearchEngineData<mld::Algorithm> &e
7474
auto &reverse_heap = *engine_working_data.reverse_heap_1;
7575
insertNodesInHeaps(forward_heap, reverse_heap, phantom_nodes);
7676

77-
std::cout << "source_phantom.forward_segment_id.id: "
78-
<< phantom_nodes.source_phantom.forward_segment_id.id
79-
<< " source_phantom.reverse_segment_id.id: "
80-
<< phantom_nodes.source_phantom.reverse_segment_id.id << std::endl;
81-
std::cout << "target_phantom.forward_segment_id.id: "
82-
<< phantom_nodes.target_phantom.forward_segment_id.id
83-
<< " target_phantom.reverse_segment_id.id: "
84-
<< phantom_nodes.target_phantom.reverse_segment_id.id << std::endl;
85-
8677
// TODO: when structured bindings will be allowed change to
8778
// auto [weight, source_node, target_node, unpacked_edges] = ...
8879
EdgeWeight weight = INVALID_EDGE_WEIGHT;

src/engine/routing_algorithms/many_to_many_ch.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,11 +148,10 @@ void backwardRoutingStep(const DataFacade<Algorithm> &facade,
148148
const auto target_weight = query_heap.GetKey(node);
149149
const auto target_duration = query_heap.GetData(node).duration;
150150
const auto parent = query_heap.GetData(node).parent;
151-
const bool INVALID_CLIQUE_ARC_TYPE = false;
152151

153152
// Store settled nodes in search space bucket
154153
search_space_with_buckets.emplace_back(
155-
node, parent, INVALID_CLIQUE_ARC_TYPE, column_index, target_weight, target_duration);
154+
node, parent, column_index, target_weight, target_duration);
156155

157156
relaxOutgoingEdges<REVERSE_DIRECTION>(
158157
facade, node, target_weight, target_duration, query_heap, phantom_node);

src/engine/routing_algorithms/many_to_many_mld.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -275,18 +275,19 @@ oneToManySearch(SearchEngineData<Algorithm> &engine_working_data,
275275
for (auto edge : facade.GetAdjacentEdgeRange(node))
276276
{
277277
const auto &data = facade.GetEdgeData(edge);
278+
const auto to = facade.GetTarget(edge);
278279
if ((DIRECTION == FORWARD_DIRECTION ? facade.IsForwardEdge(edge)
279280
: facade.IsBackwardEdge(edge)) &&
280-
!query_heap.WasInserted(facade.GetTarget(edge)))
281+
!query_heap.WasInserted(to))
281282
{
282283
const auto turn_id = data.turn_id;
283-
const auto node_id = DIRECTION == FORWARD_DIRECTION ? node : facade.GetTarget(edge);
284+
const auto node_id = DIRECTION == FORWARD_DIRECTION ? node : to;
284285
const auto edge_weight = initial_weight + facade.GetNodeWeight(node_id) +
285286
facade.GetWeightPenaltyForEdgeID(turn_id);
286287
const auto edge_duration = initial_duration + facade.GetNodeDuration(node_id) +
287288
facade.GetDurationPenaltyForEdgeID(turn_id);
288289

289-
query_heap.Insert(facade.GetTarget(edge), edge_weight, {node, edge_duration});
290+
query_heap.Insert(to, edge_weight, {node, edge_duration});
290291
}
291292
}
292293
};

0 commit comments

Comments
 (0)