From 1f26c9697a14d5a9ab1152c40b4847ac67a5465f Mon Sep 17 00:00:00 2001 From: rakow Date: Sun, 11 Feb 2024 16:08:34 +0100 Subject: [PATCH] make subpopulation in generate choice set optional --- .../org/matsim/modechoice/commands/GenerateChoiceSet.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/contribs/informed-mode-choice/src/main/java/org/matsim/modechoice/commands/GenerateChoiceSet.java b/contribs/informed-mode-choice/src/main/java/org/matsim/modechoice/commands/GenerateChoiceSet.java index 46e295edce7..3c05d8e43b5 100644 --- a/contribs/informed-mode-choice/src/main/java/org/matsim/modechoice/commands/GenerateChoiceSet.java +++ b/contribs/informed-mode-choice/src/main/java/org/matsim/modechoice/commands/GenerateChoiceSet.java @@ -27,6 +27,7 @@ import java.nio.file.Path; import java.util.Collection; import java.util.HashSet; +import java.util.Objects; import java.util.Set; import java.util.concurrent.atomic.AtomicInteger; import java.util.stream.Collectors; @@ -42,7 +43,7 @@ public class GenerateChoiceSet implements MATSimAppCommand, PersonAlgorithm { @CommandLine.Mixin private ScenarioOptions scenario; - @CommandLine.Option(names = "--subpopulation", description = "Subpopulation filter", defaultValue = "person") + @CommandLine.Option(names = "--subpopulation", description = "Subpopulation filter") private String subpopulation; @CommandLine.Option(names = "--top-k", description = "Use top k estimates") @@ -103,7 +104,7 @@ public Integer call() throws Exception { // copy the original plan, so no modifications are made for (Person person : controler.getScenario().getPopulation().getPersons().values()) { String subpop = PopulationUtils.getSubpopulation(person); - if (subpopulation != null && !subpop.equals(subpopulation)) + if (subpopulation != null && !Objects.equals(subpop, subpopulation)) continue; Plan selected = person.getSelectedPlan();