Skip to content

Commit

Permalink
small fix in a different prepare method
Browse files Browse the repository at this point in the history
  • Loading branch information
rakow committed Mar 18, 2024
1 parent fb27b3b commit dd3305d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<String> exclude;
private Set<String> exclude = new HashSet<>();


/**
Expand All @@ -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<String> exclude) {
this.exclude = exclude;
}

public static void main(String[] args) {
new SplitActivityTypesDuration().execute(args);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand Down

0 comments on commit dd3305d

Please sign in to comment.