-
Notifications
You must be signed in to change notification settings - Fork 453
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ensure backwards compatibility with previous drt config design
- Loading branch information
Showing
5 changed files
with
174 additions
and
22 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
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
61 changes: 61 additions & 0 deletions
61
...drt/src/test/java/org/matsim/contrib/drt/run/examples/RunOldDrtConfigCompatibilityIT.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,61 @@ | ||
package org.matsim.contrib.drt.run.examples; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
import org.matsim.api.core.v01.Id; | ||
import org.matsim.contrib.common.zones.systems.grid.square.SquareGridZoneSystemParams; | ||
import org.matsim.contrib.drt.run.MultiModeDrtConfigGroup; | ||
import org.matsim.contrib.dvrp.run.DvrpConfigGroup; | ||
import org.matsim.contrib.zone.skims.DvrpTravelTimeMatrixParams; | ||
import org.matsim.core.config.Config; | ||
import org.matsim.core.config.ConfigUtils; | ||
import org.matsim.core.controler.OutputDirectoryHierarchy; | ||
import org.matsim.core.utils.io.IOUtils; | ||
import org.matsim.examples.ExamplesUtils; | ||
import org.matsim.testcases.MatsimTestUtils; | ||
import org.matsim.vis.otfvis.OTFVisConfigGroup; | ||
|
||
import java.net.URL; | ||
|
||
/** | ||
* | ||
* Tests the older drt config version where optimization constraints where not stored as separate parameters | ||
* @author nkuehnel / MOIA | ||
*/ | ||
public class RunOldDrtConfigCompatibilityIT { | ||
|
||
@RegisterExtension | ||
private MatsimTestUtils utils = new MatsimTestUtils(); | ||
|
||
@Test | ||
void testRunDrtExampleWithNoRejections_ExtensiveSearch() { | ||
Id.resetCaches(); | ||
|
||
DvrpConfigGroup dvrpConfigGroup = new DvrpConfigGroup(); | ||
DvrpTravelTimeMatrixParams matrixParams = dvrpConfigGroup.getTravelTimeMatrixParams(); | ||
matrixParams.addParameterSet(matrixParams.createParameterSet(SquareGridZoneSystemParams.SET_NAME)); | ||
|
||
URL configUrl = IOUtils.extendUrl(ExamplesUtils.getTestScenarioURL("mielec"), "mielec_drt_config_v1.xml"); | ||
Config config = ConfigUtils.loadConfig(configUrl, new MultiModeDrtConfigGroup(), dvrpConfigGroup, | ||
new OTFVisConfigGroup()); | ||
|
||
for (var drtCfg : MultiModeDrtConfigGroup.get(config).getModalElements()) { | ||
//disable rejections | ||
drtCfg.getDrtOptimizationConstraintsParam().rejectRequestIfMaxWaitOrTravelTimeViolated = false; | ||
} | ||
|
||
config.controller().setOverwriteFileSetting(OutputDirectoryHierarchy.OverwriteFileSetting.deleteDirectoryIfExists); | ||
config.controller().setOutputDirectory(utils.getOutputDirectory()); | ||
RunDrtExample.run(config, false); | ||
|
||
var expectedStats = RunDrtExampleIT.Stats.newBuilder() | ||
.rejectionRate(0.0) | ||
.rejections(0) | ||
.waitAverage(297.19) | ||
.inVehicleTravelTimeMean(386.78) | ||
.totalTravelTimeMean(683.97) | ||
.build(); | ||
|
||
RunDrtExampleIT.verifyDrtCustomerStatsCloseToExpectedStats(utils.getOutputDirectory(), expectedStats); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
<?xml version="1.0" ?> | ||
<!DOCTYPE config SYSTEM "http://www.matsim.org/files/dtd/config_v2.dtd"> | ||
<config> | ||
<module name="dvrp"> | ||
</module> | ||
|
||
<module name="multiModeDrt"> | ||
<parameterset type="drt"> | ||
<parameterset type="ExtensiveInsertionSearch"/> | ||
<param name="stopDuration" value="60"/> | ||
<param name="maxWaitTime" value="600"/> | ||
<param name="maxTravelTimeAlpha" value="1.3"/> | ||
<param name="maxTravelTimeBeta" value="400"/> | ||
|
||
<param name="vehiclesFile" value="vehicles-10-cap-4.xml"/> | ||
<!-- param name="vehiclesFile" value="vehicles-20-cap-2.xml" / --> | ||
|
||
<parameterset type="zonalSystem"> | ||
<parameterset type="SquareGridZoneSystem" > | ||
<param name="cellSize" value="500"/> | ||
</parameterset> | ||
</parameterset> | ||
|
||
<parameterset type="rebalancing"> | ||
<parameterset type="minCostFlowRebalancingStrategy"> | ||
<param name="targetAlpha" value="0.5"/> | ||
<param name="targetBeta" value="0.5"/> | ||
</parameterset> | ||
</parameterset> | ||
</parameterset> | ||
</module> | ||
|
||
<module name="network"> | ||
<param name="inputNetworkFile" value="network.xml"/> | ||
</module> | ||
|
||
<module name="plans"> | ||
<param name="inputPlansFile" value="plans_only_drt_1.0.xml.gz"/> | ||
</module> | ||
|
||
<module name="qsim"> | ||
<param name="simStarttimeInterpretation" value="onlyUseStarttime"/> | ||
<param name="endTime" value="30:00:00"/> | ||
<param name="insertingWaitingVehiclesBeforeDrivingVehicles" value="true"/> | ||
<param name="snapshotStyle" value="queue"/> | ||
</module> | ||
|
||
<module name="otfvis"> | ||
<param name="coloringScheme" value="taxicab"/> | ||
<param name="drawNonMovingItems" value="true"/> | ||
</module> | ||
|
||
<module name="controller"> | ||
<param name="outputDirectory" value="test/output/mielec_drt"/> | ||
<param name="overwriteFiles" value="deleteDirectoryIfExists"/> | ||
<param name="firstIteration" value="0"/> | ||
<param name="lastIteration" value="0"/> | ||
</module> | ||
|
||
<module name="scoring"> | ||
<param name="activityType_0" value="dummy"/> | ||
<param name="activityTypicalDuration_0" value="24:00:00"/> | ||
<param name="traveling_drt" value="-6"/> | ||
</module> | ||
|
||
<module name="replanning"> | ||
<!-- We focus only on DynAgents. "Standard" agents do not change their behaviour --> | ||
<param name="maxAgentPlanMemorySize" value="1"/> | ||
<param name="ModuleProbability_1" value="1.0"/> | ||
<param name="Module_1" value="KeepLastSelected"/> | ||
</module> | ||
</config> |