-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2b58976
commit 1ebaf49
Showing
4 changed files
with
73 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
src/main/java/org/matsim/run/RunDetourConstraintsTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
package org.matsim.run; | ||
|
||
import org.matsim.application.MATSimAppCommand; | ||
import org.matsim.contrib.drt.passenger.DrtOfferAcceptor; | ||
import org.matsim.contrib.drt.passenger.MaxDetourOfferAcceptor; | ||
import org.matsim.contrib.drt.run.DrtConfigGroup; | ||
import org.matsim.contrib.drt.run.DrtControlerCreator; | ||
import org.matsim.contrib.drt.run.MultiModeDrtConfigGroup; | ||
import org.matsim.contrib.dvrp.run.AbstractDvrpModeQSimModule; | ||
import org.matsim.contrib.dvrp.run.DvrpConfigGroup; | ||
import org.matsim.core.config.Config; | ||
import org.matsim.core.config.ConfigUtils; | ||
import org.matsim.core.config.groups.RoutingConfigGroup; | ||
import org.matsim.core.config.groups.VspExperimentalConfigGroup; | ||
import org.matsim.core.controler.Controler; | ||
import org.matsim.core.controler.OutputDirectoryHierarchy; | ||
import picocli.CommandLine; | ||
|
||
public class RunDetourConstraintsTest implements MATSimAppCommand { | ||
@CommandLine.Option(names = "--config", description = "path to config file", required = true) | ||
private String configFile; | ||
@CommandLine.Option(names = "--plans", description = "path to input plans", required = true) | ||
private String inputPlans; | ||
@CommandLine.Option(names = "--output", description = "path of output folder", required = true) | ||
private String output; | ||
|
||
public static void main(String[] args) { | ||
new RunDetourConstraintsTest().execute(args); | ||
} | ||
|
||
@Override | ||
public Integer call() throws Exception { | ||
Config config = ConfigUtils.loadConfig(configFile, new MultiModeDrtConfigGroup(), new DvrpConfigGroup()); | ||
config.plans().setInputFile(inputPlans); | ||
config.controller().setOutputDirectory(output); | ||
config.vspExperimental().setVspDefaultsCheckingLevel(VspExperimentalConfigGroup.VspDefaultsCheckingLevel.info); | ||
config.routing().setAccessEgressType(RoutingConfigGroup.AccessEgressType.accessEgressModeToLink); | ||
config.controller().setOverwriteFileSetting(OutputDirectoryHierarchy.OverwriteFileSetting.overwriteExistingFiles); | ||
|
||
Controler controler = DrtControlerCreator.createControler(config, false); | ||
|
||
MultiModeDrtConfigGroup multiModeDrtConfig = ConfigUtils.addOrGetModule(config, MultiModeDrtConfigGroup.class); | ||
for (DrtConfigGroup drtCfg : multiModeDrtConfig.getModalElements()) { | ||
controler.addOverridingQSimModule(new AbstractDvrpModeQSimModule(drtCfg.mode) { | ||
@Override | ||
protected void configureQSim() { | ||
bindModal(DrtOfferAcceptor.class).toProvider(modalProvider(getter -> new MaxDetourOfferAcceptor(drtCfg.maxAllowedPickupDelay))); | ||
} | ||
}); | ||
} | ||
|
||
controler.run(); | ||
|
||
return 0; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters