Commit 99e35b9a authored by Sebastian Hörl's avatar Sebastian Hörl
Browse files

update costs

parent dc687085
......@@ -98,11 +98,23 @@ public class PublicTransportPredictor {
numberOfTransfers = Math.max(0, numberOfTransfers);
// double cost = calculateCost(trip.getPerson(), legs);
double cost = 0.25 * inVehicleDistance * 1e-3;
double cost = calculateSimpleCost(trip.getPerson(), inVehicleDistance);
return new PublicTransportPrediction(inVehicleTime, inVehicleDistance, accessEgressTime, transferTime,
numberOfTransfers, isOnlyWalk, crowflyDistance, cost);
}
private double calculateSimpleCost(Person person, double inVehicleDistance) {
boolean hasGA = (Boolean) person.getAttributes().getAttribute("ptHasGA");
boolean hasHalbtax = (Boolean) person.getAttributes().getAttribute("ptHasHalbtax");
if (hasGA) {
return 0.0;
} else {
double cost = inVehicleDistance * 1e-3 * 0.25;
return hasHalbtax ? 0.5 * cost : cost;
}
}
private double calculateCost(Person person, List<Leg> legs) {
boolean hasGA = (Boolean) person.getAttributes().getAttribute("ptHasGA");
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment