Skip to content

Commit

Permalink
fix test failures in contribs and add config parameter so relevant fu…
Browse files Browse the repository at this point in the history
…nctions
  • Loading branch information
paulheinr committed Jul 4, 2024
1 parent d647a6b commit 506ed28
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import org.matsim.core.config.Config;
import org.matsim.core.config.ConfigUtils;
import org.matsim.core.config.groups.ReplanningConfigGroup.StrategySettings;
import org.matsim.core.config.groups.RoutingConfigGroup;
import org.matsim.core.config.groups.ScoringConfigGroup.ActivityParams;
import org.matsim.core.controler.AbstractModule;
import org.matsim.core.controler.Controler;
Expand Down Expand Up @@ -57,6 +58,8 @@ static Config commonConfig( MatsimTestUtils testUtils ) {
config.controller().setOutputDirectory(testUtils.getOutputDirectory());
config.network().setInputFile( testUtils.getClassInputDirectory() + "network.xml" );

config.routing().setNetworkRouteConsistencyCheck(RoutingConfigGroup.NetworkRouteConsistencyCheck.disable);

return config;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import org.matsim.api.core.v01.Scenario;
import org.matsim.core.config.Config;
import org.matsim.core.config.ConfigUtils;
import org.matsim.core.config.groups.RoutingConfigGroup;
import org.matsim.core.controler.AbstractModule;
import org.matsim.core.controler.Controler;
import org.matsim.freight.carriers.FreightCarriersConfigGroup;
Expand All @@ -50,6 +51,7 @@ public class EquilWithCarrierWithoutPersonsIT {

public void setUp() {
Config config = EquilWithCarrierWithPersonsIT.commonConfig( testUtils );
config.routing().setNetworkRouteConsistencyCheck(RoutingConfigGroup.NetworkRouteConsistencyCheck.disable);
Scenario scenario = EquilWithCarrierWithPersonsIT.commonScenario( config, testUtils );
controler = new Controler(scenario);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ void main(){
URL url = IOUtils.extendUrl( ExamplesUtils.getTestScenarioURL( "berlin" ), "config_multimodal.xml" );;

String [] args = { url.toString(),
"--config:controler.outputDirectory" , utils.getOutputDirectory()
} ;
"--config:controler.outputDirectory" , utils.getOutputDirectory(),
"--config:routing.networkRouteConsistencyCheck", "disable"
} ;;

try{
RunMultimodalExample.main( args );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ public class PlansCalcRouteWithTollOrNotTest {
@Test
void testBestAlternatives() {
Config config = matsimTestUtils.createConfig();
config.routing().setNetworkRouteConsistencyCheck(RoutingConfigGroup.NetworkRouteConsistencyCheck.disable);
config.controller().setOverwriteFileSetting(OutputDirectoryHierarchy.OverwriteFileSetting.overwriteExistingFiles);
MutableScenario scenario = (MutableScenario) ScenarioUtils.createScenario(config);
RoadPricingTestUtils.createNetwork2(scenario);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,11 +212,11 @@ void testDistanceTollRouter() {
void testLinkTollRouter() {
Config config = utils.createConfig();
config.routing().setNetworkRouteConsistencyCheck(RoutingConfigGroup.NetworkRouteConsistencyCheck.disable);
MutableScenario scenario = (MutableScenario) ScenarioUtils.createScenario(ConfigUtils.createConfig());
MutableScenario scenario = (MutableScenario) ScenarioUtils.createScenario(config);
RoadPricingTestUtils.createNetwork2(scenario);
Network network = scenario.getNetwork();
// a basic toll where only the morning hours are tolled
RoadPricingSchemeImpl toll = RoadPricingUtils.addOrGetMutableRoadPricingScheme(ScenarioUtils.createScenario( ConfigUtils.createConfig() ) );
RoadPricingSchemeImpl toll = RoadPricingUtils.addOrGetMutableRoadPricingScheme(ScenarioUtils.createScenario( config ) );
toll.setType(RoadPricingScheme.TOLL_TYPE_LINK);
toll.addLink(Id.create("5", Link.class));
toll.addLink(Id.create("11", Link.class));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,8 @@ public void addParam(final String key, final String value) {
}
else if (ACCESSEGRESSTYPE.equals( key ) ) {
this.setAccessEgressType(AccessEgressType.valueOf(value));
} else if (NETWORK_ROUTE_CONSISTENCY_CHECK.equals(key)){
this.setNetworkRouteConsistencyCheck(NetworkRouteConsistencyCheck.valueOf(value));
}
else {
throw new IllegalArgumentException(key);
Expand All @@ -539,6 +541,7 @@ public final Map<String, String> getParams() {
map.put( CLEAR_MODE_ROUTING_PARAMS, Boolean.toString( this.clearingDefaultModeRoutingParams ) ) ;
map.put( RANDOMNESS, Double.toString( this.routingRandomness ) ) ;
map.put( ACCESSEGRESSTYPE, getAccessEgressType().toString()) ;
map.put(NETWORK_ROUTE_CONSISTENCY_CHECK, NetworkRouteConsistencyCheck.abortOnInconsistency.toString());
return map;
}

Expand Down

0 comments on commit 506ed28

Please sign in to comment.