Skip to content

Commit

Permalink
update matsim (#91)
Browse files Browse the repository at this point in the history
* change java version to 21

* explicitly configure java version in maven compiler plugin

* build(deps): bump com.google.errorprone:error_prone_annotations

Bumps [com.google.errorprone:error_prone_annotations](https://github.com/google/error-prone) from 2.27.0 to 2.27.1.
- [Release notes](https://github.com/google/error-prone/releases)
- [Commits](google/error-prone@v2.27.0...v2.27.1)

---
updated-dependencies:
- dependency-name: com.google.errorprone:error_prone_annotations
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>

* build(deps): bump org.checkerframework:checker-qual

Bumps [org.checkerframework:checker-qual](https://github.com/typetools/checker-framework) from 3.42.0 to 3.43.0.
- [Release notes](https://github.com/typetools/checker-framework/releases)
- [Changelog](https://github.com/typetools/checker-framework/blob/master/docs/CHANGELOG.md)
- [Commits](typetools/checker-framework@checker-framework-3.42.0...checker-framework-3.43.0)

---
updated-dependencies:
- dependency-name: org.checkerframework:checker-qual
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>

* build(deps): bump com.google.guava:guava from 33.1.0-jre to 33.2.0-jre

Bumps [com.google.guava:guava](https://github.com/google/guava) from 33.1.0-jre to 33.2.0-jre.
- [Release notes](https://github.com/google/guava/releases)
- [Commits](https://github.com/google/guava/commits)

---
updated-dependencies:
- dependency-name: com.google.guava:guava
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>

* replace population comparison in tests and deprecate by byte comparison of plan files (matsim-org#3247); add attributes comparison

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: Paul Heinrich <[email protected]>
Co-authored-by: Paul Heinrich <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Michal Maciejewski <[email protected]>
  • Loading branch information
5 people authored May 3, 2024
1 parent 11c8cfb commit a041bf7
Show file tree
Hide file tree
Showing 24 changed files with 380 additions and 165 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/code-coverage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- name: Setup Java
uses: actions/setup-java@v4
with:
java-version: 17
java-version: 21
distribution: 'zulu'
cache: 'maven'

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- name: Setup Java
uses: actions/setup-java@v4
with:
java-version: 17
java-version: 21
distribution: 'zulu'
cache: 'maven'

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy-on-pr-merge.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- name: Setup Java
uses: actions/setup-java@v4
with:
java-version: 17
java-version: 21
distribution: 'zulu'
cache: 'maven'
server-id: 'matsim-releases'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy-on-release-created.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- name: Setup Java
uses: actions/setup-java@v4
with:
java-version: 17
java-version: 21
distribution: 'zulu'
cache: 'maven'
server-id: matsim-releases
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy-weekly.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- name: Setup Java
uses: actions/setup-java@v4
with:
java-version: 17
java-version: 21
distribution: 'zulu'
cache: 'maven'
server-id: 'matsim-releases'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/full-integration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
- name: Setup Java
uses: actions/setup-java@v4
with:
java-version: 17
java-version: 21
distribution: 'zulu'
cache: 'maven'

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/verify-push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ jobs:
if: ${{matrix.module != 'matsim' || steps.detect-changes.outputs.outside-contribs == 'true'}}
uses: actions/setup-java@v4
with:
java-version: 17
java-version: 21
distribution: 'zulu'
cache: 'maven'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import org.matsim.core.config.ConfigUtils;
import org.matsim.core.events.EventsUtils;
import org.matsim.core.population.PopulationUtils;
import org.matsim.core.population.routes.PopulationComparison;
import org.matsim.testcases.MatsimTestUtils;
import org.matsim.utils.eventsfilecomparison.ComparisonResult;

Expand All @@ -33,8 +34,8 @@ public class RunEvExampleTest{
Population actual = PopulationUtils.createPopulation( ConfigUtils.createConfig() ) ;
PopulationUtils.readPopulation( actual, utils.getOutputDirectory() + "/output_plans.xml.gz" );

boolean result = PopulationUtils.comparePopulations( expected, actual );
Assertions.assertTrue(result);
PopulationComparison.Result result = PopulationComparison.compare(expected, actual);
Assertions.assertEquals(PopulationComparison.Result.equal, result);
}
{
String expected = utils.getInputDirectory() + "/output_events.xml.gz" ;
Expand Down Expand Up @@ -66,8 +67,8 @@ public class RunEvExampleTest{
Population actual = PopulationUtils.createPopulation( ConfigUtils.createConfig() ) ;
PopulationUtils.readPopulation( actual, utils.getOutputDirectory() + "/output_plans.xml.gz" );

boolean result = PopulationUtils.comparePopulations( expected, actual );
Assertions.assertTrue(result);
PopulationComparison.Result result = PopulationComparison.compare(expected, actual);
Assertions.assertEquals(PopulationComparison.Result.equal, result);
}
{
String expected = utils.getInputDirectory() + "/output_events.xml.gz" ;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import org.matsim.core.config.ConfigUtils;
import org.matsim.core.events.EventsUtils;
import org.matsim.core.population.PopulationUtils;
import org.matsim.core.population.routes.PopulationComparison;
import org.matsim.testcases.MatsimTestUtils;
import org.matsim.utils.eventsfilecomparison.ComparisonResult;

Expand All @@ -33,8 +34,8 @@ void runTest(){
Population actual = PopulationUtils.createPopulation( ConfigUtils.createConfig() ) ;
PopulationUtils.readPopulation( actual, utils.getOutputDirectory() + "/output_plans.xml.gz" );

boolean result = PopulationUtils.comparePopulations( expected, actual );
Assertions.assertTrue( result );
PopulationComparison.Result result = PopulationComparison.compare(expected, actual);
Assertions.assertEquals(PopulationComparison.Result.equal, result);
}
{
String expected = utils.getInputDirectory() + "/output_events.xml.gz" ;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ void runChessboard() {
Population actual = PopulationUtils.createPopulation( ConfigUtils.createConfig() ) ;
PopulationUtils.readPopulation( actual, utils.getOutputDirectory() + "/output_plans.xml.gz" );

PopulationComparison.Result result = new PopulationComparison().compare(expected, actual);
PopulationComparison.Result result = PopulationComparison.compare(expected, actual);
Assertions.assertSame(PopulationComparison.Result.equal, result);
}
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,15 @@

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;
import org.matsim.api.core.v01.population.Population;
import org.matsim.core.config.ConfigUtils;
import org.matsim.core.events.EventsUtils;
import org.matsim.core.population.PopulationUtils;
import org.matsim.core.population.routes.PopulationComparison;
import org.matsim.core.utils.io.IOUtils;
import org.matsim.examples.ExamplesUtils;
import org.matsim.testcases.MatsimTestUtils;
Expand Down Expand Up @@ -60,9 +62,8 @@ void testMain(){
PopulationUtils.readPopulation( expected, utils.getInputDirectory() + "/output_experienced_plans.xml.gz" );
final Population actual = PopulationUtils.createPopulation( ConfigUtils.createConfig() );
PopulationUtils.readPopulation( actual, utils.getOutputDirectory() + "/output_experienced_plans.xml.gz" );
if(!PopulationUtils.comparePopulations( expected, actual )) {
throw new RuntimeException("Plans file comparison ended with result false");
}
PopulationComparison.Result result = PopulationComparison.compare(expected, actual);
Assertions.assertEquals(PopulationComparison.Result.equal, result);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public void install() {
PopulationUtils.readPopulation( popExpected, utils.getInputDirectory() + "/output_plans.xml.gz" );
Population popActual = PopulationUtils.createPopulation( config );
PopulationUtils.readPopulation( popActual, outDir + "/output_plans.xml.gz" );
new PopulationComparison().compare( popExpected, popActual ) ;
PopulationComparison.compare( popExpected, popActual ) ;
Assertions.assertEquals(138.86084460860525, psimScore, MatsimTestUtils.EPSILON, "RunPsim score changed.");

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import org.matsim.core.config.ConfigUtils;
import org.matsim.core.events.EventsUtils;
import org.matsim.core.population.PopulationUtils;
import org.matsim.core.population.routes.PopulationComparison;
import org.matsim.core.utils.io.IOUtils;
import org.matsim.examples.ExamplesUtils;
import org.matsim.testcases.MatsimTestUtils;
Expand Down Expand Up @@ -62,7 +63,8 @@ final void testMain() {
PopulationUtils.readPopulation( expected, utils.getInputDirectory() + "/output_plans.xml.gz" );
final Population actual = PopulationUtils.createPopulation( ConfigUtils.createConfig() );
PopulationUtils.readPopulation( actual, utils.getOutputDirectory() + "/output_plans.xml.gz" );
Assertions.assertTrue(PopulationUtils.comparePopulations( expected, actual ), "Populations are different");
PopulationComparison.Result result = PopulationComparison.compare(expected, actual);
Assertions.assertEquals(PopulationComparison.Result.equal, result);
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,7 @@ private void runScenario(String configPath) {
Population actual = PopulationUtils.createPopulation(ConfigUtils.createConfig());
PopulationUtils.readPopulation(actual, utils.getOutputDirectory() + "/output_plans.xml.gz");

PopulationComparison populationComparison = new PopulationComparison();
PopulationComparison.Result result = populationComparison.compare(expected, actual);
PopulationComparison.Result result = PopulationComparison.compare(expected, actual);
Assertions.assertEquals(PopulationComparison.Result.equal, result);
}
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,7 @@ public static void runBenchmark(boolean vehicleDiversion, AbstractTaxiOptimizerP
Population actual = PopulationUtils.createPopulation(ConfigUtils.createConfig());
PopulationUtils.readPopulation(actual, utils.getOutputDirectory() + "/output_plans.xml.gz");

PopulationComparison populationComparison = new PopulationComparison();
PopulationComparison.Result result = populationComparison.compare(expected, actual);
PopulationComparison.Result result = PopulationComparison.compare(expected, actual);
Assertions.assertEquals(PopulationComparison.Result.equal, result);
}
{
Expand Down
5 changes: 3 additions & 2 deletions contribs/vsp/src/test/java/playground/vsp/ev/UrbanEVIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import org.matsim.core.config.ConfigUtils;
import org.matsim.core.events.EventsUtils;
import org.matsim.core.population.PopulationUtils;
import org.matsim.core.population.routes.PopulationComparison;
import org.matsim.testcases.MatsimTestUtils;
import org.matsim.utils.eventsfilecomparison.ComparisonResult;

Expand All @@ -32,8 +33,8 @@ void run() {
Population actual = PopulationUtils.createPopulation( ConfigUtils.createConfig() ) ;
PopulationUtils.readPopulation( actual, utils.getOutputDirectory() + "/output_plans.xml.gz" );

boolean result = PopulationUtils.comparePopulations( expected, actual );
Assertions.assertTrue( result );
PopulationComparison.Result result = PopulationComparison.compare(expected, actual);
Assertions.assertEquals(PopulationComparison.Result.equal, result);
}
{
String expected = utils.getInputDirectory() + "/output_events.xml.gz" ;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -665,7 +665,10 @@ public static double calculateSimilarity(List<Activity> activities1, List<Activi
* this will go unnoticed (this method will just return true or false,
* probably false, except if both Writers have written the exact same text
* until the Exception happens).
*
* @deprecated -- please use {@link org.matsim.core.population.routes.PopulationComparison} instead. nkuehnel, apr'24
*/
@Deprecated
public static boolean equalPopulation(final Population s1, final Population s2) {
try {
try( InputStream inputStream1 = openPopulationInputStream( s1 ) ; InputStream inputStream2 = openPopulationInputStream( s2 ) ){
Expand Down Expand Up @@ -1186,6 +1189,10 @@ public static Population readPopulation( String filename ) {
readPopulation( population, filename );
return population ;
}
/**
* @deprecated -- please use {@link org.matsim.core.population.routes.PopulationComparison} instead. nkuehnel, apr'24
*/
@Deprecated
public static boolean comparePopulations( Population population1, Population population2 ) {
return PopulationUtils.equalPopulation( population1, population2 );
}
Expand Down
Loading

0 comments on commit a041bf7

Please sign in to comment.