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

Revert "Separate waiting times again"

This reverts commit ffad0bc7.
parent ffad0bc7
......@@ -70,16 +70,9 @@ public class SharedAVModule extends AbstractDiscreteModeChoiceExtension {
bind(Key.get(TravelTime.class, Names.named(AV_POOL)))
.to(Key.get(TravelTime.class, Names.named(TransportMode.car)));
bind(Key.get(AVWaitingTime.class, Names.named(AV_TAXI)))
.to(Key.get(ZonalWaitingTime.class, Names.named(AV_TAXI)));
bind(Key.get(AVWaitingTime.class, Names.named(AV_POOL)))
.to(Key.get(ZonalWaitingTime.class, Names.named(AV_POOL)));
addEventHandlerBinding().to(Key.get(ZonalWaitingTime.class, Names.named(AV_TAXI)));
addEventHandlerBinding().to(Key.get(ZonalWaitingTime.class, Names.named(AV_POOL)));
addControlerListenerBinding().to(Key.get(ZonalWaitingTime.class, Names.named(AV_TAXI)));
addControlerListenerBinding().to(Key.get(ZonalWaitingTime.class, Names.named(AV_POOL)));
bind(AVWaitingTime.class).to(ZonalWaitingTime.class);
addEventHandlerBinding().to(ZonalWaitingTime.class);
addControlerListenerBinding().to(ZonalWaitingTime.class);
addControlerListenerBinding().to(WaitingTimeListener.class);
}
......@@ -88,7 +81,7 @@ public class SharedAVModule extends AbstractDiscreteModeChoiceExtension {
@Named(AV_TAXI)
public RoutingModule provideAvTaxiRoutingModule(PopulationFactory populationFactory, AVRouteFactory routeFactory,
@Named(TransportMode.walk) RoutingModule walkRoutingModule, @Named(AVModule.AV_MODE) Network network,
@Named(AV_TAXI) AVWaitingTime waitingTime, @Named(AV_TAXI) TravelTime travelTime) {
AVWaitingTime waitingTime, @Named(AV_TAXI) TravelTime travelTime) {
LeastCostPathCalculator router = new DijkstraFactory().createPathCalculator(network,
new OnlyTimeDependentTravelDisutility(travelTime), travelTime);
return new ASTRAAVRoutingModule(AV_TAXI, populationFactory, routeFactory, walkRoutingModule, router, network,
......@@ -99,7 +92,7 @@ public class SharedAVModule extends AbstractDiscreteModeChoiceExtension {
@Named(AV_POOL)
public RoutingModule provideAvPoolRoutingModule(PopulationFactory populationFactory, AVRouteFactory routeFactory,
@Named(TransportMode.walk) RoutingModule walkRoutingModule, @Named(AVModule.AV_MODE) Network network,
@Named(AV_POOL) AVWaitingTime waitingTime, @Named(AV_POOL) TravelTime travelTime) {
AVWaitingTime waitingTime, @Named(AV_POOL) TravelTime travelTime) {
LeastCostPathCalculator router = new DijkstraFactory().createPathCalculator(network,
new OnlyTimeDependentTravelDisutility(travelTime), travelTime);
return new ASTRAAVRoutingModule(AV_POOL, populationFactory, routeFactory, walkRoutingModule, router, network,
......@@ -160,23 +153,7 @@ public class SharedAVModule extends AbstractDiscreteModeChoiceExtension {
@Provides
@Singleton
@Named(AV_TAXI)
public ZonalWaitingTime provideTaxiAvWaitingTime(Network network, List<WaitingTimeZone> waitingTimeZones,
SharedAVConfigGroup sharedConfig) {
double estimationStartTime = sharedConfig.getWaitingTimeEstimatorStartTime();
double estimationEndTime = sharedConfig.getWaitingTimeEstimatorEndTime();
double estimationInterval = sharedConfig.getWaitingTimeEstimatorInterval();
int horizon = sharedConfig.getWaitingTimeEstimatorHorizon();
double defaultWaitingTime = sharedConfig.getWaitingTimeEstimatorFallbackValue();
return new ZonalWaitingTime(estimationStartTime, estimationEndTime, estimationInterval, horizon,
defaultWaitingTime, network, waitingTimeZones);
}
@Provides
@Singleton
@Named(AV_POOL)
public ZonalWaitingTime providePooledAvWaitingTime(Network network, List<WaitingTimeZone> waitingTimeZones,
public ZonalWaitingTime provideAvWaitingTime(Network network, List<WaitingTimeZone> waitingTimeZones,
SharedAVConfigGroup sharedConfig) {
double estimationStartTime = sharedConfig.getWaitingTimeEstimatorStartTime();
double estimationEndTime = sharedConfig.getWaitingTimeEstimatorEndTime();
......@@ -190,10 +167,9 @@ public class SharedAVModule extends AbstractDiscreteModeChoiceExtension {
@Provides
@Singleton
public WaitingTimeListener provideWaitingTimeListener(@Named(AV_TAXI) AVWaitingTime taxiWaitingTime,
@Named(AV_POOL) AVWaitingTime pooledWaitingTime, List<WaitingTimeZone> waitingTimeZones,
OutputDirectoryHierarchy outputHierarchy) {
return new WaitingTimeListener(taxiWaitingTime, pooledWaitingTime, waitingTimeZones, outputHierarchy);
public WaitingTimeListener provideWaitingTimeListener(AVWaitingTime waitingTime,
List<WaitingTimeZone> waitingTimeZones, OutputDirectoryHierarchy outputHierarchy) {
return new WaitingTimeListener(waitingTime, waitingTimeZones, outputHierarchy);
}
@Provides
......
......@@ -23,14 +23,12 @@ public class WaitingTimeListener implements IterationEndsListener {
private final static String FILE_NAME = "waiting_times.csv";
private final List<WaitingTimeZone> waitingTimeZones;
private final AVWaitingTime taxiWaitingTime;
private final AVWaitingTime pooledWaitingTime;
private final AVWaitingTime waitingTime;
private final OutputDirectoryHierarchy outputHierarchy;
public WaitingTimeListener(AVWaitingTime taxiWaitingTime, AVWaitingTime pooledWaitingTime,
List<WaitingTimeZone> waitingTimeZones, OutputDirectoryHierarchy outputHierarchy) {
this.taxiWaitingTime = taxiWaitingTime;
this.pooledWaitingTime = pooledWaitingTime;
public WaitingTimeListener(AVWaitingTime waitingTime, List<WaitingTimeZone> waitingTimeZones,
OutputDirectoryHierarchy outputHierarchy) {
this.waitingTime = waitingTime;
this.waitingTimeZones = waitingTimeZones;
this.outputHierarchy = outputHierarchy;
}
......@@ -58,13 +56,13 @@ public class WaitingTimeListener implements IterationEndsListener {
if (testLink.isPresent()) {
Facility<?> facility = new LinkWrapperFacility(testLink.get());
double taxiEstimate = taxiWaitingTime.getWaitingTime(facility, time, false);
double poolEstimate = pooledWaitingTime.getWaitingTime(facility, time, true);
double taxiEstimate = waitingTime.getWaitingTime(facility, time, false);
double poolEstimate = waitingTime.getWaitingTime(facility, time, true);
int taxiObservations = ((ZonalWaitingTime) taxiWaitingTime).getNumberOfObservations(facility,
time, false);
int poolObservations = ((ZonalWaitingTime) pooledWaitingTime).getNumberOfObservations(facility,
time, true);
int taxiObservations = ((ZonalWaitingTime) waitingTime).getNumberOfObservations(facility, time,
false);
int poolObservations = ((ZonalWaitingTime) waitingTime).getNumberOfObservations(facility, time,
true);
writer.write(String.join(";",
new String[] { Time.writeTime(time), zone.getIdentifier(), String.valueOf(taxiEstimate),
......
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