Ejemplo n.º 1
0
  private Set<Plan> filterPlans() {
    PlanCollectFromAlgorithm collector = new PlanCollectFromAlgorithm();

    RouteLinkFilter linkFilter = new RouteLinkFilter(collector);
    for (Tuple<String, String> t : this.linkTuples) {
      linkFilter.addLink(Id.create(t.getFirst(), Link.class));
      linkFilter.addLink(Id.create(t.getSecond(), Link.class));
    }

    SelectedPlanFilter selectedPlanFilter = new SelectedPlanFilter(linkFilter);
    selectedPlanFilter.run(this.scenario.getPopulation());
    return collector.getPlans();
  }
Ejemplo n.º 2
0
 private Set<Id<Person>> filterPlans(Population plans) {
   PlanCollectFromAlgorithm collector = new PlanCollectFromAlgorithm();
   RouteLinkFilter linkFilter = new RouteLinkFilter(collector);
   for (String id : this.linkIds) {
     linkFilter.addLink(Id.create(id, Link.class));
   }
   SelectedPlanFilter selectedPlanFilter = new SelectedPlanFilter(linkFilter);
   selectedPlanFilter.run(plans);
   Set<Plan> planSet = collector.getPlans();
   Set<Id<Person>> idSet = new HashSet<>(planSet.size());
   for (Plan p : planSet) {
     idSet.add(p.getPerson().getId());
   }
   return idSet;
 }