Avoid nodes that are disabled by an avoid flag

This commit is contained in:
Patrick Niklaus 2017-07-28 11:00:51 +00:00 committed by Patrick Niklaus
parent 84fd38ac9c
commit a3c94ef632
2 changed files with 38 additions and 0 deletions

View File

@ -148,6 +148,8 @@ void routingStep(const DataFacade<Algorithm> &facade,
const auto node = forward_heap.DeleteMin(); const auto node = forward_heap.DeleteMin();
const auto weight = forward_heap.GetKey(node); const auto weight = forward_heap.GetKey(node);
BOOST_ASSERT(!facade.AvoidNode(node));
// Upper bound for the path source -> target with // Upper bound for the path source -> target with
// weight(source -> node) = weight weight(to -> target) ≤ reverse_weight // weight(source -> node) = weight weight(to -> target) ≤ reverse_weight
// is weight + reverse_weight // is weight + reverse_weight
@ -181,6 +183,12 @@ void routingStep(const DataFacade<Algorithm> &facade,
{ {
BOOST_ASSERT(destination != cell.GetDestinationNodes().end()); BOOST_ASSERT(destination != cell.GetDestinationNodes().end());
const NodeID to = *destination; const NodeID to = *destination;
if (facade.AvoidNode(to))
{
continue;
}
if (shortcut_weight != INVALID_EDGE_WEIGHT && node != to) if (shortcut_weight != INVALID_EDGE_WEIGHT && node != to)
{ {
const EdgeWeight to_weight = weight + shortcut_weight; const EdgeWeight to_weight = weight + shortcut_weight;
@ -207,6 +215,12 @@ void routingStep(const DataFacade<Algorithm> &facade,
{ {
BOOST_ASSERT(source != cell.GetSourceNodes().end()); BOOST_ASSERT(source != cell.GetSourceNodes().end());
const NodeID to = *source; const NodeID to = *source;
if (facade.AvoidNode(to))
{
continue;
}
if (shortcut_weight != INVALID_EDGE_WEIGHT && node != to) if (shortcut_weight != INVALID_EDGE_WEIGHT && node != to)
{ {
const EdgeWeight to_weight = weight + shortcut_weight; const EdgeWeight to_weight = weight + shortcut_weight;
@ -233,6 +247,10 @@ void routingStep(const DataFacade<Algorithm> &facade,
if (DIRECTION == FORWARD_DIRECTION ? edge_data.forward : edge_data.backward) if (DIRECTION == FORWARD_DIRECTION ? edge_data.forward : edge_data.backward)
{ {
const NodeID to = facade.GetTarget(edge); const NodeID to = facade.GetTarget(edge);
if (facade.AvoidNode(to))
{
continue;
}
if (checkParentCellRestriction(partition.GetCell(level + 1, to), args...)) if (checkParentCellRestriction(partition.GetCell(level + 1, to), args...))
{ {

View File

@ -73,6 +73,7 @@ void relaxOutgoingEdges(const DataFacade<ch::Algorithm> &facade,
if (DIRECTION == FORWARD_DIRECTION ? data.forward : data.backward) if (DIRECTION == FORWARD_DIRECTION ? data.forward : data.backward)
{ {
const NodeID to = facade.GetTarget(edge); const NodeID to = facade.GetTarget(edge);
const EdgeWeight edge_weight = data.weight; const EdgeWeight edge_weight = data.weight;
const EdgeWeight edge_duration = data.duration; const EdgeWeight edge_duration = data.duration;
@ -110,6 +111,8 @@ void relaxOutgoingEdges(const DataFacade<mld::Algorithm> &facade,
typename SearchEngineData<mld::Algorithm>::ManyToManyQueryHeap &query_heap, typename SearchEngineData<mld::Algorithm>::ManyToManyQueryHeap &query_heap,
const PhantomNode &phantom_node) const PhantomNode &phantom_node)
{ {
BOOST_ASSERT(!facade.AvoidNode(node));
const auto &partition = facade.GetMultiLevelPartition(); const auto &partition = facade.GetMultiLevelPartition();
const auto &cells = facade.GetCellStorage(); const auto &cells = facade.GetCellStorage();
const auto &metric = facade.GetCellMetric(); const auto &metric = facade.GetCellMetric();
@ -136,6 +139,12 @@ void relaxOutgoingEdges(const DataFacade<mld::Algorithm> &facade,
BOOST_ASSERT(destination != cell.GetDestinationNodes().end()); BOOST_ASSERT(destination != cell.GetDestinationNodes().end());
BOOST_ASSERT(!shortcut_durations.empty()); BOOST_ASSERT(!shortcut_durations.empty());
const NodeID to = *destination; const NodeID to = *destination;
if (facade.AvoidNode(to))
{
continue;
}
if (shortcut_weight != INVALID_EDGE_WEIGHT && node != to) if (shortcut_weight != INVALID_EDGE_WEIGHT && node != to)
{ {
const auto to_weight = weight + shortcut_weight; const auto to_weight = weight + shortcut_weight;
@ -164,6 +173,12 @@ void relaxOutgoingEdges(const DataFacade<mld::Algorithm> &facade,
BOOST_ASSERT(source != cell.GetSourceNodes().end()); BOOST_ASSERT(source != cell.GetSourceNodes().end());
BOOST_ASSERT(!shortcut_durations.empty()); BOOST_ASSERT(!shortcut_durations.empty());
const NodeID to = *source; const NodeID to = *source;
if (facade.AvoidNode(to))
{
continue;
}
if (shortcut_weight != INVALID_EDGE_WEIGHT && node != to) if (shortcut_weight != INVALID_EDGE_WEIGHT && node != to)
{ {
const auto to_weight = weight + shortcut_weight; const auto to_weight = weight + shortcut_weight;
@ -191,6 +206,11 @@ void relaxOutgoingEdges(const DataFacade<mld::Algorithm> &facade,
if (DIRECTION == FORWARD_DIRECTION ? data.forward : data.backward) if (DIRECTION == FORWARD_DIRECTION ? data.forward : data.backward)
{ {
const NodeID to = facade.GetTarget(edge); const NodeID to = facade.GetTarget(edge);
if (facade.AvoidNode(to))
{
continue;
}
const EdgeWeight edge_weight = data.weight; const EdgeWeight edge_weight = data.weight;
const EdgeWeight edge_duration = data.duration; const EdgeWeight edge_duration = data.duration;