Commit 5ed894bc authored by Sebastian Hörl's avatar Sebastian Hörl
Browse files

wip

parent b9c770ab
package ch.ethz.matsim.projects.astra_2018_002.mode_choice.estimation;
import java.util.List;
import org.matsim.api.core.v01.population.Person;
import org.matsim.api.core.v01.population.PlanElement;
import org.matsim.core.router.TripRouter;
import org.matsim.facilities.ActivityFacilities;
import ch.ethz.matsim.discrete_mode_choice.components.estimators.AbstractTripRouterEstimator;
import ch.ethz.matsim.discrete_mode_choice.model.DiscreteModeChoiceTrip;
import ch.ethz.matsim.discrete_mode_choice.model.trip_based.candidates.TripCandidate;
public class SwitzerlandEstimator extends AbstractTripRouterEstimator {
public SwitzerlandEstimator(TripRouter tripRouter, ActivityFacilities facilities) {
super(tripRouter, facilities);
}
protected double estimateTrip(Person person, String mode, DiscreteModeChoiceTrip trip,
List<TripCandidate> previousTrips, List<? extends PlanElement> routedTrip) {
return 0.0;
}
}
package ch.ethz.matsim.projects.astra_2018_002.mode_choice.estimation.parameters;
public class CarParameters {
public double parkingSearchPenalty_min;
public double accessEgressPenalty_min;
public double costPerKm_CHF;
public double parkingCostPenalty_CHF;
}
package ch.ethz.matsim.projects.astra_2018_002.mode_choice.estimation.variables;
import org.matsim.core.utils.misc.Time;
import ch.ethz.matsim.discrete_mode_choice.model.DiscreteModeChoiceTrip;
public class TripVariablesUtils {
static public double calculateDelay_min(DiscreteModeChoiceTrip trip, double travelTime_min) {
if (!Time.isUndefinedTime(trip.getOriginActivity().getEndTime())) {
double arrivalTime = trip.getOriginActivity().getEndTime() + travelTime_min * 60.0;
if (!Time.isUndefinedTime(trip.getDestinationActivity().getStartTime())) {
return Math.max(0.0, arrivalTime - trip.getDestinationActivity().getStartTime()) / 60.0;
}
return 0.0;
} else {
throw new IllegalStateException();
}
}
}
package ch.ethz.matsim.projects.astra_2018_002.mode_choice.estimation.variables.bike;
public class BikeTripVariables {
public final double travelTime_min;
public final double travelDistance_km;
public final double delay_min;
public BikeTripVariables(double travelTime_min, double travelDistance_km, double delay_min) {
this.travelDistance_km = travelDistance_km;
this.travelTime_min = travelTime_min;
this.delay_min = delay_min;
}
}
package ch.ethz.matsim.projects.astra_2018_002.mode_choice.estimation.variables.bike;
import java.util.List;
import org.matsim.api.core.v01.population.Leg;
import org.matsim.api.core.v01.population.PlanElement;
import ch.ethz.matsim.discrete_mode_choice.model.DiscreteModeChoiceTrip;
import ch.ethz.matsim.projects.astra_2018_002.mode_choice.estimation.variables.TripVariablesUtils;
public class BikeTripVariablesCalculator {
public BikeTripVariables calculate(DiscreteModeChoiceTrip trip, List<? extends PlanElement> elements) {
if (elements.size() > 1) {
throw new IllegalStateException();
}
Leg leg = (Leg) elements.get(0);
double travelTime_min = leg.getTravelTime() / 60.0;
double travelDistance_km = leg.getRoute().getDistance() * 1e-3;
double delay_min = TripVariablesUtils.calculateDelay_min(trip, travelTime_min);
return new BikeTripVariables(travelTime_min, travelDistance_km, delay_min);
}
}
package ch.ethz.matsim.projects.astra_2018_002.mode_choice.estimation.variables.car;
public class CarTripVariables {
public final double travelDistance_km;
public final double travelCost_CHF;
public final double parkingCost_CHF;
public final double travelTime_min;
public final double parkingSearchTime_min;
public final double delay_min;
public CarTripVariables(double travelDistance_km, double travelCost_CHF, double parkingCost_CHF,
double travelTime_min, double parkingSearchTime_min, double delay_min) {
this.travelDistance_km = travelDistance_km;
this.travelCost_CHF = travelCost_CHF;
this.parkingCost_CHF = parkingCost_CHF;
this.travelTime_min = travelTime_min;
this.parkingSearchTime_min = parkingSearchTime_min;
this.delay_min = delay_min;
}
}
package ch.ethz.matsim.projects.astra_2018_002.mode_choice.estimation.variables.car;
import java.util.List;
import org.matsim.api.core.v01.population.Leg;
import org.matsim.api.core.v01.population.PlanElement;
import ch.ethz.matsim.discrete_mode_choice.model.DiscreteModeChoiceTrip;
import ch.ethz.matsim.projects.astra_2018_002.mode_choice.estimation.parameters.CarParameters;
import ch.ethz.matsim.projects.astra_2018_002.mode_choice.estimation.variables.TripVariablesUtils;
public class CarTripVariablesCalculator {
private final CarParameters carParameters;
public CarTripVariablesCalculator(CarParameters carParameters) {
this.carParameters = carParameters;
}
public CarTripVariables calculate(DiscreteModeChoiceTrip trip, List<? extends PlanElement> elements) {
if (elements.size() > 1) {
throw new IllegalStateException();
}
Leg leg = (Leg) elements.get(0);
double travelDistance_km = leg.getRoute().getDistance() * 1e-3;
double travelTime_min = leg.getTravelTime() / 60.0;
double parkingSearchTime_min = carParameters.parkingSearchPenalty_min;
double delay_min = TripVariablesUtils.calculateDelay_min(trip, travelTime_min);
return new CarTripVariables(travelDistance_km, travelCost_CHF, parkingCost_CHF, travelTime_min, parkingSearchTime_min, delay_min);
}
}
package ch.ethz.matsim.projects.astra_2018_002.mode_choice.estimation.variables.general;
public class GeneralTripVariables {
public final double crowflyDistance_km;
public GeneralTripVariables(double crowflyDistance_km) {
this.crowflyDistance_km = crowflyDistance_km;
}
}
package ch.ethz.matsim.projects.astra_2018_002.mode_choice.estimation.variables.general;
import org.matsim.core.utils.geometry.CoordUtils;
import ch.ethz.matsim.discrete_mode_choice.model.DiscreteModeChoiceTrip;
public class GeneralTripVariablesCalculator {
public GeneralTripVariables calculateVariables(DiscreteModeChoiceTrip trip, double travelTime_min) {
double crowflyDistance_km = CoordUtils.calcEuclideanDistance(trip.getOriginActivity().getCoord(),
trip.getDestinationActivity().getCoord()) * 1e-3;
return new GeneralTripVariables(crowflyDistance_km);
}
}
package ch.ethz.matsim.projects.astra_2018_002.mode_choice.estimation.variables.walk;
public class WalkTripVariables {
public final double travelTime_min;
public final double travelDistance_km;
public final double delay_min;
public WalkTripVariables(double travelTime_min, double travelDistance_km, double delay_min) {
this.travelDistance_km = travelDistance_km;
this.travelTime_min = travelTime_min;
this.delay_min = delay_min;
}
}
package ch.ethz.matsim.projects.astra_2018_002.mode_choice.estimation.variables.walk;
import java.util.List;
import org.matsim.api.core.v01.population.Leg;
import org.matsim.api.core.v01.population.PlanElement;
import ch.ethz.matsim.discrete_mode_choice.model.DiscreteModeChoiceTrip;
import ch.ethz.matsim.projects.astra_2018_002.mode_choice.estimation.variables.TripVariablesUtils;
public class WalkTripVariablesCalculator {
public WalkTripVariables calculate(DiscreteModeChoiceTrip trip, List<? extends PlanElement> elements) {
if (elements.size() > 1) {
throw new IllegalStateException();
}
Leg leg = (Leg) elements.get(0);
double travelTime_min = leg.getTravelTime() / 60.0;
double travelDistance_km = leg.getRoute().getDistance() * 1e-3;
double delay_min = TripVariablesUtils.calculateDelay_min(trip, travelTime_min);
return new WalkTripVariables(travelTime_min, travelDistance_km, delay_min);
}
}
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