Skip to content

Commit 8697a6b

Browse files
committed
Changes and corrections before change request
Cucumber successfull
1 parent 9a32722 commit 8697a6b

File tree

3 files changed

+17
-27
lines changed

3 files changed

+17
-27
lines changed

include/engine/routing_algorithms/routing_base_mld.hpp

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,6 @@ template <bool DIRECTION, typename Algorithm, typename... Args>
230230
void relaxOutgoingEdges(const DataFacade<Algorithm> &facade,
231231
typename SearchEngineData<Algorithm>::QueryHeap &forward_heap,
232232
const typename SearchEngineData<Algorithm>::QueryHeap::HeapNode& heapNode,
233-
const EdgeWeight weight,
234233
Args... args)
235234
{
236235
const auto &partition = facade.GetMultiLevelPartition();
@@ -253,8 +252,8 @@ void relaxOutgoingEdges(const DataFacade<Algorithm> &facade,
253252

254253
if (shortcut_weight != INVALID_EDGE_WEIGHT && heapNode.node != to)
255254
{
256-
const EdgeWeight to_weight = weight + shortcut_weight;
257-
BOOST_ASSERT(to_weight >= weight);
255+
const EdgeWeight to_weight = heapNode.weight + shortcut_weight;
256+
BOOST_ASSERT(to_weight >= heapNode.weight);
258257
auto toHeapNode = forward_heap.GetHeapNodeIfWasInserted(to);
259258
if (!toHeapNode)
260259
{
@@ -282,8 +281,8 @@ void relaxOutgoingEdges(const DataFacade<Algorithm> &facade,
282281

283282
if (shortcut_weight != INVALID_EDGE_WEIGHT && heapNode.node != to)
284283
{
285-
const EdgeWeight to_weight = weight + shortcut_weight;
286-
BOOST_ASSERT(to_weight >= weight);
284+
const EdgeWeight to_weight = heapNode.weight + shortcut_weight;
285+
BOOST_ASSERT(to_weight >= heapNode.weight);
287286
auto toHeapNode = forward_heap.GetHeapNodeIfWasInserted(to);
288287
if (!toHeapNode)
289288
{
@@ -320,7 +319,7 @@ void relaxOutgoingEdges(const DataFacade<Algorithm> &facade,
320319

321320
// TODO: BOOST_ASSERT(edge_data.weight == node_weight + turn_penalty);
322321

323-
const EdgeWeight to_weight = weight + node_weight + turn_penalty;
322+
const EdgeWeight to_weight = heapNode.weight + node_weight + turn_penalty;
324323

325324
auto toHeapNode = forward_heap.GetHeapNodeIfWasInserted(to);
326325
if (!toHeapNode)
@@ -376,7 +375,7 @@ void routingStep(const DataFacade<Algorithm> &facade,
376375
}
377376

378377
// Relax outgoing edges from node
379-
relaxOutgoingEdges<DIRECTION>(facade, forward_heap, heapNode, weight, args...);
378+
relaxOutgoingEdges<DIRECTION>(facade, forward_heap, heapNode, args...);
380379
}
381380

382381
// With (s, middle, t) we trace back the paths middle -> s and middle -> t.

include/util/query_heap.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -297,17 +297,17 @@ class QueryHeap
297297
boost::optional<HeapNode&> GetHeapNodeIfWasInserted(const NodeID node)
298298
{
299299
const auto index = node_index.peek_index(node);
300-
if (index >= static_cast<decltype(index)>(inserted_nodes.size()))
300+
if (index >= static_cast<decltype(index)>(inserted_nodes.size()) || inserted_nodes[index].node!=node)
301301
{
302302
return {};
303303
}
304304
return inserted_nodes[index];
305305
}
306306

307-
const boost::optional<const HeapNode&> GetHeapNodeIfWasInserted(const NodeID node) const
307+
boost::optional<const HeapNode&> GetHeapNodeIfWasInserted(const NodeID node) const
308308
{
309309
const auto index = node_index.peek_index(node);
310-
if (index >= static_cast<decltype(index)>(inserted_nodes.size()))
310+
if (index >= static_cast<decltype(index)>(inserted_nodes.size()) || inserted_nodes[index].node!=node)
311311
{
312312
return {};
313313
}

src/engine/routing_algorithms/many_to_many_mld.cpp

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,6 @@ void relaxBorderEdges(const DataFacade<mld::Algorithm> &facade,
9494
template <bool DIRECTION, typename... Args>
9595
void relaxOutgoingEdges(const DataFacade<mld::Algorithm> &facade,
9696
const SearchEngineData<mld::Algorithm>::ManyToManyQueryHeap::HeapNode& heapNode,
97-
const EdgeWeight weight,
98-
const EdgeDuration duration,
99-
const EdgeDistance distance,
10097
typename SearchEngineData<mld::Algorithm>::ManyToManyQueryHeap &query_heap,
10198
Args... args)
10299
{
@@ -131,9 +128,9 @@ void relaxOutgoingEdges(const DataFacade<mld::Algorithm> &facade,
131128

132129
if (shortcut_weight != INVALID_EDGE_WEIGHT && node != to)
133130
{
134-
const auto to_weight = weight + shortcut_weight;
135-
const auto to_duration = duration + shortcut_durations.front();
136-
const auto to_distance = distance + shortcut_distances.front();
131+
const auto to_weight = heapNode.weight + shortcut_weight;
132+
const auto to_duration = heapNode.data.duration + shortcut_durations.front();
133+
const auto to_distance = heapNode.data.distance + shortcut_distances.front();
137134
const auto& toHeapNode= query_heap.GetHeapNodeIfWasInserted(to);
138135
if (!toHeapNode)
139136
{
@@ -171,9 +168,9 @@ void relaxOutgoingEdges(const DataFacade<mld::Algorithm> &facade,
171168

172169
if (shortcut_weight != INVALID_EDGE_WEIGHT && node != to)
173170
{
174-
const auto to_weight = weight + shortcut_weight;
175-
const auto to_duration = duration + shortcut_durations.front();
176-
const auto to_distance = distance + shortcut_distances.front();
171+
const auto to_weight = heapNode.weight + shortcut_weight;
172+
const auto to_duration = heapNode.data.duration + shortcut_durations.front();
173+
const auto to_distance = heapNode.data.distance + shortcut_distances.front();
177174
const auto& toHeapNode= query_heap.GetHeapNodeIfWasInserted(to);
178175
if (!toHeapNode)
179176
{
@@ -199,7 +196,7 @@ void relaxOutgoingEdges(const DataFacade<mld::Algorithm> &facade,
199196
}
200197
}
201198

202-
relaxBorderEdges<DIRECTION>(facade, node, weight, duration, distance, query_heap, level);
199+
relaxBorderEdges<DIRECTION>(facade, node, heapNode.weight, heapNode.data.duration, heapNode.data.distance, query_heap, level);
203200
}
204201

205202
//
@@ -386,9 +383,6 @@ oneToManySearch(SearchEngineData<Algorithm> &engine_working_data,
386383
// Relax outgoing edges
387384
relaxOutgoingEdges<DIRECTION>(facade,
388385
heapNode,
389-
weight,
390-
duration,
391-
distance,
392386
query_heap,
393387
phantom_nodes,
394388
phantom_index,
@@ -461,7 +455,7 @@ void forwardRoutingStep(const DataFacade<Algorithm> &facade,
461455
}
462456

463457
relaxOutgoingEdges<DIRECTION>(
464-
facade, heapNode, source_weight, source_duration, source_distance, query_heap, phantom_node);
458+
facade, heapNode, query_heap, phantom_node);
465459
}
466460

467461
template <bool DIRECTION>
@@ -487,9 +481,6 @@ void backwardRoutingStep(const DataFacade<Algorithm> &facade,
487481

488482
relaxOutgoingEdges<!DIRECTION>(facade,
489483
heapNode,
490-
target_weight,
491-
target_duration,
492-
target_distance,
493484
query_heap,
494485
phantom_node,
495486
maximal_level);

0 commit comments

Comments
 (0)