Skip to content

Commit

Permalink
upgrade matsim version
Browse files Browse the repository at this point in the history
In order to include DRT estimation model
  • Loading branch information
luchengqi7 committed Aug 9, 2024
1 parent 3530b69 commit 7acdaa5
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 14 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<!--<version>14.0-PR1452</version>-->

<!-- snapshot == not recommended: rather use PR-labelled release!-->
<version>2025.0-PR3340</version>
<version>2025.0-PR3333</version>
</parent>


Expand Down
45 changes: 32 additions & 13 deletions src/main/java/org/matsim/run/RunLausitzDrtScenario.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
import org.matsim.application.MATSimApplication;
import org.matsim.application.options.ShpOptions;
import org.matsim.contrib.drt.estimator.DrtEstimatorModule;
import org.matsim.contrib.drt.estimator.impl.DirectTripBasedDrtEstimator;
import org.matsim.contrib.drt.estimator.impl.distribution.NormalDistributionGenerator;
import org.matsim.contrib.drt.estimator.impl.trip_estimation.ConstantRideDurationEstimator;
import org.matsim.contrib.drt.estimator.impl.waiting_time_estimation.ConstantWaitingTimeEstimator;
import org.matsim.contrib.drt.optimizer.constraints.DefaultDrtOptimizationConstraintsSet;
import org.matsim.contrib.drt.optimizer.constraints.DrtOptimizationConstraintsParams;
import org.matsim.contrib.drt.optimizer.insertion.extensive.ExtensiveInsertionSearchParams;
Expand Down Expand Up @@ -48,6 +52,21 @@ public final class RunLausitzDrtScenario extends MATSimApplication {
@CommandLine.Option(names = "--drt-shp", description = "Path to shp file for adding drt not network links as an allowed mode.", defaultValue = "./input/shp/lausitz.shp")
private String drtAreaShp;

@CommandLine.Option(names = "--typ-wt", description = "typical waiting time", defaultValue = "300")
private double typicalWaitTime;

@CommandLine.Option(names = "--wt-std", description = "waiting time standard deviation", defaultValue = "0.3")
private double waitTimeStd;

@CommandLine.Option(names = "--ride-time-alpha", description = "ride time estimator alpha", defaultValue = "1.25")
private double rideTimeAlpha;

@CommandLine.Option(names = "--ride-time-beta", description = "ride time estimator beta", defaultValue = "300")
private double rideTimeBeta;

@CommandLine.Option(names = "--ride-time-std", description = "ride duration standard deviation", defaultValue = "0.3")
private double rideTimeStd;

private final LausitzScenario baseScenario = new LausitzScenario();

public RunLausitzDrtScenario() {
Expand Down Expand Up @@ -219,19 +238,19 @@ protected void prepareControler(Controler controler) {
MultiModeDrtConfigGroup multiModeDrtConfigGroup = MultiModeDrtConfigGroup.get(config);
for (DrtConfigGroup drtConfigGroup : multiModeDrtConfigGroup.getModalElements()) {
// TODO uncomment theses after the new estimator is merged to the matsim-lib master branch
// controler.addOverridingModule(new AbstractModule() {
// @Override
// public void install() {
// DrtEstimatorModule.bindEstimator(binder(), drtConfigGroup.mode).toInstance(
// new DirectTripBasedDrtEstimator.Builder()
// .setWaitingTimeEstimator(new ConstantWaitingTimeEstimator(meanWaitTime))
// .setWaitingTimeDistributionGenerator(new NormalDistributionGenerator(1, waitTimeStd))
// .setRideDurationEstimator(new ConstantRideDurationEstimator(rideTimeAlpha, rideTimeBeta))
// .setRideDurationDistributionGenerator(new NormalDistributionGenerator(2, rideTimeStd))
// .build()
// );
// }
// });
controler.addOverridingModule(new AbstractModule() {
@Override
public void install() {
DrtEstimatorModule.bindEstimator(binder(), drtConfigGroup.mode).toInstance(
new DirectTripBasedDrtEstimator.Builder()
.setWaitingTimeEstimator(new ConstantWaitingTimeEstimator(typicalWaitTime))
.setWaitingTimeDistributionGenerator(new NormalDistributionGenerator(1, waitTimeStd))
.setRideDurationEstimator(new ConstantRideDurationEstimator(rideTimeAlpha, rideTimeBeta))
.setRideDurationDistributionGenerator(new NormalDistributionGenerator(2, rideTimeStd))
.build()
);
}
});
}

}
Expand Down

0 comments on commit 7acdaa5

Please sign in to comment.