Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix config file parameter to set the number of active core landmarks #931

Merged
merged 1 commit into from
May 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ RELEASING:

### Fixed
- prioritize graph build date over data date in routing request ([#925](https://github.com/GIScience/openrouteservice/issues/925))
- Config file parameter to set the number of active landmarks for core routing ([#930](https://github.com/GIScience/openrouteservice/issues/930))

## [6.4.3] - 2021-04-28
### Changed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ public class RoutingProfile {
private static final String VAL_ENABLED = "enabled";
private static final String KEY_THREADS = "threads";
private static final String KEY_WEIGHTINGS = "weightings";
private static final String KEY_LMSETS = "lmsets";
private static final String KEY_MAXCELLNODES = "maxcellnodes";
private static final String KEY_METHODS_LM = "methods.lm";
private static final String KEY_LANDMARKS = "landmarks";
Expand Down Expand Up @@ -342,8 +343,8 @@ private static CmdArgs createGHSettings(String sourceFile, RouteProfileConfigura
args.put("prepare.core.threads", coreOpts.getInt(KEY_THREADS));
if (coreOpts.hasPath(KEY_WEIGHTINGS))
args.put(KEY_PREPARE_CORE_WEIGHTINGS, StringUtility.trimQuotes(coreOpts.getString(KEY_WEIGHTINGS)));
if (coreOpts.hasPath("lmsets"))
args.put("prepare.corelm.lmsets", StringUtility.trimQuotes(coreOpts.getString("lmsets")));
if (coreOpts.hasPath(KEY_LMSETS))
args.put("prepare.corelm.lmsets", StringUtility.trimQuotes(coreOpts.getString(KEY_LMSETS)));
if (coreOpts.hasPath(KEY_LANDMARKS))
args.put("prepare.corelm.landmarks", coreOpts.getInt(KEY_LANDMARKS));
}
Expand All @@ -354,14 +355,17 @@ private static CmdArgs createGHSettings(String sourceFile, RouteProfileConfigura
if (config.getExecutionOpts() != null) {
Config opts = config.getExecutionOpts();
if (opts.hasPath(KEY_METHODS_CH)) {
Config coreOpts = opts.getConfig(KEY_METHODS_CH);
if (coreOpts.hasPath(KEY_DISABLING_ALLOWED))
args.put("routing.ch.disabling_allowed", coreOpts.getBoolean(KEY_DISABLING_ALLOWED));
Config chOpts = opts.getConfig(KEY_METHODS_CH);
if (chOpts.hasPath(KEY_DISABLING_ALLOWED))
args.put("routing.ch.disabling_allowed", chOpts.getBoolean(KEY_DISABLING_ALLOWED));
}
if (opts.hasPath(KEY_METHODS_CORE)) {
Config chOpts = opts.getConfig(KEY_METHODS_CORE);
if (chOpts.hasPath(KEY_DISABLING_ALLOWED))
args.put("routing.core.disabling_allowed", chOpts.getBoolean(KEY_DISABLING_ALLOWED));
Config coreOpts = opts.getConfig(KEY_METHODS_CORE);
if (coreOpts.hasPath(KEY_DISABLING_ALLOWED))
args.put("routing.core.disabling_allowed", coreOpts.getBoolean(KEY_DISABLING_ALLOWED));

if (coreOpts.hasPath(KEY_ACTIVE_LANDMARKS))
args.put("routing.corelm.active_landmarks", coreOpts.getInt(KEY_ACTIVE_LANDMARKS));
}
if (opts.hasPath(KEY_METHODS_LM)) {
Config lmOpts = opts.getConfig(KEY_METHODS_LM);
Expand All @@ -371,14 +375,6 @@ private static CmdArgs createGHSettings(String sourceFile, RouteProfileConfigura
if (lmOpts.hasPath(KEY_ACTIVE_LANDMARKS))
args.put("routing.lm.active_landmarks", lmOpts.getInt(KEY_ACTIVE_LANDMARKS));
}
if (opts.hasPath("methods.corelm")) {
Config lmOpts = opts.getConfig("methods.corelm");
if (lmOpts.hasPath(KEY_DISABLING_ALLOWED))
args.put("routing.lm.disabling_allowed", lmOpts.getBoolean(KEY_DISABLING_ALLOWED));

if (lmOpts.hasPath(KEY_ACTIVE_LANDMARKS))
args.put("routing.corelm.active_landmarks", lmOpts.getInt(KEY_ACTIVE_LANDMARKS));
}
}

if (config.getOptimize() && !prepareCH)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public void init(CmdArgs args) {
setPreparationThreads(args.getInt(CoreLandmark.PREPARE + "threads", getPreparationThreads()));

landmarkCount = args.getInt(CoreLandmark.COUNT, landmarkCount);
activeLandmarkCount = args.getInt(CoreLandmark.ACTIVE_COUNT, Math.min(4, landmarkCount));
activeLandmarkCount = args.getInt(CoreLandmark.ACTIVE_COUNT_DEFAULT, Math.min(4, landmarkCount));
logDetails = args.getBool(CoreLandmark.PREPARE + "log_details", false);
minNodes = args.getInt(CoreLandmark.PREPARE + "min_network_size", -1);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ private CoreLandmark() {}

public static final String PREPARE = "prepare.corelm.";
/**
* This property name in HintsMap configures at runtime if CH routing should be ignored.
* Specifies landmark sets.
*/
public static final String LMSETS = PREPARE + "lmsets";
/**
Expand All @@ -65,7 +65,7 @@ private CoreLandmark() {}
/**
* Specifies how many active landmarks should be used when routing
*/
public static final String ACTIVE_COUNT = ROUTING_INIT_PREFIX + "corelm.active_landmarks";
public static final String ACTIVE_COUNT = "corelm.active_landmarks";
/**
* Default for active count
*/
Expand Down