diff --git a/contribs/application/src/main/java/org/matsim/application/prepare/population/SplitActivityTypesDuration.java b/contribs/application/src/main/java/org/matsim/application/prepare/population/SplitActivityTypesDuration.java index b49a1d5b2c4..9bf459cdc19 100644 --- a/contribs/application/src/main/java/org/matsim/application/prepare/population/SplitActivityTypesDuration.java +++ b/contribs/application/src/main/java/org/matsim/application/prepare/population/SplitActivityTypesDuration.java @@ -13,6 +13,7 @@ import picocli.CommandLine; import java.nio.file.Path; +import java.util.HashSet; import java.util.List; import java.util.Objects; import java.util.Set; @@ -47,7 +48,7 @@ public class SplitActivityTypesDuration implements MATSimAppCommand, PersonAlgor private String subpopulation; @CommandLine.Option(names = "--exclude", description = "Activity types that won't be split", split = ",", defaultValue = "") - private Set exclude; + private Set exclude = new HashSet<>(); /** @@ -65,6 +66,13 @@ public SplitActivityTypesDuration(int activityBinSize, int maxTypicalDuration, i this.endTimeToDuration = endTimeToDuration; } + /** + * Set activity types to be excluded from splitting. + */ + public void setExclude(Set exclude) { + this.exclude = exclude; + } + public static void main(String[] args) { new SplitActivityTypesDuration().execute(args); } diff --git a/contribs/informed-mode-choice/src/main/java/org/matsim/modechoice/search/ModeChoiceSearch.java b/contribs/informed-mode-choice/src/main/java/org/matsim/modechoice/search/ModeChoiceSearch.java index 9764e80cad7..755fb3d006c 100644 --- a/contribs/informed-mode-choice/src/main/java/org/matsim/modechoice/search/ModeChoiceSearch.java +++ b/contribs/informed-mode-choice/src/main/java/org/matsim/modechoice/search/ModeChoiceSearch.java @@ -194,10 +194,8 @@ public double nextDouble() { for (int i = 0; i < result.length; i++) { - byte[] path = Arrays.copyOf(entry.modes, entry.modes.length); - byte mode = -1; - byte originalMode = path[i]; + byte originalMode = entry.modes[i]; // This mode had no options if (originalMode == -1) @@ -215,8 +213,9 @@ public double nextDouble() { } } - path[i] = mode; if (mode != -1) { + byte[] path = Arrays.copyOf(entry.modes, entry.modes.length); + path[i] = mode; // recompute the deviation from the maximum // there might be a way to store and update this, without recomputing