Skip to content

Commit

Permalink
fix small style issues
Browse files Browse the repository at this point in the history
  • Loading branch information
rakow committed Jul 9, 2024
1 parent c19dd86 commit 2a93ac6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,15 @@ public class ComputePlanChoices implements MATSimAppCommand, PersonAlgorithm {
* Rows for the result table.
*/
private final Queue<List<Object>> rows = new ConcurrentLinkedQueue<>();
private final MainModeIdentifier mmi = new DefaultAnalysisMainModeIdentifier();
@CommandLine.Mixin
private ScenarioOptions scenario;
@CommandLine.Option(names = "--top-k", description = "Use top k estimates", defaultValue = "9")
private int topK;
@CommandLine.Option(names = "--modes", description = "Modes to include in estimation", split = ",")
private Set<String> modes;

@CommandLine.Option(names = "--id-filter", description = "Filter for person ids")
private Pattern idFilter;

@CommandLine.Option(names = "--time-util-only", description = "Reset scoring for estimation and only use time utility", defaultValue = "false")
private boolean timeUtil;
@CommandLine.Option(names = "--calc-scores", description = "Perform pseudo scoring for each plan", defaultValue = "false")
Expand All @@ -70,11 +69,9 @@ public class ComputePlanChoices implements MATSimAppCommand, PersonAlgorithm {
private PlanCandidates planCandidates = PlanCandidates.bestK;
@CommandLine.Option(names = "--output", description = "Path to output csv.", defaultValue = "plan-choices.csv")
private Path output;

private ThreadLocal<Ctx> thread;
private ProgressBar pb;
private double globalAvgIncome;
private final MainModeIdentifier mmi = new DefaultAnalysisMainModeIdentifier();

public static void main(String[] args) {
new ComputePlanChoices().execute(args);
Expand Down Expand Up @@ -236,7 +233,9 @@ public void run(Person person) {
}

if (split.length != currentModes.length) {
log.warn("Number of trips ref/current do not match: {} / {}", Arrays.toString(split), Arrays.toString(currentModes));
if (log.isWarnEnabled())
log.warn("Number of trips ref/current do not match: {} / {}", Arrays.toString(split), Arrays.toString(currentModes));

pb.step();
return;
}
Expand Down
12 changes: 6 additions & 6 deletions src/main/java/org/matsim/prepare/population/PlanBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,9 @@ public Long2ObjectMap<List<Person>> createHomeIndex(Population population) {
*/
public long findHomeZone(String personId) {

List<CSVRecord> activities = this.activities.get(personId);
List<CSVRecord> acts = activities.get(personId);

Optional<CSVRecord> home = activities.stream().filter(r -> r.get("type").equals("home")).findFirst();
Optional<CSVRecord> home = acts.stream().filter(r -> r.get("type").equals("home")).findFirst();
if (home.isEmpty())
return -1;

Expand All @@ -154,12 +154,12 @@ public long findHomeZone(String personId) {
*/
public boolean assignLocationsFromZones(String personId, Plan plan, Coord homeCoord) {

List<CSVRecord> activities = this.activities.get(personId);
List<CSVRecord> acts = activities.get(personId);
List<Activity> existing = TripStructureUtils.getActivities(plan, TripStructureUtils.StageActivityHandling.ExcludeStageActivities);

// If activities don't match, this entry is skipped
// this can happen if an end home activity has been added at the end
if (activities.size() != existing.size())
if (acts.size() != existing.size())
return false;

ActLocation home = new ActLocation(null, homeCoord);
Expand All @@ -169,9 +169,9 @@ public boolean assignLocationsFromZones(String personId, Plan plan, Coord homeCo
// Distances between activities in meter
DoubleList dists = new DoubleArrayList();

for (int i = 0; i < activities.size(); i++) {
for (int i = 0; i < acts.size(); i++) {

CSVRecord ref = activities.get(i);
CSVRecord ref = acts.get(i);
Activity activity = existing.get(i);

String type = activity.getType();
Expand Down

0 comments on commit 2a93ac6

Please sign in to comment.