Skip to content

Commit

Permalink
fix optimistic estimator
Browse files Browse the repository at this point in the history
  • Loading branch information
rakow committed Dec 7, 2023
1 parent a34c7b4 commit 3a9aba0
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/main/java/org/matsim/run/drt/OptimisticDrtEstimator.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,20 @@ public OptimisticDrtEstimator(DrtConfigGroup drtConfig, double proportion, doubl
public Estimate estimate(DrtRoute route, OptionalTime departureTime) {

double distance = route.getDistance();
double travelTime = Math.max(route.getDirectRideTime(), route.getMaxTravelTime() * proportion);

double maxTravelTime = Math.min(route.getDirectRideTime() + this.drtConfig.maxAbsoluteDetour,
route.getDirectRideTime() * this.drtConfig.maxTravelTimeAlpha + this.drtConfig.maxTravelTimeBeta);

double fare = 0;
if (drtConfig.getDrtFareParams().isPresent()) {
DrtFareParams fareParams = drtConfig.getDrtFareParams().get();
fare = fareParams.distanceFare_m * distance
+ fareParams.timeFare_h * travelTime / 3600.0
+ fareParams.timeFare_h * route.getDirectRideTime() / 3600.0
+ fareParams.baseFare;

fare = Math.max(fare, fareParams.minFarePerTrip);
}

return new Estimate(distance, travelTime, waitingTime, fare, 0);
return new Estimate(distance, proportion * maxTravelTime, waitingTime, fare, 0);
}
}

0 comments on commit 3a9aba0

Please sign in to comment.