Skip to content

Commit

Permalink
added comments
Browse files Browse the repository at this point in the history
  • Loading branch information
jakobrehmann committed Dec 3, 2024
1 parent 5df0d3d commit 34adc6c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 15 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package org.matsim.contrib.accessibility;

import com.google.inject.Inject;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.locationtech.jts.util.Assert;
Expand All @@ -18,7 +17,6 @@
import org.matsim.contrib.dvrp.router.DvrpRoutingModule;
import org.matsim.core.config.Config;
import org.matsim.core.config.ConfigUtils;
import org.matsim.core.config.groups.NetworkConfigGroup;
import org.matsim.core.config.groups.ScoringConfigGroup;
import org.matsim.core.gbl.Gbl;
import org.matsim.core.router.*;
Expand All @@ -31,19 +29,14 @@
import java.util.concurrent.ConcurrentHashMap;

/**
* @author thibautd, dziemke
* @author jakobrehmann
*/
final class EstimatedDrtAccessibilityContributionCalculator implements AccessibilityContributionCalculator {
private static final Logger LOG = LogManager.getLogger( NetworkModeAccessibilityExpContributionCalculator.class );

private static final Logger LOG = LogManager.getLogger(EstimatedDrtAccessibilityContributionCalculator.class);
private final String mode;
private final Scenario scenario;


private final ScoringConfigGroup scoringConfigGroup;

private Network subNetwork;

private final double betaDrtTT_h;
private final double betaDrtDist_m;
private final double walkSpeed_m_h;
Expand All @@ -54,10 +47,8 @@ final class EstimatedDrtAccessibilityContributionCalculator implements Accessibi
private Map<Id<? extends BasicLocation>, ArrayList<ActivityFacility>> aggregatedMeasurePoints;
private Map<Id<? extends BasicLocation>, AggregationObject> aggregatedOpportunities;

// private final LeastCostPathCalculator router;
TripRouter tripRouter ;


private DvrpRoutingModule.AccessEgressFacilityFinder stopFinder;

private final DrtEstimator drtEstimator;
Expand Down Expand Up @@ -97,6 +88,7 @@ public void initialize(ActivityFacilities measuringPoints, ActivityFacilities op
Gbl.assertNotNull(measuringPoints.getFacilities());

// todo: should I aggregate the measuring points to the nearest drt stop. Or do we in the near future want to compare the drt routes between multiple access/egress drt stops?
// right now, this doesn't aggregate the measuring points at all.
for (ActivityFacility measuringPoint : measuringPoints.getFacilities().values()) {
Id<ActivityFacility> facilityId = measuringPoint.getId();
if(!aggregatedMeasurePoints.containsKey(facilityId)) {
Expand All @@ -120,6 +112,7 @@ public void initialize(ActivityFacilities measuringPoints, ActivityFacilities op


// todo: same question as above...
// while this aggregates to the nearest drt stop
this.aggregatedOpportunities = aggregateOpportunitiesWithSameNearestDrtStop(opportunities, scenario.getConfig());


Expand Down Expand Up @@ -166,7 +159,7 @@ public double computeContributionOfOpportunity(ActivityFacility origin,

// attempt to replace hard coded calculation w/ DRT Estimator
DrtRoute drtRoute = new DrtRoute(Id.createLinkId("dummyFrom"), Id.createLinkId("dummyTo"));
drtRoute.setDistance(directRideDistance_m);
drtRoute.setDistance(directRideDistance_m); // todo: since this is based on the distance and not the time of the direct car trips, congestion effects are not yet included.
drtRoute.setDirectRideTime(mainLeg.getRoute().getTravelTime().seconds());

DrtEstimator.Estimate estimate = drtEstimator.estimate(drtRoute, OptionalTime.defined(departureTime));
Expand All @@ -179,7 +172,7 @@ public double computeContributionOfOpportunity(ActivityFacility origin,
// }
double totalTime_h = (waitTime_s + rideTime_s) / 3600;
double utilityDrtTime = betaDrtTT_h * totalTime_h;
double utilityDrtDistance = betaDrtDist_m * directRideDistance_m; // Todo: this doesn't include the detours
double utilityDrtDistance = betaDrtDist_m * directRideDistance_m; // Todo: this doesn't include the detours. Only time does.


// Pre-computed effect of all opportunities reachable from destination network node
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public Integer call() throws Exception {
config.global().setNumberOfThreads(1);

for (DrtConfigGroup drtConfig : ConfigUtils.addOrGetModule(config, MultiModeDrtConfigGroup.class).getModalElements()) {
drtConfig.transitStopFile = "/Users/jakob/git/matsim-libs/examples/scenarios/kelheim/drt-stops.xml";
drtConfig.transitStopFile = "/Users/jakob/git/matsim-libs/examples/scenarios/kelheim/drt-stops.xml"; // todo!!!
drtConfig.removeParameterSet(drtConfig.getZonalSystemParams().get());
drtConfig.plotDetailedCustomerStats = false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ void kelheimDrt() {
double mapCenterX = 712144.17;
double mapCenterY = 5422153.87;

//accessibility
double tileSize = 100;
double num_rows = 45;

Expand Down

0 comments on commit 34adc6c

Please sign in to comment.