diff --git a/contribs/matrixbasedptrouter/src/test/java/org/matsim/contrib/matrixbasedptrouter/MatrixBasedPtRouterIT.java b/contribs/matrixbasedptrouter/src/test/java/org/matsim/contrib/matrixbasedptrouter/MatrixBasedPtRouterIT.java index 6553e8c813a..b71237f3dd9 100644 --- a/contribs/matrixbasedptrouter/src/test/java/org/matsim/contrib/matrixbasedptrouter/MatrixBasedPtRouterIT.java +++ b/contribs/matrixbasedptrouter/src/test/java/org/matsim/contrib/matrixbasedptrouter/MatrixBasedPtRouterIT.java @@ -41,6 +41,7 @@ import org.matsim.contrib.matrixbasedptrouter.utils.CreateTestPopulation; import org.matsim.core.config.Config; import org.matsim.core.config.ConfigUtils; +import org.matsim.core.config.groups.ScoringConfigGroup; import org.matsim.core.controler.Controler; import org.matsim.core.controler.OutputDirectoryHierarchy; import org.matsim.core.network.io.NetworkWriter; @@ -106,11 +107,8 @@ void testIntegration() throws IOException { config.plans().setInputFile(path+"plans.xml"); //add home and work activity to plansCalcScoreConfigGroup - config.scoring().addParam("activityType_0", "home"); - config.scoring().addParam("activityTypicalDuration_0", "43200"); - config.scoring().addParam("activityType_1", "work"); - config.scoring().addParam("activityTypicalDuration_1", "28800"); - + config.scoring().addActivityParams(new ScoringConfigGroup.ActivityParams("home").setTypicalDuration(43200)); + config.scoring().addActivityParams(new ScoringConfigGroup.ActivityParams("work").setTypicalDuration(28800)); Scenario scenario = ScenarioUtils.loadScenario(config); BoundingBox nbb = BoundingBox.createBoundingBox(network); diff --git a/matsim/src/main/java/org/matsim/core/config/ConfigReader.java b/matsim/src/main/java/org/matsim/core/config/ConfigReader.java index f35d8adc593..7c69bc833b4 100644 --- a/matsim/src/main/java/org/matsim/core/config/ConfigReader.java +++ b/matsim/src/main/java/org/matsim/core/config/ConfigReader.java @@ -102,6 +102,13 @@ protected void setDoctype(final String doctype) { } else if ( CONFIG_V2.equals( doctype ) ) { this.delegate = new ConfigReaderMatsimV2( this.config ); +// config.global().setInsistingOnDeprecatedConfigVersion(false); +// // Currently, V2 is the current version. +// // IMO: The default should be "false". -> Change in {@link GlobalConfigGroup}. +// This cannot be activated here, because mny tests, e.g. in DRT fails, because ScoringConfigGroup detects a deprecated syntax and then +// aborts, because of the following check -- so this must be cleaned up first. : +// usesDeprecatedSyntax && !config.global().isInsistingOnDeprecatedConfigVersion()) +// kmt, Aug'24 log.info( "using config_v2-reader" ); } else { diff --git a/matsim/src/main/java/org/matsim/core/config/ConfigUtils.java b/matsim/src/main/java/org/matsim/core/config/ConfigUtils.java index df396f15b1a..2d09a278ed7 100644 --- a/matsim/src/main/java/org/matsim/core/config/ConfigUtils.java +++ b/matsim/src/main/java/org/matsim/core/config/ConfigUtils.java @@ -55,6 +55,7 @@ public static Config createConfig(URL context) { public static Config createConfig() { Config config = new Config(); config.addCoreModules(); + config.global().setInsistingOnDeprecatedConfigVersion(false); // IMO: The default should be "false". -> Change in {@link GlobalConfigGroup}. kmt, Aug'24 return config; } diff --git a/matsim/src/main/java/org/matsim/core/config/groups/GlobalConfigGroup.java b/matsim/src/main/java/org/matsim/core/config/groups/GlobalConfigGroup.java index f778b0b9229..6b811924ce6 100644 --- a/matsim/src/main/java/org/matsim/core/config/groups/GlobalConfigGroup.java +++ b/matsim/src/main/java/org/matsim/core/config/groups/GlobalConfigGroup.java @@ -108,6 +108,9 @@ public void setCoordinateSystem(final String coordinateSystem) { // --- private boolean insistingOnDeprecatedConfigVersion = true ; // yyyy this should be set to false eventually. kai, aug'18 + // IMO: Yes, false would be the default and if read in an older version, set it to true. + // That would also avoid the setting to "false" in ConfigUtils. This should not be needed, because creating + // a new Config should always result in the newest version. // kmt, Aug'24 private static final String INSITING_ON_DEPRECATED_CONFIG_VERSION = "insistingOnDeprecatedConfigVersion" ; @StringGetter( INSITING_ON_DEPRECATED_CONFIG_VERSION ) public final boolean isInsistingOnDeprecatedConfigVersion() { return this.insistingOnDeprecatedConfigVersion ; }