Skip to content

Commit a68ff1a

Browse files
authored
fix: preventing the summing of two error terms in FeederDrtUtilityEstimator (#246)
1 parent 9fa3d45 commit a68ff1a

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

core/src/main/java/org/eqasim/core/simulation/mode_choice/epsilon/EpsilonAdapter.java

+4
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,8 @@ public double estimateUtility(Person person, DiscreteModeChoiceTrip trip, List<?
2424
utility += epsilonProvider.getEpsilon(person.getId(), trip.getIndex(), mode);
2525
return utility;
2626
}
27+
28+
public UtilityEstimator getDelegate() {
29+
return this.delegate;
30+
}
2731
}

core/src/main/java/org/eqasim/core/simulation/modes/feeder_drt/mode_choice/EqasimFeederDrtModeChoiceModule.java

+10
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,13 @@
44
import com.google.inject.Provides;
55
import org.eqasim.core.components.config.EqasimConfigGroup;
66
import org.eqasim.core.simulation.mode_choice.AbstractEqasimExtension;
7+
import org.eqasim.core.simulation.mode_choice.epsilon.EpsilonAdapter;
78
import org.eqasim.core.simulation.mode_choice.utilities.UtilityEstimator;
89
import org.eqasim.core.simulation.modes.feeder_drt.mode_choice.constraints.FeederDrtConstraint;
910
import org.eqasim.core.simulation.modes.feeder_drt.config.MultiModeFeederDrtConfigGroup;
1011
import org.eqasim.core.simulation.modes.feeder_drt.mode_choice.utilities.estimator.DefaultFeederDrtUtilityEstimator;
1112

13+
import java.util.List;
1214
import java.util.Map;
1315
import java.util.stream.Collectors;
1416

@@ -26,6 +28,14 @@ protected void installEqasimExtension() {
2628
public DefaultFeederDrtUtilityEstimator provideDefaultFeederDrtUtilityEstimator(EqasimConfigGroup eqasimConfigGroup, MultiModeFeederDrtConfigGroup multiModeFeederDrtConfigGroup, Map<String, Provider<UtilityEstimator>> utilityEstimatorProviders) {
2729
Map<String, UtilityEstimator> ptEstimators = multiModeFeederDrtConfigGroup.getModalElements().stream().collect(Collectors.toMap(cfg -> cfg.mode, cfg -> utilityEstimatorProviders.get(eqasimConfigGroup.getEstimators().get(cfg.ptModeName)).get()));
2830
Map<String, UtilityEstimator> drtEstimators = multiModeFeederDrtConfigGroup.getModalElements().stream().collect(Collectors.toMap(cfg -> cfg.mode, cfg -> utilityEstimatorProviders.get(eqasimConfigGroup.getEstimators().get(cfg.accessEgressModeName)).get()));
31+
// When we use the Epsilon adapter, we do not want to sum the pseudo-random errors of each sub-mode but rather only use one pseudo-error specific to the current mode
32+
for(Map<String, UtilityEstimator> map: List.of(ptEstimators, drtEstimators)) {
33+
for(String mode: map.keySet()) {
34+
if(map.get(mode) instanceof EpsilonAdapter epsilonAdapter) {
35+
map.put(mode, epsilonAdapter.getDelegate());
36+
}
37+
}
38+
}
2939
return new DefaultFeederDrtUtilityEstimator(ptEstimators, drtEstimators);
3040
}
3141

0 commit comments

Comments
 (0)