Skip to content

Commit

Permalink
update update detour factors and car share
Browse files Browse the repository at this point in the history
  • Loading branch information
rakow committed Jan 4, 2024
1 parent 162fcaf commit f804b3c
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,17 +86,17 @@
public class RunOpenBerlinCalibration extends MATSimApplication {

/**
* Scaling factor if all persons use car (~20.6% share).
* Scaling factor if all persons use car (~20% share).
*/
public static final double CAR_FACTOR = 4.85;
public static final int CAR_FACTOR = 5;
/**
* Flexible activities, which need to be known for location choice and during generation.
* A day can not end on a flexible activity.
*/
public static final Set<String> FLEXIBLE_ACTS = Set.of("shop_daily", "shop_other", "leisure", "dining");
private static final Logger log = LogManager.getLogger(RunOpenBerlinCalibration.class);
@CommandLine.Mixin
private final SampleOptions sample = new SampleOptions(100, 25, 10, 1);
private final SampleOptions sample = new SampleOptions(25, 10, 3, 1);
@CommandLine.Option(names = "--mode", description = "Calibration mode that should be run.")
private CalibrationMode mode;
@CommandLine.Option(names = "--weight", description = "Strategy weight.", defaultValue = "1")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ private List<PlanPerson> processPopulation(Path input, Network network, Counts<L
// if other trips have been scaled, these unscaled trips are scaled as well
if (allCar)
// scale with mean of CAR_FACTOR
scale *= (rnd.nextDouble() < 0.85 ? 5 : 4);
scale *= RunOpenBerlinCalibration.CAR_FACTOR;
}

// Index for plan
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,12 @@ public class InitLocationChoice implements MATSimAppCommand, PersonAlgorithm {
/**
* Detour factor for car routes, which was determined based on sampled routes.
*/
private static final double DETOUR_FACTOR = 1.56;
private static final double DETOUR_FACTOR = 1.46;

/**
* Factor for short trips < 2000m.
*/
private static final double DETOUR_FACTOR_SHORT = 1.3;

private static final Logger log = LogManager.getLogger(InitLocationChoice.class);

Expand Down Expand Up @@ -198,10 +203,11 @@ public void run(Person person) {
ActivityFacility location = null;

// target leg distance in km
Object origDist = act.getAttributes().getAttribute("orig_dist");
double origDist = (double) act.getAttributes().getAttribute("orig_dist");

// Distance will be reduced
double dist = (double) origDist * 1000 / DETOUR_FACTOR;
double detourFactor = origDist <= 2000 ? DETOUR_FACTOR_SHORT : DETOUR_FACTOR;
double dist = origDist * 1000 / detourFactor;

if (fixedLocations.containsKey(type)) {
location = fixedLocations.get(type);
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/matsim/run/RunOpenBerlinScenario.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public class RunOpenBerlinScenario extends MATSimApplication {
public static final String VERSION = "6.1";
public static final String CRS = "EPSG:25832";
@CommandLine.Mixin
private final SampleOptions sample = new SampleOptions(25, 10, 1);
private final SampleOptions sample = new SampleOptions(25, 10, 3, 1);

public RunOpenBerlinScenario() {
super(String.format("input/v%s/berlin-v%s.config.xml", VERSION, VERSION));
Expand Down

0 comments on commit f804b3c

Please sign in to comment.