Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update matsim #91

Merged
merged 11 commits into from
May 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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