Skip to content

Commit

Permalink
add perfect match example to tests
Browse files Browse the repository at this point in the history
  • Loading branch information
markusstraub committed Jan 8, 2025
1 parent 4a9f320 commit e5d67c5
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
import at.ac.ait.matsim.drs.util.DrsUtil;

/**
* Rejects plans containing one or more unmatched drs rider legs
* Rejects plans containing one or more unmatched drs rider legs.
* Optionally deletes invalid plans.
*/
public class UnmatchedRiderConflictResolver extends UnmatchedRiderConflictIdentifier {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public static void main(String[] args) {

@Override
public void adjustConfig(Config config) {
config.controller().setLastIteration(75);
config.controller().setLastIteration(100);
config.controller().setOutputDirectory("output-floridsdorf-perfectMatch");
config.plans().setInputFile("population_drs_perfectMatch.xml");
config.qsim().setNumberOfThreads(10);
Expand Down
20 changes: 20 additions & 0 deletions src/test/java/at/ac/ait/matsim/drs/run/IntegrationTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -418,4 +418,24 @@ public void testRidersDepartureTimeAdjustment(
}
}

/**
* Test that a perfect match must be found for each of the 12 trips
*
* NOTE: this test takes much longer than all other tests due to the high number
* of iterations
*/
@Test
@Tag("IntegrationTest")
public void testPerfectMatch(
@TempDir(cleanup = CleanupMode.NEVER, factory = TDFactory.class) Path tempDir)
throws Exception {

new RunPerfectMatchExample().run(true, tempDir);
CSV replanningStats = readCsv(tempDir.resolve(DrsReplanningStats.FILENAME + ".csv"));
assertEquals(101, replanningStats.size());
assertEquals("6", replanningStats.get(100, CsvField.matchedRiders));
assertEquals("0", replanningStats.get(100, CsvField.unmatchedRiders));
assertEquals("6", replanningStats.get(100, CsvField.matchedDrivers));
assertEquals("0", replanningStats.get(100, CsvField.unmatchedDrivers));
}
}

0 comments on commit e5d67c5

Please sign in to comment.