Added weight multipliers for speed and turn updates

This commit is contained in:
Michael Krasnyk
2017-01-17 09:24:52 +01:00
committed by Patrick Niklaus
parent 279f8aabfb
commit c059d15cb9
12 changed files with 117 additions and 124 deletions
+2 -14
View File
@@ -78,21 +78,9 @@ class Contractor
private:
ContractorConfig config;
EdgeID LoadEdgeExpandedGraph(const std::string &edge_based_graph_path,
EdgeID LoadEdgeExpandedGraph(const ContractorConfig &config,
std::vector<extractor::EdgeBasedEdge> &edge_based_edge_list,
std::vector<EdgeWeight> &node_weights,
const std::string &edge_segment_lookup_path,
const std::string &turn_weight_penalties_path,
const std::string &turn_duration_penalties_path,
const std::string &turn_penalties_index_path,
const std::vector<std::string> &segment_speed_path,
const std::vector<std::string> &turn_penalty_path,
const std::string &nodes_filename,
const std::string &geometry_filename,
const std::string &datasource_names_filename,
const std::string &datasource_indexes_filename,
const std::string &rtree_leaf_filename,
const double log_edge_updates_factor);
std::vector<EdgeWeight> &node_weights);
};
}
}
+4 -1
View File
@@ -39,7 +39,7 @@ namespace contractor
struct ContractorConfig
{
ContractorConfig() : requested_num_threads(0) {}
ContractorConfig() : requested_num_threads(0), weight_multiplier(10.) {}
// Infer the output names from the path of the .osrm file
void UseDefaultOutputNames()
@@ -57,6 +57,7 @@ struct ContractorConfig
rtree_leaf_path = osrm_input_path.string() + ".fileIndex";
datasource_names_path = osrm_input_path.string() + ".datasource_names";
datasource_indexes_path = osrm_input_path.string() + ".datasource_indexes";
profile_properties_path = osrm_input_path.string() + ".properties";
}
boost::filesystem::path config_file_path;
@@ -78,6 +79,7 @@ struct ContractorConfig
unsigned requested_num_threads;
double log_edge_updates_factor;
double weight_multiplier;
// A percentage of vertices that will be contracted for the hierarchy.
// Offers a trade-off between preprocessing and query time.
@@ -89,6 +91,7 @@ struct ContractorConfig
std::vector<std::string> turn_penalty_lookup_paths;
std::string datasource_indexes_path;
std::string datasource_names_path;
std::string profile_properties_path;
};
}
}
@@ -996,6 +996,11 @@ class ContiguousInternalMemoryDataFacade : public BaseDataFacade
return m_profile_properties->weight_precision;
}
double GetWeightMultiplier() const override final
{
return m_profile_properties->GetWeightMultiplier();
}
BearingClassID GetBearingClassID(const NodeID id) const override final
{
return m_bearing_class_id_table.at(id);
@@ -189,6 +189,8 @@ class BaseDataFacade
virtual unsigned GetWeightPrecision() const = 0;
virtual double GetWeightMultiplier() const = 0;
virtual BearingClassID GetBearingClassID(const NodeID id) const = 0;
virtual util::guidance::TurnBearing PreTurnBearing(const EdgeID eid) const = 0;
+1 -1
View File
@@ -41,7 +41,7 @@ inline std::vector<RouteStep> assembleSteps(const datafacade::BaseDataFacade &fa
const bool source_traversed_in_reverse,
const bool target_traversed_in_reverse)
{
const double weight_multiplier = std::pow(10., facade.GetWeightPrecision());
const double weight_multiplier = facade.GetWeightMultiplier();
const double constexpr ZERO_DURATION = 0., ZERO_DISTANCE = 0., ZERO_WEIGHT = 0;
const constexpr char *NO_ROTARY_NAME = "";
+2
View File
@@ -67,6 +67,8 @@ struct ProfileProperties
return std::string(weight_name);
}
double GetWeightMultiplier() const { return std::pow(10., weight_precision); }
//! penalty to cross a traffic light in deci-seconds
std::int32_t traffic_signal_penalty;
//! penalty to do a uturn in deci-seconds