Skip to content

Commit

Permalink
rearranging some code
Browse files Browse the repository at this point in the history
  • Loading branch information
sebhoerl committed Oct 14, 2024
1 parent b59c19b commit f08ae29
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,23 +40,23 @@ protected double estimateAccessEgressTimeUtility(IDFPtVariables variables) {
return parameters.betaAccessTime_u_min * variables.accessEgressTime_min;
}

protected double estimateInVehicleTimeUtility(IDFPtVariables variables) {
return parameters.pt.betaInVehicleTime_u_min * variables.inVehicleTime_min;
protected double estimateLineSwitchUtility(IDFPtVariables variables) {
return parameters.pt.betaLineSwitch_u * variables.numberOfLineSwitches;
}

protected double estimateWaitingTimeUtility(IDFPtVariables variables) {
return parameters.pt.betaWaitingTime_u_min * variables.waitingTime_min;
}

protected double estimateLineSwitchUtility(IDFPtVariables variables) {
return parameters.pt.betaLineSwitch_u * variables.numberOfLineSwitches;
}

protected double estimateMonetaryCostUtility(IDFPtVariables variables, double cost_EUR) {
return parameters.betaCost_u_MU * EstimatorUtils.interaction(variables.euclideanDistance_km,
parameters.referenceEuclideanDistance_km, parameters.lambdaCostEuclideanDistance) * cost_EUR;
}

protected double estimateInVehicleTimeUtility(IDFPtVariables variables) {
return parameters.pt.betaInVehicleTime_u_min * variables.inVehicleTime_min;
}

protected double estimateDrivingPermitUtility(IDFPersonVariables variables) {
return variables.hasDrivingPermit ? parameters.idfPt.betaDrivingPermit_u : 0.0;
}
Expand All @@ -76,13 +76,13 @@ public double estimateUtility(Person person, DiscreteModeChoiceTrip trip, List<?

utility += estimateConstantUtility();
utility += estimateAccessEgressTimeUtility(ptVariables);
utility += estimateInVehicleTimeUtility(ptVariables);
utility += estimateWaitingTimeUtility(ptVariables);
utility += estimateLineSwitchUtility(ptVariables);
utility += estimateWaitingTimeUtility(ptVariables);
utility += estimateMonetaryCostUtility(ptVariables, cost_EUR);
utility += estimateInVehicleTimeUtility(ptVariables);

utility += estimateDrivingPermitUtility(personVariables);
utility += estimateOnlyBus(ptVariables);
utility += estimateDrivingPermitUtility(personVariables);

return utility;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ protected CostModel getCostModel() {

@Override
public IDFPtVariables predict(Person person, DiscreteModeChoiceTrip trip, List<? extends PlanElement> elements) {
int numberOfVehicularTrips = 0;
int numberOfVehicularLegs = 0;

// Track relevant variables (from standard estimator)
double inVehicleTime_min = 0.0;
Expand Down Expand Up @@ -71,7 +71,7 @@ public IDFPtVariables predict(Person person, DiscreteModeChoiceTrip trip, List<?
inVehicleTime_min += inVehicleTime / 60.0;
waitingTime_min += waitingTime / 60.0;

numberOfVehicularTrips++;
numberOfVehicularLegs++;
break;
default:
throw new IllegalStateException("Unknown mode in PT trip: " + leg.getMode());
Expand Down Expand Up @@ -99,7 +99,7 @@ public IDFPtVariables predict(Person person, DiscreteModeChoiceTrip trip, List<?
}
}

int numberOfLineSwitches = Math.max(0, numberOfVehicularTrips - 1);
int numberOfLineSwitches = Math.max(0, numberOfVehicularLegs - 1);

double euclideanDistance_km = PredictorUtils.calculateEuclideanDistance_km(trip);

Expand Down

0 comments on commit f08ae29

Please sign in to comment.