Skip to content

Commit

Permalink
make subpopulation in generate choice set optional
Browse files Browse the repository at this point in the history
  • Loading branch information
rakow committed Feb 11, 2024
1 parent 62e9ec3 commit 1f26c96
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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")
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit 1f26c96

Please sign in to comment.