Commit 8e4b22a3 authored by Sebastian Hörl's avatar Sebastian Hörl
Browse files

make possible to use zurich choice model

parent a69befe7
......@@ -46,7 +46,7 @@ public class SwissUtilityEstimator extends BaseUtilityEstimator {
if (personVariables.isMale) {
utility += socioParameters.betaMale;
}
return utility;
}
......@@ -142,6 +142,8 @@ public class SwissUtilityEstimator extends BaseUtilityEstimator {
parameters.pt.lambdaCostDistance) //
* interaction(personVariables.income_1000CHF, parameters.referenceIncome_1000CHF,
parameters.lambdaCostIncome) //
* interaction(tripVariables.crowflyDistance_km, parameters.referenceCrowflyDistance_km,
parameters.lambdaCostCrowflyDistance) //
* tripVariables.travelCost_CHF;
utility += parameters.pt.betaLineSwitch
......@@ -247,6 +249,8 @@ public class SwissUtilityEstimator extends BaseUtilityEstimator {
parameters.car.lambdaCostDistance) //
* interaction(personVariables.income_1000CHF, parameters.referenceIncome_1000CHF,
parameters.lambdaCostIncome) //
* interaction(tripVariables.crowflyDistance_km, parameters.referenceCrowflyDistance_km,
parameters.lambdaCostCrowflyDistance) //
* tripVariables.travelCost_CHF;
utility += parameters.car.betaParkingCost
......@@ -306,6 +310,9 @@ public class SwissUtilityEstimator extends BaseUtilityEstimator {
utility += estimateRegion(parameters.bike.region, personVariables);
utility += estimateMunicipalityType(parameters.bike.municipalityType, personVariables);
// From Zurich model
utility += parameters.bike.betaAgeOver18 * personVariables.age_over18a;
return utility;
}
}
......@@ -37,6 +37,7 @@ public class SwissUtilityParameters {
// Constants
public double referenceDistance_km = 20.0;
public double referenceIncome_1000CHF = 7.0;
public double referenceCrowflyDistance_km = 40.0;
// I) General
public double betaCost = 0.0;
......@@ -44,6 +45,7 @@ public class SwissUtilityParameters {
public double lambdaDelayDistance = 0.0;
public double lambdaCostIncome = 0.0;
public double lambdaCostCrowflyDistance = 0.0;
public class SociodemographicsParameters {
public double betaMale = 0.0;
......@@ -92,6 +94,7 @@ public class SwissUtilityParameters {
public class BikeParameters {
public double alpha = 0.0;
public double betaTravelTime = 0.0;
public double betaAgeOver18 = 0.0;
public SociodemographicsParameters sociodemographics = new SociodemographicsParameters();
public PurposeParameters purpose = new PurposeParameters();
......@@ -109,6 +112,7 @@ public class SwissUtilityParameters {
public double betaTravelTime = 0.0;
public double betaParkingSearchTime = 0.0;
public double betaParkingCost = 0.0;
public double betaAccessEgressTime = 0.0;
public double betaAlwaysAvailable = 0.0;
......@@ -119,6 +123,9 @@ public class SwissUtilityParameters {
public double lambdaTravelTimeDistance = 0.0;
public double lambdaCostDistance = 0.0;
public double constantAccessEgressWalkTime_min = 0.0;
public double constantParkingSearchPenalty = 0.0;
}
public CarParameters car = new CarParameters();
......
......@@ -8,6 +8,7 @@ import org.matsim.api.core.v01.population.Leg;
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.core.utils.geometry.CoordUtils;
import org.matsim.core.utils.misc.Time;
import org.matsim.facilities.ActivityFacilities;
import org.matsim.pt.transitSchedule.api.TransitSchedule;
......@@ -44,6 +45,8 @@ public abstract class BaseUtilityEstimator extends AbstractTripRouterEstimator {
List<TripCandidate> previousTrips, List<? extends PlanElement> routedTrip) {
PersonVariables personVariables = new PersonVariables();
personVariables.age_over18a = Math.max(0.0,
((double) (Integer) person.getAttributes().getAttribute("age")) - 18);
personVariables.age_10a = ((double) (Integer) person.getAttributes().getAttribute("age")) / 10.0;
personVariables.income_1000CHF = (Double) person.getAttributes().getAttribute("householdIncome") * 1e-3;
personVariables.isMale = ((String) person.getAttributes().getAttribute("sex")).equals("m");
......@@ -223,6 +226,9 @@ public abstract class BaseUtilityEstimator extends AbstractTripRouterEstimator {
tripVariables.delay_min = calculateDelay(trip, totalTravelTime) / 60.0;
tripVariables.travelDistance_km = totalTravelDistance / 1000.0;
tripVariables.crowflyDistance_km = CoordUtils.calcEuclideanDistance(trip.getOriginActivity().getCoord(),
trip.getDestinationActivity().getCoord());
return estimatePtTrip(trip, personVariables, tripVariables);
}
......@@ -249,6 +255,9 @@ public abstract class BaseUtilityEstimator extends AbstractTripRouterEstimator {
tripVariables.delay_min = calculateDelay(trip, leg.getTravelTime()) / 60.0;
tripVariables.travelDistance_km = travelDistance_km;
tripVariables.crowflyDistance_km = CoordUtils.calcEuclideanDistance(trip.getOriginActivity().getCoord(),
trip.getDestinationActivity().getCoord());
return estimateCarTrip(trip, personVariables, tripVariables);
}
......
package ch.ethz.matsim.projects.astra_2018_002.mode_choice.base;
public class PersonVariables {
public double age_over18a = 0;
public double age_10a = 0;
public double income_1000CHF = 0.0;
public boolean isMale = false;
......
......@@ -9,4 +9,6 @@ public class TripVariablesCar {
public double delay_min = 0.0;
public double travelDistance_km = 0.0;
public double crowflyDistance_km = 0.0;
}
......@@ -19,4 +19,6 @@ public class TripVariablesPt {
public double delay_min = 0.0;
public double travelDistance_km = 0.0;
public double crowflyDistance_km = 0.0;
}
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