Add command-line parameter for enabling distance cache.

This commit is contained in:
Daniel Patterson 2018-09-05 15:25:56 -07:00 committed by Huyen Chau Nguyen
parent 5597415f28
commit 6bd74c287b
2 changed files with 10 additions and 3 deletions

View File

@ -72,8 +72,14 @@ struct ContractorConfig final : storage::IOConfig
// The remaining vertices form the core of the hierarchy // The remaining vertices form the core of the hierarchy
//(e.g. 0.8 contracts 80 percent of the hierarchy, leaving a core of 20%) //(e.g. 0.8 contracts 80 percent of the hierarchy, leaving a core of 20%)
double core_factor; double core_factor;
// Whether to store distances for CH edges in addition to duration/weight
// Defaults to false. Setting to true will require more storage/memory,
// but avoids the need for path unpacking to learn the distance of a CH
// route (useful for faster distance results in table queries)
bool cache_distances;
}; };
} } // namespace contractor
} } // namespace osrm
#endif // EXTRACTOR_OPTIONS_HPP #endif // EXTRACTOR_OPTIONS_HPP

View File

@ -81,7 +81,8 @@ return_code parseArguments(int argc,
"time-zone-file", "time-zone-file",
boost::program_options::value<std::string>(&contractor_config.updater_config.tz_file_path), boost::program_options::value<std::string>(&contractor_config.updater_config.tz_file_path),
"Required for conditional turn restriction parsing, provide a geojson file containing " "Required for conditional turn restriction parsing, provide a geojson file containing "
"time zone boundaries"); "time zone boundaries")("cache-distances",boost::program_options::bool_switch(&contractor_config.cache_distances)->default_value(false),
"Store distances for CH edges, avoiding the need for query-time re-calculation.");
// hidden options, will be allowed on command line, but will not be shown to the user // hidden options, will be allowed on command line, but will not be shown to the user
boost::program_options::options_description hidden_options("Hidden options"); boost::program_options::options_description hidden_options("Hidden options");