Avoid -> Exclude
This commit is contained in:
committed by
Patrick Niklaus
parent
45140ca9f7
commit
d09f5c0e3a
@@ -93,12 +93,12 @@ auto LoadAndUpdateEdgeExpandedGraph(const CustomizationConfig &config,
|
||||
}
|
||||
|
||||
std::vector<std::vector<bool>>
|
||||
avoidFlagsToNodeFilter(const MultiLevelEdgeBasedGraph &graph,
|
||||
const extractor::EdgeBasedNodeDataContainer &node_data,
|
||||
const extractor::ProfileProperties &properties)
|
||||
excludeFlagsToNodeFilter(const MultiLevelEdgeBasedGraph &graph,
|
||||
const extractor::EdgeBasedNodeDataContainer &node_data,
|
||||
const extractor::ProfileProperties &properties)
|
||||
{
|
||||
std::vector<std::vector<bool>> filters;
|
||||
for (auto mask : properties.avoidable_classes)
|
||||
for (auto mask : properties.excludable_classes)
|
||||
{
|
||||
if (mask != extractor::INAVLID_CLASS_DATA)
|
||||
{
|
||||
@@ -155,7 +155,7 @@ int Customizer::Run(const CustomizationConfig &config)
|
||||
util::Log() << "Loading partition data took " << TIMER_SEC(loading_data) << " seconds";
|
||||
|
||||
TIMER_START(cell_customize);
|
||||
auto filter = avoidFlagsToNodeFilter(graph, node_data, properties);
|
||||
auto filter = excludeFlagsToNodeFilter(graph, node_data, properties);
|
||||
auto metrics = filterToMetrics(graph, storage, mlp, filter);
|
||||
TIMER_STOP(cell_customize);
|
||||
util::Log() << "Cells customization took " << TIMER_SEC(cell_customize) << " seconds";
|
||||
|
||||
@@ -518,8 +518,8 @@ void unpackPackedPaths(InputIt first,
|
||||
forward_heap.Insert(source, 0, {source});
|
||||
reverse_heap.Insert(target, 0, {target});
|
||||
|
||||
BOOST_ASSERT(!facade.AvoidNode(source));
|
||||
BOOST_ASSERT(!facade.AvoidNode(target));
|
||||
BOOST_ASSERT(!facade.ExcludeNode(source));
|
||||
BOOST_ASSERT(!facade.ExcludeNode(target));
|
||||
|
||||
// TODO: when structured bindings will be allowed change to
|
||||
// auto [subpath_weight, subpath_source, subpath_target, subpath] = ...
|
||||
|
||||
@@ -111,7 +111,7 @@ void relaxOutgoingEdges(const DataFacade<mld::Algorithm> &facade,
|
||||
typename SearchEngineData<mld::Algorithm>::ManyToManyQueryHeap &query_heap,
|
||||
const PhantomNode &phantom_node)
|
||||
{
|
||||
BOOST_ASSERT(!facade.AvoidNode(node));
|
||||
BOOST_ASSERT(!facade.ExcludeNode(node));
|
||||
|
||||
const auto &partition = facade.GetMultiLevelPartition();
|
||||
const auto &cells = facade.GetCellStorage();
|
||||
@@ -140,7 +140,7 @@ void relaxOutgoingEdges(const DataFacade<mld::Algorithm> &facade,
|
||||
BOOST_ASSERT(!shortcut_durations.empty());
|
||||
const NodeID to = *destination;
|
||||
|
||||
if (facade.AvoidNode(to))
|
||||
if (facade.ExcludeNode(to))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -174,7 +174,7 @@ void relaxOutgoingEdges(const DataFacade<mld::Algorithm> &facade,
|
||||
BOOST_ASSERT(!shortcut_durations.empty());
|
||||
const NodeID to = *source;
|
||||
|
||||
if (facade.AvoidNode(to))
|
||||
if (facade.ExcludeNode(to))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -206,7 +206,7 @@ void relaxOutgoingEdges(const DataFacade<mld::Algorithm> &facade,
|
||||
if (DIRECTION == FORWARD_DIRECTION ? data.forward : data.backward)
|
||||
{
|
||||
const NodeID to = facade.GetTarget(edge);
|
||||
if (facade.AvoidNode(to))
|
||||
if (facade.ExcludeNode(to))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
+13
-13
@@ -114,21 +114,21 @@ void SetClassNames(const std::vector<std::string> &class_names,
|
||||
}
|
||||
|
||||
// Converts the class name list to a mask list
|
||||
void SetAvoidableClasses(const ExtractorCallbacks::ClassesMap &classes_map,
|
||||
const std::vector<std::vector<std::string>> &avoidable_classes,
|
||||
ProfileProperties &profile_properties)
|
||||
void SetExcludableClasses(const ExtractorCallbacks::ClassesMap &classes_map,
|
||||
const std::vector<std::vector<std::string>> &excludable_classes,
|
||||
ProfileProperties &profile_properties)
|
||||
{
|
||||
if (avoidable_classes.size() > MAX_AVOIDABLE_CLASSES)
|
||||
if (excludable_classes.size() > MAX_EXCLUDABLE_CLASSES)
|
||||
{
|
||||
throw util::exception("Only " + std::to_string(MAX_AVOIDABLE_CLASSES) +
|
||||
" avoidable combinations allowed.");
|
||||
throw util::exception("Only " + std::to_string(MAX_EXCLUDABLE_CLASSES) +
|
||||
" excludable combinations allowed.");
|
||||
}
|
||||
|
||||
// The avoid index 0 is reserve for not avoiding anything
|
||||
profile_properties.SetAvoidableClasses(0, 0);
|
||||
// The exclude index 0 is reserve for not excludeing anything
|
||||
profile_properties.SetExcludableClasses(0, 0);
|
||||
|
||||
std::size_t combination_index = 1;
|
||||
for (const auto &combination : avoidable_classes)
|
||||
for (const auto &combination : excludable_classes)
|
||||
{
|
||||
ClassData mask = 0;
|
||||
for (const auto &name : combination)
|
||||
@@ -137,7 +137,7 @@ void SetAvoidableClasses(const ExtractorCallbacks::ClassesMap &classes_map,
|
||||
if (iter == classes_map.end())
|
||||
{
|
||||
util::Log(logWARNING)
|
||||
<< "Unknown class name " + name + " in avoidable combination. Ignoring.";
|
||||
<< "Unknown class name " + name + " in excludable combination. Ignoring.";
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -147,7 +147,7 @@ void SetAvoidableClasses(const ExtractorCallbacks::ClassesMap &classes_map,
|
||||
|
||||
if (mask > 0)
|
||||
{
|
||||
profile_properties.SetAvoidableClasses(combination_index++, mask);
|
||||
profile_properties.SetExcludableClasses(combination_index++, mask);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -414,8 +414,8 @@ Extractor::ParseOSMData(ScriptingEnvironment &scripting_environment,
|
||||
|
||||
auto profile_properties = scripting_environment.GetProfileProperties();
|
||||
SetClassNames(scripting_environment.GetClassNames(), classes_map, profile_properties);
|
||||
auto avoidable_classes = scripting_environment.GetAvoidableClasses();
|
||||
SetAvoidableClasses(classes_map, avoidable_classes, profile_properties);
|
||||
auto excludable_classes = scripting_environment.GetExcludableClasses();
|
||||
SetExcludableClasses(classes_map, excludable_classes, profile_properties);
|
||||
files::writeProfileProperties(config.GetPath(".osrm.properties").string(), profile_properties);
|
||||
|
||||
TIMER_STOP(extracting);
|
||||
|
||||
@@ -727,13 +727,13 @@ Sol2ScriptingEnvironment::GetStringListsFromTable(const std::string &table_name)
|
||||
return string_lists;
|
||||
}
|
||||
|
||||
std::vector<std::vector<std::string>> Sol2ScriptingEnvironment::GetAvoidableClasses()
|
||||
std::vector<std::vector<std::string>> Sol2ScriptingEnvironment::GetExcludableClasses()
|
||||
{
|
||||
auto &context = GetSol2Context();
|
||||
switch (context.api_version)
|
||||
{
|
||||
case 2:
|
||||
return Sol2ScriptingEnvironment::GetStringListsFromTable("avoidable");
|
||||
return Sol2ScriptingEnvironment::GetStringListsFromTable("excludable");
|
||||
default:
|
||||
return {};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user