Skip to content

Commit

Permalink
add some logging
Browse files Browse the repository at this point in the history
  • Loading branch information
rakow committed Jan 4, 2025
1 parent 9712007 commit 57951ca
Showing 1 changed file with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package org.matsim.run.policies;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.matsim.api.core.v01.Id;
import org.matsim.api.core.v01.Scenario;
import org.matsim.api.core.v01.TransportMode;
Expand Down Expand Up @@ -37,6 +39,8 @@
*/
public class OpenBerlinChoiceExperiment extends OpenBerlinScenario {

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

@CommandLine.Option(names = "--bike-speed-offset", description = "Offset the default bike speed in km/h", defaultValue = "0")
private double bikeSpeedOffset;

Expand All @@ -52,6 +56,9 @@ public class OpenBerlinChoiceExperiment extends OpenBerlinScenario {
@CommandLine.Option(names = "--balanced-innovation", description = "Use balanced innovation selection", defaultValue = "false")
private boolean bi;

@CommandLine.Option(names = "--act-est", description = "Include estimation of activity utilities into score", defaultValue = "true")
private boolean actEst;

@CommandLine.Option(names = "--inv-beta", description = "Beta inv value for selection", defaultValue = "-1")
private double invBeta;

Expand Down Expand Up @@ -128,6 +135,8 @@ protected void prepareScenario(Scenario scenario) {
// These times will be recalculated by the router
if (bikeSpeedOffset != 0) {

log.info("Adjusting bike speed by {} km/h", bikeSpeedOffset);

VehicleType bike = scenario.getVehicles().getVehicleTypes().get(Id.create(TransportMode.bike, VehicleType.class));
bike.setMaximumVelocity(bike.getMaximumVelocity() + bikeSpeedOffset / 3.6);

Expand All @@ -150,13 +159,13 @@ protected void prepareControler(Controler controler) {
super.prepareControler(controler);

if (bi) {
log.info("Using balanced innovation strategy chooser");
BalancedInnovationStrategyChooser.install(controler);
}

if (imc) {

InformedModeChoiceModule.Builder builder = InformedModeChoiceModule.newBuilder()
.withActivityEstimator(DefaultActivityEstimator.class)
.withFixedCosts(FixedCostsEstimator.DailyConstant.class, "car", "pt")
.withLegEstimator(DefaultLegScoreEstimator.class, ModeOptions.ConsiderIfCarAvailable.class, "car")
// Modes with fixed costs need to be considered separately
Expand All @@ -165,7 +174,13 @@ protected void prepareControler(Controler controler) {
.withPruner("p" + pruning, new PlanScoreThresholdPruner(pruning))
.withConstraint(RelaxedMassConservationConstraint.class);

if (actEst) {
log.info("Including activity estimation into score");
builder.withActivityEstimator(DefaultActivityEstimator.class);
}

if (ConfigUtils.hasModule(controler.getConfig(), AdvancedScoringConfigGroup.class)) {
log.info("Using pseudo-random trip score estimator");
builder.withTripScoreEstimator(PseudoRandomTripScoreEstimator.class);
}

Expand Down

0 comments on commit 57951ca

Please sign in to comment.