Skip to content

Commit

Permalink
somewhat cleanup the ride scoring code
Browse files Browse the repository at this point in the history
  • Loading branch information
kainagel committed Aug 2, 2024
1 parent c2e2128 commit d43b191
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions src/main/java/org/matsim/run/MetropoleRuhrScenario.java
Original file line number Diff line number Diff line change
Expand Up @@ -270,22 +270,26 @@ protected Config prepareConfig(Config config) {

// alpha can be calibrated
double alpha = 2.0;
//gamma must stay one
double gamma = 0.0;

double monetaryDistanceRateRide = config.scoring().getOrCreateModeParams(TransportMode.car).getMonetaryDistanceRate() * alpha;

double marginalUtilityOfTravllingRide = config.scoring().getOrCreateModeParams(TransportMode.car).getMarginalUtilityOfTraveling(); //marginal disutility of passenger
marginalUtilityOfTravllingRide += alpha * (-config.scoring().getPerforming_utils_hr() + config.scoring().getOrCreateModeParams(TransportMode.car).getMarginalUtilityOfTraveling()); // Zeitverbrauch des Fahrers
//marginalUtilityOfTravllingRide += gamma * -config.scoring().getPerforming_utils_hr(); //we prefer not using this term
double marginalUtilityOfTravelingRide = config.scoring().getOrCreateModeParams(TransportMode.car).getMarginalUtilityOfTraveling(); //marginal disutility of passenger

marginalUtilityOfTravelingRide += alpha * (-config.scoring().getPerforming_utils_hr() + config.scoring().getOrCreateModeParams(TransportMode.car).getMarginalUtilityOfTraveling()); // Zeitverbrauch des Fahrers

double tmp = (alpha + gamma) * -(config.scoring().getPerforming_utils_hr()) + config.scoring().getOrCreateModeParams(TransportMode.car).getMarginalUtilityOfTraveling() * (1.0 + alpha) ;
//marginalUtilityOfTravelingRide += gamma * -config.scoring().getPerforming_utils_hr(); //we prefer not using this term

Assert.isTrue(tmp==marginalUtilityOfTravllingRide);
double tmp = alpha * -(config.scoring().getPerforming_utils_hr()) + config.scoring().getOrCreateModeParams(TransportMode.car).getMarginalUtilityOfTraveling() * (1.0 + alpha) ;
Assert.isTrue(tmp==marginalUtilityOfTravelingRide);
// I think that the two lines above were left behind after that refactoring to ensure that the new way to compute this results in the
// same result as the old way. If this assessment is correct, then those two lines can be removed as soon as this has been run a
// couple of times. Since I do not know if this is the case, I leave these two lines in place for the time being, but am adding this
// comment here. kai, aug'24

double marginalUtilityOfDistanceRide = (alpha + 1.0) * config.scoring().getOrCreateModeParams(TransportMode.car).getMarginalUtilityOfDistance();
config.scoring().getOrCreateModeParams(TransportMode.ride).setMonetaryDistanceRate(monetaryDistanceRateRide);
config.scoring().getOrCreateModeParams(TransportMode.ride).setMarginalUtilityOfDistance(marginalUtilityOfDistanceRide);
config.scoring().getOrCreateModeParams(TransportMode.ride).setMarginalUtilityOfTraveling(marginalUtilityOfTravllingRide);
config.scoring().getOrCreateModeParams(TransportMode.ride).setMarginalUtilityOfTraveling(marginalUtilityOfTravelingRide);

prepareCommercialTrafficConfig(config);

Expand Down

0 comments on commit d43b191

Please sign in to comment.