Skip to content

Commit

Permalink
update to new config api
Browse files Browse the repository at this point in the history
  • Loading branch information
rakow committed Oct 13, 2023
1 parent 4c90473 commit 27c8f1c
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import org.matsim.contrib.drt.extension.estimator.run.MultiModeDrtEstimatorConfigGroup;
import org.matsim.core.config.Config;
import org.matsim.core.config.ConfigUtils;
import org.matsim.core.config.groups.StrategyConfigGroup;
import org.matsim.core.config.groups.ReplanningConfigGroup;
import org.matsim.core.controler.Controler;
import org.matsim.modechoice.InformedModeChoiceModule;
import org.matsim.modechoice.ModeOptions;
Expand All @@ -36,7 +36,7 @@ public void setUp() throws Exception {

Config config = DrtTestScenario.loadConfig(utils);

config.controler().setLastIteration(3);
config.controller().setLastIteration(3);

controler = MATSimApplication.prepare(new DrtTestScenario(MultiModalDrtLegEstimatorTest::prepare, MultiModalDrtLegEstimatorTest::prepare), config);
}
Expand All @@ -60,17 +60,17 @@ private static void prepare(Config config) {
estimators.addParameterSet(new DrtEstimatorConfigGroup("av"));

// Set subtour mode selection as strategy
List<StrategyConfigGroup.StrategySettings> strategies = config.strategy().getStrategySettings().stream()
List<ReplanningConfigGroup.StrategySettings> strategies = config.replanning().getStrategySettings().stream()
.filter(s -> !s.getStrategyName().toLowerCase().contains("mode")
).collect(Collectors.toList());

strategies.add(new StrategyConfigGroup.StrategySettings()
strategies.add(new ReplanningConfigGroup.StrategySettings()
.setStrategyName(InformedModeChoiceModule.SELECT_SUBTOUR_MODE_STRATEGY)
.setSubpopulation("person")
.setWeight(0.2));

config.strategy().clearStrategySettings();
strategies.forEach(s -> config.strategy().addStrategySettings(s));
config.replanning().clearStrategySettings();
strategies.forEach(s -> config.replanning().addStrategySettings(s));

}

Expand Down

0 comments on commit 27c8f1c

Please sign in to comment.