Skip to content

Commit

Permalink
bind LinkBasedRelocationCalculator as singleton
Browse files Browse the repository at this point in the history
  • Loading branch information
michalmac committed Nov 27, 2020
1 parent aa537a9 commit 46519fa
Showing 1 changed file with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,22 +45,21 @@ public DrtModePlusOneRebalanceModule(DrtConfigGroup drtCfg) {
public void install() {
log.info("Plus one rebalancing strategy is now being installed!");
RebalancingParams generalParams = drtCfg.getRebalancingParams().orElseThrow();
PlusOneRebalancingStrategyParams specificParams = (PlusOneRebalancingStrategyParams) generalParams
.getRebalancingStrategyParams();
PlusOneRebalancingStrategyParams specificParams = (PlusOneRebalancingStrategyParams)generalParams.getRebalancingStrategyParams();

installQSimModule(new AbstractDvrpModeQSimModule(getMode()) {
@Override
protected void configureQSim() {
bindModal(PlusOneRebalancingStrategy.class).toProvider(modalProvider(
getter -> new PlusOneRebalancingStrategy(getMode(), getter.getModal(Network.class),
getter.getModal(LinkBasedRelocationCalculator.class))))
.asEagerSingleton();
getter.getModal(LinkBasedRelocationCalculator.class)))).asEagerSingleton();

// binding zone free relocation calculator
switch (specificParams.getZoneFreeRelocationCalculatorType()) {
case FastHeuristic:
bindModal(LinkBasedRelocationCalculator.class).toProvider(
modalProvider(getter -> new FastHeuristicLinkBasedRelocationCalculator()));
modalProvider(getter -> new FastHeuristicLinkBasedRelocationCalculator()))
.asEagerSingleton();
break;

default:
Expand Down

0 comments on commit 46519fa

Please sign in to comment.